preCICE v3.1.1
Loading...
Searching...
No Matches
ExportXML.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Core>
4#include <iosfwd>
5#include <string>
6#include <vector>
7#include "io/Export.hpp"
8#include "logging/Logger.hpp"
10
11namespace precice {
12namespace mesh {
13class Mesh;
14class Edge;
15class Triangle;
16class Tetrahedron;
17} // namespace mesh
18} // namespace precice
19
20namespace precice {
21namespace io {
22
24class ExportXML : public Export {
25public:
26 void doExport(
27 const std::string &name,
28 const std::string &location,
29 const mesh::Mesh & mesh) override;
30
31 static void writeVertex(
32 const Eigen::VectorXd &position,
33 std::ostream & outFile);
34
35 static void writeLine(
36 const mesh::Edge &edge,
37 std::ostream & outFile);
38
39 static void writeTriangle(
40 const mesh::Triangle &triangle,
41 std::ostream & outFile);
42
43 static void writeTetrahedron(
44 const mesh::Tetrahedron &tetra,
45 std::ostream & outFile);
46
47private:
48 mutable logging::Logger _log{"io::ExportXML"};
49
52
55
56 virtual std::string getVTKFormat() const = 0;
57 virtual std::string getParallelExtension() const = 0;
58 virtual std::string getPieceExtension() const = 0;
59 virtual std::string getPieceAttributes(const mesh::Mesh &mesh) const = 0;
60
66
71 const std::string &name,
72 const std::string &location,
73 const mesh::Mesh & mesh) const;
74
75 virtual void writeParallelCells(std::ostream &out) const = 0;
76
78
82 void writeSubFile(
83 const std::string &name,
84 const std::string &location,
85 const mesh::Mesh & mesh) const;
86
87 void exportPoints(
88 std::ostream & outFile,
89 const mesh::Mesh &mesh) const;
90
91 virtual void exportConnectivity(
92 std::ostream & outFile,
93 const mesh::Mesh &mesh) const = 0;
94
95 void exportData(
96 std::ostream & outFile,
97 const mesh::Mesh &mesh) const;
98
99 void exportGradient(const mesh::PtrData data, const int dataDim, std::ostream &outFile) const;
100};
101
102} // namespace io
103} // namespace precice
std::ostream & out
std::string name
Common class to generate the VTK XML-based formats.
Definition ExportXML.hpp:24
virtual std::string getPieceExtension() const =0
virtual std::string getPieceAttributes(const mesh::Mesh &mesh) const =0
void writeParallelData(std::ostream &out) const
static void writeLine(const mesh::Edge &edge, std::ostream &outFile)
virtual std::string getVTKFormat() const =0
void exportData(std::ostream &outFile, const mesh::Mesh &mesh) const
virtual void exportConnectivity(std::ostream &outFile, const mesh::Mesh &mesh) const =0
logging::Logger _log
Definition ExportXML.hpp:48
void exportPoints(std::ostream &outFile, const mesh::Mesh &mesh) const
void writeSubFile(const std::string &name, const std::string &location, const mesh::Mesh &mesh) const
Writes the sub file for each rank.
void doExport(const std::string &name, const std::string &location, const mesh::Mesh &mesh) override
Does export. Has to be implemented in subclass.
Definition ExportXML.cpp:23
static void writeTriangle(const mesh::Triangle &triangle, std::ostream &outFile)
std::vector< std::string > _scalarDataNames
List of names of all scalar data on mesh.
Definition ExportXML.hpp:51
virtual std::string getParallelExtension() const =0
static void writeTetrahedron(const mesh::Tetrahedron &tetra, std::ostream &outFile)
std::vector< std::string > _vectorDataNames
List of names of all vector data on mesh.
Definition ExportXML.hpp:54
void exportGradient(const mesh::PtrData data, const int dataDim, std::ostream &outFile) const
void writeParallelFile(const std::string &name, const std::string &location, const mesh::Mesh &mesh) const
Writes the primary file (called only by the primary rank)
Definition ExportXML.cpp:68
void processDataNamesAndDimensions(const mesh::Mesh &mesh)
Stores scalar and vector data names in string vectors Needed for writing primary file and sub files.
Definition ExportXML.cpp:40
static void writeVertex(const Eigen::VectorXd &position, std::ostream &outFile)
virtual void writeParallelCells(std::ostream &out) const =0
Abstract base class of all classes exporting container data structures.
Definition Export.hpp:15
This class provides a lightweight logger.
Definition Logger.hpp:16
Linear edge of a mesh, defined by two Vertex objects.
Definition Edge.hpp:16
Container and creator for meshes.
Definition Mesh.hpp:39
Tetrahedron of a mesh, defined by 4 vertices.
Triangle of a mesh, defined by three vertices.
Definition Triangle.hpp:27
Main namespace of the precice library.