#include <FibreReader.hpp>
Public Member Functions | |
FibreReader (FileFinder &rFileFinder, FibreFileType fibreFileType) | |
~FibreReader () | |
void | GetNextFibreSheetAndNormalMatrix (c_matrix< double, DIM, DIM > &rFibreMatrix, bool checkOrthogonality=true) |
void | GetNextFibreVector (c_vector< double, DIM > &rFibreVector, bool checkNormalised=true) |
unsigned | GetNumLinesOfData () |
Private Member Functions | |
unsigned | GetTokensAtNextLine () |
void | ReadNumLinesOfDataFromFile () |
Private Attributes | |
std::ifstream | mDataFile |
std::string | mFilePath |
unsigned | mNumLinesOfData |
unsigned | mNumItemsPerLine |
std::vector< double > | mTokens |
Definition at line 54 of file FibreReader.hpp.
FibreReader< DIM >::FibreReader | ( | FileFinder & | rFileFinder, | |
FibreFileType | fibreFileType | |||
) | [inline] |
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 35 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 | ( | ) | [inline] |
Destructor closes file.
Definition at line 59 of file FibreReader.cpp.
References FibreReader< DIM >::mDataFile.
unsigned FibreReader< DIM >::GetTokensAtNextLine | ( | ) | [inline, private] |
Read a line of numbers from mDataFile. Sets up the member variable mTokens with the data in the next line.
Definition at line 147 of file FibreReader.cpp.
References EXCEPTION, FibreReader< DIM >::mDataFile, FibreReader< DIM >::mFilePath, FibreReader< DIM >::mNumItemsPerLine, and FibreReader< DIM >::mTokens.
Referenced by FibreReader< DIM >::GetNextFibreSheetAndNormalMatrix(), FibreReader< DIM >::GetNextFibreVector(), and FibreReader< DIM >::ReadNumLinesOfDataFromFile().
void FibreReader< DIM >::ReadNumLinesOfDataFromFile | ( | ) | [inline, 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 204 of file FibreReader.cpp.
References EXCEPTION, FibreReader< DIM >::GetTokensAtNextLine(), FibreReader< DIM >::mDataFile, FibreReader< DIM >::mNumLinesOfData, and FibreReader< DIM >::mTokens.
Referenced by FibreReader< DIM >::FibreReader().
void FibreReader< DIM >::GetNextFibreSheetAndNormalMatrix | ( | c_matrix< double, DIM, DIM > & | rFibreMatrix, | |
bool | checkOrthogonality = true | |||
) | [inline] |
Read the next fibre direction matrix from the file. Must only be used when reading an orthotropic file. These have lines of the form
fibre0 fibre1 fibre2 sheet0 sheet1 sheet2 normal0 normal1 normal2
[ fibre0 sheet0 normal0 ] [ fibre1 sheet1 normal1 ] [ fibre2 sheet2 normal2 ]
rFibreMatrix | matrix to be filled in | |
checkOrthogonality | if true, checks if the matrix is orthogonal and throws an exception if not |
Definition at line 65 of file FibreReader.cpp.
References EXCEPTION, FibreReader< DIM >::GetTokensAtNextLine(), FibreReader< DIM >::mFilePath, FibreReader< DIM >::mNumItemsPerLine, and FibreReader< DIM >::mTokens.
Referenced by AbstractCardiacMechanicsSolver< DIM >::SetVariableFibreSheetDirections().
void FibreReader< DIM >::GetNextFibreVector | ( | c_vector< double, DIM > & | rFibreVector, | |
bool | checkNormalised = true | |||
) | [inline] |
Read the next fibre direction vector from the file. Must only be used when reading an axisymmetric file. These have lines of the form
fibre0 fibre1 fibre2
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 114 of file FibreReader.cpp.
References EXCEPTION, FibreReader< DIM >::GetTokensAtNextLine(), FibreReader< DIM >::mFilePath, FibreReader< DIM >::mNumItemsPerLine, and FibreReader< DIM >::mTokens.
unsigned FibreReader< DIM >::GetNumLinesOfData | ( | ) | [inline] |
Get the number of lines of data in the file - this is the value read from the first line.
Definition at line 137 of file FibreReader.hpp.
References FibreReader< DIM >::mNumLinesOfData.
Referenced by AbstractCardiacMechanicsSolver< DIM >::SetVariableFibreSheetDirections().
std::ifstream FibreReader< DIM >::mDataFile [private] |
File stream to use for GetTokensAtNextLine
Definition at line 58 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::FibreReader(), FibreReader< DIM >::GetTokensAtNextLine(), FibreReader< DIM >::ReadNumLinesOfDataFromFile(), and FibreReader< DIM >::~FibreReader().
std::string FibreReader< DIM >::mFilePath [private] |
Absolute path of the file being read
Definition at line 61 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::FibreReader(), FibreReader< DIM >::GetNextFibreSheetAndNormalMatrix(), FibreReader< DIM >::GetNextFibreVector(), and FibreReader< DIM >::GetTokensAtNextLine().
unsigned FibreReader< DIM >::mNumLinesOfData [private] |
Number of lines of data in the file, read from the first line of the file
Definition at line 64 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::GetNumLinesOfData(), and FibreReader< DIM >::ReadNumLinesOfDataFromFile().
unsigned FibreReader< DIM >::mNumItemsPerLine [private] |
How many items we expect to find per line: DIM for axisymmetric, DIM*DIM for orthotropic
Definition at line 67 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::FibreReader(), FibreReader< DIM >::GetNextFibreSheetAndNormalMatrix(), FibreReader< DIM >::GetNextFibreVector(), and FibreReader< DIM >::GetTokensAtNextLine().
std::vector<double> FibreReader< DIM >::mTokens [private] |
Vector which entries read from a line in a file is put into.
Definition at line 70 of file FibreReader.hpp.
Referenced by FibreReader< DIM >::FibreReader(), FibreReader< DIM >::GetNextFibreSheetAndNormalMatrix(), FibreReader< DIM >::GetNextFibreVector(), FibreReader< DIM >::GetTokensAtNextLine(), and FibreReader< DIM >::ReadNumLinesOfDataFromFile().