CEPS  24.01
Cardiac ElectroPhysiology Simulator
MeshReader Class Referenceabstract

Detailed Description

Abstract base class that encapsulates primary functionalities of each mesh reader.

The pure virtual functions (that must be defined by child class) will do the actual parsing.

Definition at line 41 of file MeshReader.hpp.

#include <MeshReader.hpp>

Inheritance diagram for MeshReader:
[legend]

Public Member Functions

 MeshReader ()=delete
 Deleted default constructor. More...
 
 MeshReader (const CepsString &mesh, const CepsUInt &dim, CepsBool quads=false)
 Constructor with full file name, and intended dimension of mesh. More...
 
 ~MeshReader () override
 Destructor. More...
 
CepsUInt getNbCellsRead () const
 Number of cells that have been read until now. More...
 
CepsUInt getNbBdryCellsRead () const
 Number of boundary cells that have been read. More...
 
CepsUInt getNbNodes () const
 Number of nodes of current mesh. More...
 
CepsUInt getNbCells () const
 Number of cell of current mesh. More...
 
CepsUInt getNbBdryCells () const
 Number of boundary cell of current mesh. More...
 
virtual CepsInt getNbAttributesPerNode () const
 Number of attributes per node. More...
 
virtual CepsInt getNbAttributesPerCell () const
 Number of attributes per cell. More...
 
virtual CepsInt getNbAttributesPerBdryCell () const
 Number of attributes per boundary cell. More...
 
virtual void initialize ()=0
 The routine MUST set the number of nodes and cells. More...
 
virtual void readNodes (CepsUInt indexStart, CepsUInt indexEnd, CepsUInt nodeOffset, CepsVector< CepsReal > &coords, CepsVector< CepsAttribute > &attr, CepsVector< CepsUInt > &attrPtr)=0
 Reads several nodes in mesh file. More...
 
virtual void readCells (CepsUInt indexStart, CepsUInt indexEnd, CepsUInt nodeOffset, CepsUInt cellOffset, CepsVector< CepsNodeGlobalIndex > &nodeIndices, CepsVector< CepsUInt > &nodeIndicesPtr, CepsVector< CepsAttribute > &cellAttr, CepsVector< CepsUInt > &cellAttrPtr, CepsVector< CepsChar > &isBoundaryCell)=0
 Reads several cells in mesh file. More...
 
- Public Member Functions inherited from FileReader
 FileReader ()
 Alternative constructor. More...
 
 FileReader (const CepsString &fileName)
 Default constructor. More...
 
 FileReader (const FileReader &that)
 Copy constructor. More...
 
FileReaderoperator= (const FileReader &that)
 Copy constructor. More...
 
virtual ~FileReader ()
 Destructor. Calls FileReader::close. More...
 
void setFileName (const CepsString &fileName)
 Set file to read. More...
 
virtual CepsBool open ()
 Opens the designated file in read mode. More...
 
virtual void close ()
 Close the file. More...
 
virtual CepsBool good ()
 true if stream is still readable More...
 
void reset ()
 Set file stream to the beginning of the file. More...
 
CepsUInt find (const CepsString &pattern)
 Advance stream until pattern is found. More...
 
CepsBool findNext (const CepsString &pattern)
 Advance stream until pattern is found. More...
 
CepsUInt findNextOf (const CepsVector< CepsString > &patterns)
 Advance stream until one of patterns is found. More...
 
CepsString getFileName ()
 Name of parsed file. More...
 
CepsUInt skipLines (CepsUInt nbLines)
 Skip given number of lines. More...
 
void oneLine (CepsString &line)
 Get one line from the stream. More...
 
template<typename T >
FileReaderoperator>> (T &var)
 Reading operator. More...
 
CepsInt lineIndex (const CepsString &word)
 Index of first line starting with word, search starting from the current stream position. More...
 
CepsUInt checkEOF ()
 Checks if the reader reached end of file. More...
 

Protected Member Functions

