preCICE v3.1.1
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
precice::impl::WriteDataContext Class Reference

Stores one Data object with related mesh. Context stores data to be written to and potentially provides a write mapping. More...

#include <WriteDataContext.hpp>

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

Public Member Functions

 WriteDataContext (mesh::PtrData data, mesh::PtrMesh mesh)
 Construct a new WriteDataContext object without a mapping.
 
void resetBuffer ()
 Resets writeDataBuffer.
 
void trimAfter (double time)
 Removes stample before time and (if mapping exists) fromData or toData.
 
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 &copy)=delete
 Disable copy construction.
 
WriteDataContextoperator= (const WriteDataContext &assign)=delete
 Disable assignment construction.
 
 WriteDataContext (WriteDataContext &&)=default
 Move constructor, use the implicitly declared.
 
WriteDataContextoperator= (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_tlocateInvalidVertexID (const Container &c)
 

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
 Unique data this context is associated with.
 

Detailed Description

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 17 of file WriteDataContext.hpp.

Constructor & Destructor Documentation

◆ WriteDataContext() [1/3]

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

Construct a new WriteDataContext object without a mapping.

Parameters
dataData associated with this WriteDataContext.
meshMesh associated with this WriteDataContext.

Definition at line 9 of file WriteDataContext.cpp.

◆ WriteDataContext() [2/3]

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

Disable copy construction.

◆ WriteDataContext() [3/3]

precice::impl::WriteDataContext::WriteDataContext ( WriteDataContext && )
default

Move constructor, use the implicitly declared.

Member Function Documentation

◆ appendMappingConfiguration()

void precice::impl::WriteDataContext::appendMappingConfiguration ( MappingContext & mappingContext,
const MeshContext & meshContext )
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.

Parameters
[in]mappingContextContext of write mapping
[in]meshContextContext of mesh this write mapping is mapping to (_toData)

Implements precice::impl::DataContext.

Definition at line 107 of file WriteDataContext.cpp.

Here is the call graph for this function:

◆ operator=() [1/2]

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

Disable assignment construction.

◆ operator=() [2/2]

WriteDataContext & precice::impl::WriteDataContext::operator= ( WriteDataContext && )
default

◆ resetBuffer()

void precice::impl::WriteDataContext::resetBuffer ( )

Resets writeDataBuffer.

Definition at line 16 of file WriteDataContext.cpp.

◆ resizeBufferTo()

void precice::impl::WriteDataContext::resizeBufferTo ( int size)

Definition at line 63 of file WriteDataContext.cpp.

Here is the call graph for this function:

◆ storeBufferedData()

void precice::impl::WriteDataContext::storeBufferedData ( double currentTime)

Store data from _writeDataBuffer in persistent storage.

Parameters
[in]currentTimetime data should be associated with

Definition at line 102 of file WriteDataContext.cpp.

◆ trimAfter()

void precice::impl::WriteDataContext::trimAfter ( double time)

Removes stample before time and (if mapping exists) fromData or toData.

Parameters
timethe point in time after which to remove samples

Definition at line 22 of file WriteDataContext.cpp.

Here is the call graph for this function:

◆ writeGradientsIntoDataBuffer()

void precice::impl::WriteDataContext::writeGradientsIntoDataBuffer ( ::precice::span< const VertexID > vertices,
::precice::span< const double > gradients )

Store gradients in _writeDataBuffer.

Parameters
[in]verticesids of data
[in]gradientsgradients of data

Definition at line 47 of file WriteDataContext.cpp.

Here is the call graph for this function:

◆ writeValuesIntoDataBuffer()

void precice::impl::WriteDataContext::writeValuesIntoDataBuffer ( ::precice::span< const VertexID > vertices,
::precice::span< const double > values )

Store values in _writeDataBuffer.

Parameters
[in]verticesids of data
[in]valuesvalues of data

Definition at line 33 of file WriteDataContext.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _log

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

Definition at line 85 of file WriteDataContext.hpp.

◆ _writeDataBuffer

time::Sample precice::impl::WriteDataContext::_writeDataBuffer
private

Buffer to store written data until it is copied to _providedData->timeStepsStorage()

Definition at line 88 of file WriteDataContext.hpp.


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