#include <ColumnDataReader.hpp>


Public Member Functions | |
| ColumnDataReader (const std::string &rDirectory, const std::string &rBaseName, bool makeAbsolute=true) | |
| std::vector< double > | GetValues (const std::string &rVariableName) |
| std::vector< double > | GetValues (const std::string &rVariableName, int fixedDimension) |
| std::vector< double > | GetUnlimitedDimensionValues () |
| bool | HasValues (const std::string &rVariableName) |
Private Member Functions | |
| void | PushColumnEntryFromLine (const std::string &rLine, int col) |
| void | ReadColumnFromFile (const std::string &rFilename, int col) |
| void | ReadValueFromFile (const std::string &rFilename, int col, int row) |
Private Attributes | |
| std::map< std::string, int > | mVariablesToColumns |
| std::map< std::string, std::string > | mVariablesToUnits |
| int | mNumFixedDimensions |
| bool | mHasUnlimitedDimension |
| int | mNumVariables |
| std::string | mInfoFilename |
| std::string | mDataFilename |
| std::string | mAncillaryFilename |
| std::vector< double > | mValues |
Static Private Attributes | |
| static const int | FIELD_WIDTH = 10 |
| static const int | SPACING = 2 |
Definition at line 40 of file ColumnDataReader.hpp.
| ColumnDataReader::ColumnDataReader | ( | const std::string & | rDirectory, | |
| const std::string & | rBaseName, | |||
| bool | makeAbsolute = true | |||
| ) |
Read data from the given files into memory.
| rDirectory | The directory the files are stored in | |
| rBaseName | The base name of the files to read (i.e. without the extensions) | |
| makeAbsolute | Whether to convert directory to an absolute path using the OutputFileHandler (defaults to true) |
Definition at line 53 of file ColumnDataReader.cpp.
References FILE_SUFFIX_WIDTH, OutputFileHandler::GetOutputDirectoryFullPath(), mAncillaryFilename, mDataFilename, mHasUnlimitedDimension, mInfoFilename, mNumFixedDimensions, mNumVariables, mVariablesToColumns, mVariablesToUnits, and NOT_READ.
| void ColumnDataReader::PushColumnEntryFromLine | ( | const std::string & | rLine, | |
| int | col | |||
| ) | [private] |
Push back an entry from the data file into mValues.
| rLine | the line of the data file | |
| col | the column number |
Definition at line 318 of file ColumnDataReader.cpp.
References FIELD_WIDTH, mValues, and SPACING.
Referenced by ReadColumnFromFile(), and ReadValueFromFile().
| void ColumnDataReader::ReadColumnFromFile | ( | const std::string & | rFilename, | |
| int | col | |||
| ) | [private] |
Read in a given column from a data file into mValues.
| rFilename | the file name | |
| col | the column number |
Definition at line 292 of file ColumnDataReader.cpp.
References mValues, and PushColumnEntryFromLine().
Referenced by GetUnlimitedDimensionValues(), and GetValues().
| void ColumnDataReader::ReadValueFromFile | ( | const std::string & | rFilename, | |
| int | col, | |||
| int | row | |||
| ) | [private] |
Push back an entry from a file into mValues.
| rFilename | the file name | |
| col | the column number | |
| row | the row number |
Definition at line 272 of file ColumnDataReader.cpp.
References PushColumnEntryFromLine().
Referenced by GetValues().
| std::vector< double > ColumnDataReader::GetValues | ( | const std::string & | rVariableName | ) | [virtual] |
Get the entries for a given variable.
| rVariableName |
Implements AbstractDataReader.
Definition at line 176 of file ColumnDataReader.cpp.
References mDataFilename, mNumFixedDimensions, mValues, mVariablesToColumns, and ReadColumnFromFile().
| std::vector< double > ColumnDataReader::GetValues | ( | const std::string & | rVariableName, | |
| int | fixedDimension | |||
| ) | [virtual] |
Get the entries for a given variable with fixed dimension.
| rVariableName | ||
| fixedDimension |
Implements AbstractDataReader.
Definition at line 195 of file ColumnDataReader.cpp.
References FILE_SUFFIX_WIDTH, mDataFilename, mHasUnlimitedDimension, mNumFixedDimensions, mValues, mVariablesToColumns, and ReadValueFromFile().
| std::vector< double > ColumnDataReader::GetUnlimitedDimensionValues | ( | ) |
Get the entries for a given variable with unlimited dimension.
Definition at line 252 of file ColumnDataReader.cpp.
References mAncillaryFilename, mDataFilename, mHasUnlimitedDimension, mNumFixedDimensions, mValues, and ReadColumnFromFile().
| bool ColumnDataReader::HasValues | ( | const std::string & | rVariableName | ) |
Determine whether the data file has entries for a given variable.
| rVariableName |
Definition at line 333 of file ColumnDataReader.cpp.
References mVariablesToColumns.
std::map<std::string, int> ColumnDataReader::mVariablesToColumns [private] |
Map between variable names and data column numbers.
Definition at line 44 of file ColumnDataReader.hpp.
Referenced by ColumnDataReader(), GetValues(), and HasValues().
std::map<std::string, std::string> ColumnDataReader::mVariablesToUnits [private] |
Map between variable names and variable units.
Definition at line 45 of file ColumnDataReader.hpp.
Referenced by ColumnDataReader().
int ColumnDataReader::mNumFixedDimensions [private] |
The number of fixed dimensions in data file.
Definition at line 46 of file ColumnDataReader.hpp.
Referenced by ColumnDataReader(), GetUnlimitedDimensionValues(), and GetValues().
bool ColumnDataReader::mHasUnlimitedDimension [private] |
Whether the data file has an unlimited dimension.
Definition at line 47 of file ColumnDataReader.hpp.
Referenced by ColumnDataReader(), GetUnlimitedDimensionValues(), and GetValues().
int ColumnDataReader::mNumVariables [private] |
The number of variables in the data file.
Definition at line 48 of file ColumnDataReader.hpp.
Referenced by ColumnDataReader().
std::string ColumnDataReader::mInfoFilename [private] |
The name of the info file.
Definition at line 49 of file ColumnDataReader.hpp.
Referenced by ColumnDataReader().
std::string ColumnDataReader::mDataFilename [private] |
The name of the data file.
Definition at line 50 of file ColumnDataReader.hpp.
Referenced by ColumnDataReader(), GetUnlimitedDimensionValues(), and GetValues().
std::string ColumnDataReader::mAncillaryFilename [private] |
The name of the ancillary file.
Definition at line 51 of file ColumnDataReader.hpp.
Referenced by ColumnDataReader(), and GetUnlimitedDimensionValues().
std::vector<double> ColumnDataReader::mValues [private] |
Vector to hold values for a variable.
Definition at line 52 of file ColumnDataReader.hpp.
Referenced by GetUnlimitedDimensionValues(), GetValues(), PushColumnEntryFromLine(), and ReadColumnFromFile().
const int ColumnDataReader::FIELD_WIDTH = 10 [static, private] |
Width of each column in the text file (excludes column headers)
Definition at line 79 of file ColumnDataReader.hpp.
Referenced by PushColumnEntryFromLine().
const int ColumnDataReader::SPACING = 2 [static, private] |
Space between columns (includes minus sign)
Definition at line 80 of file ColumnDataReader.hpp.
Referenced by PushColumnEntryFromLine().
1.5.5