deal.II version GIT relicensing-6842-g793a97d2aa 2026-10-02 14:00:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
Functions
VTKWrappers::internal Namespace Reference

Functions

vtkSmartPointer< vtkUnstructuredGrid > load_vtk_file (const std::string &vtk_filename, const bool cleanup=true, const double relative_tolerance=0.0)
 
vtkSmartPointer< vtkUnstructuredGrid > convert_to_unstructured_grid (const vtkSmartPointer< vtkDataObject > &data_object)
 
void write_vtk (const std::string &vtk_filename, const vtkSmartPointer< vtkDataObject > &data_object)
 

Function Documentation

◆ load_vtk_file()

vtkSmartPointer< vtkUnstructuredGrid > VTKWrappers::internal::load_vtk_file ( const std::string &  vtk_filename,
const bool  cleanup = true,
const double  relative_tolerance = 0.0 
)

Load a VTK file containing an unstructured grid and return the unstructured grid object.

If cleanup is true, overlapping points in the VTK file are merged using VTK's cleaning utilities (only available in VTK >= 9.3).

If the read operation fails, an exception is thrown.

Parameters
vtk_filename
cleanup
relative_tolerance
Returns
vtkUnstructuredGrid*

Definition at line 139 of file utilities.cc.

◆ convert_to_unstructured_grid()

vtkSmartPointer< vtkUnstructuredGrid > VTKWrappers::internal::convert_to_unstructured_grid ( const vtkSmartPointer< vtkDataObject > &  data_object)

Convert a VTK data object to a vtkUnstructuredGrid if the smart pointer points to one of the supported VTK dataset types listed below.

Supported input types:

  • vtkUnstructuredGrid -> returned as-is (shallow copy)
  • vtkStructuredGrid -> hexahedral cells extracted from the structured connectivity
  • vtkRectilinearGrid / vtkStructuredPoints -> hexahedral cells reconstructed from grid dimensions
  • vtkPolyData -> triangles, lines, and polygons converted to their unstructured grid equivalents

If the input is not a supported dataset type, an exception is thrown. Point and cell data are copied to the output.

This function is used internally by load_vtk_file and write_vtk to normalize all VTK data to a single unstructured grid representation.

Parameters
data_objectThe VTK data object to convert.
Returns
A smart pointer to a newly created vtkUnstructuredGrid.

Definition at line 101 of file utilities.cc.

◆ write_vtk()

void VTKWrappers::internal::write_vtk ( const std::string &  vtk_filename,
const vtkSmartPointer< vtkDataObject > &  data_object 
)

Write a VTK file to disk from any VTK dataset that can be converted to an unstructured grid.

The output format is determined by the file extension:

  • .vtu -> VTK XML UnstructuredGrid format
  • .vtk -> legacy VTK UnstructuredGrid format

Supported input types are the same as those handled by convert_to_unstructured_grid: unstructured grids, structured grids, rectilinear grids, structured points, and polydata. Each type is converted to an unstructured grid internally before writing.

If the write operation fails, an exception is thrown.

Parameters
[in]vtk_filenamePath to the output file. The extension determines the format: .vtu for XML format, .vtk for legacy format.
[in]data_objectThe VTK data object to write. Must point to a valid dataset that can be converted to an unstructured grid.

Definition at line 213 of file utilities.cc.