|
preCICE v3.3.0
|
Stores one Data object with related mesh. Context stores data to be written to and potentially provides a write mapping. More...
#include <WriteDataContext.hpp>
Public Member Functions | |
| WriteDataContext (mesh::PtrData data, mesh::PtrMesh mesh) | |
| Construct a new WriteDataContext object without a mapping. | |
| void | resetBufferedData () |
| Resets the writeDataBuffer and the mapping data cache. | |
| void | trimAfter (double time) |
| Removes stample before time and (if mapping exists) fromData or toData. | |
| void | writeAndMapValues (::precice::span< const double > coordinates, ::precice::span< const double > values) |
| Forwards the just-in-time mapping API call for writing data to the data context. | |
| void | completeJustInTimeMapping () |
Evaluates the MappingDataCache and stores the result in the _writeDataBuffer. | |
| void | writeValuesIntoDataBuffer (::precice::span< const VertexID > vertices, ::precice::span< const double > values) |
| Store values in _writeDataBuffer. | |
| void | writeGradientsIntoDataBuffer (::precice::span< const VertexID > vertices, ::precice::span< const double > gradients) |
| Store gradients in _writeDataBuffer. | |
| void | resizeBufferTo (int size) |
| void | storeBufferedData (double currentTime) |
| Store data from _writeDataBuffer in persistent storage. | |
| void | appendMappingConfiguration (MappingContext &mappingContext, const MeshContext &meshContext) override |
| Adds a MappingContext and the MeshContext required by the write mapping to the corresponding WriteDataContext data structures. | |
| WriteDataContext (const WriteDataContext ©)=delete | |
| Disable copy construction. | |
| WriteDataContext & | operator= (const WriteDataContext &assign)=delete |
| Disable assignment construction. | |
| WriteDataContext (WriteDataContext &&)=default | |
| Move constructor, use the implicitly declared. | |
| WriteDataContext & | operator= (WriteDataContext &&)=default |
| 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. | |
| bool | hasJustInTimeMapping () const |
Private Attributes | |
| time::Sample | _writeDataBuffer |
| Buffer to store written data until it is copied to _providedData->timeStepsStorage() | |
Static Private Attributes | |
| static logging::Logger | _log {"impl::WriteDataContext"} |
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 written to and potentially provides a write mapping.
Derived from DataContext
Definition at line 16 of file WriteDataContext.hpp.
| precice::impl::WriteDataContext::WriteDataContext | ( | mesh::PtrData | data, |
| mesh::PtrMesh | mesh ) |
Construct a new WriteDataContext object without a mapping.
| data | Data associated with this WriteDataContext. |
| mesh | Mesh associated with this WriteDataContext. |
Definition at line 7 of file WriteDataContext.cpp.
|
delete |
Disable copy construction.
|
default |
Move constructor, use the implicitly declared.
|
overridevirtual |
Adds a MappingContext and the MeshContext required by the write mapping to the corresponding WriteDataContext data structures.
A write mapping maps _providedData to _toData. A WriteDataContext already has _providedData, but additionally requires _toData.
| [in] | mappingContext | Context of write mapping |
| [in] | meshContext | Context of mesh this write mapping is mapping to (_toData) |
Implements precice::impl::DataContext.
Definition at line 124 of file WriteDataContext.cpp.
| void precice::impl::WriteDataContext::completeJustInTimeMapping | ( | ) |
Evaluates the MappingDataCache and stores the result in the _writeDataBuffer.
If a just-in-time mapping stores intermediate results in the mappingCache, we need to finalize the mapping in the cache and store the mapped values in the _writeDataBuffer.
See also writeAndMapValues and the documentation of Mapping::completeJustInTimeMapping as well as the impl::MappingDataCache class for more details.
This function needs to be called before calling storeBufferedData, which stores the buffer into the time step storage.
Definition at line 32 of file WriteDataContext.cpp.
|
delete |
Disable assignment construction.
|
default |
| void precice::impl::WriteDataContext::resetBufferedData | ( | ) |
Resets the writeDataBuffer and the mapping data cache.
Definition at line 14 of file WriteDataContext.cpp.
| void precice::impl::WriteDataContext::resizeBufferTo | ( | int | size | ) |
| void precice::impl::WriteDataContext::storeBufferedData | ( | double | currentTime | ) |
Store data from _writeDataBuffer in persistent storage.
| [in] | currentTime | time data should be associated with |
Definition at line 119 of file WriteDataContext.cpp.
| void precice::impl::WriteDataContext::trimAfter | ( | double | time | ) |
Removes stample before time and (if mapping exists) fromData or toData.
| time | the point in time after which to remove samples |
Definition at line 21 of file WriteDataContext.cpp.
| void precice::impl::WriteDataContext::writeAndMapValues | ( | ::precice::span< const double > | coordinates, |
| ::precice::span< const double > | values ) |
Forwards the just-in-time mapping API call for writing data to the data context.
writeAndMapValues then forwards the arguments along with a target buffer to the justInTimeMapping this DataContext holds. The function always forwards both, the _writeDataBuffer and the mappingCache. The justInTimeMapping then decides, whether the data can directly be stored in the actual target _writeDataBuffer or whether intermediate results are stored in the mappingCache.
If written data is stored in the mappingCache, the function completeJustInTimeMapping is responsible for evaluating the cache and storing the result in the _writeDataBuffer.
See also the documentation of the impl::MappingDataCache class.
| [in] | coordinates | Provided by the user through the API function |
| [in] | values | Containing the write data values given by the user |
Definition at line 42 of file WriteDataContext.cpp.
| void precice::impl::WriteDataContext::writeGradientsIntoDataBuffer | ( | ::precice::span< const VertexID > | vertices, |
| ::precice::span< const double > | gradients ) |
Store gradients in _writeDataBuffer.
| [in] | vertices | ids of data |
| [in] | gradients | gradients of data |
Definition at line 73 of file WriteDataContext.cpp.
| void precice::impl::WriteDataContext::writeValuesIntoDataBuffer | ( | ::precice::span< const VertexID > | vertices, |
| ::precice::span< const double > | values ) |
Store values in _writeDataBuffer.
| [in] | vertices | ids of data |
| [in] | values | values of data |
Definition at line 59 of file WriteDataContext.cpp.
|
staticprivate |
Definition at line 117 of file WriteDataContext.hpp.
|
private |
Buffer to store written data until it is copied to _providedData->timeStepsStorage()
Definition at line 120 of file WriteDataContext.hpp.