![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
Exports a single mesh as a single VTK grid. More...
#include <mesh_exporter.hpp>
Public Types | |
| using | float_t = MeshDerived::float_t |
| The float type used by the mesh. | |
| using | index_t = MeshDerived::index_t |
| The index type used by the mesh. | |
Public Member Functions | |
| MeshExporter (const MeshDerived &mesh, const VtuOptions &options={}) | |
| Constructs a MeshExporter for a given mesh. | |
| void | attachVertexData (const std::string &label, const Eigen::Map< const Eigen::Matrix< float_t, -1, -1 > > data_view) const |
| Attaches a list of vertex data to the VTK grid. | |
| void | attachVertexData (const std::string &label, const Eigen::Matrix< float_t, -1, -1 > &data) const |
| Attaches a list of vertex data to the VTK grid. | |
| void | attachVertexData (const std::string &label, const std::vector< float_t > &data) const |
| Attaches an instance of vertex data to the VTK grid. | |
| void | attachVertexData (const std::string &label, const std::vector< index_t > &data) const |
| Attaches an instance of integer vertex data to the VTK grid. | |
| template<typename DataType> | |
| void | attachCellData (const std::string &label, const Eigen::Map< const Eigen::Vector< DataType, -1 > > data_view) const |
| Attaches a vector of cell data to the VTK grid. | |
| template<typename DataType> | |
| void | attachCellData (const std::string &label, const std::vector< DataType > &data) const |
| Attaches a vector of cell data to the VTK grid. | |
| void | attachMetadata (const MeshDerived &mesh) const |
| Attaches metadata (field data) to the VTK grid. | |
| 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 | buildVtkMesh2D () |
| Builds a 2D VTK mesh from the internal mesh data. | |
| void | buildVtkMesh3D () |
| Builds a 3D VTK mesh from the internal mesh data. | |
| 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 |
Exports a single mesh as a single VTK grid.
This class extends MeshExporterBase to handle a single mesh and convert it into a single VTK unstructured grid. It provides methods to attach both vertex and cell data to this grid. The constructor automatically builds the grid based on the mesh's dimensionality.
| MeshDerived | The derived mesh class. |
| using vulpes::geometry::MeshExporter< MeshDerived >::float_t = MeshDerived::float_t |
The float type used by the mesh.
| using vulpes::geometry::MeshExporter< MeshDerived >::index_t = MeshDerived::index_t |
The index type used by the mesh.
|
inlineexplicit |
Constructs a MeshExporter for a given mesh.
This constructor builds the VTK mesh and attaches any tags found in the mesh's metadata.
| mesh | The mesh to be exported. |
| options | Export options including precision settings. |
| void vulpes::geometry::MeshExporter< MeshDerived >::attachCellData | ( | const std::string & | label, |
| const Eigen::Map< const Eigen::Vector< DataType, -1 > > | data_view ) const |
Attaches a vector of cell data to the VTK grid.
| DataType | The type of the data (e.g., double, int). |
| label | The name for the data array. |
| data_view | A view of the vector containing the cell data. |
|
inline |
Attaches a vector of cell data to the VTK grid.
| DataType | The type of the data (e.g., double, int). |
| label | The name for the data array. |
| data | The vector containing the cell data. |
| void vulpes::geometry::MeshExporter< MeshDerived >::attachMetadata | ( | const MeshDerived & | mesh | ) | const |
Attaches metadata (field data) to the VTK grid.
This method writes both double and integer metadata from the mesh to the VTK grid's field data, preserving information like periodic dimensions and other mesh-level attributes.
| void vulpes::geometry::MeshExporter< MeshDerived >::attachVertexData | ( | const std::string & | label, |
| const Eigen::Map< const Eigen::Matrix< float_t, -1, -1 > > | data_view ) const |
Attaches a list of vertex data to the VTK grid.
The data is attached to the points (vertices) of the grid, with each row of the matrix being a separate data array (in column major format). That is, data is contiguous across the same vertex list.
| label | The base name for the data arrays. An index will be appended for each row. |
| data_view | A view of the matrix containing the vertex data. |
|
inline |
Attaches a list of vertex data to the VTK grid.
The data is attached to the points (vertices) of the grid, with each row of the matrix being a separate data array (in column major format). That is, data is contiguous across the same vertex list.
| label | The base name for the data arrays. An index will be appended for each row. |
| data | The matrix containing the vertex data. |
|
inline |
Attaches an instance of vertex data to the VTK grid.
The data is attached to the points (vertices) of the grid, with each row of the matrix being a separate data array (in column major format). That is, data is contiguous across the same vertex list.
| label | The base name for the data arrays. An index will be appended for each row. |
| data | The vector containing the vertex data. |
| void vulpes::geometry::MeshExporter< MeshDerived >::attachVertexData | ( | const std::string & | label, |
| const std::vector< index_t > & | data ) const |
Attaches an instance of integer vertex data to the VTK grid.
This is used for vertex tags which are typically stored as integers.
| label | The name for the data array. |
| data | The vector containing the integer vertex data. |
|
protected |
Builds a 2D VTK mesh from the internal mesh data.
This method creates a single vtkUnstructuredGrid representing the 2D mesh, using vtkPolygon cells. Uses getMeshRef() to access the appropriate mesh (original or modified).
|
protected |
Builds a 3D VTK mesh from the internal mesh data.
This method creates a single vtkUnstructuredGrid representing the 3D mesh, using vtkPolyhedron cells. Uses getMeshRef() to access the appropriate mesh (original or modified).
|
inlineinherited |
Gets a constant reference to the mesh.
|
inlineprotectedinherited |
Gets a reference to the mesh for export (original/modified).
|
inlineinherited |
Gets a constant reference to the generated VTK grids.
|
inlineprotectedinherited |
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.
|
inherited |
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.
| filename | The name of the output file. |
| options | Optional 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. |
|
protectedinherited |
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.
| filename | The name of the output .pvtu file. |
| write_options | Writer options used for the output files. |
|
protectedinherited |
|
protectedinherited |
|
mutableprotectedinherited |
|
protectedinherited |