svMultiPhysics
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VtkVtuData Class Reference

A mesh stored in the VTK XML unstructured grid format ('.vtu' files). More...

#include <VtkData.h>

Inheritance diagram for VtkVtuData:
[legend]

Public Member Functions

 VtkVtuData ()
 Default constructor.
 
 VtkVtuData (const std::string &file_name, bool reader=true)
 Constructor.
 
virtual void create_grid () override
 Create an empty grid.
 
virtual void write () const override
 Write the mesh data to a file.
 
- Public Member Functions inherited from VtkData
 VtkData ()=default
 Default constructor.
 
virtual ~VtkData ()=default
 Virtual destructor.
 
virtual void read_file (const std::string &file_name)
 Read the mesh data from a VTK file.
 
Array< int > get_connectivity () const
 Get the connectivity of the mesh elements.
 
Array< double > get_points () const
 Get the points of the mesh.
 
int num_elems () const
 Get the number of elements in the mesh.
 
int elem_type () const
 Get the element type.
 
int num_points_per_elem () const
 Get the number of points per element.
 
int num_points () const
 Get the number of points in the mesh.
 
void set_element_data (const std::string &data_name, const Array< double > &data)
 Set a double-valued element data array.
 
void set_element_data (const std::string &data_name, const Array< int > &data)
 Set an int-valued element data array.
 
void set_element_data (const std::string &data_name, const Vector< int > &data)
 Set an int-valued element data vector.
 
void set_point_data (const std::string &data_name, const Array< double > &data)
 Set a double-valued point data array.
 
void set_point_data (const std::string &data_name, const Array< int > &data)
 Set an int-valued point data array.
 
void set_point_data (const std::string &data_name, const Vector< int > &data)
 Set an int-valued point data array.
 
void set_points (const Array< double > &points)
 Set the point coordinates of the mesh.
 
void set_connectivity (const int nsd, const Array< int > &conn)
 Set the mesh connectivity to define the elements.
 
void set_time_value (const double time)
 Store a time value as field data.
 
bool has_cell_data (const std::string &data_name) const
 Check if a given cell data array exists.
 
bool has_point_data (const std::string &data_name) const
 Check if a given point data array exists.
 
void copy_points (Array< double > &points) const
 Copy the mesh points to an Array.
 
void copy_point_data (const std::string &data_name, Array< double > &mesh_data) const
 Copy an array of point data from the mesh into the given Array.
 
void copy_point_data (const std::string &data_name, Vector< double > &mesh_data) const
 Copy an array of point data from the mesh into the given Vector.
 
void copy_point_data (const std::string &data_name, Vector< int > &mesh_data) const
 Copy an array of int-valued point data from the mesh into the given Vector.
 
void copy_cell_data (const std::string &data_name, Array< double > &mesh_data) const
 Copy an array of cell data from the mesh into the given Array.
 
void copy_cell_data (const std::string &data_name, Vector< double > &mesh_data) const
 Copy an array of cell data from the mesh into the given Vector.
 
void copy_cell_data (const std::string &data_name, Vector< int > &mesh_data) const
 Copy an array of int-valued cell data from the mesh into the given Vector.
 
Array< double > get_point_data (const std::string &data_name) const
 Get an array of point data from the mesh.
 
std::vector< std::string > get_point_data_names () const
 Get a list of point data names.
 
std::pair< int, int > get_cell_data_dimensions (const std::string &data_name) const
 Get the dimensions of a cell data array.
 

Protected Member Functions

virtual void read_file_internal (const std::string &file_name) override
 Read the mesh data from a file.
 
virtual int cell_type (int nsd, int np_elem) const override
 Get the VTK cell type of a volume element.
 
virtual void insert_cell (int vtk_cell_type, vtkSmartPointer< vtkIdList > elem_nodes) override
 Insert a new cell into the vtkUnstructuredGrid object.
 

Protected Attributes

vtkSmartPointer< vtkUnstructuredGrid > vtk_ugrid
 
- Protected Attributes inherited from VtkData
vtkSmartPointer< vtkPointSet > vtk_data
 
std::string file_name_
 Filename that the mesh is read from, or written to.
 
int elem_type_ = -1
 Type of elements in the mesh.
 
int num_elems_ = 0
 Number of elements.
 
int num_points_per_elem_ = 0
 Number of points per element.
 
int num_points_ = 0
 Number of points.
 

Additional Inherited Members

- Static Public Member Functions inherited from VtkData
static VtkData * create_reader (const std::string &file_name)
 Create an object to read a mesh from a VTK file.
 
static VtkData * create_writer (const std::string &file_name)
 Create an object to write a mesh to a VTK file.
 

Detailed Description

A mesh stored in the VTK XML unstructured grid format ('.vtu' files).

The mesh is held as a vtkUnstructuredGrid, whose elements may be of any VTK cell type: the volume meshes the equations are solved on, and the results written at each saved time step.

Constructor & Destructor Documentation

◆ VtkVtuData() [1/2]

VtkVtuData::VtkVtuData ( )

Default constructor.

Creates an empty VtkVtuData object with an empty vtkUnstructuredGrid grid.

◆ VtkVtuData() [2/2]

VtkVtuData::VtkVtuData ( const std::string &  file_name,
bool  reader = true 
)

Constructor.

Parameters
[in]file_nameThe name of the VTP file to read from or write to.
[in]readerIf true, the constructor reads the mesh data from the given file. If false, it creates an empty grid.

Member Function Documentation

◆ cell_type()

int VtkVtuData::cell_type ( int  nsd,
int  np_elem 
) const
overrideprotectedvirtual

Get the VTK cell type of a volume element.

Implements VtkData.

◆ create_grid()

void VtkVtuData::create_grid ( )
overridevirtual

Create an empty grid.

Implements VtkData.

◆ insert_cell()

void VtkVtuData::insert_cell ( int  vtk_cell_type,
vtkSmartPointer< vtkIdList >  elem_nodes 
)
overrideprotectedvirtual

Insert a new cell into the vtkUnstructuredGrid object.

Implements VtkData.

◆ read_file_internal()

void VtkVtuData::read_file_internal ( const std::string &  file_name)
overrideprotectedvirtual

Read the mesh data from a file.

Implements VtkData.

◆ write()

void VtkVtuData::write ( ) const
overridevirtual

Write the mesh data to a file.

Implements VtkData.

Member Data Documentation

◆ vtk_ugrid

vtkSmartPointer<vtkUnstructuredGrid> VtkVtuData::vtk_ugrid
protected

The mesh, represented as a vtkUnstructuredGrid object.


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