35 template<
typename ParameterType>
36 void parameterReading(std::vector<std::string> parameters, ParameterType& var,
37 bool defaultAvailable,
bool exitIfMissing,
bool showWarning)
const;
38 void loadFile(
bool loadOK, std::string fName)
const;
39 void readValue(
bool warningsOn, std::string name, std::string fName)
const;
40 void printWarning(std::string name, std::string typeName, std::string value,
41 bool verboseOn,
bool exitIfMissing)
const;
42 template<
typename XMLreaderType>
43 void print(
int indent, XMLreaderType& xmlReader)
const;
69template<
typename ParameterType>
72 bool defaultAvailable,
74 bool showWarning)
const
77 clout <<
"Warning: Cannot read parameter from XML File: ";
78 std::for_each(parameters.begin(), parameters.end(), [
this](
const std::string name_parameter)
79 { clout <<
"<" << name_parameter <<
">"; });
82 if ( exitIfMissing ) {
83 clout <<
"Error: This program cannot continue without ";
84 std::for_each(parameters.begin(), parameters.end(), [
this](
const std::string name_parameter)
85 { clout <<
"<" << name_parameter <<
">"; });
86 clout <<
". Optimization aborted." << std::endl;
89 if (defaultAvailable) {
90 clout <<
"\t Setting default value: " << parameters.back() <<
" = "<< var << std::endl;
93 clout <<
"\t Setting arbitrarily: " << parameters.back() <<
" = " << var << std::endl;
102 clout << std::string(
"Problem processing input XML file ") << fName << std::endl;
109 clout <<
"Warning: cannot read value from node \"" << name <<
"\"" <<
", \"" << fName <<
"\"" << std::endl;
115 std::string value,
bool verboseOn,
bool exitIfMissing)
const
119 clout <<
"Warning: Cannot read " << typeName <<
" value from XML element " << name <<
"." << std::endl;
120 if ( ! value.empty() ) {
121 clout <<
" Setting default value = " << value << std::endl;
124 if ( exitIfMissing ) {
125 clout <<
"Error: This program cannot continue without \"" << name <<
"\". Optimization aborted." << std::endl;
131template<
typename XMLreaderType>
133 std::string indentStr(indent,
' ');
134 clout << indentStr <<
"[" << xmlReader.getName() <<
"]" << std::endl;
135 if (!xmlReader.getText().empty()) {
136 clout << indentStr <<
" " << xmlReader.getText() << std::endl;
138 for (
unsigned int iNode=0; iNode<xmlReader._children.size(); ++iNode) {
139 xmlReader._children[iNode]->_output.print(indent+2,*xmlReader._children[iNode]);
class for marking output with some text
void loadFile(bool loadOK, std::string fName) const
void parameterReading(std::vector< std::string > parameters, ParameterType &var, bool defaultAvailable, bool exitIfMissing, bool showWarning) const
void printWarning(std::string name, std::string typeName, std::string value, bool verboseOn, bool exitIfMissing) const
print warning if verbose mode is on and exit, if exItMissing is true
void print(int indent, XMLreaderType &xmlReader) const
printing the whole structure of the XMLreader
void readValue(bool warningsOn, std::string name, std::string fName) const
XMLreaderOutput(std::ostream &stream)
Top level namespace for all of OpenLB.