sim_fibo_ad*: print the log messages from the parser/EclipseState

This commit is contained in:
Andreas Lauser 2014-10-03 15:52:57 +02:00
parent 3c97fa0d64
commit 566c7c03d7
2 changed files with 44 additions and 6 deletions

View File

@ -102,10 +102,29 @@ try
double gravity[3] = { 0.0 };
std::string deck_filename = param.get<std::string>("deck_filename");
Opm::ParserPtr newParser(new Opm::Parser() );
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParserLogPtr parserLog(new Opm::ParserLog());
bool strict_parsing = param.getDefault("strict_parsing", true);
Opm::DeckConstPtr deck = newParser->parseFile(deck_filename, strict_parsing);
std::shared_ptr<EclipseState> eclipseState(new EclipseState(deck));
Opm::DeckConstPtr deck;
std::shared_ptr<EclipseState> eclipseState;
try {
deck = parser->parseFile(deck_filename, strict_parsing, parserLog);
EclipseState::checkDeck(deck, parserLog);
eclipseState.reset(new EclipseState(deck, parserLog));
}
catch (const std::invalid_argument& e) {
std::cerr << "error while parsing the deck file: " << e.what() << "\n";
if (parserLog->size() > 0) {
std::cerr << "Issues found while parsing the deck file:\n";
parserLog->printAll(std::cerr);
}
return 1;
}
if (parserLog->size() > 0) {
std::cerr << "Issues found while parsing the deck file:\n";
parserLog->printAll(std::cerr);
}
// Grid init
std::vector<double> porv;

View File

@ -128,10 +128,29 @@ try
double gravity[3] = { 0.0 };
std::string deck_filename = param.get<std::string>("deck_filename");
Opm::ParserPtr newParser(new Opm::Parser() );
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParserLogPtr parserLog(new Opm::ParserLog());
bool strict_parsing = param.getDefault("strict_parsing", true);
Opm::DeckConstPtr deck = newParser->parseFile(deck_filename, strict_parsing);
std::shared_ptr<EclipseState> eclipseState(new EclipseState(deck));
Opm::DeckConstPtr deck;
std::shared_ptr<EclipseState> eclipseState;
try {
deck = parser->parseFile(deck_filename, strict_parsing, parserLog);
EclipseState::checkDeck(deck, parserLog);
eclipseState.reset(new EclipseState(deck, parserLog));
}
catch (const std::invalid_argument& e) {
std::cerr << "error while parsing the deck file: " << e.what() << "\n";
if (parserLog->size() > 0) {
std::cerr << "Issues found while parsing the deck file:\n";
parserLog->printAll(std::cerr);
}
return 1;
}
if (parserLog->size() > 0) {
std::cerr << "Issues found while parsing the deck file:\n";
parserLog->printAll(std::cerr);
}
// Grid init
grid.reset(new Dune::CpGrid());