Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
VtkMeshReader< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <VtkMeshReader.hpp>

+ Inheritance diagram for VtkMeshReader< ELEMENT_DIM, SPACE_DIM >:
+ Collaboration diagram for VtkMeshReader< ELEMENT_DIM, SPACE_DIM >:

Public Member Functions

 VtkMeshReader (std::string pathBaseName)
 
 VtkMeshReader (vtkUnstructuredGrid *p_vtkUnstructuredGrid)
 
virtual ~VtkMeshReader ()
 
unsigned GetNumElements () const
 
unsigned GetNumCableElements () const
 
unsigned GetNumNodes () const
 
unsigned GetNumFaces () const
 
unsigned GetNumEdges () const
 
unsigned GetNumElementAttributes () const
 
unsigned GetNumCableElementAttributes () const
 
unsigned GetNumFaceAttributes () const
 
void Reset ()
 
std::vector< doubleGetNextNode ()
 
ElementData GetNextElementData ()
 
ElementData GetNextFaceData ()
 
ElementData GetNextCableElementData ()
 
void GetCellData (std::string dataName, std::vector< double > &dataPayload)
 
void GetPointData (std::string dataName, std::vector< double > &dataPayload)
 
void GetCellData (std::string dataName, std::vector< c_vector< double, SPACE_DIM > > &dataPayload)
 
void GetPointData (std::string dataName, std::vector< c_vector< double, SPACE_DIM > > &dataPayload)
 
vtkUnstructuredGrid * OutputMeshAsVtkUnstructuredGrid ()
 
- Public Member Functions inherited from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >
virtual std::vector< doubleGetNodeAttributes ()
 
unsigned GetNumEdges () const
 
ElementData GetNextEdgeData ()
 
virtual std::vector< doubleGetNode (unsigned index)
 
virtual ElementData GetElementData (unsigned index)
 
virtual ElementData GetFaceData (unsigned index)
 
ElementData GetEdgeData (unsigned index)
 
virtual std::vector< unsignedGetContainingElementIndices (unsigned index)
 
virtual std::string GetMeshFileBaseName ()
 
virtual unsigned GetOrderOfElements ()
 
virtual unsigned GetOrderOfBoundaryElements ()
 
virtual bool GetReadContainingElementOfBoundaryElement ()
 
virtual bool IsFileFormatBinary ()
 
virtual bool HasNclFile ()
 
virtual bool HasNodePermutation ()
 
virtual const std::vector< unsigned > & rGetNodePermutation ()
 
ElementIterator GetElementIteratorBegin ()
 
ElementIterator GetElementIteratorBegin (const std::set< unsigned > &rIndices)
 
ElementIterator GetElementIteratorEnd ()
 
NodeIterator GetNodeIteratorBegin ()
 
NodeIterator GetNodeIteratorBegin (const std::set< unsigned > &rIndices)
 
NodeIterator GetNodeIteratorEnd ()
 

Private Member Functions

void CommonConstructor ()
 

Private Attributes

vtkSmartPointer< vtkUnstructuredGrid > mpVtkUnstructuredGrid
 
vtkGeometryFilter * mpVtkGeometryFilter
 
vtkFeatureEdges * mpVtkFilterEdges
 
bool mIndexFromZero
 
std::ifstream mVtuFile
 
unsigned mNumNodes
 
unsigned mNumElements
 
unsigned mNumFaces
 
unsigned mNumCableElements
 
unsigned mNodesRead
 
unsigned mElementsRead
 
unsigned mFacesRead
 
unsigned mBoundaryFacesRead
 
unsigned mBoundaryFacesSkipped
 
unsigned mCableElementsRead
 
unsigned mNumNodeAttributes
 
unsigned mMaxNodeBdyMarker
 
unsigned mNumElementAttributes
 
unsigned mNumFaceAttributes
 
unsigned mNumCableElementAttributes
 
unsigned mOrderOfElements
 
unsigned mNodesPerElement
 
int mVtkCellType
 

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
class VtkMeshReader< ELEMENT_DIM, SPACE_DIM >

VtkMeshReader

Reads a mesh (and data) from VTK .vtu format (that's an XML-based, data compressed unstructured mesh)

Definition at line 80 of file VtkMeshReader.hpp.

Constructor & Destructor Documentation

◆ VtkMeshReader() [1/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::VtkMeshReader ( std::string  pathBaseName)

◆ VtkMeshReader() [2/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::VtkMeshReader ( vtkUnstructuredGrid *  p_vtkUnstructuredGrid)

Alternative constructor, takes a vtkUnstructuredGrid that is already in memory as an input parameter rather than a .vtu file

Parameters
p_vtkUnstructuredGridPointer to a vtkUnstructuredGrid object

Definition at line 203 of file VtkMeshReader.cpp.

References VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::CommonConstructor(), and VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructuredGrid.

◆ ~VtkMeshReader()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::~VtkMeshReader ( )
virtual

Destructor

Definition at line 227 of file VtkMeshReader.cpp.

Member Function Documentation

◆ CommonConstructor()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::CommonConstructor ( )
private

Common constructor which uses the vtkUnstructuredGrid object. The main constructors need to make sure that mpVtkUnstructuredGrid is assigned properly.

Definition at line 89 of file VtkMeshReader.cpp.

References NEVER_REACHED.

Referenced by VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::VtkMeshReader(), and VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::VtkMeshReader().

◆ GetCellData() [1/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetCellData ( std::string  dataName,
std::vector< c_vector< double, SPACE_DIM > > &  dataPayload 
)

Returns an std::vector (dataPayload) containing the vector-directed vtkCellData with attribute name specified Throws if the attribute name does not exist

Parameters
dataNameName of the cell data
dataPayloadin which to store the result (returned)

Definition at line 448 of file VtkMeshReader.cpp.

References EXCEPTION.

◆ GetCellData() [2/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetCellData ( std::string  dataName,
std::vector< double > &  dataPayload 
)

Returns an std::vector (dataPayload) containing the vtkCellData with attribute name specified Throws if the attribute name does not exist

Parameters
dataNameName of the cell data
dataPayloadin which to store the result (returned)

Definition at line 425 of file VtkMeshReader.cpp.

References EXCEPTION.

◆ GetNextCableElementData()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextCableElementData ( )
virtual
Returns
a vector of the nodes of each face in turn (synonym of GetNextEdgeData())

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 345 of file VtkMeshReader.cpp.

References ElementData::AttributeValue, EXCEPTION, and ElementData::NodeIndices.

◆ GetNextElementData()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData ( )
virtual
Returns
a vector of the nodes of each element (and any attribute information, if there is any) in turn

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 318 of file VtkMeshReader.cpp.

References ElementData::AttributeValue, EXCEPTION, and ElementData::NodeIndices.

◆ GetNextFaceData()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextFaceData ( )
virtual
Returns
a vector of the nodes of each face in turn (synonym of GetNextEdgeData())

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 371 of file VtkMeshReader.cpp.

References EXCEPTION, NEVER_REACHED, and ElementData::NodeIndices.

◆ GetNextNode()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextNode ( )
virtual
Returns
a vector of the coordinates of each node in turn

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 299 of file VtkMeshReader.cpp.

References EXCEPTION.

◆ GetNumCableElementAttributes()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumCableElementAttributes ( ) const
virtual
Returns
mNumCableElementAttributes

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 276 of file VtkMeshReader.cpp.

◆ GetNumCableElements()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumCableElements ( ) const
virtual
Returns
the mNumCableElements

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 246 of file VtkMeshReader.cpp.

◆ GetNumEdges()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumEdges ( ) const
Returns
mNumFaces (synonym of GetNumFaces() method)

Definition at line 264 of file VtkMeshReader.cpp.

◆ GetNumElementAttributes()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElementAttributes ( ) const
virtual
Returns
mNumElementAttributes

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 270 of file VtkMeshReader.cpp.

◆ GetNumElements()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElements ( ) const
virtual
Returns
the mNumElements

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 240 of file VtkMeshReader.cpp.

◆ GetNumFaceAttributes()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumFaceAttributes ( ) const
virtual
Returns
mNumFaceAttributes

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 282 of file VtkMeshReader.cpp.

◆ GetNumFaces()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumFaces ( ) const
virtual
Returns
mNumFaces (synonym of GetNumEdges() method)

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 258 of file VtkMeshReader.cpp.

◆ GetNumNodes()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumNodes ( ) const
virtual
Returns
mNumNodes

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 252 of file VtkMeshReader.cpp.

◆ GetPointData() [1/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetPointData ( std::string  dataName,
std::vector< c_vector< double, SPACE_DIM > > &  dataPayload 
)

Returns an std::vector (dataPayload) containing the vector-directed vtkPointData with attribute name specified Throws if the attribute name does not exist

Parameters
dataNameName of the point data
dataPayloadin which to store the result (returned)

Definition at line 501 of file VtkMeshReader.cpp.

References EXCEPTION.

◆ GetPointData() [2/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::GetPointData ( std::string  dataName,
std::vector< double > &  dataPayload 
)

Returns an std::vector (dataPayload) containing the vtkPointData with attribute name specified Throws if the attribute name does not exist

Parameters
dataNameName of the point data
dataPayloadin which to store the result (returned)

Definition at line 477 of file VtkMeshReader.cpp.

References EXCEPTION.

◆ OutputMeshAsVtkUnstructuredGrid()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
vtkUnstructuredGrid * VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::OutputMeshAsVtkUnstructuredGrid ( )
Returns
a pointer to mpVtkUnstructuredGrid

Definition at line 530 of file VtkMeshReader.cpp.

◆ Reset()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::Reset ( )
virtual

Resets mNodesRead, mElementsRead, mFacesRead and mBoundaryFacesRead to zero (for another pass through the mesh from the beginning

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 288 of file VtkMeshReader.cpp.

Member Data Documentation

◆ mBoundaryFacesRead

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mBoundaryFacesRead
private

Number of boundary faces read from file so far

Definition at line 105 of file VtkMeshReader.hpp.

◆ mBoundaryFacesSkipped

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mBoundaryFacesSkipped
private

Number of (not) boundary faces skipped

Definition at line 106 of file VtkMeshReader.hpp.

◆ mCableElementsRead

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mCableElementsRead
private

Number of cable elements read in.

Definition at line 107 of file VtkMeshReader.hpp.

◆ mElementsRead

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mElementsRead
private

Number of elements read from file so far

Definition at line 103 of file VtkMeshReader.hpp.

◆ mFacesRead

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mFacesRead
private

Number of faces read from file so far

Definition at line 104 of file VtkMeshReader.hpp.

◆ mIndexFromZero

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mIndexFromZero
private

True if input data is numbered from zero, false otherwise

Definition at line 93 of file VtkMeshReader.hpp.

◆ mMaxNodeBdyMarker

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mMaxNodeBdyMarker
private

Is the maximum node boundary marker

Definition at line 111 of file VtkMeshReader.hpp.

◆ mNodesPerElement

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesPerElement
private

Number of nodes per element

Definition at line 117 of file VtkMeshReader.hpp.

◆ mNodesRead

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesRead
private

Number of nodes read from file so far

Definition at line 102 of file VtkMeshReader.hpp.

◆ mNumCableElementAttributes

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumCableElementAttributes
private

Is the number of attributes stored for each cable

Definition at line 114 of file VtkMeshReader.hpp.

◆ mNumCableElements

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumCableElements
private

Number of cable elements in the mesh.

Definition at line 100 of file VtkMeshReader.hpp.

◆ mNumElementAttributes

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumElementAttributes
private

Is the number of attributes stored for each element

Definition at line 112 of file VtkMeshReader.hpp.

◆ mNumElements

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumElements
private

Number of elements in the mesh

Definition at line 98 of file VtkMeshReader.hpp.

◆ mNumFaceAttributes

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumFaceAttributes
private

Is the number of attributes stored for each face

Definition at line 113 of file VtkMeshReader.hpp.

◆ mNumFaces

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumFaces
private

Number of faces in the mesh

Definition at line 99 of file VtkMeshReader.hpp.

◆ mNumNodeAttributes

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumNodeAttributes
private

Is the number of attributes stored at each node

Definition at line 110 of file VtkMeshReader.hpp.

◆ mNumNodes

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumNodes
private

Number of nodes in the mesh

Definition at line 97 of file VtkMeshReader.hpp.

◆ mOrderOfElements

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfElements
private

Order of the elements (i.e. linear, quadratic, cubic FE basis functions

Definition at line 116 of file VtkMeshReader.hpp.

◆ mpVtkFilterEdges

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
vtkFeatureEdges* VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mpVtkFilterEdges
private

VTK edge filter object to extract the boundary elements in 2D

Definition at line 91 of file VtkMeshReader.hpp.

◆ mpVtkGeometryFilter

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
vtkGeometryFilter* VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mpVtkGeometryFilter
private

VTK geometry filter object to extract the surface elements

Definition at line 88 of file VtkMeshReader.hpp.

◆ mpVtkUnstructuredGrid

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
vtkSmartPointer<vtkUnstructuredGrid> VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructuredGrid
private

vtkUnstructuredGrid object: the rest of the class acts as an interface to this

Definition at line 85 of file VtkMeshReader.hpp.

Referenced by VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::VtkMeshReader(), and VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::VtkMeshReader().

◆ mVtkCellType

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
int VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mVtkCellType
private

Enumerated as VTK_TETRA in 3D and VTK_TRIANGLE in 2D. The VTK method GetCellType() returns an int, but this is documented as being non-negative

Definition at line 119 of file VtkMeshReader.hpp.

◆ mVtuFile

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::mVtuFile
private

Location of the .vtu file

Definition at line 95 of file VtkMeshReader.hpp.

Referenced by VtkMeshReader< ELEMENT_DIM, SPACE_DIM >::VtkMeshReader().


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