OGS
ProcessLib::OutputVTKFormat Struct Referencefinal

Detailed Description

Definition at line 59 of file OutputFormat.h.

#include <OutputFormat.h>

Inheritance diagram for ProcessLib::OutputVTKFormat:
[legend]
Collaboration diagram for ProcessLib::OutputVTKFormat:
[legend]

Public Member Functions

 OutputVTKFormat (std::string const &directory, std::string prefix, std::string suffix, bool const compression, int const data_mode)
 
void outputMeshes (const int timestep, const double t, const int iteration, std::vector< std::reference_wrapper< const MeshLib::Mesh > > const &meshes, std::set< std::string > const &output_variables) const override
 
MeshLib::IO::PVDFilefindOrCreatePVDFile (std::string const &mesh_name) const
 
std::string constructFilename (std::string const &mesh_name, int const timestep, double const t, int const iteration) const override
 
std::string constructPVDName (std::string const &mesh_name) const
 
- Public Member Functions inherited from ProcessLib::OutputFormat
 OutputFormat (std::string const &directory, std::string prefix, std::string suffix, bool const compression)
 
virtual ~OutputFormat ()=default
 
 OutputFormat (OutputFormat const &other)=delete
 
 OutputFormat (OutputFormat &&other)=default
 
OutputFormatoperator= (OutputFormat &other)=delete
 
OutputFormatoperator= (OutputFormat &&other)=default
 

Public Attributes

int data_mode
 
std::map< std::string, MeshLib::IO::PVDFilemesh_name_to_pvd_file
 Holds the PVD files associated with the meshes.
 
- Public Attributes inherited from ProcessLib::OutputFormat
std::string directory
 
std::string prefix
 
std::string suffix
 
bool compression
 Enables or disables zlib-compression of the output files.
 

Constructor & Destructor Documentation

◆ OutputVTKFormat()

ProcessLib::OutputVTKFormat::OutputVTKFormat ( std::string const & directory,
std::string prefix,
std::string suffix,
bool const compression,
int const data_mode )
inline

Definition at line 61 of file OutputFormat.h.

64 : OutputFormat(directory, std::move(prefix), std::move(suffix),
67 {
68 }
OutputFormat(std::string const &directory, std::string prefix, std::string suffix, bool const compression)
bool compression
Enables or disables zlib-compression of the output files.

Member Function Documentation

◆ constructFilename()

std::string ProcessLib::OutputVTKFormat::constructFilename ( std::string const & mesh_name,
int const timestep,
double const t,
int const iteration ) const
overridevirtual

Implements ProcessLib::OutputFormat.

Definition at line 92 of file OutputFormat.cpp.

96{
97 return BaseLib::constructFormattedFileName(prefix, mesh_name, timestep, t,
98 iteration) +
99 BaseLib::constructFormattedFileName(suffix, mesh_name, timestep, t,
100 iteration) +
101 ".vtu";
102}
std::string constructFormattedFileName(std::string const &format_specification, std::string const &mesh_name, int const timestep, double const t, int const iteration)

References BaseLib::constructFormattedFileName(), ProcessLib::OutputFormat::prefix, and ProcessLib::OutputFormat::suffix.

Referenced by ProcessLib::outputMeshVtk().

◆ constructPVDName()

std::string ProcessLib::OutputVTKFormat::constructPVDName ( std::string const & mesh_name) const

Definition at line 74 of file OutputFormat.cpp.

76{
77 return BaseLib::joinPaths(
79 BaseLib::constructFormattedFileName(prefix, mesh_name, 0, 0, 0) +
80 ".pvd");
81}
std::string joinPaths(std::string const &pathA, std::string const &pathB)

References BaseLib::constructFormattedFileName(), ProcessLib::OutputFormat::directory, BaseLib::joinPaths(), and ProcessLib::OutputFormat::prefix.

Referenced by findOrCreatePVDFile().

◆ findOrCreatePVDFile()

MeshLib::IO::PVDFile & ProcessLib::OutputVTKFormat::findOrCreatePVDFile ( std::string const & mesh_name) const

Get a reference to the PVDFile corresponding to the given filename

Parameters
mesh_namethe name of the mesh the PVD file is searched for
Returns
Reference to a PVDFile object

Definition at line 32 of file OutputFormat.cpp.

34{
35 auto const it = mesh_name_to_pvd_file.find(mesh_name);
36 if (it == mesh_name_to_pvd_file.end())
37 {
38 auto const filename = constructPVDName(mesh_name);
39 auto p = mesh_name_to_pvd_file.emplace(std::piecewise_construct,
40 std::forward_as_tuple(mesh_name),
41 std::forward_as_tuple(filename));
42 return p.first->second;
43 }
44
45 return it->second;
46}
std::map< std::string, MeshLib::IO::PVDFile > mesh_name_to_pvd_file
Holds the PVD files associated with the meshes.
std::string constructPVDName(std::string const &mesh_name) const

References constructPVDName(), and mesh_name_to_pvd_file.

Referenced by outputMeshes().

◆ outputMeshes()

void ProcessLib::OutputVTKFormat::outputMeshes ( const int timestep,
const double t,
const int iteration,
std::vector< std::reference_wrapper< const MeshLib::Mesh > > const & meshes,
std::set< std::string > const & output_variables ) const
overridevirtual

Implements ProcessLib::OutputFormat.

Definition at line 134 of file OutputFormat.cpp.

138{
139 for (auto const& mesh : meshes)
140 {
141 auto& pvd_file = findOrCreatePVDFile(mesh.get().getName());
142 outputMeshVtk(*this, pvd_file, mesh, t, timestep, iteration);
143 }
144}
void outputMeshVtk(std::string const &file_name, MeshLib::Mesh const &mesh, bool const compress_output, int const data_mode)
MeshLib::IO::PVDFile & findOrCreatePVDFile(std::string const &mesh_name) const

References findOrCreatePVDFile(), and ProcessLib::outputMeshVtk().

Member Data Documentation

◆ data_mode

int ProcessLib::OutputVTKFormat::data_mode

Chooses vtk's data mode for output following the enumeration given in the vtkXMLWriter: {Ascii, Binary, Appended}. See vtkXMLWriter documentation http://www.vtk.org/doc/nightly/html/classvtkXMLWriter.html

Definition at line 79 of file OutputFormat.h.

Referenced by ProcessLib::Output::doOutputNonlinearIteration(), and ProcessLib::outputMeshVtk().

◆ mesh_name_to_pvd_file

std::map<std::string, MeshLib::IO::PVDFile> ProcessLib::OutputVTKFormat::mesh_name_to_pvd_file
mutable

Holds the PVD files associated with the meshes.

Definition at line 82 of file OutputFormat.h.

Referenced by findOrCreatePVDFile().


The documentation for this struct was generated from the following files: