preCICE v3.2.0
Loading...
Searching...
No Matches
precice::impl::ReadDataContext Class Reference

Stores one Data object with related mesh. Context stores data to be read from and potentially provides a read mapping. Additionally stores Waveform object associated with _providedData. More...

#include <ReadDataContext.hpp>

Inheritance diagram for precice::impl::ReadDataContext:
[legend]
Collaboration diagram for precice::impl::ReadDataContext:
[legend]

Public Member Functions

 ReadDataContext (mesh::PtrData data, mesh::PtrMesh mesh)
 Construct a new ReadDataContext object without a mapping.
int getWaveformDegree () const
 Gets degree of waveform.
void appendMappingConfiguration (MappingContext &mappingContext, const MeshContext &meshContext) override
 Adds a MappingContext and the MeshContext required by the read mapping to the corresponding ReadDataContext data structures.
void readValues (::precice::span< const VertexID > vertices, double time, ::precice::span< double > values) const
 Samples data at a given point in time within the current time window for given indices.
void mapAndReadValues (::precice::span< const double > coordinates, double readTime, ::precice::span< double > values)
 Forwards the just-in-time mapping API call for reading data to the data context.
bool hasSamples () const
 Are there samples to read from?
 ReadDataContext (const ReadDataContext &copy)=delete
 Disable copy construction.
ReadDataContextoperator= (const ReadDataContext &assign)=delete
 Disable assignment construction.
 ReadDataContext (ReadDataContext &&)=default
 Move constructor, use the implicitly declared.
ReadDataContextoperator= (ReadDataContext &&)=default
void clearToDataFor (const cplscheme::ImplicitData &from)
 Removes all toData samples from mappings.
void trimToDataAfterFor (const cplscheme::ImplicitData &from, double t)
 Trims all toData of associated mappings after the given t.
Public Member Functions inherited from precice::impl::DataContext
std::string getDataName () const
 Get the Name of _providedData.
void resetInitialGuesses ()
 Resets initial guesses of transient mappings to zero.
int getDataDimensions () const
 Get the dimensions of _providedData.
int getSpatialDimensions () const
 Get the spatial dimensions of _providedData.
std::string getMeshName () const
 Get the name of _mesh.
MeshID getMeshID () const
 Get the ID of _mesh.
bool hasGradient () const
 Returns whether _providedData has gradient.
int mapData (std::optional< double > after=std::nullopt, bool skipZero=false)
 Perform the mapping for mapping contexts and the corresponding data context (from and to data)
bool hasMapping () const
 Informs the user whether this DataContext has any _mappingContext.
template<typename Container>
std::optional< std::size_tlocateInvalidVertexID (const Container &c)
void addJustInTimeMapping (MappingContext &mappingContext, MeshContext &meshContext)
 Attach a just-in-time mapping to this data context and setup a corresponding MappingDataCache.
void initializeMappingDataCache ()
 Initializes the MappingDataCache.
void invalidateMappingCache ()
 Resets the time stamp of the MappingDataCache.
void invalidateMappingCacheAndResetData ()
 Resets the time stamp of the MappingDataCache and resets the data it holds.

Static Private Attributes

static logging::Logger _log {"impl::ReadDataContext"}

Additional Inherited Members

Protected Member Functions inherited from precice::impl::DataContext
 DataContext (mesh::PtrData data, mesh::PtrMesh mesh)
 Construct a new DataContext without a mapping. Protected, because only ReadDataContext and WriteDataContext should use this constructor.
void appendMapping (MappingContext mappingContext)
 Helper to append a mappingContext, fromData and toData to the corresponding data containers.
bool hasReadMapping () const
 Informs the user whether this DataContext has any read mapping.
bool hasWriteMapping () const
 Informs the user whether this DataContext has any write mapping.
int getMeshVertexCount () const
 Get the number of vertices of mesh.
bool isValidVertexID (const VertexID id) const
 Returns true if the given vertexID is valid.
Protected Attributes inherited from precice::impl::DataContext
std::vector< MappingContext_mappingContexts
 Defines all mappings associated to this DataContext. A DataContext may also exist without a mapping.
mesh::PtrData _providedData
std::unique_ptr< mapping::impl::MappingDataCachemappingCache
 Cache for just-in-time mapping.
mapping::PtrMapping justInTimeMapping
 The just-in-time mapping for this data context.
mesh::PtrMesh _mesh

Detailed Description

