chombo-discharge
Functions
DataParser Namespace Reference

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< PointParticlereadPointParticlesASCII (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...
 

Detailed Description

Class for simple data parsing from IO files.

Function Documentation

◆ fractionalFileReadASCII()

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="".

Parameters
[in]a_fileNameInput file name. Must be an ASCII file organized into rows and columns.
[in]a_startReadIdentifier where we start parsing lines into the table
[in]a_stopReadIdentifier where we stop parsing lines into the table
[in]a_xColumnWhich column to use as the x-column.
[in]a_yColumnWhich column to use as the y-column.
[in]a_ignoreCharsCharacters indicating comments in the file. Lines starting with these characters are ignored.

◆ readPointParticlesASCII()

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

Parameters
[in]a_fileNameInput file name. Must be an ASCII file organized into rows and columns.
[in]a_xColumnColumn containing the x-coordinate
[in]a_yColumnColumn containing the y-coordinate
[in]a_zColumnColumn containing the z-coordinate
[in]a_wColumnColumn containing the particle weight
[in]a_ignoreCharsCharacters indicating comments in the file. Lines starting with these characters are ignored.

◆ simpleFileReadASCII()

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.

Parameters
[in]a_fileNameInput file name. Must be an ASCII file organized into rows and columns.
[in]a_xColumnWhich column to use as the x-column.
[in]a_yColumnWhich column to use as the y-column.
[in]a_ignoreCharsCharacters indicating comments in the file. Lines starting with these characters are ignored.
Note
xColumn = 0 is the FIRST column, xColumn=1 is the SECOND column and so on.