Added possibility to parse comments in readparam.

This commit is contained in:
Xavier Raynaud 2012-03-26 09:50:47 +02:00
parent 4544000065
commit 5c2cc54ecc
2 changed files with 20 additions and 13 deletions

View File

@ -119,6 +119,11 @@ namespace Opm {
int lineno = 0;
while (samcode_readline(is, parameter)) {
++lineno;
int commentpos = parameter.find(ID_comment);
if (commentpos != 0) {
if (commentpos != int(std::string::npos)) {
parameter = parameter.substr(0, commentpos);
}
int fpos = parameter.find(ID_delimiter_assignment);
if (fpos == int(std::string::npos)) {
std::cerr << "WARNING: No '" << ID_delimiter_assignment << "' found on line " << lineno << ".\n";
@ -133,6 +138,7 @@ namespace Opm {
std::cerr << "WARNING: To many '" << ID_delimiter_assignment << "' found on line " << lineno << ".\n";
}
}
}
#ifdef MATLAB_MEX_FILE
fclose(is);
#endif

View File

@ -63,6 +63,7 @@ namespace Opm {
const std::string ID_path_root = "";
const std::string ID_delimiter_path = "/";
const std::string ID_comment = "//";
const std::string ID_delimiter_assignment = "=";
} // namespace parameter
} // namespace Opm