OGS
VtuInterface.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <string>
18#include <filesystem>
19#include <vtkXMLWriter.h>
20
21namespace MeshLib {
22class Mesh;
23
24namespace IO
25{
26
27#ifdef USE_PETSC
29 std::string const& file_name);
30#endif
31
37class VtuInterface final
38{
39public:
41 explicit VtuInterface(const MeshLib::Mesh* mesh,
42 int dataMode = vtkXMLWriter::Appended,
43 bool compress = false);
44
48 std::string const& file_name,
49 bool const compute_element_neighbors = false);
50
55 std::string const& file_name,
56 bool const compute_element_neighbors = false);
57
60 bool writeToFile(std::filesystem::path const& file_path);
61
67 template <typename UnstructuredGridWriter>
68 bool writeVTU(std::string const& file_name, const int num_partitions = 1,
69 const int rank = 1);
70
71private:
75};
76
77int writeVtu(MeshLib::Mesh const& mesh, std::string const& file_name,
78 int const data_mode = vtkXMLWriter::Appended);
79
80} // end namespace IO
81} // end namespace MeshLib
82
83#include "VtuInterface-impl.h"
Implementation of the VtuInterface class.
Reads and writes VtkXMLUnstructuredGrid-files (vtu) to and from OGS data structures....
VtuInterface(const MeshLib::Mesh *mesh, int dataMode=vtkXMLWriter::Appended, bool compress=false)
Provide the mesh to write and set if compression should be used.
static MeshLib::Mesh * readVTUFile(std::string const &file_name, bool const compute_element_neighbors=false)
static MeshLib::Mesh * readVTKFile(std::string const &file_name, bool const compute_element_neighbors=false)
bool writeVTU(std::string const &file_name, const int num_partitions=1, const int rank=1)
bool writeToFile(std::filesystem::path const &file_path)
const MeshLib::Mesh * _mesh
int writeVtu(MeshLib::Mesh const &mesh, std::string const &file_name, int const data_mode)
std::string getVtuFileNameForPetscOutputWithoutExtension(std::string const &file_name)