chombo-discharge
|
Class for simple data parsing from IO files. More...
Functions | |
LookupTable1D< Real, 1 > | simpleFileReadASCII (const std::string a_fileName, const int a_xColumn=0, const int a_yColumn=1, const std::vector< char > a_ignoreChars={'#', '/'}) |
Simple file parser which reads a file and puts the data into two columns (a lookup table). More... | |
LookupTable1D< Real, 1 > | fractionalFileReadASCII (const std::string a_fileName, const std::string a_startRead, const std::string a_stopRead, const int a_xColumn=0, const int a_yColumn=1, const std::vector< char > a_ignoreChars={'#', '/'}) |
Simple ASCII file parser which reads a file and puts the data into two columns (a lookup table) More... | |
List< PointParticle > | readPointParticlesASCII (const std::string a_fileName, const unsigned int a_xColumn=0, const unsigned int a_yColumn=1, const unsigned int a_zColumn=2, const unsigned int a_wColumn=3, const std::vector< char > a_ignoreChars={'#', '/'}) |
Simple file parser which will read particles (position/weight) from an ASCII file. More... | |
Class for simple data parsing from IO files.
LookupTable1D< Real, 1 > DataParser::fractionalFileReadASCII | ( | const std::string | a_fileName, |
const std::string | a_startRead, | ||
const std::string | a_stopRead, | ||
const int | a_xColumn = 0 , |
||
const int | a_yColumn = 1 , |
||
const std::vector< char > | a_ignoreChars = {'#', '/'} |
||
) |
Simple ASCII file parser which reads a file and puts the data into two columns (a lookup table)
This version can read a partial file. It will ignore all lines until the a_startRead string is encountered. After that, it will read files as usual, skipping lines that begin with comments. Empty lines are NOT skipped, since an empty line typically identifies the end of a field from e.g. BOLSIG outputs. Instead to stop reading when an empty line is encountered, one can use a_stopRead="".
[in] | a_fileName | Input file name. Must be an ASCII file organized into rows and columns. |
[in] | a_startRead | Identifier where we start parsing lines into the table |
[in] | a_stopRead | Identifier where we stop parsing lines into the table |
[in] | a_xColumn | Which column to use as the x-column. |
[in] | a_yColumn | Which column to use as the y-column. |
[in] | a_ignoreChars | Characters indicating comments in the file. Lines starting with these characters are ignored. |
List< PointParticle > DataParser::readPointParticlesASCII | ( | const std::string | a_fileName, |
const unsigned int | a_xColumn = 0 , |
||
const unsigned int | a_yColumn = 1 , |
||
const unsigned int | a_zColumn = 2 , |
||
const unsigned int | a_wColumn = 3 , |
||
const std::vector< char > | a_ignoreChars = {'#', '/'} |
||
) |
Simple file parser which will read particles (position/weight) from an ASCII file.
Particles should be arranged as rows, e.g. in the form x y z w 0.0 0.0 0.0 1
[in] | a_fileName | Input file name. Must be an ASCII file organized into rows and columns. |
[in] | a_xColumn | Column containing the x-coordinate |
[in] | a_yColumn | Column containing the y-coordinate |
[in] | a_zColumn | Column containing the z-coordinate |
[in] | a_wColumn | Column containing the particle weight |
[in] | a_ignoreChars | Characters indicating comments in the file. Lines starting with these characters are ignored. |
LookupTable1D< Real, 1 > DataParser::simpleFileReadASCII | ( | const std::string | a_fileName, |
const int | a_xColumn = 0 , |
||
const int | a_yColumn = 1 , |
||
const std::vector< char > | a_ignoreChars = {'#', '/'} |
||
) |
Simple file parser which reads a file and puts the data into two columns (a lookup table).
This will read ASCII row/column data into a LookupTable1D (which is a simple x-y data structure). The user can specify which columns to use as the x and y coordinates in the LookupTable1D. If the user ask for a column that does not exist in the input file, the data will not be read into the LookupTable1D.
[in] | a_fileName | Input file name. Must be an ASCII file organized into rows and columns. |
[in] | a_xColumn | Which column to use as the x-column. |
[in] | a_yColumn | Which column to use as the y-column. |
[in] | a_ignoreChars | Characters indicating comments in the file. Lines starting with these characters are ignored. |