preCICE v3.1.2
Loading...
Searching...
No Matches
ExportConfiguration.cpp
Go to the documentation of this file.
4#include "xml/XMLTag.hpp"
5
6namespace precice::io {
7
9{
10 using namespace xml;
11 std::string doc;
13 XMLTag::Occurrence occ = XMLTag::OCCUR_ARBITRARY;
14 {
15 XMLTag tag(*this, VALUE_VTK, occ, TAG);
16 tag.setDocumentation("Exports meshes to VTK legacy format files. Parallel participants will use the VTU exporter instead.");
17 tags.push_back(tag);
18 }
19 {
20 XMLTag tag(*this, VALUE_VTU, occ, TAG);
21 tag.setDocumentation("Exports meshes to VTU files in serial or PVTU files with VTU piece files in parallel.");
22 tags.push_back(tag);
23 }
24 {
25 XMLTag tag(*this, VALUE_VTP, occ, TAG);
26 tag.setDocumentation("Exports meshes to VTP files in serial or PVTP files with VTP piece files in parallel.");
27 tags.push_back(tag);
28 }
29 {
30 XMLTag tag(*this, VALUE_CSV, occ, TAG);
31 tag.setDocumentation("Exports vertex coordinates and data to CSV files.");
32 tags.push_back(tag);
33 }
34
35 auto attrLocation = XMLAttribute<std::string>(ATTR_LOCATION, "")
36 .setDocumentation("Directory to export the files to.");
37
38 auto attrEveryNTimeWindows = makeXMLAttribute(ATTR_EVERY_N_TIME_WINDOWS, 1)
39 .setDocumentation("preCICE does an export every X time windows. Choose -1 for no exports.");
40
41 auto attrEveryIteration = makeXMLAttribute(ATTR_EVERY_ITERATION, false)
42 .setDocumentation("Exports in every coupling (sub)iteration. For debug purposes.");
43
44 for (XMLTag &tag : tags) {
45 tag.addAttribute(attrLocation);
46 tag.addAttribute(attrEveryNTimeWindows);
47 tag.addAttribute(attrEveryIteration);
48 parent.addSubtag(tag);
49 }
50}
51
53 const xml::ConfigurationContext &context,
54 xml::XMLTag & tag)
55{
56 if (tag.getNamespace() == TAG) {
57 ExportContext econtext;
61 econtext.type = tag.getName();
62 _contexts.push_back(econtext);
63 }
64}
65
66} // namespace precice::io
virtual void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag)
Callback at begin of XML tag.
std::list< ExportContext > _contexts
XMLAttribute & setDocumentation(std::string documentation)
Sets a documentation string for the attribute.
Represents an XML tag to be configured automatically.
Definition XMLTag.hpp:31
const std::string & getNamespace() const
Returns xml namespace.
Definition XMLTag.hpp:159
std::string getStringAttributeValue(const std::string &name, std::optional< std::string > default_value=std::nullopt) const
Definition XMLTag.cpp:142
bool getBooleanAttributeValue(const std::string &name, std::optional< bool > default_value=std::nullopt) const
Definition XMLTag.cpp:155
const std::string & getName() const
Returns name (without namespace).
Definition XMLTag.hpp:153
int getIntAttributeValue(const std::string &name, std::optional< int > default_value=std::nullopt) const
Definition XMLTag.cpp:129
XMLTag & addSubtag(const XMLTag &tag)
Adds an XML tag as subtag by making a copy of the given tag.
Definition XMLTag.cpp:41
provides Import and Export of the coupling mesh and data.
T push_back(T... args)
Tightly coupled to the parameters of Participant()
Definition XMLTag.hpp:24