virtual void getNextCell (CepsUInt cellId, CepsUInt fileCellId, CepsUInt nodeOffset, CepsVector< CepsNodeGlobalIndex > &nodeIndices, CepsVector< CepsUInt > &nodeIndicesPtr, CepsVector< CepsAttribute > &cellAttr, CepsVector< CepsUInt > &cellAttrPtr, CepsVector< CepsChar > &isBoundaryCell, CepsBool boundaryFlag)=0
 Reads a single cell in mesh file. More...
 
virtual CepsBool checkExtension () const
 Stop if extension is not ok, extension must be defined in child classes. More...
 
void checkCanReadNodes (CepsUInt indexStart, CepsUInt indexEnd) const
 Aborts if passed indices are wrong. More...
 
void checkCanReadCells (CepsUInt indexStart, CepsUInt indexEnd) const
 Aborts if passed indices are wrong. More...
 

Protected Attributes

CepsString m_extension
 File name extension. More...
 
CepsUInt m_expectedDim
 Expected dimension of mesh. More...
 
CepsBool m_quads
 Reader for quadratic cells. More...
 
CepsBool m_initialized
 Flag to ensure call of initializeReader() More...
 
CepsUInt m_cellsRead
 Keeps track of already read cells. More...
 
CepsUInt m_nbNodesPerCell
 nb nodes per cell More...
 
CepsUInt m_bdryCellsRead
 Keeps track of already read boundary cells. More...
 
CepsUInt m_nbNodesPerBdryCell
 nb nodes per boundary cell More...
 
CepsInt m_nodesBegin
 line start of nodes More...
 
CepsUInt m_nbNodes
 number of nodes in mesh More...
 
CepsInt m_cellsBegin
 line start of cells More...
 
CepsUInt m_nbCells
 number of cells in mesh, appropriate for dimension More...
 
CepsUInt m_nbCellsTotal
 number of all cells in file More...
 
CepsInt m_bdryCellsBegin
 line start of boundary cells More...
 
CepsUInt m_nbBdryCells
 number of boundary cells in mesh, appropriate for dimension More...
 
CepsUInt m_nbAttrPerNode
 attributes per node More...
 
CepsUInt m_nbAttrPerCell
 attributes per cell More...
 
CepsUInt m_nbAttrPerBdryCell
 attributes per boundary cell More...
 
- Protected Attributes inherited from FileReader
CepsString m_fileName
 file to open More...
 
std::ifstream m_file
 stream More...
 

Constructor & Destructor Documentation

◆ MeshReader() [1/2]

MeshReader::MeshReader ( )
delete

Deleted default constructor.

◆ MeshReader() [2/2]

MeshReader::MeshReader ( const CepsString mesh,
const CepsUInt dim,
CepsBool  quads = false 
)

Constructor with full file name, and intended dimension of mesh.

Definition at line 32 of file MeshReader.cpp.

◆ ~MeshReader()

MeshReader::~MeshReader ( )
override

Destructor.

Definition at line 71 of file MeshReader.cpp.

Member Function Documentation

◆ checkCanReadCells()

void MeshReader::checkCanReadCells ( CepsUInt  indexStart,
CepsUInt  indexEnd 
) const
protected

Aborts if passed indices are wrong.

Definition at line 151 of file MeshReader.cpp.

◆ checkCanReadNodes()

void MeshReader::checkCanReadNodes ( CepsUInt  indexStart,
CepsUInt  indexEnd 
) const
protected

Aborts if passed indices are wrong.

Definition at line 137 of file MeshReader.cpp.

◆ checkExtension()

CepsBool MeshReader::checkExtension ( ) const
protectedvirtual

Stop if extension is not ok, extension must be defined in child classes.

Definition at line 123 of file MeshReader.cpp.

◆ getNbAttributesPerBdryCell()

CepsInt MeshReader::getNbAttributesPerBdryCell ( ) const
virtual

Number of attributes per boundary cell.

