Chaste  Release::3.4
TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <TrianglesMeshReader.hpp>

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

Public Member Functions

 TrianglesMeshReader (std::string pathBaseName, unsigned orderOfElements=1, unsigned orderOfBoundaryElements=1, bool readContainingElementsForBoundaryElements=false)
 
 ~TrianglesMeshReader ()
 
unsigned GetNumElements () const
 
unsigned GetNumNodes () const
 
unsigned GetNumFaces () const
 
unsigned GetNumCableElements () const
 
unsigned GetNumElementAttributes () const
 
unsigned GetNumFaceAttributes () const
 
unsigned GetNumCableElementAttributes () const
 
void Reset ()
 
std::vector< doubleGetNextNode ()
 
ElementData GetNextElementData ()
 
ElementData GetNextFaceData ()
 
ElementData GetNextCableElementData ()
 
unsigned GetOrderOfElements ()
 
unsigned GetOrderOfBoundaryElements ()
 
bool GetReadContainingElementOfBoundaryElement ()
 
std::vector< doubleGetNodeAttributes ()
 
std::vector< doubleGetNode (unsigned index)
 
ElementData GetElementData (unsigned index)
 
ElementData GetFaceData (unsigned index)
 
std::vector< unsignedGetContainingElementIndices (unsigned index)
 
bool IsFileFormatBinary ()
 
bool HasNclFile ()
 
void SetReadBufferSize (unsigned bufferSize)
 
void SetNodePermutation (std::vector< unsigned > &rPermutationVector)
 
bool HasNodePermutation ()
 
const std::vector< unsigned > & rGetNodePermutation ()
 
- Public Member Functions inherited from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >
unsigned GetNumEdges () const
 
ElementData GetNextEdgeData ()
 
ElementData GetEdgeData (unsigned index)
 
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 OpenFiles ()
 
void OpenNodeFile ()
 
void OpenElementsFile ()
 
void OpenFacesFile ()
 
void OpenNclFile ()
 
void OpenCableElementsFile ()
 
void ReadHeaders ()
 
void CloseFiles ()
 
void GetNextLineFromStream (std::ifstream &rFileStream, std::string &rRawLine)
 
template<class T_DATA >
void GetNextItemFromStream (std::ifstream &rFileStream, unsigned expectedItemNumber, std::vector< T_DATA > &rDataPacket, const unsigned &rNumAttributes, std::vector< double > &rAttributes)
 
std::string GetMeshFileBaseName ()
 
void GetOneDimBoundary ()
 
void EnsureIndexingFromZero (std::vector< unsigned > &rNodeIndices)
 

Private Attributes

bool mIndexFromZero
 
std::string mFilesBaseName
 
std::ifstream mNodesFile
 
std::ifstream mElementsFile
 
std::ifstream mFacesFile
 
std::ifstream mNclFile
 
std::ifstream mCableElementsFile
 
std::streampos mNodeFileDataStart
 
std::streamoff mNodeItemWidth
 
std::streampos mElementFileDataStart
 
std::streamoff mElementItemWidth
 
std::streampos mFaceFileDataStart
 
std::streamoff mFaceItemWidth
 
std::streampos mNclFileDataStart
 
std::streamoff mNclItemWidth
 
unsigned mNumNodes
 
unsigned mNumElements
 
unsigned mNumFaces
 
unsigned mNumCableElements
 
unsigned mNodesRead
 
unsigned mElementsRead
 
unsigned mCableElementsRead
 
unsigned mFacesRead
 
unsigned mBoundaryFacesRead
 
unsigned mNclItemsRead
 
std::vector< unsignedmOneDimBoundary
 
unsigned mNumNodeAttributes
 
std::vector< doublemNodeAttributes
 
unsigned mMaxNodeBdyMarker
 
unsigned mNumElementNodes
 
unsigned mNumElementAttributes
 
unsigned mNumFaceAttributes
 
unsigned mNumCableElementAttributes
 
unsigned mOrderOfElements
 
unsigned mOrderOfBoundaryElements
 
unsigned mNodesPerElement
 
unsigned mNodesPerBoundaryElement
 
unsigned mMaxContainingElements
 
