preCICE
Loading...
Searching...
No Matches
ParticipantConfiguration.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Core>
4#include <memory>
5#include <string>
6#include <vector>
9#include "logging/Logger.hpp"
16#include "time/Time.hpp"
17#include "utils/networking.hpp"
18#include "xml/XMLTag.hpp"
19
20namespace precice::config {
21
26public:
28 xml::XMLTag &parent,
29 mesh::PtrMeshConfiguration meshConfiguration);
30
31 void setExperimental(bool experimental);
32 void setRemeshing(bool allowed);
33
39 void xmlTagCallback(
40 const xml::ConfigurationContext &context,
41 xml::XMLTag &callingTag) override;
42
49 const xml::ConfigurationContext &context,
50 xml::XMLTag &callingTag) override;
51
52 std::size_t nParticipants() const;
53
55 const std::vector<impl::PtrParticipant> &getParticipants() const;
56
58 const impl::PtrParticipant getParticipant(std::string_view participantName) const;
59
60 std::set<std::string> knownParticipants() const;
61
62 bool hasParticipant(std::string_view name) const;
63
64 std::string hintFor(std::string_view wrongName) const;
65
66private:
68 std::string name;
69 std::string nameMesh;
70 Eigen::VectorXd coordinates;
71 };
72
74 std::string name;
75 std::string nameMesh;
77 };
78
79 mutable logging::Logger _log{"config::ParticipantConfiguration"};
80
81 const std::string TAG = "participant";
82 const std::string TAG_WRITE = "write-data";
83 const std::string TAG_READ = "read-data";
84 const std::string TAG_DATA_ACTION = "data-action";
85 const std::string TAG_PROVIDE_MESH = "provide-mesh";
86 const std::string TAG_RECEIVE_MESH = "receive-mesh";
87 const std::string TAG_WATCH_INTEGRAL = "watch-integral";
88 const std::string TAG_WATCH_POINT = "watch-point";
89 const std::string TAG_INTRA_COMM = "intra-comm";
90
91 const std::string ATTR_NAME = "name";
92 const std::string ATTR_SOURCE_DATA = "source-data";
93 const std::string ATTR_TARGET_DATA = "target-data";
94 const std::string ATTR_TIMING = "timing";
95 const std::string ATTR_LOCAL_OFFSET = "offset";
96 const std::string ATTR_ACTION_TYPE = "type";
97 const std::string ATTR_FROM = "from";
98 const std::string ATTR_SAFETY_FACTOR = "safety-factor";
99 const std::string ATTR_GEOMETRIC_FILTER = "geometric-filter";
100 const std::string ATTR_DIRECT_ACCESS = "direct-access";
101 const std::string ATTR_API_ACCESS = "api-access";
102 const std::string ATTR_PROVIDE = "provide";
103 const std::string ATTR_MESH = "mesh";
104 const std::string ATTR_COORDINATE = "coordinate";
105 const std::string ATTR_COMMUNICATION = "communication";
106 const std::string ATTR_CONTEXT = "context";
107 const std::string ATTR_NETWORK = "network";
108 const std::string ATTR_EXCHANGE_DIRECTORY = "exchange-directory";
109 const std::string ATTR_SCALE_WITH_CONN = "scale-with-connectivity";
110
111 const std::string VALUE_FILTER_ON_SECONDARY_RANKS = "on-secondary-ranks";
112 const std::string VALUE_FILTER_ON_PRIMARY_RANK = "on-primary-rank";
113 const std::string VALUE_NO_FILTER = "no-filter";
114
115 const std::string VALUE_VTK = "vtk";
116 const std::string VALUE_VTU = "vtu";
117 const std::string VALUE_VTP = "vtp";
118 const std::string VALUE_CSV = "csv";
119
120 bool _experimental = false;
121 bool _remeshing = false;
122
124
126
128
129 std::unique_ptr<io::ExportConfiguration> _exportConfig;
130
131 std::vector<impl::PtrParticipant> _participants;
132
133 std::vector<WatchPointConfig> _watchPointConfigs;
134
135 std::vector<WatchIntegralConfig> _watchIntegralConfigs;
136
137 partition::ReceivedPartition::GeometricFilter getGeoFilter(const std::string &geoFilter) const;
138
140
141 const mesh::PtrData &getData(
142 const mesh::PtrMesh &mesh,
143 const std::string &nameData) const;
144
145 mapping::PtrMapping getMapping(const std::string &mappingName);
146
147 // Does this participant already define a primary tag?
148 // This context information is needed in xmlEndTagCallback to create a default
149 // primary com if required (i.e. no solution yet defined and parallel).
151
153 const xml::ConfigurationContext &context,
154 const impl::PtrParticipant &participant);
155
159 const impl::PtrParticipant &participant);
160};
161
162} // namespace precice::config
const std::vector< impl::PtrParticipant > & getParticipants() const
Returns all configured participants.
std::vector< impl::PtrParticipant > _participants
ParticipantConfiguration(xml::XMLTag &parent, mesh::PtrMeshConfiguration meshConfiguration)
partition::ReceivedPartition::GeometricFilter getGeoFilter(const std::string &geoFilter) const
mesh::PtrMesh copy(const mesh::PtrMesh &mesh) const
void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback function required for use of automatic configuration.
void finishParticipantConfiguration(const xml::ConfigurationContext &context, const impl::PtrParticipant &participant)
std::string hintFor(std::string_view wrongName) const
void checkIllDefinedMappings(const mapping::MappingConfiguration::ConfiguredMapping &mapping, const impl::PtrParticipant &participant)
Check whether a mapping to the same mesh and with similar data fields already exists.
void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback function required for use of automatic configuration.
std::unique_ptr< io::ExportConfiguration > _exportConfig
mapping::PtrMapping getMapping(const std::string &mappingName)
std::vector< WatchIntegralConfig > _watchIntegralConfigs
const impl::PtrParticipant getParticipant(std::string_view participantName) const
Returns a participant with the given name.
This class provides a lightweight logger.
Definition Logger.hpp:17
GeometricFilter
Defines the type of geometric filter used.
Represents an XML tag to be configured automatically.
Definition XMLTag.hpp:28
vector< double > getData()
Definition mainA.cpp:19
std::shared_ptr< ActionConfiguration > PtrActionConfiguration
std::shared_ptr< ParticipantState > PtrParticipant
contains data mapping from points to meshes.
std::shared_ptr< MappingConfiguration > PtrMappingConfiguration
std::shared_ptr< Mapping > PtrMapping
provides Mesh, Data and primitives.
std::shared_ptr< Data > PtrData
std::shared_ptr< Mesh > PtrMesh
std::shared_ptr< MeshConfiguration > PtrMeshConfiguration
Tightly coupled to the parameters of Participant().
Definition XMLTag.hpp:21
Callback interface for configuration classes using XMLTag.
Definition XMLTag.hpp:46