preCICE v3.2.0
|
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 () |
void | initializeMappingDataCache (std::string_view mappingType) |
Initializes the MappingDataCache in the DataContext after having computed the mappings. | |
void | configureInputMeshContext (std::string_view fromMesh, impl::MappingContext &mappingContext, mapping::Mapping::MeshRequirement requirement) |
Configures the mesh context with connectivity requirements and adds it to the mappingcontext. | |
void | configureOutputMeshContext (std::string_view toMesh, impl::MappingContext &mappingContext, mapping::Mapping::MeshRequirement requirement) |
Configures the mesh context with connectivity requirements and adds it to the mappingcontext. | |
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. | |
bool | hasReadMappings () const |
Returns true, if the participant has at least one read mapping. | |
bool | hasWriteMappings () const |
Returns true, if the participant has at least one write mapping. | |
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. | |
bool | hasExports () const |
Returns true, if the participant has any exports enabled. | |
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 69 of file ParticipantState.hpp.
|
private |
Definition at line 344 of file ParticipantState.hpp.
|
private |
Definition at line 341 of file ParticipantState.hpp.
Enumerator | |
---|---|
MAPPING_LINEAR_CONSERVATIVE | |
MAPPING_LINEAR_CONSISTENT | |
MAPPING_DIRECT |
Definition at line 71 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 312 of file ParticipantState.cpp.
const std::vector< action::PtrAction > & precice::impl::ParticipantState::actions | ( | ) | const |
Provided access to all Action.
Definition at line 317 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 322 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 |
|
private |
void precice::impl::ParticipantState::configureInputMeshContext | ( | std::string_view | fromMesh, |
impl::MappingContext & | mappingContext, | ||
mapping::Mapping::MeshRequirement | requirement ) |
Configures the mesh context with connectivity requirements and adds it to the mappingcontext.
Definition at line 486 of file ParticipantState.cpp.
void precice::impl::ParticipantState::configureOutputMeshContext | ( | std::string_view | toMesh, |
impl::MappingContext & | mappingContext, | ||
mapping::Mapping::MeshRequirement | requirement ) |
Configures the mesh context with connectivity requirements and adds it to the mappingcontext.
Definition at line 492 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 328 of file ParticipantState.cpp.
void precice::impl::ParticipantState::exportInitial | ( | ) |
void precice::impl::ParticipantState::exportIntermediate | ( | IntermediateExport | exp | ) |
Exports timewindows and iterations of meshes and watchpoints.
Definition at line 378 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 |
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::hasExports | ( | ) | const |
Returns true, if the participant has any exports enabled.
Definition at line 373 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.
bool precice::impl::ParticipantState::hasReadMappings | ( | ) | const |
Returns true, if the participant has at least one read mapping.
Definition at line 292 of file ParticipantState.cpp.
bool precice::impl::ParticipantState::hasWriteMappings | ( | ) | const |
Returns true, if the participant has at least one write mapping.
Definition at line 297 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 |
void precice::impl::ParticipantState::initializeMappingDataCache | ( | std::string_view | mappingType | ) |
Initializes the MappingDataCache in the DataContext after having computed the mappings.
Definition at line 473 of file ParticipantState.cpp.
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 383 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 282 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 274 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 | ) |
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 179 of file ParticipantState.hpp.
std::vector< MappingContext > & precice::impl::ParticipantState::readMappingContexts | ( | ) |
Provided access to all read MappingContext.
Definition at line 302 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 116 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 343 of file ParticipantState.cpp.
std::vector< PtrWatchIntegral > & precice::impl::ParticipantState::watchIntegrals | ( | ) |
Provided access to all WatchIntegrals.
Definition at line 338 of file ParticipantState.cpp.
std::vector< PtrWatchPoint > & precice::impl::ParticipantState::watchPoints | ( | ) |
Provided access to all WatchPoints.
Definition at line 333 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 171 of file ParticipantState.hpp.
std::vector< MappingContext > & precice::impl::ParticipantState::writeMappingContexts | ( | ) |
Provided access to all write MappingContext.
Definition at line 307 of file ParticipantState.cpp.
|
friend |
Definition at line 377 of file ParticipantState.hpp.
|
friend |
To allow white box tests.
Definition at line 376 of file ParticipantState.hpp.
|
private |
Definition at line 338 of file ParticipantState.hpp.
|
private |
Export contexts to export meshes, data, and more.
Definition at line 336 of file ParticipantState.hpp.
|
mutableprivate |
Definition at line 327 of file ParticipantState.hpp.
|
private |
All mesh contexts involved in a simulation.
Definition at line 347 of file ParticipantState.hpp.
|
private |
Definition at line 364 of file ParticipantState.hpp.
|
private |
Definition at line 329 of file ParticipantState.hpp.
|
private |
Definition at line 360 of file ParticipantState.hpp.
|
private |
Read mapping contexts used by the participant.
Definition at line 350 of file ParticipantState.hpp.
|
private |
Mesh contexts used by the participant.
Definition at line 356 of file ParticipantState.hpp.
|
private |
Definition at line 362 of file ParticipantState.hpp.
|
private |
Definition at line 333 of file ParticipantState.hpp.
|
private |
Definition at line 331 of file ParticipantState.hpp.
|
private |
Definition at line 358 of file ParticipantState.hpp.
|
private |
Write mapping contexts used by the participant.
Definition at line 353 of file ParticipantState.hpp.