Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
|
#include <FibreReader.hpp>
Public Member Functions | |
FibreReader (const FileFinder &rFileFinder, FibreFileType fibreFileType) | |
~FibreReader () | |
void | GetFibreSheetAndNormalMatrix (unsigned fibreIndex, c_matrix< double, DIM, DIM > &rFibreMatrix, bool checkOrthogonality=true) |
void | GetFibreVector (unsigned fibreIndex, c_vector< double, DIM > &rFibreVector, bool checkNormalised=true) |
unsigned | GetNumLinesOfData () |
void | GetAllAxi (std::vector< c_vector< double, DIM > > &direction) |
void | GetAllOrtho (std::vector< c_vector< double, DIM > > &first_direction, std::vector< c_vector< double, DIM > > &second_direction, std::vector< c_vector< double, DIM > > &third_direction) |
bool | IsBinary () |
Private Member Functions | |
unsigned | GetTokensAtNextLine () |
void | ReadNumLinesOfDataFromFile () |
Private Attributes | |
std::ifstream | mDataFile |
std::string | mFilePath |
unsigned | mNumLinesOfData |
bool | mFileIsBinary |
unsigned | mNumItemsPerLine |
unsigned | mNextIndex |
std::vector< double > | mTokens |
A class for reading .axi files (files which define the fibre direction for each element) and .ortho files (files which define the fibre, sheet and normal directions for each element.
Definition at line 61 of file FibreReader.hpp.
FibreReader< DIM >::FibreReader | ( | const FileFinder & | rFileFinder, |
FibreFileType | fibreFileType | ||
) |
Create a new FibreReader.
rFileFinder | the path to the fibre direction file |
fibreFileType | AXISYM or ORTHO depending on type of file to be read |
Definition at line 42 of file FibreReader.cpp.
References EXCEPTION, FileFinder::GetAbsolutePath(), FibreReader< DIM >::mDataFile, FibreReader< DIM >::mFilePath, FibreReader< DIM >::mNumItemsPerLine, FibreReader< DIM >::mTokens, and FibreReader< DIM >::ReadNumLinesOfDataFromFile().
FibreReader< DIM >::~FibreReader | ( | ) |
Destructor closes file.
Definition at line 68 of file FibreReader.cpp.
void FibreReader< DIM >::GetAllAxi | ( | std::vector< c_vector< double, DIM > > & | direction | ) |
Get every line of a fibre file (axi-symmetric) in vector of vectors format. This is useful for adding to a visualizer. (Do not use with GetNext...)
direction | an empty vector which will be filled with data from file |
Definition at line 74 of file FibreReader.cpp.
References EXCEPTION.
Referenced by FibreConverter::Convert().
void FibreReader< DIM >::GetAllOrtho | ( | std::vector< c_vector< double, DIM > > & | first_direction, |
std::vector< c_vector< double, DIM > > & | second_direction, | ||
std::vector< c_vector< double, DIM > > & | third_direction | ||
) |
Get every line of a fibre file (orthotropic) in vector of vectors format. This is useful for adding to a visualizer. (Do not use with GetNext...)
first_direction | an empty vector which will be filled with data from file |
second_direction | an empty vector which will be filled with data from file |
third_direction | an empty vector which will be filled with data from file (or will remain empty in 2D) |
Definition at line 91 of file FibreReader.cpp.
Referenced by FibreConverter::Convert().
void FibreReader< DIM >::GetFibreSheetAndNormalMatrix | ( | unsigned | fibreIndex, |
c_matrix< double, DIM, DIM > & | rFibreMatrix, | ||
bool | checkOrthogonality = true |
||
) |
Read a fibre direction matrix from the file. Must only be used when reading an orthotropic file. These have lines of the form
which are converted to the matrix
fibreIndex | which fibre vector to read. Note that vectors must be read in monotonically increasing order, so subsequent calls to this method must always pass a strictly greater index. They may skip vectors, however. |
rFibreMatrix | matrix to be filled in |
checkOrthogonality | if true, checks if the matrix is orthogonal and throws an exception if not |
Definition at line 125 of file FibreReader.cpp.
References EXCEPTION.
Referenced by AbstractCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::SetVariableFibreSheetDirections().
void FibreReader< DIM >::GetFibreVector | ( | unsigned | fibreIndex, |
c_vector< double, DIM > & | rFibreVector, | ||
bool | checkNormalised = true |
||
) |
Read a fibre direction vector from the file. Must only be used when reading an axisymmetric file. These have lines of the form
fibreIndex | which fibre vector to read. Note that vectors must be read in monotonically increasing order, so subsequent calls to this method must always pass a strictly greater index. They may skip vectors, however. |
rFibreVector | vector to be filled in |
checkNormalised | if true, checks if the read vector is normalised and throws an exception if not |
Definition at line 196 of file FibreReader.cpp.
References EXCEPTION.
|
inline |
Definition at line 155 of file FibreReader.hpp.
References FibreReader< DIM >::mNumLinesOfData.
Referenced by AbstractCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::SetVariableFibreSheetDirections().
|
private |
|
inline |
Definition at line 185 of file FibreReader.hpp.
References FibreReader< DIM >::mFileIsBinary.
|
private |
Read number of elements from mDataFile. Note: Must be called before GetTokensAtNextLine (it assumes that it's reading the first line).
Definition at line 302 of file FibreReader.cpp.
References EXCEPTION.
Referenced by FibreReader< DIM >::FibreReader().
|
private |
File stream to use for GetTokensAtNextLine
Definition at line 65 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::FibreReader().
|
private |
Whether the data file has binary entries
Definition at line 73 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::IsBinary().
|
private |
Absolute path of the file being read
Definition at line 68 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::FibreReader().
|
private |
The next index we expect to read from the file.
Definition at line 79 of file FibreReader.hpp.
|
private |
How many items we expect to find per line: DIM for axisymmetric, DIM*DIM for orthotropic
Definition at line 76 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::FibreReader().
|
private |
Number of lines of data in the file, read from the first line of the file
Definition at line 71 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::GetNumLinesOfData().
|
private |
Vector which entries read from a line in a file is put into.
Definition at line 82 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::FibreReader().