preCICE
Loading...
Searching...
No Matches
ActionConfiguration.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <string>
5#include <vector>
6#include "action/Action.hpp"
8#include "logging/Logger.hpp"
10#include "xml/XMLTag.hpp"
11
12namespace precice::action {
13
18public:
20 xml::XMLTag &parent,
22
28 void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override;
29
35 void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override;
36
40 int getUsedMeshID() const;
41
45 const std::list<PtrAction> &actions() const
46 {
47 return _actions;
48 }
49
55 std::list<PtrAction> extractActions()
56 {
57 return std::exchange(_actions, std::list<PtrAction>{});
58 }
59
60private:
65 std::string type;
66 std::string timing;
67 std::vector<std::string> sourceDataVector;
68 std::string targetData;
69 std::string mesh;
72 std::string path;
73 std::string module;
74 };
75
76 mutable logging::Logger _log{"config::ActionConfiguration"};
77
78 const std::string TAG = "action";
79
80 const std::string NAME_DIVIDE_BY_AREA;
81 const std::string NAME_MULTIPLY_BY_AREA;
82 const std::string NAME_SUMMATION;
83 const std::string NAME_COMPUTE_CURVATURE;
84 const std::string NAME_PYTHON;
85 const std::string NAME_RECORDER;
86
87 const std::string TAG_SOURCE_DATA;
88 const std::string TAG_TARGET_DATA;
89 const std::string TAG_CONVERGENCE_TOLERANCE;
90 const std::string TAG_MAX_ITERATIONS;
91 const std::string TAG_MODULE_PATH;
92 const std::string TAG_MODULE_NAME;
93
94 const std::string ATTR_TYPE = "type";
95 const std::string ATTR_TIMING = "timing";
96 const std::string ATTR_NAME = "name";
97 const std::string ATTR_VALUE = "value";
98 const std::string ATTR_MESH = "mesh";
99
100 const std::string WRITE_MAPPING_POST;
101 const std::string READ_MAPPING_POST;
102
104
106
107 std::list<PtrAction> _actions;
108
109 // /**
110 // * @brief Adds all required subtags to the main action tag.
111 // */
112 // void addSubtags (
113 // std::list<xml::XMLTag>& tags,
114 // const std::string& type );
115
119 void createAction();
120
122};
123
124} // namespace precice::action
void createAction()
Adds all required subtags to the main action tag.
const std::list< PtrAction > & actions() const
Returns the configured action.
void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback function required for use of automatic configuration.
ActionConfiguration(xml::XMLTag &parent, mesh::PtrMeshConfiguration meshConfig)
void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback function required for use of automatic configuration.
int getUsedMeshID() const
Returns the id of the mesh used in the data action.
std::list< PtrAction > extractActions()
Extracts the configured action.
Timing
Defines the time and place of application of the action.
Definition Action.hpp:17
This class provides a lightweight logger.
Definition Logger.hpp:17
Represents an XML tag to be configured automatically.
Definition XMLTag.hpp:28
contains actions to modify exchanged data.
Definition Action.hpp:6
std::shared_ptr< MeshConfiguration > PtrMeshConfiguration
Stores configuration information temporarily to create the Action.
Tightly coupled to the parameters of Participant()
Definition XMLTag.hpp:21
Callback interface for configuration classes using XMLTag.
Definition XMLTag.hpp:46