Chaste  Release::2017.1
GmshMeshReader< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <GmshMeshReader.hpp>

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

Public Member Functions

 GmshMeshReader (std::string pathBaseName, unsigned orderOfElements=1, unsigned orderOfBoundaryElements=1)
 
 ~GmshMeshReader ()
 
unsigned GetNumElements () const
 
unsigned GetNumNodes () const
 
unsigned GetNumFaces () const
 
unsigned GetNumCableElements () const
 
unsigned GetNumElementAttributes () const
 
unsigned GetNumFaceAttributes () const
 
unsigned GetNumCableElementAttributes () const
 
unsigned GetOrderOfElements ()
 
unsigned GetOrderOfBoundaryElements ()
 
void Reset ()
 
std::vector< doubleGetNextNode ()
 
ElementData GetNextElementData ()
 
ElementData GetNextFaceData ()
 
ElementData GetNextCableElementData ()
 
std::vector< doubleGetNodeAttributes ()
 
std::vector< doubleGetNode (unsigned index)
 
ElementData GetElementData (unsigned index)
 
ElementData GetFaceData (unsigned index)
 
- Public Member Functions inherited from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >
unsigned GetNumEdges () const
 
ElementData GetNextEdgeData ()
 
ElementData GetEdgeData (unsigned index)
 
virtual std::vector< unsignedGetContainingElementIndices (unsigned index)
 
virtual std::string GetMeshFileBaseName ()
 
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 ReadHeaders ()
 
void ReadNodeHeader ()
 
void ReadElementHeader ()
 
void ReadFaceHeader ()
 
void OpenFiles ()
 
void CloseFiles ()
 

Private Attributes

std::string mFileName
 
std::ifstream mNodeFile
 
std::ifstream mElementFile
 
std::ifstream mFaceFile
 
double mVersionNumber
 
unsigned mFileType
 
unsigned mDataSize
 
unsigned mNumNodes
 
unsigned mNumElements
 
unsigned mNumFaces
 
unsigned mTotalNumElementsAndFaces
 
unsigned mNumElementAttributes
 
unsigned mNumFaceAttributes
 
unsigned mOrderOfElements
 
unsigned mOrderOfBoundaryElements
 
unsigned mNodesPerElement
 
unsigned mNodesPerBoundaryElement
 

Detailed Description

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

Class to enable reading of Gmsh format mesh files (see #2312).

Definition at line 68 of file GmshMeshReader.hpp.

Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GmshMeshReader ( std::string  pathBaseName,
unsigned  orderOfElements = 1,
unsigned  orderOfBoundaryElements = 1 
)

Constructor.

Parameters
pathBaseNamethe base name of the files from which to read the mesh data (either absolute, or relative to the current directory)
orderOfElementsthe order of each element: 1 for linear, 2 for quadratic (defaults to 1)
orderOfBoundaryElementsthe order of each boundary element: 1 for linear, 2 for quadratic (defaults to 1. May or may not be different to orderOfElements

Definition at line 43 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesPerBoundaryElement, GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesPerElement, GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfBoundaryElements, GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfElements, GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenFiles(), and GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadHeaders().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::~GmshMeshReader ( )

Destructor

Definition at line 76 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::CloseFiles().

Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::CloseFiles ( )
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetElementData ( unsigned  index)
virtual

Normally throws an exception. Only implemented for tetrahedral mesh reader of binary files.

Parameters
indexThe global element index
Returns
a vector of the node indices of the element (and any attribute information, if there is any)

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 472 of file GmshMeshReader.cpp.

References NEVER_REACHED.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetFaceData ( unsigned  index)
virtual

Normally throws an exception. Only implemented for tetrahedral mesh reader of binary files.

Parameters
indexThe global face index
Returns
a vector of the node indices of the face (and any attribute/containment information, if there is any)

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 480 of file GmshMeshReader.cpp.

References NEVER_REACHED.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextCableElementData ( )
virtual
Returns
a vector of the node indices of each cable element (and any attribute information, if there is any) in turn

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 402 of file GmshMeshReader.cpp.

References NEVER_REACHED.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData ( )
virtual
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextFaceData ( )
virtual
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > GmshMeshReader< 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 320 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodeFile.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNode ( unsigned  index)
virtual

Normally throws an exception. Only implemented for tetrahedral mesh reader of binary files.

Parameters
indexThe global node index
Returns
a vector of the coordinates of the node

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 464 of file GmshMeshReader.cpp.

References NEVER_REACHED.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNodeAttributes ( )
virtual
Returns
the vector of node attributes

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 341 of file GmshMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumCableElementAttributes ( ) const
virtual
Returns
the number of cable element attributes in the mesh

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 303 of file GmshMeshReader.cpp.

References NEVER_REACHED.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumCableElements ( ) const
virtual
Returns
the number of cable elements in the mesh

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 270 of file GmshMeshReader.cpp.

References NEVER_REACHED.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElementAttributes ( ) const
virtual
Returns
the number of attributes in the mesh

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 290 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumElementAttributes.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElements ( ) const
virtual
Returns
the number of elements in the mesh

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 251 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumElements.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumFaceAttributes ( ) const
virtual
Returns
the number of attributes in the mesh

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 296 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumFaceAttributes.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumFaces ( ) const
virtual
Returns
the number of faces in the mesh (synonym of GetNumEdges())

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 263 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumFaces.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumNodes ( ) const
virtual
Returns
the number of nodes in the mesh

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 257 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumNodes.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetOrderOfBoundaryElements ( )
virtual
Returns
the expected order of the element file (1=linear, 2=quadratic)

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 284 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfBoundaryElements.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetOrderOfElements ( )
virtual

*

Returns
the expected order of the element file (1=linear, 2=quadratic)

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 278 of file GmshMeshReader.cpp.

References GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfElements.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadElementHeader ( )
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadFaceHeader ( )
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadNodeHeader ( )
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::Reset ( )
virtual

Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mDataSize
private

The number of floating point numbers in the file

Definition at line 186 of file GmshMeshReader.hpp.

Referenced by GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadHeaders().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mElementFile
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mFaceFile
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mFileName
private

The name of the mesh file.

Definition at line 180 of file GmshMeshReader.hpp.

Referenced by GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenFiles().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mFileType
private

The type of the mesh file being read (should always be 0)

Definition at line 185 of file GmshMeshReader.hpp.

Referenced by GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadHeaders().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodeFile
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesPerBoundaryElement
private

The number of nodes contained in each boundary element.

Definition at line 196 of file GmshMeshReader.hpp.

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

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

The number of nodes contained in each element.

Definition at line 195 of file GmshMeshReader.hpp.

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

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

Is the number of attributes stored for each element.

Definition at line 191 of file GmshMeshReader.hpp.

Referenced by GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData(), and GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElementAttributes().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumElements
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumFaceAttributes
private

Is the number of attributes stored for each face.

Definition at line 192 of file GmshMeshReader.hpp.

Referenced by GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextFaceData(), and GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumFaceAttributes().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumFaces
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumNodes
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfBoundaryElements
private

The order of each element (1 for linear, 2 for quadratic).

Definition at line 194 of file GmshMeshReader.hpp.

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

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

The order of each element (1 for linear, 2 for quadratic).

Definition at line 193 of file GmshMeshReader.hpp.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mTotalNumElementsAndFaces
private

Total number of elements and faces in the mesh.

Definition at line 190 of file GmshMeshReader.hpp.

Referenced by GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadElementHeader(), and GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadHeaders().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::mVersionNumber
private

The version number of the file.

Definition at line 184 of file GmshMeshReader.hpp.

Referenced by GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadHeaders().


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