bool mEofException
 
bool mReadContainingElementOfBoundaryElement
 
bool mFilesAreBinary
 
bool mMeshIsHexahedral
 
bool mNclFileAvailable
 
char * mNodeFileReadBuffer
 
char * mElementFileReadBuffer
 
char * mFaceFileReadBuffer
 
bool mNodePermutationDefined
 
std::vector< unsignedmPermutationVector
 
std::vector< unsignedmInversePermutationVector
 

Friends

class TestTrianglesMeshReader
 

Detailed Description

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

Concrete version of the AbstractCachedMeshReader class. Once constructed the public methods of the AbstractCachedMeshReader (std::vector<double> GetNextNode(); etc) can be called to interrogate the data.

Definition at line 52 of file TrianglesMeshReader.hpp.

Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::TrianglesMeshReader ( std::string  pathBaseName,
unsigned  orderOfElements = 1,
unsigned  orderOfBoundaryElements = 1,
bool  readContainingElementsForBoundaryElements = false 
)

The containing element for each boundary element (obtaining by doing tetgen with the -nn flag). In a std::vector rather than the struct to save space if not read. 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 (Note tetgen with the -o2 flag creates quadratic elements but doesn't create quadratic faces, hence the need for this third parameter)
readContainingElementsForBoundaryElementsWhether to read in the containing element information for each boundary element (in the .face file if tetgen was run with '-nn').

Definition at line 54 of file TrianglesMeshReader.cpp.

References EXCEPTION, TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mIndexFromZero, TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesPerBoundaryElement, TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesPerElement, TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfBoundaryElements, TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfElements, TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mReadContainingElementOfBoundaryElement, TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenFiles(), and TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::ReadHeaders().

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

Destructor

Definition at line 124 of file TrianglesMeshReader.cpp.

Member Function Documentation

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

Close mesh files.

Definition at line 837 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::EnsureIndexingFromZero ( std::vector< unsigned > &  rNodeIndices)
private

Helper method to ensure we are indexing the nodes from 0 (some files have them indexed from 1) decides according to the property mIndexFromZero

Parameters
rNodeIndicesThe nodes we have read in.

Definition at line 984 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< unsigned > TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetContainingElementIndices ( unsigned  index)
virtual

Normally throws an exception. When a NCL file is available, returns a list of the elements that contain the node (only available for binary files).

Parameters
indexThe global node 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 436 of file TrianglesMeshReader.cpp.

References EXCEPTION.

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

References EXCEPTION.

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

References EXCEPTION.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetMeshFileBaseName ( )
privatevirtual
Returns
mFilesBaseName.

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 933 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData TrianglesMeshReader< 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

only one element attribute registered for the moment

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 238 of file TrianglesMeshReader.cpp.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData TrianglesMeshReader< 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

only one element attribute registered for the moment

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 205 of file TrianglesMeshReader.cpp.

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

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

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
template<class T_DATA >
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextItemFromStream ( std::ifstream &  rFileStream,
unsigned  expectedItemNumber,
std::vector< T_DATA > &  rDataPacket,
const unsigned rNumAttributes,
std::vector< double > &  rAttributes 
)
private
Returns
the Item details from the next line via a call to GetNextLineFromStream()
Parameters
rFileStreamThe file to read from
expectedItemNumberTo check file syntax, what item is expected to be on the next line.
rDataPacketAssumed to be of the right size but is allowed to contain dirty data on entry.
rNumAttributesThe number of attributes per item that we expect to read. Either mNumFaceAttributes or mNumElementAttributes.
rAttributesWill be filled with the attribute values if rNumAttributes > 0, otherwise empty. Note that floating point attributes are now standard

Definition at line 870 of file TrianglesMeshReader.cpp.

References EXCEPTION.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextLineFromStream ( std::ifstream &  rFileStream,
std::string &  rRawLine 
)
private

Read in the next line.

Parameters
rFileStreamThe file to read from
rRawLineWill be filled in with the next line

Definition at line 847 of file TrianglesMeshReader.cpp.

References EXCEPTION.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > TrianglesMeshReader< 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 193 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > TrianglesMeshReader< 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 339 of file TrianglesMeshReader.cpp.

References EXCEPTION.

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

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 593 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< 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 169 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< 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 150 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< 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 157 of file TrianglesMeshReader.cpp.

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

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 132 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< 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 163 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< 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 144 of file TrianglesMeshReader.cpp.

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

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 138 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetOneDimBoundary ( )
private

Get method specialized to 1D meshes

Definition at line 939 of file TrianglesMeshReader.cpp.

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

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 199 of file TrianglesMeshReader.hpp.

References TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfBoundaryElements.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetOrderOfElements ( )
inlinevirtual
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetReadContainingElementOfBoundaryElement ( )
inlinevirtual
Returns
true if the boundary element file is linear, but contains information about neighbouring elements

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 207 of file TrianglesMeshReader.hpp.

References TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mReadContainingElementOfBoundaryElement.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::HasNclFile ( )
virtual
Returns
true if there is a node connectivity list (NCL) file available.
whether there is a node connectivity list (NCL) file available

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 1002 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::HasNodePermutation ( )
virtual
Returns
true if a node permutation has been applied by SetNodePermutation.

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 1037 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::IsFileFormatBinary ( )
virtual
Returns
true if reading binary files, false if reading ascii files.

Note, this will always return false unless over-ridden by a derived class that is able to support binary file formats.

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 996 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenCableElementsFile ( )
private

Open the cable elements definition file, if it exists.

Definition at line 581 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenElementsFile ( )
private

Open elements file.

Definition at line 514 of file TrianglesMeshReader.cpp.

References EXCEPTION.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenFacesFile ( )
private

Open faces file.

Definition at line 546 of file TrianglesMeshReader.cpp.

References EXCEPTION.

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

Open mesh files.

Definition at line 492 of file TrianglesMeshReader.cpp.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenNclFile ( )
private

Open node connectivity list file.

Definition at line 572 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile ( )
private

Open node file.

Todo:
Change name to OpenNodesFile for consistency with OpenElementsFile and OpenFacesFile? (#991)

Definition at line 502 of file TrianglesMeshReader.cpp.

References EXCEPTION.

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

Read the header from each mesh file.

Definition at line 599 of file TrianglesMeshReader.cpp.

References EXCEPTION.

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

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

Resets pointers to beginning

Implements AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 176 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
const std::vector< unsigned > & TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::rGetNodePermutation ( )
virtual
Returns
the node permutation if a node permutation has been applied to this reader (or an empty permutation)

Reimplemented from AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >.

Definition at line 1048 of file TrianglesMeshReader.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::SetNodePermutation ( std::vector< unsigned > &  rPermutationVector)

Sets a node permutation to use when reading in node file.

Todo:
#2452 We need a way of propagating this back to the mesh (and insuring that the mesh is NOT being re-partitioned)
Parameters
rPermutationVectorPermutation vector

Definition at line 1020 of file TrianglesMeshReader.cpp.

References EXCEPTION.

Referenced by AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM >::load().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::SetReadBufferSize ( unsigned  bufferSize)

Sets size of std:ifstream internal read buffer. Use it for tuning I/O.

Parameters
bufferSizeThe size of the read buffer in bytes.

Definition at line 1008 of file TrianglesMeshReader.cpp.

Member Data Documentation

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

Number of boundary faces read in.

Definition at line 87 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mCableElementsFile
private

The elements file for the mesh.

Definition at line 67 of file TrianglesMeshReader.hpp.

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

Number of cable elements read in.

Definition at line 85 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::streampos TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mElementFileDataStart
private

The start of the binary element data

Definition at line 71 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
char* TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mElementFileReadBuffer
private

Buffer for element file read with std::ifstream

Definition at line 114 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::streamoff TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mElementItemWidth
private

The number of bytes in a line of the element file

Definition at line 72 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mElementsFile
private

The elements file for the mesh.

Definition at line 64 of file TrianglesMeshReader.hpp.

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

Number of elements read in (or the index of the last one read in + 1).

Definition at line 84 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mEofException
private

Set to true when end-of-file exception is thrown (for use in a try-catch)

Definition at line 106 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::streampos TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mFaceFileDataStart
private

The start of the binary face data

Definition at line 73 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
char* TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mFaceFileReadBuffer
private

Buffer for face file read with std::ifstream

Definition at line 115 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::streamoff TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mFaceItemWidth
private

The number of bytes in a line of the face file

Definition at line 74 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mFacesFile
private

The faces (edges) file for the mesh.

Definition at line 65 of file TrianglesMeshReader.hpp.

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

Number of faces read in (or the index of the last one read in + 1).

Definition at line 86 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mFilesAreBinary
private

Whether to read all data as binary (determined by a magic number in the node file header)

Definition at line 109 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mFilesBaseName
private

The base name for mesh files.

Definition at line 61 of file TrianglesMeshReader.hpp.

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

True if input data is numbered from zero, false otherwise

Definition at line 59 of file TrianglesMeshReader.hpp.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mInversePermutationVector
private

Permutation inverse, stored for performance reasons.

Definition at line 119 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mMaxContainingElements
private

The maximum number of elements that any node is contained in.

Definition at line 104 of file TrianglesMeshReader.hpp.

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

Is the maximum node boundary marker.

Definition at line 93 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mMeshIsHexahedral
private

Whether the mesh is hexahedral (determined by a magic number in the element file header)

Definition at line 110 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNclFile
private

The node connectivity list file for the mesh.

Definition at line 66 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNclFileAvailable
private

Whether a ncl file exists

Definition at line 111 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::streampos TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNclFileDataStart
private

The start of the binary data

Definition at line 75 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNclItemsRead
private

Number of NCL element items read in

Definition at line 88 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::streamoff TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNclItemWidth
private

The number of bytes in a line of the node file

Definition at line 76 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<double> TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodeAttributes
private

Will contain the nodal attributes at each node. Cleared and re-filled at each node

Definition at line 92 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::streampos TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodeFileDataStart
private

The start of the binary data

Definition at line 69 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
char* TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodeFileReadBuffer
private

Buffer for node file read with std::ifstream

Definition at line 113 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::streamoff TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodeItemWidth
private

The number of bytes in a line of the node file

Definition at line 70 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodePermutationDefined
private

Whether to consider a user-defined node permutation when reading a mesh from file.

Definition at line 117 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ifstream TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesFile
private

The nodes file for the mesh.

Definition at line 63 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNodesPerBoundaryElement
private

The number of nodes in each boundary element.

Definition at line 102 of file TrianglesMeshReader.hpp.

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

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

The number of nodes contained in each element.

Definition at line 101 of file TrianglesMeshReader.hpp.

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

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

Number of nodes read in (or the index of the last one read in + 1).

Definition at line 83 of file TrianglesMeshReader.hpp.

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

Is the number of attributes stored for each cable element.

Definition at line 97 of file TrianglesMeshReader.hpp.

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

Number of cable elements in the mesh.

Definition at line 81 of file TrianglesMeshReader.hpp.

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

Is the number of attributes stored for each element.

Definition at line 95 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mNumElementNodes
private

Is the number of nodes per element.

Definition at line 94 of file TrianglesMeshReader.hpp.

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

Number of elements in the mesh.

Definition at line 79 of file TrianglesMeshReader.hpp.

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

Is the number of attributes stored for each face.

Definition at line 96 of file TrianglesMeshReader.hpp.

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

Number of faces in the mesh.

Definition at line 80 of file TrianglesMeshReader.hpp.

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

Is the number of attributes stored at each node.

Definition at line 91 of file TrianglesMeshReader.hpp.

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

Number of nodes in the mesh.

Definition at line 78 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mOneDimBoundary
private

Indices of nodes which are at the boundary of a 1D mesh

Definition at line 89 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfBoundaryElements
private
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mOrderOfElements
private

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

Definition at line 99 of file TrianglesMeshReader.hpp.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mPermutationVector
private

Permutation to be considered, i-th entry of the vector contains new index for original node i.

Definition at line 118 of file TrianglesMeshReader.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::mReadContainingElementOfBoundaryElement
private

Whether to read containing element info for each boundary element (obtaining by doing tetgen with the -nn flag)

Definition at line 108 of file TrianglesMeshReader.hpp.

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


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