preCICE v3.1.1
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Attributes | Static Private Attributes | Friends | List of all members
precice::impl::DataContext Class Referenceabstract

Stores one Data object with related mesh. More...

#include <DataContext.hpp>

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

Public Member Functions

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)
 
virtual void appendMappingConfiguration (MappingContext &mappingContext, const MeshContext &meshContext)=0
 Adds a MappingContext and the MeshContext required by the mapping to the corresponding DataContext data structures.
 
bool hasMapping () const
 Informs the user whether this DataContext has any _mappingContext.
 
template<typename Container >
std::optional< std::size_tlocateInvalidVertexID (const Container &c)
 

Protected Member Functions

 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

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.
 

Private Types

using FromToDataIDs = std::pair<int, int>
 

Private Attributes

mesh::PtrMesh _mesh
 Unique mesh associated with _providedData.
 
std::map< FromToDataIDs, Eigen::VectorXd > _initialGuesses
 

Static Private Attributes

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

Friends

class testing::DataContextFixture
 

Detailed Description

Stores one Data object with related mesh.

Definition at line 29 of file DataContext.hpp.

Member Typedef Documentation

◆ FromToDataIDs

Definition at line 167 of file DataContext.hpp.

Constructor & Destructor Documentation

◆ DataContext()

precice::impl::DataContext::DataContext ( mesh::PtrData data,
mesh::PtrMesh mesh )
protected

Construct a new DataContext without a mapping. Protected, because only ReadDataContext and WriteDataContext should use this constructor.

Parameters
dataData associated with this DataContext.
meshMesh associated with this DataContext.

Definition at line 12 of file DataContext.cpp.

Member Function Documentation

◆ appendMapping()

void precice::impl::DataContext::appendMapping ( MappingContext mappingContext)
protected

Helper to append a mappingContext, fromData and toData to the corresponding data containers.

Parameters
mappingContextMappingContext this DataContext will be associated to.
Note
Only unique mappings may be appended. In case the same mapping is appended twice, an error is raised.

Definition at line 69 of file DataContext.cpp.

Here is the call graph for this function:

◆ appendMappingConfiguration()

virtual void precice::impl::DataContext::appendMappingConfiguration ( MappingContext & mappingContext,
const MeshContext & meshContext )
pure virtual

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

A mapping maps the given data from or to _providedData (depending on whether it is a read or write mapping).

Parameters
[in]mappingContextContext of the mapping
[in]meshContextContext of mesh this mapping is mapping from or to

Implemented in precice::impl::ReadDataContext, and precice::impl::WriteDataContext.

◆ getDataDimensions()

int precice::impl::DataContext::getDataDimensions ( ) const

Get the dimensions of _providedData.

Returns
int Dimensions of _providedData.

Definition at line 33 of file DataContext.cpp.

◆ getDataName()

std::string precice::impl::DataContext::getDataName ( ) const

Get the Name of _providedData.

Returns
std::string Name of _providedData.

Definition at line 20 of file DataContext.cpp.

◆ getMeshID()

MeshID precice::impl::DataContext::getMeshID ( ) const

Get the ID of _mesh.

Returns
int ID of _mesh.

Definition at line 57 of file DataContext.cpp.

◆ getMeshName()

std::string precice::impl::DataContext::getMeshName ( ) const

Get the name of _mesh.

Returns
std::string Name of _mesh.

Definition at line 45 of file DataContext.cpp.

◆ getMeshVertexCount()

int precice::impl::DataContext::getMeshVertexCount ( ) const
protected

Get the number of vertices of mesh.

Returns
int number of vertices

Definition at line 51 of file DataContext.cpp.

◆ getSpatialDimensions()

int precice::impl::DataContext::getSpatialDimensions ( ) const

Get the spatial dimensions of _providedData.

Returns
int Spatial dimensions of _providedData.

Definition at line 39 of file DataContext.cpp.

◆ hasGradient()

bool precice::impl::DataContext::hasGradient ( ) const

Returns whether _providedData has gradient.

Returns
true, if it has gradient
false, if it has gradient

Definition at line 63 of file DataContext.cpp.

◆ hasMapping()

bool precice::impl::DataContext::hasMapping ( ) const

Informs the user whether this DataContext has any _mappingContext.

Returns
True, if this DataContext is associated with a mapping. False, if not.

Definition at line 85 of file DataContext.cpp.

Here is the call graph for this function:

◆ hasReadMapping()

bool precice::impl::DataContext::hasReadMapping ( ) const
protected

Informs the user whether this DataContext has any read mapping.

Returns
True, if DataContext has any read mapping.

Definition at line 153 of file DataContext.cpp.

Here is the call graph for this function:

◆ hasWriteMapping()

bool precice::impl::DataContext::hasWriteMapping ( ) const
protected

Informs the user whether this DataContext has any write mapping.

Returns
True, if DataContext has any write mapping.

Definition at line 158 of file DataContext.cpp.

Here is the call graph for this function:

◆ isValidVertexID()

bool precice::impl::DataContext::isValidVertexID ( const VertexID id) const
protected

Returns true if the given vertexID is valid.

Definition at line 163 of file DataContext.cpp.

◆ locateInvalidVertexID()

template<typename Container >
std::optional< std::size_t > precice::impl::DataContext::locateInvalidVertexID ( const Container & c)
inline

Definition at line 108 of file DataContext.hpp.

Here is the call graph for this function:

◆ mapData()

int precice::impl::DataContext::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)

Parameters
[in]afteronly map samples after this optional time
[in]skipZeroset output sample to zero if the input sample is zero too
Returns
the number of performed mappings

Definition at line 90 of file DataContext.cpp.

Here is the call graph for this function:

◆ resetInitialGuesses()

void precice::impl::DataContext::resetInitialGuesses ( )

Resets initial guesses of transient mappings to zero.

Definition at line 26 of file DataContext.cpp.

Friends And Related Symbol Documentation

◆ testing::DataContextFixture

friend class testing::DataContextFixture
friend

Definition at line 30 of file DataContext.hpp.

Member Data Documentation

◆ _initialGuesses

std::map<FromToDataIDs, Eigen::VectorXd> precice::impl::DataContext::_initialGuesses
private

Definition at line 168 of file DataContext.hpp.

◆ _log

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

Definition at line 165 of file DataContext.hpp.

◆ _mappingContexts

std::vector<MappingContext> precice::impl::DataContext::_mappingContexts
protected

Defines all mappings associated to this DataContext. A DataContext may also exist without a mapping.

Definition at line 123 of file DataContext.hpp.

◆ _mesh

mesh::PtrMesh precice::impl::DataContext::_mesh
private

Unique mesh associated with _providedData.

Definition at line 163 of file DataContext.hpp.

◆ _providedData

mesh::PtrData precice::impl::DataContext::_providedData
protected

Unique data this context is associated with.

Definition at line 126 of file DataContext.hpp.


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