![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
Exports a mesh as multiple VTK grids, one for each cell. 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 | |
| MeshExporterSubmesh (const MeshDerived &mesh, std::size_t min_n_submesh_elem, const VtuOptions &options={}) | |
| Constructs a MeshExporterSubmesh for a given mesh. | |
| void | attachVertexData (const std::string &label, const datastructure::CrsMap< float_t, index_t > &data) const |
| Attaches vertex data to the sub-meshes. | |
| template<typename DataType> | |
| void | attachCellData (const std::string &label, const Eigen::Map< const Eigen::Vector< DataType, -1 > > data_view) const |
| Attaches cell data to the sub-meshes. | |
| template<typename DataType> | |
| void | attachCellData (const std::string &label, const std::vector< DataType > &data) const |
| Attaches cell data to the sub-meshes. | |
| 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 (std::size_t min_n_submesh_elem) |
| Builds 2D sub-meshes from each cell. | |
| void | buildVtkMesh3D (std::size_t min_n_submesh_elem) |
| Builds 3D sub-meshes from each cell. | |
| 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 mesh as multiple VTK grids, one for each cell.
This class extends MeshExporterBase to create a separate vtkUnstructuredGrid for each cell (or element) of the original mesh. This is useful for visualizing results that are defined on a per-cell basis, especially when solving problems with discontinuous methods.
| MeshDerived | The derived mesh class. |
| using vulpes::geometry::MeshExporterSubmesh< MeshDerived >::float_t = MeshDerived::float_t |
The float type used by the mesh.
| using vulpes::geometry::MeshExporterSubmesh< MeshDerived >::index_t = MeshDerived::index_t |
The index type used by the mesh.
|
inline |
Constructs a MeshExporterSubmesh for a given mesh.
This constructor builds a separate sub-mesh (triangulation or tetrahedralization) for each cell of the input mesh, ensuring that each sub-mesh has at least a specified number of elements.
| mesh | The mesh to be exported. |
| min_n_submesh_elem | The minimum number of elements (triangles or tetrahedra) to create for each sub-mesh. |
| options | Export options including precision settings. |
| void vulpes::geometry::MeshExporterSubmesh< MeshDerived >::attachCellData | ( | const std::string & | label, |
| const Eigen::Map< const Eigen::Vector< DataType, -1 > > | data_view ) const |
Attaches cell data to the sub-meshes.
This method adds a single value to the cell data of each sub-mesh, based on the data_view index. The value from the data_view at index i is assigned to all cells of the i-th 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 cell data to the sub-meshes.
| 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::MeshExporterSubmesh< MeshDerived >::attachVertexData | ( | const std::string & | label, |
| const datastructure::CrsMap< float_t, index_t > & | data ) const |
Attaches vertex data to the sub-meshes.
This method handles vertex data that is structured per sub-mesh. The data is added to each individual vtkUnstructuredGrid in the exporter.
| label | The base name for the data arrays. |
| data | The CrsMap containing the vertex data for each sub-mesh. |
|
protected |
Builds 2D sub-meshes from each cell.
Each cell of the original mesh is triangulated into a separate VTK grid, ensuring a minimum number of elements.
| min_n_submesh_elem | The minimum number of triangles for each sub-mesh. |
|
protected |
Builds 3D sub-meshes from each cell.
Each cell of the original mesh is tetrahedralized into a separate VTK grid, ensuring a minimum number of elements.
| min_n_submesh_elem | The minimum number of tetrahedra for each sub-mesh. |
|
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 |