Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::geometry::MeshExporterBase< MeshDerived > Class Template Reference

Base class for exporting a mesh to VTK file formats. More...

#include <mesh_exporter.hpp>

Inheritance diagram for vulpes::geometry::MeshExporterBase< MeshDerived >:
[legend]
Collaboration diagram for vulpes::geometry::MeshExporterBase< MeshDerived >:
[legend]

Public Types

using index_t = MeshDerived::index_t
 The index type used by the mesh.

Public Member Functions

 MeshExporterBase (const MeshDerived &mesh, const VtuOptions &options={})
 Constructs a MeshExporterBase for a given mesh.
void save (const std::string &filename, const std::optional< VtuOptions > &options=std::nullopt) const
 Saves the mesh data to a file.
const auto & getMesh () const
 Gets a constant reference to the mesh.
const auto & getVtkGrids () const
 Gets a constant reference to the generated VTK grids.

Protected Member Functions

void savePvtu (const std::string &filename, const VtuOptions &write_options) const
 Saves the mesh data to a parallel VTU file.
void initializeMeshForExport () const
 Initializes the mesh for export, modifying if necessary.
const MeshDerived & getMeshRef () const
 Gets a reference to the mesh for export (original/modified).

Protected Attributes

const MeshDerived & m_mesh
VtuOptions m_export_options
std::vector< vtkSmartPointer< vtkUnstructuredGrid > > m_vtk_grids
std::optional< MeshDerived > m_modified_mesh

Detailed Description

template<typename MeshDerived>
class vulpes::geometry::MeshExporterBase< MeshDerived >

Base class for exporting a mesh to VTK file formats.

This template class provides the core functionality for converting a mesh data structure into one or more VTK unstructured grids and saving them to a file. It handles the common tasks of writing VTU or VTK files.

Template Parameters
MeshDerivedThe derived mesh class, which must be derived from MeshBase

Member Typedef Documentation

◆ index_t

template<typename MeshDerived>
using vulpes::geometry::MeshExporterBase< MeshDerived >::index_t = MeshDerived::index_t

The index type used by the mesh.

Constructor & Destructor Documentation

◆ MeshExporterBase()

template<typename MeshDerived>
vulpes::geometry::MeshExporterBase< MeshDerived >::MeshExporterBase ( const MeshDerived & mesh,
const VtuOptions & options = {} )
inlineexplicit

Constructs a MeshExporterBase for a given mesh.

Parameters
meshThe mesh to be exported.
optionsExport options including precision settings.

Member Function Documentation

◆ getMesh()

template<typename MeshDerived>
const auto & vulpes::geometry::MeshExporterBase< MeshDerived >::getMesh ( ) const
inline

Gets a constant reference to the mesh.

Returns
A constant reference to the stored mesh.

◆ getMeshRef()

template<typename MeshDerived>
const MeshDerived & vulpes::geometry::MeshExporterBase< MeshDerived >::getMeshRef ( ) const
inlineprotected

Gets a reference to the mesh for export (original/modified).

Returns
A const reference to either the original mesh or the modified copy.

◆ getVtkGrids()

template<typename MeshDerived>
const auto & vulpes::geometry::MeshExporterBase< MeshDerived >::getVtkGrids ( ) const
inline

Gets a constant reference to the generated VTK grids.

Returns
A constant reference to the vector of VTK unstructured grids.

◆ initializeMeshForExport()

template<typename MeshDerived>
void vulpes::geometry::MeshExporterBase< MeshDerived >::initializeMeshForExport ( ) const
inlineprotected

Initializes the mesh for export, modifying if necessary.

If the mesh requires modification (e.g., closed periodic 2D mesh), this creates a modified copy stored in m_modified_mesh for use during export.

◆ save()

template<typename MeshDerived>
void vulpes::geometry::MeshExporterBase< MeshDerived >::save ( const std::string & filename,
const std::optional< VtuOptions > & options = std::nullopt ) const

Saves the mesh data to a file.

This method writes the internal VTK grid data to the specified filename. It supports .vtu (VTK Unstructured Grid XML) and .vtk (legacy VTK) file formats.

Parameters
filenameThe name of the output file.
optionsOptional override for writer options (compressor_type and data_mode). If not provided, uses the options passed to the constructor. Note: coordinate_precision cannot be changed here as it affects point data already built in the VTK grids.

◆ savePvtu()

template<typename MeshDerived>
void vulpes::geometry::MeshExporterBase< MeshDerived >::savePvtu ( const std::string & filename,
const VtuOptions & write_options ) const
protected

Saves the mesh data to a parallel VTU file.

This method writes the internal VTK grid data using the parallel .pvtu XML format. It is intended for ParallelMesh exporters.

Parameters
filenameThe name of the output .pvtu file.
write_optionsWriter options used for the output files.

Member Data Documentation

◆ m_export_options

template<typename MeshDerived>
VtuOptions vulpes::geometry::MeshExporterBase< MeshDerived >::m_export_options
protected

◆ m_mesh

template<typename MeshDerived>
const MeshDerived& vulpes::geometry::MeshExporterBase< MeshDerived >::m_mesh
protected

◆ m_modified_mesh

template<typename MeshDerived>
std::optional<MeshDerived> vulpes::geometry::MeshExporterBase< MeshDerived >::m_modified_mesh
mutableprotected

◆ m_vtk_grids

template<typename MeshDerived>
std::vector<vtkSmartPointer<vtkUnstructuredGrid> > vulpes::geometry::MeshExporterBase< MeshDerived >::m_vtk_grids
protected

The documentation for this class was generated from the following file: