preCICE v3.2.0
|
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>
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 ©)=delete | |
Disable copy construction. | |
ReadDataContext & | operator= (const ReadDataContext &assign)=delete |
Disable assignment construction. | |
ReadDataContext (ReadDataContext &&)=default | |
Move constructor, use the implicitly declared. | |
ReadDataContext & | operator= (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_t > | locateInvalidVertexID (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::MappingDataCache > | mappingCache |
Cache for just-in-time mapping. | |
mapping::PtrMapping | justInTimeMapping |
The just-in-time mapping for this data context. | |
mesh::PtrMesh | _mesh |
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.
precice::impl::ReadDataContext::ReadDataContext | ( | mesh::PtrData | data, |
mesh::PtrMesh | mesh ) |
Construct a new ReadDataContext object without a mapping.
data | Data associated with this ReadDataContext. |
mesh | Mesh associated with this ReadDataContext. |
Definition at line 7 of file ReadDataContext.cpp.
|
delete |
Disable copy construction.
|
default |
Move constructor, use the implicitly declared.
|
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.
[in] | mappingContext | Context of read mapping |
[in] | meshContext | Context of mesh this read mapping is mapping from (_fromData) |
Implements precice::impl::DataContext.
Definition at line 14 of file ReadDataContext.cpp.
void precice::impl::ReadDataContext::clearToDataFor | ( | const cplscheme::ImplicitData & | from | ) |
Removes all toData samples from mappings.
Definition at line 68 of file ReadDataContext.cpp.
int precice::impl::ReadDataContext::getWaveformDegree | ( | ) | const |
Gets degree of waveform.
Definition at line 63 of file ReadDataContext.cpp.
bool precice::impl::ReadDataContext::hasSamples | ( | ) | const |
Are there samples to read from?
Definition at line 28 of file ReadDataContext.cpp.
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.
[in] | coordinates | As provided by the user through mapAndReadData |
[in] | readTime | The relative read time specified by the user |
[out] | values | The memory block to write the result into |
Definition at line 43 of file ReadDataContext.cpp.
|
delete |
Disable assignment construction.
|
default |
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.
[in] | vertices | vertex ids |
[in] | time | Point in time where waveform is sampled. |
[in] | values | read data associated with given indices for time time will be returned into this span |
Definition at line 33 of file ReadDataContext.cpp.
void precice::impl::ReadDataContext::trimToDataAfterFor | ( | const cplscheme::ImplicitData & | from, |
double | t ) |
Trims all toData of associated mappings after the given t.
[in] | t | the time after which to trim data |
Definition at line 84 of file ReadDataContext.cpp.
|
staticprivate |
Definition at line 95 of file ReadDataContext.hpp.