Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
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

◆ GmshMeshReader()

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().

◆ ~GmshMeshReader()

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

Destructor

Definition at line 76 of file GmshMeshReader.cpp.

Member Function Documentation

◆ CloseFiles()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::CloseFiles ( )
private

Closes the .msh file descriptors

Definition at line 95 of file GmshMeshReader.cpp.

◆ GetElementData()

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.

◆ GetFaceData()

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.

◆ GetNextCableElementData()

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.

◆ GetNextElementData()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData GmshMeshReader< 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 347 of file GmshMeshReader.cpp.

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

◆ GetNextFaceData()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData GmshMeshReader< 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 409 of file GmshMeshReader.cpp.

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

◆ GetNextNode()

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.

◆ GetNode()

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.

◆ GetNodeAttributes()

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.

◆ GetNumCableElementAttributes()

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.

◆ GetNumCableElements()

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.

◆ GetNumElementAttributes()

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.

◆ GetNumElements()

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.

◆ GetNumFaceAttributes()

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.

◆ GetNumFaces()

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.

◆ GetNumNodes()

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.

◆ GetOrderOfBoundaryElements()

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.

◆ GetOrderOfElements()

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.

◆ OpenFiles()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenFiles ( )
private

Opens the .msh file descriptors

Definition at line 82 of file GmshMeshReader.cpp.

References EXCEPTION.

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

◆ ReadElementHeader()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadElementHeader ( )
private

Read the element header from the mesh file.

Definition at line 164 of file GmshMeshReader.cpp.

◆ ReadFaceHeader()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadFaceHeader ( )
private

Read the face header from the mesh file.

Definition at line 209 of file GmshMeshReader.cpp.

◆ ReadHeaders()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadHeaders ( )
private

Read all the header information from the mesh file.

Definition at line 103 of file GmshMeshReader.cpp.

References EXCEPTION.

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

◆ ReadNodeHeader()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void GmshMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadNodeHeader ( )
private

Read the node header from the mesh file.

Definition at line 146 of file GmshMeshReader.cpp.

◆ Reset()

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

Resets pointers to beginning

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 311 of file GmshMeshReader.cpp.

Member Data Documentation

◆ mDataSize

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.

◆ mElementFile

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

A file stream used to read the volume elements of the file.

Definition at line 182 of file GmshMeshReader.hpp.

◆ mFaceFile

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

A file stream used to read the boundary elements of the file.

Definition at line 183 of file GmshMeshReader.hpp.

◆ mFileName

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.

◆ mFileType

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.

◆ mNodeFile

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

A file stream used to read the node (and header) part of the file.

Definition at line 181 of file GmshMeshReader.hpp.

◆ mNodesPerBoundaryElement

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 >::GmshMeshReader().

◆ mNodesPerElement

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 >::GmshMeshReader().

◆ mNumElementAttributes

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.

◆ mNumElements

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

Number of elements in the mesh.

Definition at line 188 of file GmshMeshReader.hpp.

◆ mNumFaceAttributes

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.

◆ mNumFaces

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

Number of faces in the mesh.

Definition at line 189 of file GmshMeshReader.hpp.

◆ mNumNodes

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

Number of nodes in the mesh.

Definition at line 187 of file GmshMeshReader.hpp.

◆ mOrderOfBoundaryElements

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 >::GmshMeshReader().

◆ mOrderOfElements

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 >::GmshMeshReader().

◆ mTotalNumElementsAndFaces

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.

◆ mVersionNumber

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.


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