Definition at line 117 of file MeshReader.cpp.

◆ getNbAttributesPerCell()

CepsInt MeshReader::getNbAttributesPerCell ( ) const
virtual

Number of attributes per cell.

Definition at line 111 of file MeshReader.cpp.

◆ getNbAttributesPerNode()

CepsInt MeshReader::getNbAttributesPerNode ( ) const
virtual

Number of attributes per node.

Definition at line 105 of file MeshReader.cpp.

◆ getNbBdryCells()

CepsUInt MeshReader::getNbBdryCells ( ) const

Number of boundary cell of current mesh.

Definition at line 99 of file MeshReader.cpp.

◆ getNbBdryCellsRead()

CepsUInt MeshReader::getNbBdryCellsRead ( ) const

Number of boundary cells that have been read.

Definition at line 81 of file MeshReader.cpp.

◆ getNbCells()

CepsUInt MeshReader::getNbCells ( ) const

Number of cell of current mesh.

Definition at line 93 of file MeshReader.cpp.

◆ getNbCellsRead()

CepsUInt MeshReader::getNbCellsRead ( ) const

Number of cells that have been read until now.

Definition at line 75 of file MeshReader.cpp.

◆ getNbNodes()

CepsUInt MeshReader::getNbNodes ( ) const

Number of nodes of current mesh.

Definition at line 87 of file MeshReader.cpp.

◆ getNextCell()

virtual void MeshReader::getNextCell ( CepsUInt  cellId,
CepsUInt  fileCellId,
CepsUInt  nodeOffset,
CepsVector< CepsNodeGlobalIndex > &  nodeIndices,
CepsVector< CepsUInt > &  nodeIndicesPtr,
CepsVector< CepsAttribute > &  cellAttr,
CepsVector< CepsUInt > &  cellAttrPtr,
CepsVector< CepsChar > &  isBoundaryCell,
CepsBool  boundaryFlag 
)
protectedpure virtual

Reads a single cell in mesh file.

Parameters
cellIdID of the cell in the array to fill (offset)
fileCellIdID in the file (for error message)
nodeOffsetnumber of nodes already read in other meshes (out array shift)
nodeIndicesarray of node indices in each cell
nodeIndicesPtrarray of cell positions in nodeIndices array
cellAttrarray of cell attributes
cellAttrPtrarray of positions in cellAttr array
isBoundaryCellarray of boundary flags
boundaryFlagtells if this cell is on boundary

Implemented in VtkMeshReader, TetgenMeshReader, MeditMeshReader, and GmshMeshReader.

◆ initialize()

virtual void MeshReader::initialize ( )
pure virtual

The routine MUST set the number of nodes and cells.

Implemented in VtkMeshReader, TetgenMeshReader, MeditMeshReader, and GmshMeshReader.

◆ readCells()

virtual void MeshReader::readCells ( CepsUInt  indexStart,
CepsUInt  indexEnd,
CepsUInt  nodeOffset,
CepsUInt  cellOffset,
CepsVector< CepsNodeGlobalIndex > &  nodeIndices,
CepsVector< CepsUInt > &  nodeIndicesPtr,
CepsVector< CepsAttribute > &  cellAttr,
CepsVector< CepsUInt > &  cellAttrPtr,
CepsVector< CepsChar > &  isBoundaryCell 
)
pure virtual

Reads several cells in mesh file.

Parameters
indexStartin file index of where to start reading
indexEndin file index of where to stop reading (+1)
nodeOffsetnumber of nodes already read in other meshes (out array shift)
cellOffsetnumber of cells already read in other meshes (out array shift)
nodeIndicesarray of node indices in each cell
nodeIndicesPtrarray of cell positions in nodeIndices array
cellAttrarray of cell attributes
cellAttrPtrarray of positions in cellAttr array
isBoundaryCellarray of boundary flags

Implemented in VtkMeshReader, TetgenMeshReader, MeditMeshReader, and GmshMeshReader.

