Parses an input file and extracts parameters. More...
#include <inputOutput.hh>


Public Types | |
| typedef struct yy_buffer_state * | YY_BUFFER_STATE |
| The buffer representing the input file (for the parser) | |
Public Member Functions | |
| InOutParameters & | inputParameters () |
| Returns the input data. | |
| InputParser (bool quiet=false) | |
| Default constructor. | |
| InOutParameters & | outputParameters () |
| Returns the output data. | |
| void | parse () |
| Parses the input file. | |
| void | parse (std::string file) |
| Parses the input file. | |
| virtual | ~InputParser () |
Protected Member Functions | |
| virtual std::ostream & | info (std::ostream &os) const |
| Returns information in an output stream. | |
Private Attributes | |
| YY_BUFFER_STATE | current_buffer_ |
| The current input buffer (for the parser) | |
| InOutParameters | input_ |
| Input data. | |
| InOutParameters | output_ |
| Output data. | |
| bool | quiet_ |
| Suppress output of current time, machine name etc. in the output. | |
Parses an input file and extracts parameters.
The parameters are stored in a separate object in hashes and arrays. Another instance of the same class can be used to store output information.
The output operator writes the date and time in a comment and then content of the input parameters, then "end" and then the content of the output parameters (eg. convergence data). This can be used to generate "unfified" result files where the input data is also present. Advice: put the name of the executable and the command line options in a comment on the first line of the output file.
The format of the input file is the following. Comments are C/C++ style. In an input line, only C-style comments are allowed, the // form is only allowed in otherwise empty lines. An example of an input file:
// Here, it begins
string title "Title of the problem"
double eps 1e-16
bool debug true
array string bc {
0 "(0)"
1 "(x)"
2 "(y)"
}
int iter 10
array string bc {
3 "(x*y)"
}
end
This is ignored"end" marks the end of the input file, everything after it will be ignored. The possible types are string, double, int and bool (also as arrays -- arrays are not allowed to be mixed). An array may be continued (like shown in the example).
The parser is written using a combination of bison(1) and flex(1)
hpFEM2d.cc, hpFEM3d-EV.cc, inputoutput.cc, linearDG1d.cc, and linearFEM1d.cc.
Definition at line 436 of file inputOutput.hh.
| typedef struct yy_buffer_state* concepts::InputParser::YY_BUFFER_STATE |
The buffer representing the input file (for the parser)
Definition at line 460 of file inputOutput.hh.
| concepts::InputParser::InputParser | ( | bool | quiet = false | ) |
Default constructor.
Enters the string parameters title, author and comment into the input field with value "(empty)". These may be overriden by the input file.
| quiet | If set to true, the output of the current time, the machine name etc. in the output of this class is suppressed. |
| virtual concepts::InputParser::~InputParser | ( | ) | [virtual] |
| virtual std::ostream& concepts::InputParser::info | ( | std::ostream & | os | ) | const [protected, virtual] |
Returns information in an output stream.
Reimplemented from concepts::OutputOperator.
| InOutParameters& concepts::InputParser::inputParameters | ( | ) | [inline] |
Returns the input data.
Definition at line 454 of file inputOutput.hh.
| InOutParameters& concepts::InputParser::outputParameters | ( | ) | [inline] |
Returns the output data.
Definition at line 457 of file inputOutput.hh.
| void concepts::InputParser::parse | ( | ) |
Parses the input file.
| void concepts::InputParser::parse | ( | std::string | file | ) |
Parses the input file.
The current input buffer (for the parser)
Definition at line 465 of file inputOutput.hh.
InOutParameters concepts::InputParser::input_ [private] |
Input data.
Definition at line 468 of file inputOutput.hh.
Output data.
Definition at line 471 of file inputOutput.hh.
bool concepts::InputParser::quiet_ [private] |
Suppress output of current time, machine name etc. in the output.
Definition at line 474 of file inputOutput.hh.