CEPS
24.01
Cardiac ElectroPhysiology Simulator
|
Reader used to import point or cell data from files.
Usage:
r = ceps::getNew<CoeffReader>(fileName,geomPtr); r.getData(v,label,component); (component optional if data is scalar)
The ptr used at instanciation is a ptr to a Geometry, (geom nodes, geom cells) Finite Element nodes are not compatible with this reader. Coefficients are usually defined following the geometry, not the discretization or partitioning...
Definition at line 62 of file CoeffReader.hpp.
#include <CoeffReader.hpp>
Public Member Functions | |
CoeffReader (const CepsString &fileName, const CepsLocationFlag &loc, Geometry *geom) | |
Constructor from file name, and location flag, linked to geometry. More... | |
~CoeffReader () override | |
Destructor. More... | |
CepsBool | isValidExtension (CepsString ext) |
Tells if extension is compatible with reader. More... | |
void | getData (const CepsString &label, DistributedInfos< CepsMathScalar > &dest) |
Extract a distributed data structure of scalars with given label. More... | |
void | getData (const CepsString &label, DistributedInfos< CepsMathVertex > &dest) |
Extract a distributed data structure of vertex with given label. More... | |
void | getData (const CepsString &label, DistributedInfos< CepsMathTensor > &dest) |
Extract a distributed data structure of tensors with given label. More... | |
CepsBool | hasArray (const CepsString &label, CepsInt dim=-1) const |
Tells if file has data array, dim = 0 for scalars, 1 for vector, 2 for tensor. 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... | |
FileReader & | operator= (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 > | |
FileReader & | operator>> (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 | |
void | buildArrayNamesList () |
Stores the names of the arrays for easier access afterwards. More... | |
template<typename _Result > | |
void | read (const CepsString &label, DistributedInfos< _Result > &dest) |
Read the array and stores the data into instance. The label is needed for vtk format. More... | |
template<typename _Result > | |
void | readVtk (const CepsString &label, DistributedInfos< _Result > &dest) |
Read the array with given label in file, stores the data into instance. More... | |
template<typename _Result > | |
void | readMsh (const CepsString &label, DistributedInfos< _Result > &dest) |
Read the array with given label in file, stores the data into instance. More... | |
Protected Attributes | |
Geometry * | m_geom |
Link to geometry. More... | |
CepsLocationFlag | m_loc |
Used to choose between point or cell data. More... | |
CepsArray< CepsVector< CepsString >, 3 > | m_cellArrayNames |
Names of data arrays defined on cells (array index: scalar, vector, tensor) More... | |
CepsArray< CepsVector< CepsString >, 3 > | m_nodeArrayNames |
Names of data arrays defined on nodes (array index: scalar, vector, tensor) More... | |
vtkSmartPointer< vtkDataSet > | m_vtkData |
Array in the vtk format. More... | |
Protected Attributes inherited from FileReader | |
CepsString | m_fileName |
file to open More... | |
std::ifstream | m_file |
stream More... | |
CoeffReader::CoeffReader | ( | const CepsString & | fileName, |
const CepsLocationFlag & | loc, | ||
Geometry * | geom | ||
) |
Constructor from file name, and location flag, linked to geometry.
Definition at line 33 of file CoeffReader.cpp.
|
override |
Destructor.
Definition at line 70 of file CoeffReader.cpp.
|
protected |
Stores the names of the arrays for easier access afterwards.
Definition at line 131 of file CoeffReader.cpp.
void CoeffReader::getData | ( | const CepsString & | label, |
DistributedInfos< CepsMathScalar > & | dest | ||
) |
Extract a distributed data structure of scalars with given label.
Definition at line 81 of file CoeffReader.cpp.
void CoeffReader::getData | ( | const CepsString & | label, |
DistributedInfos< CepsMathTensor > & | dest | ||
) |
Extract a distributed data structure of tensors with given label.
Definition at line 101 of file CoeffReader.cpp.
void CoeffReader::getData | ( | const CepsString & | label, |
DistributedInfos< CepsMathVertex > & | dest | ||
) |
Extract a distributed data structure of vertex with given label.
Definition at line 91 of file CoeffReader.cpp.
CepsBool CoeffReader::hasArray | ( | const CepsString & | label, |
CepsInt | dim = -1 |
||
) | const |
Tells if file has data array, dim = 0 for scalars, 1 for vector, 2 for tensor.
Definition at line 111 of file CoeffReader.cpp.
CepsBool CoeffReader::isValidExtension | ( | CepsString | ext | ) |
Tells if extension is compatible with reader.
Definition at line 75 of file CoeffReader.cpp.
|
protected |
Read the array and stores the data into instance. The label is needed for vtk format.
.msh, other extensions caused abort at instanciation
Definition at line 133 of file CoeffReader.hpp.
|
protected |
Read the array with given label in file, stores the data into instance.
Definition at line 195 of file CoeffReader.hpp.
|
protected |
Read the array with given label in file, stores the data into instance.
Definition at line 147 of file CoeffReader.hpp.
|
protected |
Names of data arrays defined on cells (array index: scalar, vector, tensor)
Definition at line 124 of file CoeffReader.hpp.
|
protected |
Link to geometry.
Definition at line 120 of file CoeffReader.hpp.
|
protected |
Used to choose between point or cell data.
Definition at line 121 of file CoeffReader.hpp.
|
protected |
Names of data arrays defined on nodes (array index: scalar, vector, tensor)
Definition at line 126 of file CoeffReader.hpp.
|
protected |
Array in the vtk format.
Definition at line 128 of file CoeffReader.hpp.