◆ readNodes()

virtual void MeshReader::readNodes ( CepsUInt  indexStart,
CepsUInt  indexEnd,
CepsUInt  nodeOffset,
CepsVector< CepsReal > &  coords,
CepsVector< CepsAttribute > &  attr,
CepsVector< CepsUInt > &  attrPtr 
)
pure virtual

Reads several nodes in mesh file.

Parameters
indexStartin file index of where to start reading
indexEndin file index of where to stop reading (+1)
nodeOffsetnumber of nodes already read in other meshes (equiv. shift in arrays to fill)
coordsarray of coordinates
attrarray of node attributes
attrPtrarray of positions in attributes array

Implemented in VtkMeshReader, TetgenMeshReader, MeditMeshReader, and GmshMeshReader.

Field Documentation

◆ m_bdryCellsBegin

CepsInt MeshReader::m_bdryCellsBegin
protected

line start of boundary cells

Definition at line 190 of file MeshReader.hpp.

◆ m_bdryCellsRead

CepsUInt MeshReader::m_bdryCellsRead
protected

Keeps track of already read boundary cells.

Definition at line 180 of file MeshReader.hpp.

◆ m_cellsBegin

CepsInt MeshReader::m_cellsBegin
protected

line start of cells

Definition at line 186 of file MeshReader.hpp.

◆ m_cellsRead

CepsUInt MeshReader::m_cellsRead
protected

Keeps track of already read cells.

Definition at line 178 of file MeshReader.hpp.

◆ m_expectedDim

CepsUInt MeshReader::m_expectedDim
protected

Expected dimension of mesh.

Definition at line 174 of file MeshReader.hpp.

◆ m_extension

CepsString MeshReader::m_extension
protected

File name extension.

Definition at line 172 of file MeshReader.hpp.

◆ m_initialized

CepsBool MeshReader::m_initialized
protected

Flag to ensure call of initializeReader()

Definition at line 176 of file MeshReader.hpp.

◆ m_nbAttrPerBdryCell

CepsUInt MeshReader::m_nbAttrPerBdryCell
protected

attributes per boundary cell

Definition at line 195 of file MeshReader.hpp.

◆ m_nbAttrPerCell

CepsUInt MeshReader::m_nbAttrPerCell
protected

attributes per cell

Definition at line 194 of file MeshReader.hpp.

◆ m_nbAttrPerNode

CepsUInt MeshReader::m_nbAttrPerNode
protected

attributes per node

Definition at line 193 of file MeshReader.hpp.

◆ m_nbBdryCells

CepsUInt MeshReader::m_nbBdryCells
protected

number of boundary cells in mesh, appropriate for dimension

Definition at line 191 of file MeshReader.hpp.

◆ m_nbCells

CepsUInt MeshReader::m_nbCells
protected

number of cells in mesh, appropriate for dimension

Definition at line 187 of file MeshReader.hpp.

◆ m_nbCellsTotal

CepsUInt MeshReader::m_nbCellsTotal
protected

number of all cells in file

Definition at line 188 of file MeshReader.hpp.

◆ m_nbNodes

CepsUInt MeshReader::m_nbNodes
protected

number of nodes in mesh

Definition at line 184 of file MeshReader.hpp.

◆ m_nbNodesPerBdryCell

CepsUInt MeshReader::m_nbNodesPerBdryCell
protected

nb nodes per boundary cell

Definition at line 181 of file MeshReader.hpp.

◆ m_nbNodesPerCell

CepsUInt MeshReader::m_nbNodesPerCell
protected

nb nodes per cell

Definition at line 179 of file MeshReader.hpp.

◆ m_nodesBegin

CepsInt MeshReader::m_nodesBegin
protected

line start of nodes

Definition at line 183 of file MeshReader.hpp.

◆ m_quads

CepsBool MeshReader::m_quads
protected

Reader for quadratic cells.

Definition at line 175 of file MeshReader.hpp.


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