preCICE v3.1.2
|
Holds coupling state of one participating solver in coupled simulation. More...
#include <ParticipantState.hpp>
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 ReadDataContext & | readDataContext (std::string_view mesh, std::string_view data) const |
ReadDataContext & | readDataContext (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 WriteDataContext & | writeDataContext (std::string_view mesh, std::string_view data) const |
WriteDataContext & | writeDataContext (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 MeshContext & | meshContext (std::string_view mesh) const |
Mesh queries. | |
MeshContext & | meshContext (std::string_view mesh) |
const std::vector< MeshContext * > & | usedMeshContexts () const |
std::vector< MeshContext * > & | usedMeshContexts () |
MeshContext & | usedMeshContext (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::string & | getName () 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 |
Holds coupling state of one participating solver in coupled simulation.
Definition at line 74 of file ParticipantState.hpp.
|
private |
Definition at line 330 of file ParticipantState.hpp.
|
private |
Definition at line 327 of file ParticipantState.hpp.
Enumerator | |
---|---|
MAPPING_LINEAR_CONSERVATIVE | |
MAPPING_LINEAR_CONSISTENT | |
MAPPING_DIRECT |
Definition at line 76 of file ParticipantState.hpp.
precice::impl::ParticipantState::ParticipantState | ( | std::string | name, |
mesh::PtrMeshConfiguration & | meshConfig ) |
Constructor.
[in] | name | Name of the participant. Has to be unique. |
Definition at line 29 of file ParticipantState.cpp.
|
virtual |
Definition at line 36 of file ParticipantState.cpp.
std::vector< action::PtrAction > & precice::impl::ParticipantState::actions | ( | ) |
Provided access to all Action.
Definition at line 296 of file ParticipantState.cpp.
const std::vector< action::PtrAction > & precice::impl::ParticipantState::actions | ( | ) | const |
Provided access to all Action.
Definition at line 301 of file ParticipantState.cpp.
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.
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.
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.
void precice::impl::ParticipantState::addReadMappingContext | ( | const MappingContext & | mappingContext | ) |
Adds a configured read Mapping to the ParticipantState.
Definition at line 123 of file ParticipantState.cpp.
void precice::impl::ParticipantState::addWatchIntegral | ( | const PtrWatchIntegral & | watchIntegral | ) |
Adds a configured WatchIntegral to the ParticipantState.
Definition at line 64 of file ParticipantState.cpp.
void precice::impl::ParticipantState::addWatchPoint | ( | const PtrWatchPoint & | watchPoint | ) |
Adds a configured WatchPoint to the ParticipantState.
Definition at line 58 of file ParticipantState.cpp.
void precice::impl::ParticipantState::addWriteData | ( | const mesh::PtrData & | data, |
const mesh::PtrMesh & | mesh ) |
void precice::impl::ParticipantState::addWriteMappingContext | ( | const MappingContext & | mappingContext | ) |
Adds a configured write Mapping to the ParticipantState.
Definition at line 129 of file ParticipantState.cpp.
|
private |
Definition at line 395 of file ParticipantState.cpp.
|
private |
Definition at line 387 of file ParticipantState.cpp.
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.
void precice::impl::ParticipantState::exportInitial | ( | ) |
Definition at line 337 of file ParticipantState.cpp.
void precice::impl::ParticipantState::exportIntermediate | ( | IntermediateExport | exp | ) |
Exports timewindows and iterations of meshes and watchpoints.
Definition at line 352 of file ParticipantState.cpp.
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.
data | name of the data |
Definition at line 150 of file ParticipantState.cpp.
const std::string & precice::impl::ParticipantState::getName | ( | ) | const |
Definition at line 332 of file ParticipantState.cpp.
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.
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.
std::string precice::impl::ParticipantState::hintForMesh | ( | std::string_view | mesh | ) | const |
std::string precice::impl::ParticipantState::hintForMeshData | ( | std::string_view | mesh, |
std::string_view | data ) const |
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.
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.
|
private |
Definition at line 369 of file ParticipantState.hpp.
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.
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.
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.
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.
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.
MeshContext & precice::impl::ParticipantState::meshContext | ( | std::string_view | mesh | ) |
Definition at line 215 of file ParticipantState.cpp.
const MeshContext & precice::impl::ParticipantState::meshContext | ( | std::string_view | mesh | ) | const |
Mesh queries.
Definition at line 208 of file ParticipantState.cpp.
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.
ReadDataContext & precice::impl::ParticipantState::readDataContext | ( | std::string_view | mesh, |
std::string_view | data ) |
Provides access to ReadDataContext
Definition at line 143 of file ParticipantState.cpp.
const ReadDataContext & precice::impl::ParticipantState::readDataContext | ( | std::string_view | mesh, |
std::string_view | data ) const |
Provides access to ReadDataContext
Definition at line 136 of file ParticipantState.cpp.
|
inline |
Provides access to all ReadDataContext objects
Definition at line 184 of file ParticipantState.hpp.
std::vector< MappingContext > & precice::impl::ParticipantState::readMappingContexts | ( | ) |
Provided access to all read MappingContext.
Definition at line 286 of file ParticipantState.cpp.
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.
|
inline |
Sets the manager responsible for providing unique IDs to meshes.
Definition at line 121 of file ParticipantState.hpp.
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.
MeshContext & precice::impl::ParticipantState::usedMeshContext | ( | std::string_view | name | ) |
Looks for a used MeshContext with a given mesh name.
[in] | name | the name of the Mesh |
Definition at line 232 of file ParticipantState.cpp.
MeshContext const & precice::impl::ParticipantState::usedMeshContext | ( | std::string_view | name | ) | const |
Looks for a used MeshContext with a given mesh name.
[in] | name | the name of the Mesh |
Definition at line 242 of file ParticipantState.cpp.
std::vector< MeshContext * > & precice::impl::ParticipantState::usedMeshContexts | ( | ) |
Provides unordered access to all MeshContext.used by this ParticipantState
Definition at line 227 of file ParticipantState.cpp.
const std::vector< MeshContext * > & precice::impl::ParticipantState::usedMeshContexts | ( | ) | const |
Provides unordered access to all MeshContext.used by this ParticipantState
Definition at line 222 of file ParticipantState.cpp.
bool precice::impl::ParticipantState::useIntraComm | ( | ) | const |
Returns true, if the participant uses a primary tag.
Definition at line 327 of file ParticipantState.cpp.
std::vector< PtrWatchIntegral > & precice::impl::ParticipantState::watchIntegrals | ( | ) |
Provided access to all WatchIntegrals.
Definition at line 322 of file ParticipantState.cpp.
std::vector< PtrWatchPoint > & precice::impl::ParticipantState::watchPoints | ( | ) |
Provided access to all WatchPoints.
Definition at line 317 of file ParticipantState.cpp.
WriteDataContext & precice::impl::ParticipantState::writeDataContext | ( | std::string_view | mesh, |
std::string_view | data ) |
Provides access to WriteDataContext
Definition at line 170 of file ParticipantState.cpp.
const WriteDataContext & precice::impl::ParticipantState::writeDataContext | ( | std::string_view | mesh, |
std::string_view | data ) const |
Provides access to WriteDataContext
Definition at line 163 of file ParticipantState.cpp.
|
inline |
Provides access to all WriteDataContext objects
Definition at line 176 of file ParticipantState.hpp.
std::vector< MappingContext > & precice::impl::ParticipantState::writeMappingContexts | ( | ) |
Provided access to all write MappingContext.
Definition at line 291 of file ParticipantState.cpp.
|
friend |
Definition at line 363 of file ParticipantState.hpp.
|
friend |
To allow white box tests.
Definition at line 362 of file ParticipantState.hpp.
|
private |
Definition at line 324 of file ParticipantState.hpp.
|
private |
Export contexts to export meshes, data, and more.
Definition at line 322 of file ParticipantState.hpp.
|
mutableprivate |
Definition at line 313 of file ParticipantState.hpp.
|
private |
All mesh contexts involved in a simulation.
Definition at line 333 of file ParticipantState.hpp.
|
private |
Definition at line 350 of file ParticipantState.hpp.
|
private |
Definition at line 315 of file ParticipantState.hpp.
|
private |
Definition at line 346 of file ParticipantState.hpp.
|
private |
Read mapping contexts used by the participant.
Definition at line 336 of file ParticipantState.hpp.
|
private |
Mesh contexts used by the participant.
Definition at line 342 of file ParticipantState.hpp.
|
private |
Definition at line 348 of file ParticipantState.hpp.
|
private |
Definition at line 319 of file ParticipantState.hpp.
|
private |
Definition at line 317 of file ParticipantState.hpp.
|
private |
Definition at line 344 of file ParticipantState.hpp.
|
private |
Write mapping contexts used by the participant.
Definition at line 339 of file ParticipantState.hpp.