Addde ParseMode argument to parse and EclipseState

This commit is contained in:
Joakim Hove 2015-08-05 14:18:05 +02:00
parent c86d25a5be
commit 7bd36a6b65
6 changed files with 40 additions and 26 deletions

View File

@ -86,6 +86,7 @@
#include <opm/parser/eclipse/OpmLog/CounterLog.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
@ -212,12 +213,14 @@ try
Opm::OpmLog::addBackend( "COUNTER" , counterLog );
}
Opm::ParseMode parseMode;
Opm::DeckConstPtr deck;
std::shared_ptr<EclipseState> eclipseState;
parseMode.randomSlash = InputError::IGNORE;
try {
deck = parser->parseFile(deck_filename);
deck = parser->parseFile(deck_filename, parseMode);
Opm::checkDeck(deck);
eclipseState.reset(new Opm::EclipseState(deck));
eclipseState.reset(new Opm::EclipseState(deck , parseMode));
}
catch (const std::invalid_argument& e) {
std::cerr << "Failed to create valid ECLIPSESTATE object. See logfile: " << logFile << std::endl;

View File

@ -31,6 +31,7 @@
#include <ert/ecl/ecl_nnc_export.h>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
@ -344,9 +345,10 @@ int main(int argc, char** argv) {
ParserPtr parser(new Parser());
ParseMode parseMode;
std::cout << "Parsing input file ............: " << input_file << std::endl;
DeckConstPtr deck = parser->parseFile(input_file);
std::shared_ptr<EclipseState> state = std::make_shared<EclipseState>( deck );
DeckConstPtr deck = parser->parseFile(input_file, parseMode);
std::shared_ptr<EclipseState> state = std::make_shared<EclipseState>( deck , parseMode );
std::cout << "Loading eclipse INIT file .....: " << init_file << std::endl;
ecl_file_type * ecl_init = ecl_file_open( init_file.c_str() , 0 );

View File

@ -47,6 +47,7 @@
#include <opm/autodiff/SimulatorIncompTwophaseAd.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <boost/filesystem.hpp>
@ -111,8 +112,9 @@ try
double gravity[3] = { 0.0 };
if (use_deck) {
std::string deck_filename = param.get<std::string>("deck_filename");
deck = parser->parseFile(deck_filename);
eclipseState.reset(new EclipseState(deck));
Opm::ParseMode parseMode;
deck = parser->parseFile(deck_filename, parseMode);
eclipseState.reset(new EclipseState(deck , parseMode));
// Grid init
grid.reset(new GridManager(deck));

View File

@ -35,6 +35,7 @@
#include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
@ -45,9 +46,10 @@
struct SetupSimple {
SetupSimple()
{
Opm::ParseMode parseMode;
Opm::ParserPtr parser(new Opm::Parser());
deck = parser->parseFile("fluid.data");
eclState.reset(new Opm::EclipseState(deck));
deck = parser->parseFile("fluid.data", parseMode);
eclState.reset(new Opm::EclipseState(deck , parseMode));
param.disableOutput();
param.insertParameter("init_rock" , "false" );

View File

@ -39,6 +39,7 @@
#include <opm/core/simulator/BlackoilState.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
@ -47,8 +48,9 @@ struct SetupSimple {
SetupSimple()
{
Opm::ParserPtr parser(new Opm::Parser());
deck = parser->parseFile("fluid.data");
eclState.reset(new Opm::EclipseState(deck));
Opm::ParseMode parseMode;
deck = parser->parseFile("fluid.data" , parseMode);
eclState.reset(new Opm::EclipseState(deck , parseMode));
param.disableOutput();
param.insertParameter("init_rock" , "false" );

View File

@ -31,6 +31,7 @@
#include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
@ -158,11 +159,12 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
{
Opm::parameter::ParameterGroup param;
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParseMode parseMode;
/////
// create a DerivedGeology object without any multipliers involved
Opm::DeckConstPtr origDeck = parser->parseString(origDeckString);
Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(origDeck));
Opm::DeckConstPtr origDeck = parser->parseString(origDeckString, parseMode);
Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(origDeck , parseMode));
auto origGridManager = std::make_shared<Opm::GridManager>(origEclipseState->getEclipseGrid());
auto origProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(origDeck, origEclipseState, *(origGridManager->c_grid()));
@ -172,8 +174,8 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
/////
// create a DerivedGeology object _with_ transmissibility multipliers involved
Opm::DeckConstPtr multDeck = parser->parseString(multDeckString);
Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(multDeck));
Opm::DeckConstPtr multDeck = parser->parseString(multDeckString, parseMode);
Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(multDeck, parseMode));
auto multGridManager = std::make_shared<Opm::GridManager>(multEclipseState->getEclipseGrid());
auto multProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multDeck, multEclipseState, *(multGridManager->c_grid()));
@ -184,8 +186,8 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
/////
// create a DerivedGeology object _with_ transmissibility multipliers involved for
// the negative faces
Opm::DeckConstPtr multMinusDeck = parser->parseString(multMinusDeckString);
Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(multMinusDeck));
Opm::DeckConstPtr multMinusDeck = parser->parseString(multMinusDeckString, parseMode);
Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(multMinusDeck , parseMode));
auto multMinusGridManager = std::make_shared<Opm::GridManager>(multMinusEclipseState->getEclipseGrid());
auto multMinusProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multMinusDeck, multMinusEclipseState, *(multMinusGridManager->c_grid()));
@ -195,8 +197,8 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
/////
// create a DerivedGeology object with the NTG keyword involved
Opm::DeckConstPtr ntgDeck = parser->parseString(ntgDeckString);
Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(ntgDeck));
Opm::DeckConstPtr ntgDeck = parser->parseString(ntgDeckString, parseMode);
Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(ntgDeck, parseMode));
auto ntgGridManager = std::make_shared<Opm::GridManager>(ntgEclipseState->getEclipseGrid());
auto ntgProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(ntgDeck, ntgEclipseState, *(ntgGridManager->c_grid()));
@ -272,11 +274,12 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
Opm::parameter::ParameterGroup param;
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParseMode parseMode;
/////
// create a DerivedGeology object without any multipliers involved
Opm::DeckConstPtr origDeck = parser->parseString(origDeckString);
Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(origDeck));
Opm::DeckConstPtr origDeck = parser->parseString(origDeckString , parseMode);
Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(origDeck , parseMode));
auto origGrid = std::make_shared<Dune::CpGrid>();
origGrid->processEclipseFormat(origEclipseState->getEclipseGrid(), 0.0, false);
@ -290,8 +293,8 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
/////
// create a DerivedGeology object _with_ transmissibility multipliers involved
Opm::DeckConstPtr multDeck = parser->parseString(multDeckString);
Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(multDeck));
Opm::DeckConstPtr multDeck = parser->parseString(multDeckString,parseMode);
Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(multDeck, parseMode));
auto multGrid = std::make_shared<Dune::CpGrid>();
multGrid->processEclipseFormat(multEclipseState->getEclipseGrid(), 0.0, false);
@ -304,8 +307,8 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
/////
// create a DerivedGeology object _with_ transmissibility multipliers involved for
// the negative faces
Opm::DeckConstPtr multMinusDeck = parser->parseString(multMinusDeckString);
Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(multMinusDeck));
Opm::DeckConstPtr multMinusDeck = parser->parseString(multMinusDeckString , parseMode);
Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(multMinusDeck, parseMode));
auto multMinusGrid = std::make_shared<Dune::CpGrid>();
multMinusGrid->processEclipseFormat(multMinusEclipseState->getEclipseGrid(), 0.0, false);
@ -318,8 +321,8 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
/////
// create a DerivedGeology object with the NTG keyword involved
Opm::DeckConstPtr ntgDeck = parser->parseString(ntgDeckString);
Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(ntgDeck));
Opm::DeckConstPtr ntgDeck = parser->parseString(ntgDeckString, parseMode);
Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(ntgDeck, parseMode));
auto ntgGrid = std::make_shared<Dune::CpGrid>();
ntgGrid->processEclipseFormat(ntgEclipseState->getEclipseGrid(), 0.0, false);