EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
EBGeometry::VTK< T > Class Template Reference

Class for storing VTK Polydata meshes. More...

#include <EBGeometry_VTK.hpp>

Collaboration diagram for EBGeometry::VTK< T >:
Collaboration graph
[legend]

Public Member Functions

 VTK () noexcept=default
 Default constructor. Initializes empty member data holder.
 
 VTK (const std::string &a_id) noexcept
 Constructor. Initializes empty vertices and facets but sets the VTK ID (usually the file name.
 
 VTK (const VTK &a_other)=default
 Copy constructor.
 
 VTK (VTK &&a_other) noexcept=default
 Move constructor.
 
VTKoperator= (const VTK &a_other)=default
 Copy assignment operator.
 
VTKoperator= (VTK &&a_other) noexcept=default
 Move assignment operator.
 
 ~VTK () noexcept=default
 Destructor. Clears all data.
 
std::string & getID () noexcept
 Get the identifier for this object.
 
const std::string & getID () const noexcept
 Get the identifier for this object.
 
std::vector< Vec3T< T > > & getVertexCoordinates () noexcept
 Get the vertex coordinates.
 
const std::vector< Vec3T< T > > & getVertexCoordinates () const noexcept
 Get the vertex coordinates.
 
std::vector< std::vector< size_t > > & getFacets () noexcept
 Get the face indices.
 
const std::vector< std::vector< size_t > > & getFacets () const noexcept
 Get the face indices.
 
std::vector< T > & getPointDataScalars (const std::string a_name)
 Get the point data scalars.
 
const std::vector< T > & getPointDataScalars (const std::string a_name) const
 Get the point data scalars.
 
std::vector< T > & getCellDataScalars (const std::string a_name)
 Get the cell data scalars.
 
const std::vector< T > & getCellDataScalars (const std::string a_name) const
 Get the cell data scalars.
 
void setPointDataScalars (const std::string a_name, std::vector< T > a_data)
 Set point data scalars.
 
void setCellDataScalars (const std::string a_name, std::vector< T > a_data)
 Set cell data scalars.
 
template<typename Meta >
std::shared_ptr< EBGeometry::DCEL::MeshT< T, Meta > > convertToDCEL () const noexcept
 Turn the VTK mesh into a DCEL mesh.
 

Protected Attributes

std::string m_id
 VTK object ID.
 
std::vector< Vec3T< T > > m_vertexCoordinates
 Vertex coordinates.
 
std::vector< std::vector< size_t > > m_facets
 Faces – each entry in the outer vector contains the indices defining one face.
 
std::map< std::string, std::vector< T > > m_pointDataScalars
 Point data scalar arrays.
 
std::map< std::string, std::vector< T > > m_cellDataScalars
 Cell data scalar arrays.
 

Detailed Description

template<typename T>
class EBGeometry::VTK< T >

Class for storing VTK Polydata meshes.

Template Parameters
TFloating-point precision for vertex coordinates and scalar arrays.

Constructor & Destructor Documentation

◆ VTK() [1/3]

template<typename T >
EBGeometry::VTK< T >::VTK ( const std::string &  a_id)
noexcept

Constructor. Initializes empty vertices and facets but sets the VTK ID (usually the file name.

Parameters
[in]a_idIdentifier for VTK object

◆ VTK() [2/3]

template<typename T >
EBGeometry::VTK< T >::VTK ( const VTK< T > &  a_other)
default

Copy constructor.

Parameters
[in]a_otherOther VTK object.

◆ VTK() [3/3]

template<typename T >
EBGeometry::VTK< T >::VTK ( VTK< T > &&  a_other)
defaultnoexcept

Move constructor.

Parameters
[in,out]a_otherOther VTK object.

Member Function Documentation

◆ convertToDCEL()

template<typename T >
template<typename Meta >
std::shared_ptr< EBGeometry::DCEL::MeshT< T, Meta > > EBGeometry::VTK< T >::convertToDCEL ( ) const
noexcept

Turn the VTK mesh into a DCEL mesh.

This call does not populate any meta-data in the DCEL mesh structures. If you need to also populate the meta-data on vertices and faces, you should not use this function but supply your own constructor.

Template Parameters
MetaMetadata type attached to DCEL vertices, edges, and faces.
Returns
Shared pointer to the constructed DCEL mesh.

◆ getCellDataScalars() [1/2]

template<typename T >
std::vector< T > & EBGeometry::VTK< T >::getCellDataScalars ( const std::string  a_name)

Get the cell data scalars.

Parameters
[in]a_nameScalar array name
Note
Function will throw std::out_of_range if the array does not exist
Returns
m_cellDataScalars at provided name

◆ getCellDataScalars() [2/2]

template<typename T >
const std::vector< T > & EBGeometry::VTK< T >::getCellDataScalars ( const std::string  a_name) const

Get the cell data scalars.

Parameters
[in]a_nameScalar array name
Note
Function will throw std::out_of_range if the array does not exist
Returns
m_cellDataScalars at provided name

◆ getFacets() [1/2]

template<typename T >
const std::vector< std::vector< size_t > > & EBGeometry::VTK< T >::getFacets ( ) const
noexcept

Get the face indices.

Returns
m_facets

◆ getFacets() [2/2]

template<typename T >
std::vector< std::vector< size_t > > & EBGeometry::VTK< T >::getFacets ( )
noexcept

Get the face indices.

Returns
m_facets

◆ getID() [1/2]

template<typename T >
const std::string & EBGeometry::VTK< T >::getID ( ) const
noexcept

Get the identifier for this object.

Returns
Const reference to the VTK object identifier.

◆ getID() [2/2]

template<typename T >
std::string & EBGeometry::VTK< T >::getID ( )
noexcept

Get the identifier for this object.

Returns
Reference to the VTK object identifier.

◆ getPointDataScalars() [1/2]

template<typename T >
std::vector< T > & EBGeometry::VTK< T >::getPointDataScalars ( const std::string  a_name)

Get the point data scalars.

Parameters
[in]a_nameScalar array name
Note
Function will throw std::out_of_range if the array does not exist
Returns
m_pointDataScalars at provided name

◆ getPointDataScalars() [2/2]

template<typename T >
const std::vector< T > & EBGeometry::VTK< T >::getPointDataScalars ( const std::string  a_name) const

Get the point data scalars.

Parameters
[in]a_nameScalar array name
Note
Function will throw std::out_of_range if the array does not exist
Returns
m_pointDataScalars at provided name

◆ getVertexCoordinates() [1/2]

template<typename T >
const std::vector< Vec3T< T > > & EBGeometry::VTK< T >::getVertexCoordinates ( ) const
noexcept

Get the vertex coordinates.

Returns
m_vertexCoordinates

◆ getVertexCoordinates() [2/2]

template<typename T >
std::vector< Vec3T< T > > & EBGeometry::VTK< T >::getVertexCoordinates ( )
noexcept

Get the vertex coordinates.

Returns
m_vertexCoordinates

◆ operator=() [1/2]

template<typename T >
VTK & EBGeometry::VTK< T >::operator= ( const VTK< T > &  a_other)
default

Copy assignment operator.

Parameters
[in]a_otherOther VTK object.
Returns
Reference to (*this).

◆ operator=() [2/2]

template<typename T >
VTK & EBGeometry::VTK< T >::operator= ( VTK< T > &&  a_other)
defaultnoexcept

Move assignment operator.

Parameters
[in,out]a_otherOther VTK object.
Returns
Reference to (*this).

◆ setCellDataScalars()

template<typename T >
void EBGeometry::VTK< T >::setCellDataScalars ( const std::string  a_name,
std::vector< T >  a_data 
)

Set cell data scalars.

Parameters
[in]a_nameArray name
[in]a_dataArray data

◆ setPointDataScalars()

template<typename T >
void EBGeometry::VTK< T >::setPointDataScalars ( const std::string  a_name,
std::vector< T >  a_data 
)

Set point data scalars.

Parameters
[in]a_nameArray name
[in]a_dataArray data

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