Stores one Data object with related mesh. Context stores data to be read from and potentially provides a read mapping. Additionally stores Waveform object associated with _providedData.

Derived from DataContext

Definition at line 16 of file ReadDataContext.hpp.

Constructor & Destructor Documentation

◆ ReadDataContext() [1/3]

precice::impl::ReadDataContext::ReadDataContext ( mesh::PtrData data,
mesh::PtrMesh mesh )

Construct a new ReadDataContext object without a mapping.

Parameters
dataData associated with this ReadDataContext.
meshMesh associated with this ReadDataContext.

Definition at line 7 of file ReadDataContext.cpp.

Here is the call graph for this function:

◆ ReadDataContext() [2/3]

precice::impl::ReadDataContext::ReadDataContext ( const ReadDataContext & copy)
delete

Disable copy construction.

Here is the call graph for this function:

◆ ReadDataContext() [3/3]

precice::impl::ReadDataContext::ReadDataContext ( ReadDataContext && )
default

Move constructor, use the implicitly declared.

Here is the call graph for this function:

Member Function Documentation

◆ appendMappingConfiguration()

void precice::impl::ReadDataContext::appendMappingConfiguration ( MappingContext & mappingContext,
const MeshContext & meshContext )
overridevirtual

Adds a MappingContext and the MeshContext required by the read mapping to the corresponding ReadDataContext data structures.

A read mapping maps _fromData to _providedData. A ReadDataContext already has _providedData, but additionally requires _fromData.

Parameters
[in]mappingContextContext of read mapping
[in]meshContextContext of mesh this read mapping is mapping from (_fromData)
Note
Note that read mapping contexts have to be unique and and this function may only be called once for a given ReadDataContext

Implements precice::impl::DataContext.

Definition at line 14 of file ReadDataContext.cpp.

Here is the call graph for this function:

◆ clearToDataFor()

void precice::impl::ReadDataContext::clearToDataFor ( const cplscheme::ImplicitData & from)

Removes all toData samples from mappings.

Definition at line 68 of file ReadDataContext.cpp.

Here is the call graph for this function:

◆ getWaveformDegree()

int precice::impl::ReadDataContext::getWaveformDegree ( ) const

Gets degree of waveform.

Returns
int degree of waveform

Definition at line 63 of file ReadDataContext.cpp.

◆ hasSamples()

bool precice::impl::ReadDataContext::hasSamples ( ) const

Are there samples to read from?

Definition at line 28 of file ReadDataContext.cpp.

◆ mapAndReadValues()

void precice::impl::ReadDataContext::mapAndReadValues ( ::precice::span< const double > coordinates,
double readTime,
::precice::span< double > values )

Forwards the just-in-time mapping API call for reading data to the data context.

mapAndReadValues takes care of time interpolation then, updates the MappingDataCache to the latest time interpolant (if necessary) and then forwards the MappingDataCache to the just-in-time mapping to query the mapped data, which is then passed back to the user.

Parameters
[in]coordinatesAs provided by the user through mapAndReadData
[in]readTimeThe relative read time specified by the user
[out]valuesThe memory block to write the result into

Definition at line 43 of file ReadDataContext.cpp.

Here is the call graph for this function:

◆ operator=() [1/2]

ReadDataContext & precice::impl::ReadDataContext::operator= ( const ReadDataContext & assign)
delete

Disable assignment construction.

Here is the call graph for this function:

◆ operator=() [2/2]

ReadDataContext & precice::impl::ReadDataContext::operator= ( ReadDataContext && )
default
Here is the call graph for this function:

◆ readValues()

void precice::impl::ReadDataContext::readValues ( ::precice::span< const VertexID > vertices,
double time,
::precice::span< double > values ) const

Samples data at a given point in time within the current time window for given indices.

Parameters
[in]verticesvertex ids
[in]timePoint in time where waveform is sampled.
[in]valuesread data associated with given indices for time time will be returned into this span

Definition at line 33 of file ReadDataContext.cpp.

Here is the call graph for this function:

◆ trimToDataAfterFor()

void precice::impl::ReadDataContext::trimToDataAfterFor ( const cplscheme::ImplicitData & from,
double t )

Trims all toData of associated mappings after the given t.

Parameters
[in]tthe time after which to trim data

Definition at line 84 of file ReadDataContext.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _log

logging::Logger precice::impl::ReadDataContext::_log {"impl::ReadDataContext"}
staticprivate

Definition at line 95 of file ReadDataContext.hpp.


The documentation for this class was generated from the following files: