preCICE v3.1.1
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
precice::impl::ParticipantState Class Reference

Holds coupling state of one participating solver in coupled simulation. More...

#include <ParticipantState.hpp>

Collaboration diagram for precice::impl::ParticipantState:
[legend]

Classes

struct  IntermediateExport
 

Public Types

enum  MappingConstants { MAPPING_LINEAR_CONSERVATIVE , MAPPING_LINEAR_CONSISTENT , MAPPING_DIRECT }
 

Public Member Functions

 ParticipantState (std::string name, mesh::PtrMeshConfiguration &meshConfig)
 Constructor.
 
virtual ~ParticipantState ()
 
Configuration interface

Adds a configured write Data to the ParticipantState

void addWriteData (const mesh::PtrData &data, const mesh::PtrMesh &mesh)
 
void addReadData (const mesh::PtrData &data, const mesh::PtrMesh &mesh)
 Adds a configured read Data to the ParticipantState.
 
void addReadMappingContext (const MappingContext &mappingContext)
 Adds a configured read Mapping to the ParticipantState.
 
void addWriteMappingContext (const MappingContext &mappingContext)
 Adds a configured write Mapping to the ParticipantState.
 
void addWatchPoint (const PtrWatchPoint &watchPoint)
 Adds a configured WatchPoint to the ParticipantState.
 
void addWatchIntegral (const PtrWatchIntegral &watchIntegral)
 Adds a configured WatchIntegral to the ParticipantState.
 
void setUsePrimaryRank (bool useIntraComm)
 Sets weather the participant was configured with a primary tag.
 
void setMeshIdManager (std::unique_ptr< utils::ManageUniqueIDs > &&idm)
 Sets the manager responsible for providing unique IDs to meshes.
 
void addAction (action::PtrAction &&action)
 Adds a configured Action to the participant.
 
void addExportContext (const io::ExportContext &context)
 Adds a configured ExportContext to export meshes and data.
 
void provideMesh (const mesh::PtrMesh &mesh)
 Adds a mesh to be provided by the participant.
 
void receiveMesh (const mesh::PtrMesh &mesh, const std::string &fromParticipant, double safetyFactor, partition::ReceivedPartition::GeometricFilter geoFilter, const bool allowDirectAccess)
 Adds a mesh to be received by the participant.
 
Data queries
const ReadDataContextreadDataContext (std::string_view mesh, std::string_view data) const
 
ReadDataContextreadDataContext (std::string_view mesh, std::string_view data)
 
mesh::PtrMesh findMesh (std::string_view data) const
 Returns the mesh associated with ReadDataContext with given data name in _readDataContexts of this Participant.
 
const WriteDataContextwriteDataContext (std::string_view mesh, std::string_view data) const
 
WriteDataContextwriteDataContext (std::string_view mesh, std::string_view data)
 
auto writeDataContexts ()
 
auto readDataContexts ()
 
bool hasData (std::string_view mesh, std::string_view data) const
 Is the dataID know to preCICE?
 
bool isDataUsed (std::string_view mesh, std::string_view data) const
 Is the data used by this participant?
 
bool isDataRead (std::string_view mesh, std::string_view data) const
 Is the participant allowed to read the data?
 
bool isDataWrite (std::string_view mesh, std::string_view data) const
 Is the participant allowed to write the data?
 
Mesh queries
const MeshContextmeshContext (std::string_view mesh) const
 Mesh queries.
 
MeshContextmeshContext (std::string_view mesh)
 
const std::vector< MeshContext * > & usedMeshContexts () const
 
std::vector< MeshContext * > & usedMeshContexts ()
 
MeshContextusedMeshContext (std::string_view name)
 
MeshContext const & usedMeshContext (std::string_view name) const
 
bool hasMesh (std::string_view mesh) const
 Does preCICE know a mesh with this name?
 
bool isMeshUsed (std::string_view mesh) const
 Is a mesh with this name used by this participant?
 
bool isMeshProvided (std::string_view mesh) const
 Is a mesh with this name provided by this participant?
 
bool isMeshReceived (std::string_view mesh) const
 Is a mesh with this name received by this participant?
 
bool isDirectAccessAllowed (std::string_view mesh) const
 
Exporting interface

Exports the initial state of meshes

void exportInitial ()
 
void exportIntermediate (IntermediateExport exp)
 Exports timewindows and iterations of meshes and watchpoints.
 
Other queries

Returns the name of the participant.

const std::stringgetName () const
 
bool useIntraComm () const
 Returns true, if the participant uses a primary tag.
 
std::vector< MappingContext > & readMappingContexts ()
 Provided access to all read MappingContext.
 
std::vector< MappingContext > & writeMappingContexts ()
 Provided access to all write MappingContext.
 
std::vector< PtrWatchPoint > & watchPoints ()
 Provided access to all WatchPoints.
 
std::vector< PtrWatchIntegral > & watchIntegrals ()
 Provided access to all WatchIntegrals.
 
std::vector< action::PtrAction > & actions ()
 Provided access to all Action.
 
const std::vector< action::PtrAction > & actions () const
 Provided access to all Action.
 
const std::vector< io::ExportContext > & exportContexts () const
 Returns all ExportContext for exporting meshes and data.
 
Error helpers
std::string hintForMesh (std::string_view mesh) const
 
std::string hintForMeshData (std::string_view mesh, std::string_view data) const
 

Private Types

template<typename T >
using MeshMap = std::map<std::string, T, std::less<>>
 
template<typename T >
using DataMap = std::map<MeshDataKey<std::string>, T, std::less<>>
 

Private Member Functions

template<typename ELEMENT_T >
bool isDataValid (const std::vector< ELEMENT_T > &data, const ELEMENT_T &newElement) const
 
void checkDuplicatedUse (std::string_view mesh)
 
void checkDuplicatedData (std::string_view mesh, std::string_view data)
 

Private Attributes

logging::Logger _log {"impl::ParticipantState"}
 
std::string _name
 
std::vector< PtrWatchPoint_watchPoints
 
std::vector< PtrWatchIntegral_watchIntegrals
 
std::vector< io::ExportContext_exportContexts
 Export contexts to export meshes, data, and more.
 
std::vector< action::PtrAction_actions
 
MeshMap< MeshContext * > _meshContexts
 All mesh contexts involved in a simulation.
 
std::vector< MappingContext_readMappingContexts
 Read mapping contexts used by the participant.
 
std::vector< MappingContext_writeMappingContexts
 Write mapping contexts used by the participant.
 
std::vector< MeshContext * > _usedMeshContexts
 Mesh contexts used by the participant.
 
DataMap< WriteDataContext_writeDataContexts
 
DataMap< ReadDataContext_readDataContexts
 
bool _useIntraComm = false
 
std::unique_ptr< utils::ManageUniqueIDs_meshIdManager
 

Friends

struct Integration::Serial::Whitebox::TestConfigurationPeano
 To allow white box tests.
 
struct Integration::Serial::Whitebox::TestConfigurationComsol
 

Detailed Description

Holds coupling state of one participating solver in coupled simulation.

Definition at line 74 of file ParticipantState.hpp.

Member Typedef Documentation

◆ DataMap

Definition at line 330 of file ParticipantState.hpp.

◆ MeshMap

template<typename T >
using precice::impl::ParticipantState::MeshMap = std::map<std::string, T, std::less<>>
private

Definition at line 327 of file ParticipantState.hpp.

Member Enumeration Documentation

◆ MappingConstants

Enumerator
MAPPING_LINEAR_CONSERVATIVE 
MAPPING_LINEAR_CONSISTENT 
MAPPING_DIRECT 

Definition at line 76 of file ParticipantState.hpp.

Constructor & Destructor Documentation

◆ ParticipantState()

precice::impl::ParticipantState::ParticipantState ( std::string name,
mesh::PtrMeshConfiguration & meshConfig )

Constructor.

Parameters
[in]nameName of the participant. Has to be unique.

Definition at line 29 of file ParticipantState.cpp.

◆ ~ParticipantState()

precice::impl::ParticipantState::~ParticipantState ( )
virtual

Definition at line 36 of file ParticipantState.cpp.

Member Function Documentation

◆ actions() [1/2]

std::vector< action::PtrAction > & precice::impl::ParticipantState::actions ( )

Provided access to all Action.

Definition at line 296 of file ParticipantState.cpp.

◆ actions() [2/2]

const std::vector< action::PtrAction > & precice::impl::ParticipantState::actions ( ) const

Provided access to all Action.

Definition at line 301 of file ParticipantState.cpp.

◆ addAction()

void precice::impl::ParticipantState::addAction ( action::PtrAction && action)

Adds a configured Action to the participant.

Configuration interface.

Definition at line 46 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ addExportContext()

void precice::impl::ParticipantState::addExportContext ( const io::ExportContext & context)

Adds a configured ExportContext to export meshes and data.

Definition at line 306 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ addReadData()

void precice::impl::ParticipantState::addReadData ( const mesh::PtrData & data,
const mesh::PtrMesh & mesh )

Adds a configured read Data to the ParticipantState.

Definition at line 115 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ addReadMappingContext()

void precice::impl::ParticipantState::addReadMappingContext ( const MappingContext & mappingContext)

Adds a configured read Mapping to the ParticipantState.

Definition at line 123 of file ParticipantState.cpp.

◆ addWatchIntegral()

void precice::impl::ParticipantState::addWatchIntegral ( const PtrWatchIntegral & watchIntegral)

Adds a configured WatchIntegral to the ParticipantState.

Definition at line 64 of file ParticipantState.cpp.

◆ addWatchPoint()

void precice::impl::ParticipantState::addWatchPoint ( const PtrWatchPoint & watchPoint)

Adds a configured WatchPoint to the ParticipantState.

Definition at line 58 of file ParticipantState.cpp.

◆ addWriteData()

void precice::impl::ParticipantState::addWriteData ( const mesh::PtrData & data,
const mesh::PtrMesh & mesh )

Definition at line 107 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ addWriteMappingContext()

void precice::impl::ParticipantState::addWriteMappingContext ( const MappingContext & mappingContext)

Adds a configured write Mapping to the ParticipantState.

Definition at line 129 of file ParticipantState.cpp.

◆ checkDuplicatedData()

void precice::impl::ParticipantState::checkDuplicatedData ( std::string_view mesh,
std::string_view data )
private

Definition at line 395 of file ParticipantState.cpp.

◆ checkDuplicatedUse()

void precice::impl::ParticipantState::checkDuplicatedUse ( std::string_view mesh)
private

Definition at line 387 of file ParticipantState.cpp.

◆ exportContexts()

const std::vector< io::ExportContext > & precice::impl::ParticipantState::exportContexts ( ) const

Returns all ExportContext for exporting meshes and data.

Definition at line 312 of file ParticipantState.cpp.

◆ exportInitial()

void precice::impl::ParticipantState::exportInitial ( )

Definition at line 337 of file ParticipantState.cpp.

◆ exportIntermediate()

void precice::impl::ParticipantState::exportIntermediate ( IntermediateExport exp)

Exports timewindows and iterations of meshes and watchpoints.

Todo
this is the global iteration count. Shouldn't this be local to the timestep? example .dtN.itM or similar

Definition at line 352 of file ParticipantState.cpp.

◆ findMesh()

mesh::PtrMesh precice::impl::ParticipantState::findMesh ( std::string_view data) const

Returns the mesh associated with ReadDataContext with given data name in _readDataContexts of this Participant.

Parameters
dataname of the data
Returns
mesh::PtrMesh, returns nullptr, if no read data contest for given data name was found

Definition at line 150 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ getName()

const std::string & precice::impl::ParticipantState::getName ( ) const

Definition at line 332 of file ParticipantState.cpp.

◆ hasData()

bool precice::impl::ParticipantState::hasData ( std::string_view mesh,
std::string_view data ) const

Is the dataID know to preCICE?

Definition at line 177 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ hasMesh()

bool precice::impl::ParticipantState::hasMesh ( std::string_view mesh) const

Does preCICE know a mesh with this name?

Definition at line 252 of file ParticipantState.cpp.

◆ hintForMesh()

std::string precice::impl::ParticipantState::hintForMesh ( std::string_view mesh) const

Definition at line 403 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ hintForMeshData()

std::string precice::impl::ParticipantState::hintForMeshData ( std::string_view mesh,
std::string_view data ) const

Definition at line 420 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ isDataRead()

bool precice::impl::ParticipantState::isDataRead ( std::string_view mesh,
std::string_view data ) const

Is the participant allowed to read the data?

Definition at line 196 of file ParticipantState.cpp.

◆ isDataUsed()

bool precice::impl::ParticipantState::isDataUsed ( std::string_view mesh,
std::string_view data ) const

Is the data used by this participant?

Definition at line 189 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ isDataValid()

template<typename ELEMENT_T >
bool precice::impl::ParticipantState::isDataValid ( const std::vector< ELEMENT_T > & data,
const ELEMENT_T & newElement ) const
private

Definition at line 369 of file ParticipantState.hpp.

◆ isDataWrite()

bool precice::impl::ParticipantState::isDataWrite ( std::string_view mesh,
std::string_view data ) const

Is the participant allowed to write the data?

Definition at line 201 of file ParticipantState.cpp.

◆ isDirectAccessAllowed()

bool precice::impl::ParticipantState::isDirectAccessAllowed ( std::string_view mesh) const

Returns whether we are allowed to access a received mesh direct which requires the config tag <receive-mesh ... direct-access="true"

Definition at line 278 of file ParticipantState.cpp.

◆ isMeshProvided()

bool precice::impl::ParticipantState::isMeshProvided ( std::string_view mesh) const

Is a mesh with this name provided by this participant?

Definition at line 266 of file ParticipantState.cpp.

◆ isMeshReceived()

bool precice::impl::ParticipantState::isMeshReceived ( std::string_view mesh) const

Is a mesh with this name received by this participant?

Definition at line 272 of file ParticipantState.cpp.

◆ isMeshUsed()

bool precice::impl::ParticipantState::isMeshUsed ( std::string_view mesh) const

Is a mesh with this name used by this participant?

Definition at line 257 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ meshContext() [1/2]

MeshContext & precice::impl::ParticipantState::meshContext ( std::string_view mesh)

Definition at line 215 of file ParticipantState.cpp.

◆ meshContext() [2/2]

const MeshContext & precice::impl::ParticipantState::meshContext ( std::string_view mesh) const

Mesh queries.

Definition at line 208 of file ParticipantState.cpp.

◆ provideMesh()

void precice::impl::ParticipantState::provideMesh ( const mesh::PtrMesh & mesh)

Adds a mesh to be provided by the participant.

Definition at line 70 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ readDataContext() [1/2]

ReadDataContext & precice::impl::ParticipantState::readDataContext ( std::string_view mesh,
std::string_view data )

Provides access to ReadDataContext

Precondition
there exists a ReadDataContext for data

Definition at line 143 of file ParticipantState.cpp.

◆ readDataContext() [2/2]

const ReadDataContext & precice::impl::ParticipantState::readDataContext ( std::string_view mesh,
std::string_view data ) const

Provides access to ReadDataContext

Precondition
there exists a ReadDataContext for data

Definition at line 136 of file ParticipantState.cpp.

◆ readDataContexts()

auto precice::impl::ParticipantState::readDataContexts ( )
inline

Provides access to all ReadDataContext objects

Remarks
does not contain nullptr.

Definition at line 184 of file ParticipantState.hpp.

◆ readMappingContexts()

std::vector< MappingContext > & precice::impl::ParticipantState::readMappingContexts ( )

Provided access to all read MappingContext.

Definition at line 286 of file ParticipantState.cpp.

◆ receiveMesh()

void precice::impl::ParticipantState::receiveMesh ( const mesh::PtrMesh & mesh,
const std::string & fromParticipant,
double safetyFactor,
partition::ReceivedPartition::GeometricFilter geoFilter,
const bool allowDirectAccess )

Adds a mesh to be received by the participant.

Definition at line 83 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ setMeshIdManager()

void precice::impl::ParticipantState::setMeshIdManager ( std::unique_ptr< utils::ManageUniqueIDs > && idm)
inline

Sets the manager responsible for providing unique IDs to meshes.

Definition at line 121 of file ParticipantState.hpp.

◆ setUsePrimaryRank()

void precice::impl::ParticipantState::setUsePrimaryRank ( bool useIntraComm)

Sets weather the participant was configured with a primary tag.

Definition at line 53 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ usedMeshContext() [1/2]

MeshContext & precice::impl::ParticipantState::usedMeshContext ( std::string_view name)

Looks for a used MeshContext with a given mesh name.

Parameters
[in]namethe name of the Mesh
Returns
a reference to the MeshContext
Precondition
there is a matching mesh

Definition at line 232 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ usedMeshContext() [2/2]

MeshContext const & precice::impl::ParticipantState::usedMeshContext ( std::string_view name) const

Looks for a used MeshContext with a given mesh name.

Parameters
[in]namethe name of the Mesh
Returns
a reference to the MeshContext
Precondition
there is a matching mesh

Definition at line 242 of file ParticipantState.cpp.

Here is the call graph for this function:

◆ usedMeshContexts() [1/2]

std::vector< MeshContext * > & precice::impl::ParticipantState::usedMeshContexts ( )

Provides unordered access to all MeshContext.used by this ParticipantState

Remarks
The sequence does not contain nullptr

Definition at line 227 of file ParticipantState.cpp.

◆ usedMeshContexts() [2/2]

const std::vector< MeshContext * > & precice::impl::ParticipantState::usedMeshContexts ( ) const

Provides unordered access to all MeshContext.used by this ParticipantState

Remarks
The sequence does not contain nullptr

Definition at line 222 of file ParticipantState.cpp.

◆ useIntraComm()

bool precice::impl::ParticipantState::useIntraComm ( ) const

Returns true, if the participant uses a primary tag.

Definition at line 327 of file ParticipantState.cpp.

◆ watchIntegrals()

std::vector< PtrWatchIntegral > & precice::impl::ParticipantState::watchIntegrals ( )

Provided access to all WatchIntegrals.

Definition at line 322 of file ParticipantState.cpp.

◆ watchPoints()

std::vector< PtrWatchPoint > & precice::impl::ParticipantState::watchPoints ( )

Provided access to all WatchPoints.

Definition at line 317 of file ParticipantState.cpp.

◆ writeDataContext() [1/2]

WriteDataContext & precice::impl::ParticipantState::writeDataContext ( std::string_view mesh,
std::string_view data )

Provides access to WriteDataContext

Precondition
there exists a WriteDataContext for data

Definition at line 170 of file ParticipantState.cpp.

◆ writeDataContext() [2/2]

const WriteDataContext & precice::impl::ParticipantState::writeDataContext ( std::string_view mesh,
std::string_view data ) const

Provides access to WriteDataContext

Precondition
there exists a WriteDataContext for data

Definition at line 163 of file ParticipantState.cpp.

◆ writeDataContexts()

auto precice::impl::ParticipantState::writeDataContexts ( )
inline

Provides access to all WriteDataContext objects

Remarks
does not contain nullptr.

Definition at line 176 of file ParticipantState.hpp.

◆ writeMappingContexts()

std::vector< MappingContext > & precice::impl::ParticipantState::writeMappingContexts ( )

Provided access to all write MappingContext.

Definition at line 291 of file ParticipantState.cpp.

Friends And Related Symbol Documentation

◆ Integration::Serial::Whitebox::TestConfigurationComsol

friend struct Integration::Serial::Whitebox::TestConfigurationComsol
friend

Definition at line 363 of file ParticipantState.hpp.

◆ Integration::Serial::Whitebox::TestConfigurationPeano

friend struct Integration::Serial::Whitebox::TestConfigurationPeano
friend

To allow white box tests.

Definition at line 362 of file ParticipantState.hpp.

Member Data Documentation

◆ _actions

std::vector<action::PtrAction> precice::impl::ParticipantState::_actions
private

Definition at line 324 of file ParticipantState.hpp.

◆ _exportContexts

std::vector<io::ExportContext> precice::impl::ParticipantState::_exportContexts
private

Export contexts to export meshes, data, and more.

Definition at line 322 of file ParticipantState.hpp.

◆ _log

logging::Logger precice::impl::ParticipantState::_log {"impl::ParticipantState"}
mutableprivate

Definition at line 313 of file ParticipantState.hpp.

◆ _meshContexts

MeshMap<MeshContext *> precice::impl::ParticipantState::_meshContexts
private

All mesh contexts involved in a simulation.

Definition at line 333 of file ParticipantState.hpp.

◆ _meshIdManager

std::unique_ptr<utils::ManageUniqueIDs> precice::impl::ParticipantState::_meshIdManager
private

Definition at line 350 of file ParticipantState.hpp.

◆ _name

std::string precice::impl::ParticipantState::_name
private

Definition at line 315 of file ParticipantState.hpp.

◆ _readDataContexts

DataMap<ReadDataContext> precice::impl::ParticipantState::_readDataContexts
private

Definition at line 346 of file ParticipantState.hpp.

◆ _readMappingContexts

std::vector<MappingContext> precice::impl::ParticipantState::_readMappingContexts
private

Read mapping contexts used by the participant.

Definition at line 336 of file ParticipantState.hpp.

◆ _usedMeshContexts

std::vector<MeshContext *> precice::impl::ParticipantState::_usedMeshContexts
private

Mesh contexts used by the participant.

Definition at line 342 of file ParticipantState.hpp.

◆ _useIntraComm

bool precice::impl::ParticipantState::_useIntraComm = false
private

Definition at line 348 of file ParticipantState.hpp.

◆ _watchIntegrals

std::vector<PtrWatchIntegral> precice::impl::ParticipantState::_watchIntegrals
private

Definition at line 319 of file ParticipantState.hpp.

◆ _watchPoints

std::vector<PtrWatchPoint> precice::impl::ParticipantState::_watchPoints
private

Definition at line 317 of file ParticipantState.hpp.

◆ _writeDataContexts

DataMap<WriteDataContext> precice::impl::ParticipantState::_writeDataContexts
private

Definition at line 344 of file ParticipantState.hpp.

◆ _writeMappingContexts

std::vector<MappingContext> precice::impl::ParticipantState::_writeMappingContexts
private

Write mapping contexts used by the participant.

Definition at line 339 of file ParticipantState.hpp.


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