Added struct ParseMode to control parse behaviour.
- Introduce a very simple class ParseMode which will become a simple value object which can be used to control the behavior when errors and inconsistencies are encountered in the parse and EclipseState construction phases. - Added ParseMode instance as second argument to all parseXXX() methods.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#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/Schedule/Schedule.hpp>
|
||||
|
||||
@@ -14,7 +15,7 @@
|
||||
int main(int /* argc */, char** argv) {
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
std::string file = argv[1];
|
||||
Opm::DeckConstPtr deck = parser->parseFile(file);
|
||||
Opm::DeckConstPtr deck = parser->parseFile(file, Opm::ParseMode());
|
||||
std::shared_ptr<const Opm::EclipseGrid> grid = std::make_shared<const Opm::EclipseGrid>( deck );
|
||||
Opm::IOConfigPtr ioConfig;
|
||||
Opm::Schedule sched( grid , deck, ioConfig );
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <opm/parser/eclipse/OpmLog/OpmLog.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>
|
||||
|
||||
@@ -67,7 +68,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
std::string file = argv[1];
|
||||
Opm::DeckConstPtr deck = parser->parseFile(file);
|
||||
Opm::DeckConstPtr deck = parser->parseFile(file, Opm::ParseMode());
|
||||
Opm::EclipseState state(deck);
|
||||
|
||||
printDeckDiagnostics(deck, printKeywords);
|
||||
|
||||
@@ -47,7 +47,8 @@ Deck/DeckStringItem.cpp
|
||||
Deck/Section.cpp
|
||||
)
|
||||
|
||||
set( parser_source
|
||||
set( parser_source
|
||||
Parser/ParseMode.cpp
|
||||
Parser/ParserEnums.cpp
|
||||
Parser/ParserKeyword.cpp
|
||||
Parser/Parser.cpp
|
||||
@@ -155,6 +156,8 @@ Parser/ParserIntItem.hpp
|
||||
Parser/ParserFloatItem.hpp
|
||||
Parser/ParserDoubleItem.hpp
|
||||
Parser/ParserStringItem.hpp
|
||||
Parser/InputErrorAction.hpp
|
||||
Parser/ParseMode.hpp
|
||||
#
|
||||
Generator/KeywordLoader.hpp
|
||||
Generator/KeywordGenerator.hpp
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <opm/parser/eclipse/Units/ConversionFactors.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -52,7 +53,7 @@ static Opm::DeckPtr createDeckInvalidArray() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +71,7 @@ static Opm::DeckPtr createDeckInvalidRegion() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +91,7 @@ static Opm::DeckPtr createDeckInvalidValue() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +112,7 @@ static Opm::DeckPtr createDeckUnInitializedRegion() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +133,7 @@ static Opm::DeckPtr createDeckUnInitializedVector() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +165,7 @@ static Opm::DeckPtr createValidIntDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +205,7 @@ static Opm::DeckPtr createValidPERMXDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -53,7 +54,7 @@ static Opm::DeckPtr createDeckInvalidArray1() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
static Opm::DeckPtr createDeckInvalidArray2() {
|
||||
@@ -72,7 +73,7 @@ static Opm::DeckPtr createDeckInvalidArray2() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +93,7 @@ static Opm::DeckPtr createDeckInvalidTypeMismatch() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +114,7 @@ static Opm::DeckPtr createDeckInvalidRegion() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +135,7 @@ static Opm::DeckPtr createDeckUnInitialized() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +164,7 @@ static Opm::DeckPtr createValidIntDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -61,7 +62,7 @@ static Opm::DeckPtr createDeckHeaders() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode());
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +75,7 @@ static Opm::DeckPtr createDeckMissingDIMS() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MissingDimsThrows) {
|
||||
@@ -118,7 +119,7 @@ static Opm::DeckPtr createCPDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +142,7 @@ static Opm::DeckPtr createPinchedCPDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +167,7 @@ static Opm::DeckPtr createMinpvDefaultCPDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +190,7 @@ static Opm::DeckPtr createMinpvCPDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +214,7 @@ static Opm::DeckPtr createMinpvFilCPDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +237,7 @@ static Opm::DeckPtr createCARTDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +260,7 @@ static Opm::DeckPtr createCARTDeckDEPTHZ() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +281,7 @@ static Opm::DeckPtr createCARTInvalidDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CREATE_SIMPLE) {
|
||||
@@ -396,7 +397,7 @@ static Opm::DeckPtr createInvalidDXYZCARTDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -426,7 +427,7 @@ static Opm::DeckPtr createInvalidDXYZCARTDeckDEPTHZ() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -457,7 +458,7 @@ static Opm::DeckPtr createOnlyTopDZCartGrid() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -480,7 +481,7 @@ static Opm::DeckPtr createInvalidDEPTHZDeck1 () {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -509,7 +510,7 @@ static Opm::DeckPtr createInvalidDEPTHZDeck2 () {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDInvalidDEPTHZ2) {
|
||||
@@ -561,7 +562,7 @@ BOOST_AUTO_TEST_CASE(CornerPointSizeMismatchCOORD) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData) ;
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
Opm::DeckKeywordConstPtr zcorn = deck->getKeyword("ZCORN");
|
||||
BOOST_CHECK_EQUAL( 8000U , zcorn->getDataSize( ));
|
||||
|
||||
@@ -586,7 +587,7 @@ BOOST_AUTO_TEST_CASE(CornerPointSizeMismatchZCORN) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData) ;
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
Opm::DeckKeywordConstPtr zcorn = deck->getKeyword("ZCORN");
|
||||
BOOST_CHECK_THROW((void)Opm::EclipseGrid(deck), std::invalid_argument);
|
||||
}
|
||||
@@ -609,7 +610,7 @@ BOOST_AUTO_TEST_CASE(CornerPointSizeMismatchACTNUM) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData) ;
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
BOOST_CHECK_THROW((void)Opm::EclipseGrid( deck ) , std::invalid_argument);
|
||||
}
|
||||
|
||||
@@ -630,7 +631,7 @@ BOOST_AUTO_TEST_CASE(ResetACTNUM) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData) ;
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
|
||||
Opm::EclipseGrid grid(deck);
|
||||
BOOST_CHECK_EQUAL( 1000U , grid.getNumActive());
|
||||
@@ -665,7 +666,7 @@ BOOST_AUTO_TEST_CASE(Fwrite) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData) ;
|
||||
Opm::DeckConstPtr deck = parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
Opm::EclipseGrid grid1(deck );
|
||||
|
||||
grid1.fwriteEGRID( "TEST.EGRID" , true);
|
||||
@@ -694,7 +695,7 @@ BOOST_AUTO_TEST_CASE(ConstructorNORUNSPEC) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck1 = parser->parseString(deckData) ;
|
||||
Opm::DeckConstPtr deck1 = parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
Opm::DeckConstPtr deck2 = createCPDeck();
|
||||
|
||||
Opm::EclipseGrid grid1(deck1);
|
||||
@@ -718,7 +719,7 @@ BOOST_AUTO_TEST_CASE(ConstructorNoSections) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck1 = parser->parseString(deckData) ;
|
||||
Opm::DeckConstPtr deck1 = parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
Opm::DeckConstPtr deck2 = createCPDeck();
|
||||
|
||||
Opm::EclipseGrid grid1(deck1);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -51,7 +52,7 @@ static Opm::DeckPtr createDeckInvalidArray() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +70,7 @@ static Opm::DeckPtr createDeckInvalidRegion() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +88,7 @@ static Opm::DeckPtr createDeckInvalidValue() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +107,7 @@ static Opm::DeckPtr createDeckUnInitialized() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +142,7 @@ static Opm::DeckPtr createValidIntDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +184,7 @@ static Opm::DeckPtr createValidPERMXDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <ert/ecl/EclKW.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -101,7 +102,7 @@ Opm::DeckKeywordConstPtr createSATNUMKeyword( ) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckPtr deck = parser->parseString(deckData);
|
||||
Opm::DeckPtr deck = parser->parseString(deckData, Opm::ParseMode());
|
||||
return deck->getKeyword("SATNUM");
|
||||
}
|
||||
|
||||
@@ -112,7 +113,7 @@ Opm::DeckKeywordConstPtr createTABDIMSKeyword( ) {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckPtr deck = parser->parseString(deckData);
|
||||
Opm::DeckPtr deck = parser->parseString(deckData, Opm::ParseMode());
|
||||
return deck->getKeyword("TABDIMS");
|
||||
}
|
||||
|
||||
@@ -351,7 +352,7 @@ BOOST_AUTO_TEST_CASE(GridPropertyInitialization) {
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
|
||||
auto deck = parser->parseString(deckString);
|
||||
auto deck = parser->parseString(deckString, Opm::ParseMode());
|
||||
|
||||
auto eclipseState = std::make_shared<Opm::EclipseState>(deck);
|
||||
|
||||
@@ -426,7 +427,7 @@ static Opm::DeckPtr createDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -92,7 +93,7 @@ static Opm::DeckPtr createInvalidMULTREGTDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +162,7 @@ static Opm::DeckPtr createNotSupportedMULTREGTDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +227,7 @@ static Opm::DeckPtr createCopyMULTNUMDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -51,7 +52,7 @@ static Opm::DeckPtr createDeckInvalidArray() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +73,7 @@ static Opm::DeckPtr createDeckInvalidRegion() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +94,7 @@ static Opm::DeckPtr createDeckInvalidValue() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +115,7 @@ static Opm::DeckPtr createDeckMissingVector() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +134,7 @@ static Opm::DeckPtr createDeckUnInitialized() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +170,7 @@ static Opm::DeckPtr createValidIntDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -55,7 +56,7 @@ static Opm::DeckPtr createCARTDeck() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +84,7 @@ static Opm::DeckPtr createDeckWithPORO() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +115,7 @@ static Opm::DeckPtr createDeckWithPORVPORO() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +155,7 @@ static Opm::DeckPtr createDeckWithMULTPV() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +187,7 @@ static Opm::DeckPtr createDeckWithBOXPORV() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +222,7 @@ static Opm::DeckPtr createDeckWithNTG() {
|
||||
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(PORV_cartesianDeck) {
|
||||
@@ -335,7 +336,7 @@ static Opm::DeckPtr createDeckNakedGRID() {
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, Opm::ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <boost/test/unit_test.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/EclipseState/IOConfig/IOConfig.hpp>
|
||||
|
||||
@@ -82,7 +83,7 @@ const std::string& deckStr4 = "RUNSPEC\n"
|
||||
|
||||
static DeckPtr createDeck(const std::string& input) {
|
||||
Opm::Parser parser;
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, Opm::ParseMode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ const std::string& deckStr4 =
|
||||
|
||||
static DeckPtr createDeck(const std::string& input) {
|
||||
Opm::Parser parser;
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, Opm::ParseMode());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(InitConfigTest) {
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckStringItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
@@ -42,7 +43,7 @@ static DeckPtr createDeck() {
|
||||
"SCHEDULE\n"
|
||||
"\n";
|
||||
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, ParseMode());
|
||||
}
|
||||
|
||||
static DeckPtr createDeckWithWells() {
|
||||
@@ -66,7 +67,7 @@ static DeckPtr createDeckWithWells() {
|
||||
" \'W_3\' \'OP\' 20 51 3.92 \'OIL\' 7* / \n"
|
||||
"/\n";
|
||||
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, ParseMode());
|
||||
}
|
||||
|
||||
static DeckPtr createDeckWithWellsOrdered() {
|
||||
@@ -81,7 +82,7 @@ static DeckPtr createDeckWithWellsOrdered() {
|
||||
" \'AW_3\' \'OP\' 20 51 3.92 \'OIL\' 7* / \n"
|
||||
"/\n";
|
||||
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, ParseMode());
|
||||
}
|
||||
|
||||
static DeckPtr createDeckWithWellsAndCompletionData() {
|
||||
@@ -115,7 +116,7 @@ static DeckPtr createDeckWithWellsAndCompletionData() {
|
||||
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||
"/\n";
|
||||
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, ParseMode());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateScheduleDeckMissingReturnsDefaults) {
|
||||
@@ -332,7 +333,7 @@ static DeckPtr createDeckWithWellsAndCompletionDataWithWELOPEN() {
|
||||
" 'OP_1' SHUT 0 0 0 0 0 / \n "
|
||||
"/\n";
|
||||
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, ParseMode());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndCompletionDataWithWELOPEN) {
|
||||
@@ -442,7 +443,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_TryToOpenWellWithShutCompleti
|
||||
"/\n";
|
||||
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,10);
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
IOConfigPtr ioConfig;
|
||||
Schedule schedule(grid , deck, ioConfig);
|
||||
WellPtr well;
|
||||
@@ -484,7 +485,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithCOMPLUMPwithC1_ThrowsExcpetion) {
|
||||
"/\n";
|
||||
|
||||
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
IOConfigPtr ioConfig;
|
||||
BOOST_CHECK_THROW(Schedule schedule(grid , deck, ioConfig), std::exception);
|
||||
@@ -521,7 +522,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithCOMPLUMPwithC1andC2_ThrowsExcpetion)
|
||||
"/\n";
|
||||
|
||||
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
IOConfigPtr ioConfig;
|
||||
BOOST_CHECK_THROW(Schedule schedule(grid , deck, ioConfig), std::exception);
|
||||
@@ -558,7 +559,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithCOMPLUMPwithC2_ThrowsExcpetion) {
|
||||
"/\n";
|
||||
|
||||
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
IOConfigPtr ioConfig;
|
||||
BOOST_CHECK_THROW(Schedule schedule(grid , deck, ioConfig), std::exception);
|
||||
@@ -595,7 +596,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithCOMPLUMPwithDefaultValuesInWELOPEN) {
|
||||
"/\n";
|
||||
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
IOConfigPtr ioConfig;
|
||||
Schedule schedule(grid , deck, ioConfig);
|
||||
WellPtr well;
|
||||
@@ -637,7 +638,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFT) {
|
||||
"/\n";
|
||||
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
IOConfigPtr ioConfig;
|
||||
Schedule schedule(grid , deck, ioConfig);
|
||||
WellPtr well;
|
||||
@@ -698,7 +699,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFTPLT) {
|
||||
"/\n";
|
||||
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
IOConfigPtr ioConfig;
|
||||
Schedule schedule(grid , deck, ioConfig);
|
||||
WellPtr well;
|
||||
@@ -745,7 +746,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArg) {
|
||||
" OP_1 GUID 2300.14 /\n"
|
||||
"/\n";
|
||||
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
IOConfigPtr ioConfig;
|
||||
Schedule schedule(grid , deck, ioConfig);
|
||||
@@ -782,7 +783,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArgException) {
|
||||
" OP_1 RESV 1801.05 /\n"
|
||||
"/\n";
|
||||
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
IOConfigPtr ioConfig;
|
||||
|
||||
@@ -797,7 +798,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArgException2) {
|
||||
" OP_1 RESV 1801.05 /\n"
|
||||
"/\n";
|
||||
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
IOConfigPtr ioConfig;
|
||||
|
||||
@@ -874,7 +875,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithRPTRST) {
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
Opm::Parser parser;
|
||||
|
||||
DeckPtr deck = parser.parseString(deckData);
|
||||
DeckPtr deck = parser.parseString(deckData, ParseMode());
|
||||
IOConfigPtr ioConfig = std::make_shared<IOConfig>();
|
||||
Schedule schedule(grid , deck, ioConfig);
|
||||
|
||||
@@ -883,7 +884,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithRPTRST) {
|
||||
BOOST_CHECK_EQUAL(true, ioConfig->getWriteRestartFile(2));
|
||||
|
||||
|
||||
DeckPtr deck2 = parser.parseString(deckData2) ;
|
||||
DeckPtr deck2 = parser.parseString(deckData2, ParseMode()) ;
|
||||
IOConfigPtr ioConfig2 = std::make_shared<IOConfig>();
|
||||
Schedule schedule2(grid , deck2, ioConfig2);
|
||||
|
||||
@@ -985,7 +986,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithRPTSCHED) {
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
Opm::Parser parser;
|
||||
|
||||
DeckPtr deck = parser.parseString(deckData);
|
||||
DeckPtr deck = parser.parseString(deckData, ParseMode());
|
||||
IOConfigPtr ioConfig = std::make_shared<IOConfig>();
|
||||
Schedule schedule(grid , deck, ioConfig);
|
||||
|
||||
@@ -995,7 +996,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithRPTSCHED) {
|
||||
BOOST_CHECK_EQUAL(true, ioConfig->getWriteRestartFile(3));
|
||||
|
||||
|
||||
DeckPtr deck1 = parser.parseString(deckData1);
|
||||
DeckPtr deck1 = parser.parseString(deckData1, ParseMode());
|
||||
IOConfigPtr ioConfig1 = std::make_shared<IOConfig>();
|
||||
Schedule schedule1(grid , deck1, ioConfig1);
|
||||
|
||||
@@ -1007,7 +1008,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithRPTSCHED) {
|
||||
|
||||
//Older ECLIPSE 100 data set may use integer controls instead of mnemonics
|
||||
|
||||
DeckPtr deck2 = parser.parseString(deckData2) ;
|
||||
DeckPtr deck2 = parser.parseString(deckData2, ParseMode()) ;
|
||||
IOConfigPtr ioConfig2 = std::make_shared<IOConfig>();
|
||||
Schedule schedule2(grid , deck2, ioConfig2);
|
||||
|
||||
@@ -1048,7 +1049,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithRPTSCHEDandRPTRST) {
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10 , 10 , 10 );
|
||||
Opm::Parser parser;
|
||||
|
||||
DeckPtr deck = parser.parseString(deckData);
|
||||
DeckPtr deck = parser.parseString(deckData, ParseMode());
|
||||
IOConfigPtr ioConfig = std::make_shared<IOConfig>();
|
||||
Schedule schedule(grid , deck, ioConfig);
|
||||
|
||||
@@ -1111,7 +1112,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
|
||||
"/\n";
|
||||
|
||||
|
||||
DeckPtr deck = parser.parseString(input);
|
||||
DeckPtr deck = parser.parseString(input, ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10, 10, 10);
|
||||
IOConfigPtr ioConfig;
|
||||
Schedule schedule(grid, deck, ioConfig);
|
||||
|
||||
@@ -230,7 +230,7 @@ BOOST_AUTO_TEST_CASE(TimeStepsCorrect) {
|
||||
" 6 7 /\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser(/*addDefault=*/true));
|
||||
Opm::DeckPtr deck = parser->parseString(deckData);
|
||||
Opm::DeckPtr deck = parser->parseString(deckData, Opm::ParseMode());
|
||||
Opm::TimeMap tmap(deck);
|
||||
|
||||
BOOST_CHECK_EQUAL(tmap.getStartTime(/*timeLevelIdx=*/0),
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
|
||||
#include <opm/parser/eclipse/Units/ConversionFactors.hpp>
|
||||
@@ -58,7 +59,7 @@ const std::string& deckStr = "START\n"
|
||||
|
||||
static DeckPtr createDeck(const std::string& input) {
|
||||
Opm::Parser parser;
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, ParseMode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
|
||||
@@ -85,7 +86,7 @@ namespace {
|
||||
Opm::WellProductionProperties properties(const std::string& input) {
|
||||
Opm::Parser parser;
|
||||
|
||||
Opm::DeckPtr deck = parser.parseString(input);
|
||||
Opm::DeckPtr deck = parser.parseString(input, Opm::ParseMode());
|
||||
Opm::DeckRecordConstPtr record = deck->getKeyword("WCONHIST")->getRecord(0);
|
||||
|
||||
return Opm::WellProductionProperties::history(record);
|
||||
@@ -109,7 +110,7 @@ namespace {
|
||||
{
|
||||
Opm::Parser parser;
|
||||
|
||||
Opm::DeckPtr deck = parser.parseString(input);
|
||||
Opm::DeckPtr deck = parser.parseString(input, Opm::ParseMode());
|
||||
Opm::DeckKeywordConstPtr kwd = deck->getKeyword("WCONHIST");
|
||||
Opm::DeckRecordConstPtr record = kwd->getRecord(0);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <boost/filesystem.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/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
|
||||
@@ -54,7 +55,7 @@ const std::string& inputStr = "RUNSPEC\n"
|
||||
|
||||
static DeckPtr createDeck(const std::string& input) {
|
||||
Opm::Parser parser;
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, ParseMode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
|
||||
|
||||
@@ -117,7 +118,7 @@ const std::string& inputStrMissingData = "RUNSPEC\n"
|
||||
|
||||
static DeckPtr createDeck(const std::string& input) {
|
||||
Opm::Parser parser;
|
||||
return parser.parseString(input);
|
||||
return parser.parseString(input, ParseMode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
// generic table classes
|
||||
@@ -53,7 +54,7 @@ BOOST_AUTO_TEST_CASE(CreateSingleRecordTable) {
|
||||
" 9 10 11 12 /\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData, Opm::ParseMode()));
|
||||
|
||||
std::vector<std::string> tooFewColumnNames{"A", "B", "C"};
|
||||
std::vector<std::string> justRightColumnNames{"A", "B", "C", "D"};
|
||||
@@ -94,7 +95,7 @@ BOOST_AUTO_TEST_CASE(CreateMultiTable) {
|
||||
"/\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData, Opm::ParseMode()));
|
||||
|
||||
std::vector<std::string> tooFewColumnNames{"A", "B", "C"};
|
||||
std::vector<std::string> justRightColumnNames{"A", "B", "C", "D"};
|
||||
@@ -135,7 +136,7 @@ BOOST_AUTO_TEST_CASE(SwofTable_Tests) {
|
||||
" 17 18 19 20/\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr swofKeyword = deck->getKeyword("SWOF");
|
||||
|
||||
BOOST_CHECK_EQUAL(Opm::SwofTable::numTables(swofKeyword), 2);
|
||||
@@ -183,7 +184,7 @@ BOOST_AUTO_TEST_CASE(SgofTable_Tests) {
|
||||
" 17 18 19 20/\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr sgofKeyword = deck->getKeyword("SGOF");
|
||||
|
||||
BOOST_CHECK_EQUAL(Opm::SgofTable::numTables(sgofKeyword), 2);
|
||||
@@ -235,7 +236,7 @@ BOOST_AUTO_TEST_CASE(PlyadsTable_Tests) {
|
||||
"2.00 0.000030\n"
|
||||
"3.00 0.000030 /\n";
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(correctDeckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(correctDeckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr plyadsKeyword = deck->getKeyword("PLYADS");
|
||||
|
||||
BOOST_CHECK_EQUAL(Opm::PlyadsTable::numTables(plyadsKeyword), 1);
|
||||
@@ -267,7 +268,7 @@ BOOST_AUTO_TEST_CASE(PlyadsTable_Tests) {
|
||||
"2.00 0.000030\n"
|
||||
"3.00 0.000030 /\n";
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(incorrectDeckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(incorrectDeckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr plyadsKeyword = deck->getKeyword("PLYADS");
|
||||
|
||||
BOOST_CHECK_EQUAL(Opm::PlyadsTable::numTables(plyadsKeyword), 1);
|
||||
@@ -293,7 +294,7 @@ BOOST_AUTO_TEST_CASE(PlyadsTable_Tests) {
|
||||
"2.00 0.000030\n"
|
||||
"3.00 0.000029 /\n";
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(incorrectDeckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(incorrectDeckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr plyadsKeyword = deck->getKeyword("PLYADS");
|
||||
|
||||
BOOST_CHECK_EQUAL(Opm::PlyadsTable::numTables(plyadsKeyword), 1);
|
||||
@@ -320,7 +321,7 @@ BOOST_AUTO_TEST_CASE(PvtoTable_Tests) {
|
||||
"/\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr pvtoKeyword = deck->getKeyword("PVTO");
|
||||
|
||||
BOOST_CHECK_EQUAL(Opm::PvtoTable::numTables(pvtoKeyword), 2);
|
||||
@@ -397,7 +398,7 @@ VFPPROD \n\
|
||||
2 2 2 2 46.5 47.5 48.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPPROD");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
|
||||
@@ -524,7 +525,7 @@ VFPPROD \n\
|
||||
1 1 1 1 1.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPPROD");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
|
||||
@@ -636,7 +637,7 @@ VFPPROD \n\
|
||||
1 1 1 1 1.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_values));
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_values, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPPROD");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPPROD"), 1);
|
||||
@@ -673,7 +674,7 @@ VFPPROD \n\
|
||||
1 1 1 1 1.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_values));
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_values, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPPROD");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPPROD"), 1);
|
||||
@@ -708,7 +709,7 @@ VFPPROD \n\
|
||||
1 1 1 1 1.5 2.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_metadata));
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_metadata, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPPROD");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPPROD"), 1);
|
||||
@@ -744,7 +745,7 @@ VFPPROD \n\
|
||||
1 1 1 1 1.5 2.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(wrong_metadata));
|
||||
Opm::DeckConstPtr deck(parser->parseString(wrong_metadata, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPPROD");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPPROD"), 1);
|
||||
@@ -779,7 +780,7 @@ VFPPROD \n\
|
||||
1 1 1 1 1.5 2.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_axes));
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_axes, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPPROD");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPPROD"), 1);
|
||||
@@ -812,7 +813,7 @@ VFPINJ \n\
|
||||
2 4.5 5.5 6.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData));
|
||||
Opm::DeckConstPtr deck(parser->parseString(deckData, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpprodKeyword = deck->getKeyword("VFPINJ");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
|
||||
@@ -906,7 +907,7 @@ VFPINJ \n\
|
||||
2 4.5 5.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_values));
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_values, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
|
||||
@@ -937,7 +938,7 @@ VFPINJ \n\
|
||||
1 1.5 2.5 3.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_values));
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_values, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
|
||||
@@ -967,7 +968,7 @@ VFPINJ \n\
|
||||
2 4.5 5.5 6.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_metadata));
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_metadata, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
|
||||
@@ -998,7 +999,7 @@ VFPINJ \n\
|
||||
2 4.5 5.5 6.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(wrong_metadata));
|
||||
Opm::DeckConstPtr deck(parser->parseString(wrong_metadata, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
|
||||
@@ -1028,7 +1029,7 @@ VFPINJ \n\
|
||||
2 4.5 5.5 6.5 / \n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser);
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_axes));
|
||||
Opm::DeckConstPtr deck(parser->parseString(missing_axes, Opm::ParseMode()));
|
||||
Opm::DeckKeywordConstPtr vfpinjKeyword = deck->getKeyword("VFPINJ");
|
||||
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
|
||||
BOOST_CHECK_EQUAL(deck->numKeywords("VFPINJ"), 1);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/Units/ConversionFactors.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckStringItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -82,7 +83,7 @@ static DeckPtr createDeckTOP() {
|
||||
"\n";
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +143,7 @@ static DeckPtr createDeck() {
|
||||
"\n";
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +171,7 @@ static DeckPtr createDeckNoFaults() {
|
||||
"\n";
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +209,7 @@ static DeckPtr createDeckSimConfig() {
|
||||
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(inputStr) ;
|
||||
return parser->parseString(inputStr, ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -367,7 +368,7 @@ static DeckPtr createDeckNoGridOpts() {
|
||||
" 1000*1 /\n";
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +387,7 @@ static DeckPtr createDeckWithGridOpts() {
|
||||
" 1000*1 /\n";
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
return parser->parseString(deckData, ParseMode()) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -440,7 +441,7 @@ BOOST_AUTO_TEST_CASE(TestIOConfigCreation) {
|
||||
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
DeckPtr deck = parser->parseString(deckData) ;
|
||||
DeckPtr deck = parser->parseString(deckData, ParseMode()) ;
|
||||
EclipseState state(deck);
|
||||
|
||||
IOConfigConstPtr ioConfig = state.getIOConfigConst();
|
||||
@@ -487,7 +488,7 @@ BOOST_AUTO_TEST_CASE(TestIOConfigCreationWithSolutionRPTRST) {
|
||||
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
DeckPtr deck = parser->parseString(deckData) ;
|
||||
DeckPtr deck = parser->parseString(deckData, ParseMode()) ;
|
||||
EclipseState state(deck);
|
||||
|
||||
IOConfigConstPtr ioConfig = state.getIOConfigConst();
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#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/EclipseState.hpp>
|
||||
|
||||
|
||||
@@ -34,7 +35,7 @@ EclipseState makeState(const std::string& fileName);
|
||||
EclipseState makeState(const std::string& fileName) {
|
||||
ParserPtr parser(new Parser( ));
|
||||
boost::filesystem::path boxFile(fileName);
|
||||
DeckPtr deck = parser->parseFile(boxFile.string());
|
||||
DeckPtr deck = parser->parseFile(boxFile.string(), ParseMode());
|
||||
EclipseState state(deck);
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <boost/test/test_tools.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>
|
||||
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
|
||||
@@ -49,7 +50,7 @@ BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
|
||||
"SOLUTION\n"
|
||||
"SCHEDULE\n";
|
||||
|
||||
auto deck = parser->parseString(correctDeckString);
|
||||
auto deck = parser->parseString(correctDeckString, Opm::ParseMode());
|
||||
BOOST_CHECK(Opm::checkDeck(deck));
|
||||
}
|
||||
|
||||
@@ -62,7 +63,7 @@ BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
|
||||
"SOLUTION\n"
|
||||
"SCHEDULE\n";
|
||||
|
||||
auto deck = parser->parseString(correctDeckString);
|
||||
auto deck = parser->parseString(correctDeckString, Opm::ParseMode());
|
||||
BOOST_CHECK(!Opm::checkDeck(deck));
|
||||
BOOST_CHECK(Opm::checkDeck(deck, ~Opm::SectionTopology));
|
||||
}
|
||||
@@ -88,7 +89,7 @@ BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
|
||||
"SOLUTION\n"
|
||||
"SCHEDULE\n";
|
||||
|
||||
auto deck = parser->parseString(incorrectDeckString);
|
||||
auto deck = parser->parseString(incorrectDeckString, Opm::ParseMode());
|
||||
BOOST_CHECK(!Opm::checkDeck(deck));
|
||||
|
||||
// this is supposed to succeed as we don't ensure that all keywords are in the
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Completion.hpp>
|
||||
|
||||
@@ -41,7 +42,7 @@ BOOST_AUTO_TEST_CASE( CreateCompletionsFromRecord ) {
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_COMPDAT1");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr COMPDAT1 = deck->getKeyword("COMPDAT" , 0);
|
||||
DeckRecordConstPtr line0 = COMPDAT1->getRecord(0);
|
||||
DeckRecordConstPtr line1 = COMPDAT1->getRecord(1);
|
||||
@@ -87,7 +88,7 @@ BOOST_AUTO_TEST_CASE( CreateCompletionsFromKeyword ) {
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_COMPDAT1");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr COMPDAT1 = deck->getKeyword("COMPDAT" , 1);
|
||||
|
||||
std::map< std::string , std::vector<CompletionPtr> > completions = Completion::completionsFromCOMPDATKeyword( COMPDAT1 );
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
@@ -35,7 +36,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE(CreateCPGrid) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT.DATA");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<EclipseGrid> grid(new EclipseGrid( deck ));
|
||||
|
||||
BOOST_CHECK_EQUAL( 10U , grid->getNX( ));
|
||||
@@ -48,7 +49,7 @@ BOOST_AUTO_TEST_CASE(CreateCPGrid) {
|
||||
BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT_ACTNUM.DATA");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<EclipseGrid> grid(new EclipseGrid( deck ));
|
||||
|
||||
BOOST_CHECK_EQUAL( 10U , grid->getNX( ));
|
||||
@@ -61,7 +62,7 @@ BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) {
|
||||
BOOST_AUTO_TEST_CASE(ExportFromCPGridAllActive) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT.DATA");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
|
||||
std::shared_ptr<EclipseGrid> grid(new EclipseGrid( deck ));
|
||||
|
||||
@@ -78,7 +79,7 @@ BOOST_AUTO_TEST_CASE(ExportFromCPGridAllActive) {
|
||||
BOOST_AUTO_TEST_CASE(ExportFromCPGridACTNUM) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT_ACTNUM.DATA");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
|
||||
std::shared_ptr<EclipseGrid> grid(new EclipseGrid( deck ));
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -149,7 +150,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckReturned) {
|
||||
path datafile;
|
||||
ParserPtr parser(new Parser());
|
||||
createDeckWithInclude (datafile, "");
|
||||
DeckConstPtr deck = parser->parseFile(datafile.string());
|
||||
DeckConstPtr deck = parser->parseFile(datafile.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK( deck->hasKeyword("START"));
|
||||
BOOST_CHECK( deck->hasKeyword("DIMENS"));
|
||||
@@ -160,7 +161,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithENDINCKeyword_deckReturned) {
|
||||
path datafile;
|
||||
ParserPtr parser(new Parser());
|
||||
createDeckWithInclude (datafile, "ENDINC");
|
||||
DeckConstPtr deck = parser->parseFile(datafile.string());
|
||||
DeckConstPtr deck = parser->parseFile(datafile.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK( deck->hasKeyword("START"));
|
||||
BOOST_CHECK( !deck->hasKeyword("DIMENS"));
|
||||
@@ -171,7 +172,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithENDKeyword_deckReturned) {
|
||||
path datafile;
|
||||
ParserPtr parser(new Parser());
|
||||
createDeckWithInclude (datafile, "END");
|
||||
DeckConstPtr deck = parser->parseFile(datafile.string());
|
||||
DeckConstPtr deck = parser->parseFile(datafile.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK( deck->hasKeyword("START"));
|
||||
BOOST_CHECK( !deck->hasKeyword("DIMENS"));
|
||||
@@ -182,7 +183,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithPathsKeyword_IncludeExtendsPath) {
|
||||
path datafile;
|
||||
ParserPtr parser(new Parser());
|
||||
createDeckWithInclude (datafile, "");
|
||||
DeckConstPtr deck = parser->parseFile(datafile.string());
|
||||
DeckConstPtr deck = parser->parseFile(datafile.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK( deck->hasKeyword("TITLE"));
|
||||
BOOST_CHECK( deck->hasKeyword("BOX"));
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -66,7 +67,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckReturned) {
|
||||
ParserPtr parser = createWWCTParser();
|
||||
BOOST_CHECK( parser->isRecognizedKeyword("WWCT"));
|
||||
BOOST_CHECK( parser->isRecognizedKeyword("SUMMARY"));
|
||||
BOOST_CHECK_NO_THROW( parser->parseFile(singleKeywordFile.string()) );
|
||||
BOOST_CHECK_NO_THROW( parser->parseFile(singleKeywordFile.string(), ParseMode()) );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_stringWithWWCTKeyword_deckReturned) {
|
||||
@@ -80,7 +81,7 @@ BOOST_AUTO_TEST_CASE(parse_stringWithWWCTKeyword_deckReturned) {
|
||||
ParserPtr parser = createWWCTParser();
|
||||
BOOST_CHECK( parser->isRecognizedKeyword("WWCT"));
|
||||
BOOST_CHECK( parser->isRecognizedKeyword("SUMMARY"));
|
||||
BOOST_CHECK_NO_THROW(DeckPtr deck = parser->parseString(wwctString));
|
||||
BOOST_CHECK_NO_THROW(DeckPtr deck = parser->parseString(wwctString, ParseMode()));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_streamWithWWCTKeyword_deckReturned) {
|
||||
@@ -95,13 +96,13 @@ BOOST_AUTO_TEST_CASE(parse_streamWithWWCTKeyword_deckReturned) {
|
||||
ParserPtr parser = createWWCTParser();
|
||||
BOOST_CHECK( parser->isRecognizedKeyword("WWCT"));
|
||||
BOOST_CHECK( parser->isRecognizedKeyword("SUMMARY"));
|
||||
BOOST_CHECK_NO_THROW(DeckPtr deck = parser->parseStream(wwctStream));
|
||||
BOOST_CHECK_NO_THROW(DeckPtr deck = parser->parseStream(wwctStream, ParseMode()));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckHasWWCT) {
|
||||
boost::filesystem::path singleKeywordFile("testdata/integration_tests/wwct.data");
|
||||
ParserPtr parser = createWWCTParser();
|
||||
DeckPtr deck = parser->parseFile(singleKeywordFile.string());
|
||||
DeckPtr deck = parser->parseFile(singleKeywordFile.string(), ParseMode());
|
||||
BOOST_CHECK(deck->hasKeyword("SUMMARY"));
|
||||
BOOST_CHECK(deck->hasKeyword("WWCT"));
|
||||
}
|
||||
@@ -109,7 +110,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckHasWWCT) {
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_dataIsCorrect) {
|
||||
boost::filesystem::path singleKeywordFile("testdata/integration_tests/wwct.data");
|
||||
ParserPtr parser = createWWCTParser();
|
||||
DeckPtr deck = parser->parseFile(singleKeywordFile.string());
|
||||
DeckPtr deck = parser->parseFile(singleKeywordFile.string(), ParseMode());
|
||||
BOOST_CHECK_EQUAL("WELL-1", deck->getKeyword("WWCT" , 0)->getRecord(0)->getItem(0)->getString(0));
|
||||
BOOST_CHECK_EQUAL("WELL-2", deck->getKeyword("WWCT" , 0)->getRecord(0)->getItem(0)->getString(1));
|
||||
}
|
||||
@@ -157,14 +158,14 @@ BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_deckReturned) {
|
||||
boost::filesystem::path singleKeywordFile("testdata/integration_tests/bpr.data");
|
||||
ParserPtr parser = createBPRParser();
|
||||
|
||||
BOOST_CHECK_NO_THROW(parser->parseFile(singleKeywordFile.string()));
|
||||
BOOST_CHECK_NO_THROW(parser->parseFile(singleKeywordFile.string(), ParseMode()));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_DeckhasBRP) {
|
||||
boost::filesystem::path singleKeywordFile("testdata/integration_tests/bpr.data");
|
||||
|
||||
ParserPtr parser = createBPRParser();
|
||||
DeckPtr deck = parser->parseFile(singleKeywordFile.string());
|
||||
DeckPtr deck = parser->parseFile(singleKeywordFile.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK_EQUAL(true, deck->hasKeyword("BPR"));
|
||||
}
|
||||
@@ -173,7 +174,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_dataiscorrect) {
|
||||
boost::filesystem::path singleKeywordFile("testdata/integration_tests/bpr.data");
|
||||
|
||||
ParserPtr parser = createBPRParser();
|
||||
DeckPtr deck = parser->parseFile(singleKeywordFile.string());
|
||||
DeckPtr deck = parser->parseFile(singleKeywordFile.string(), ParseMode());
|
||||
|
||||
DeckKeywordConstPtr keyword = deck->getKeyword("BPR" , 0);
|
||||
BOOST_CHECK_EQUAL(2U, keyword->size());
|
||||
@@ -220,7 +221,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_dataiscorrect) {
|
||||
/***************** Testing non-recognized keywords ********************/
|
||||
BOOST_AUTO_TEST_CASE(parse_unknownkeyword_exceptionthrown) {
|
||||
ParserPtr parser(new Parser());
|
||||
BOOST_CHECK_THROW( parser->parseFile("testdata/integration_tests/someobscureelements.data"), std::invalid_argument);
|
||||
BOOST_CHECK_THROW( parser->parseFile("testdata/integration_tests/someobscureelements.data", ParseMode()), std::invalid_argument);
|
||||
}
|
||||
|
||||
/*********************Testing truncated (default) records ***************************/
|
||||
@@ -229,7 +230,7 @@ BOOST_AUTO_TEST_CASE(parse_unknownkeyword_exceptionthrown) {
|
||||
// Datafile contains 3 RADFIN4 keywords. One fully specified, one with 2 out of 11 items, and one with no items.
|
||||
BOOST_AUTO_TEST_CASE(parse_truncatedrecords_deckFilledWithDefaults) {
|
||||
ParserPtr parser(new Parser());
|
||||
DeckPtr deck = parser->parseFile("testdata/integration_tests/truncated_records.data");
|
||||
DeckPtr deck = parser->parseFile("testdata/integration_tests/truncated_records.data", ParseMode());
|
||||
BOOST_CHECK_EQUAL(3U, deck->size());
|
||||
DeckKeywordConstPtr radfin4_0_full= deck->getKeyword("RADFIN4", 0);
|
||||
DeckKeywordConstPtr radfin4_1_partial= deck->getKeyword("RADFIN4", 1);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.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/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
@@ -38,7 +39,7 @@ BOOST_AUTO_TEST_CASE(noNNC)
|
||||
{
|
||||
const std::string filename = "testdata/integration_tests/NNC/noNNC.DATA";
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename));
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, ParseMode()));
|
||||
Opm::EclipseStateConstPtr eclipseState(new EclipseState(deck));
|
||||
auto eclGrid = eclipseState->getEclipseGrid();
|
||||
Opm::NNC nnc(deck, eclGrid);
|
||||
@@ -49,7 +50,7 @@ BOOST_AUTO_TEST_CASE(readDeck)
|
||||
{
|
||||
const std::string filename = "testdata/integration_tests/NNC/NNC.DATA";
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename));
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, ParseMode()));
|
||||
Opm::EclipseStateConstPtr eclipseState(new EclipseState(deck));
|
||||
auto eclGrid = eclipseState->getEclipseGrid();
|
||||
Opm::NNC nnc(deck, eclGrid);
|
||||
@@ -72,7 +73,7 @@ BOOST_AUTO_TEST_CASE(addNNC)
|
||||
{
|
||||
const std::string filename = "testdata/integration_tests/NNC/NNC.DATA";
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename));
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, ParseMode()));
|
||||
Opm::EclipseStateConstPtr eclipseState(new EclipseState(deck));
|
||||
auto eclGrid = eclipseState->getEclipseGrid();
|
||||
Opm::NNC nnc(deck, eclGrid);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckDoubleItem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
@@ -52,7 +53,7 @@ ENKRVD\n\
|
||||
|
||||
BOOST_AUTO_TEST_CASE( ParseMissingRECORD_THrows) {
|
||||
ParserPtr parser(new Parser());
|
||||
BOOST_CHECK_THROW( parser->parseString( dataMissingRecord ) , std::invalid_argument);
|
||||
BOOST_CHECK_THROW( parser->parseString( dataMissingRecord , ParseMode()) , std::invalid_argument);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +73,7 @@ ENKRVD\n\
|
||||
|
||||
BOOST_AUTO_TEST_CASE( parse_DATAWithDefult_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
DeckConstPtr deck = parser->parseString( data );
|
||||
DeckConstPtr deck = parser->parseString( data , ParseMode());
|
||||
DeckKeywordConstPtr keyword = deck->getKeyword( "ENKRVD" );
|
||||
DeckRecordConstPtr rec0 = keyword->getRecord(0);
|
||||
DeckRecordConstPtr rec1 = keyword->getRecord(1);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckDoubleItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -40,7 +41,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE(ParseDENSITY) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path file("testdata/integration_tests/DENSITY/DENSITY1");
|
||||
DeckPtr deck = parser->parseFile(file.string());
|
||||
DeckPtr deck = parser->parseFile(file.string(), ParseMode());
|
||||
DeckKeywordConstPtr densityKw = deck->getKeyword("DENSITY" , 0);
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -39,7 +40,7 @@ BOOST_AUTO_TEST_CASE( parse_END_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path fileWithTitleKeyword("testdata/integration_tests/END/END1.txt");
|
||||
|
||||
DeckPtr deck = parser->parseFile(fileWithTitleKeyword.string());
|
||||
DeckPtr deck = parser->parseFile(fileWithTitleKeyword.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK_EQUAL(size_t(1), deck->size());
|
||||
BOOST_CHECK_EQUAL (true, deck->hasKeyword("OIL"));
|
||||
@@ -51,7 +52,7 @@ BOOST_AUTO_TEST_CASE( parse_ENDINC_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path fileWithTitleKeyword("testdata/integration_tests/END/ENDINC1.txt");
|
||||
|
||||
DeckPtr deck = parser->parseFile(fileWithTitleKeyword.string());
|
||||
DeckPtr deck = parser->parseFile(fileWithTitleKeyword.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK_EQUAL(size_t(1), deck->size());
|
||||
BOOST_CHECK_EQUAL (true, deck->hasKeyword("OIL"));
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -39,7 +40,7 @@ BOOST_AUTO_TEST_CASE( parse_EQUIL_MISSING_DIMS ) {
|
||||
Parser parser;
|
||||
const std::string equil = "EQUIL\n"
|
||||
"2469 382.4 1705.0 0.0 500 0.0 1 1 20 /";
|
||||
std::shared_ptr<const Deck> deck = parser.parseString(equil);
|
||||
std::shared_ptr<const Deck> deck = parser.parseString(equil, ParseMode());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("EQUIL" , 0);
|
||||
BOOST_CHECK_EQUAL( 1U , kw1->size() );
|
||||
|
||||
@@ -56,7 +57,7 @@ BOOST_AUTO_TEST_CASE( parse_EQUIL_MISSING_DIMS ) {
|
||||
BOOST_AUTO_TEST_CASE( parse_EQUIL_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path pvtgFile("testdata/integration_tests/EQUIL/EQUIL1");
|
||||
DeckPtr deck = parser->parseFile(pvtgFile.string());
|
||||
DeckPtr deck = parser->parseFile(pvtgFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr kw0 = deck->getKeyword("EQLDIMS" , 0);
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("EQUIL" , 0);
|
||||
BOOST_CHECK_EQUAL( 3U , kw1->size() );
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -39,7 +40,7 @@ using namespace Opm;
|
||||
|
||||
BOOST_AUTO_TEST_CASE( parse_MULTREGT_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
DeckPtr deck = parser->parseFile("testdata/integration_tests/MULTREGT/MULTREGT");
|
||||
DeckPtr deck = parser->parseFile("testdata/integration_tests/MULTREGT/MULTREGT", ParseMode());
|
||||
BOOST_CHECK_NO_THROW( deck->getKeyword("MULTREGT" , 0); );
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ BOOST_AUTO_TEST_CASE( parse_MULTREGT_OK ) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE( MULTREGT_ECLIPSE_STATE ) {
|
||||
ParserPtr parser(new Parser());
|
||||
DeckPtr deck = parser->parseFile("testdata/integration_tests/MULTREGT/MULTREGT.DATA");
|
||||
DeckPtr deck = parser->parseFile("testdata/integration_tests/MULTREGT/MULTREGT.DATA", ParseMode());
|
||||
EclipseState state(deck);
|
||||
auto transMult = state.getTransMult();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/EclipseState.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
@@ -34,7 +35,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE( PARSE_PLYDHFLF_OK) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path deckFile("testdata/integration_tests/POLYMER/plydhflf.data");
|
||||
DeckPtr deck = parser->parseFile(deckFile.string());
|
||||
DeckPtr deck = parser->parseFile(deckFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr kw = deck->getKeyword("PLYDHFLF");
|
||||
DeckRecordConstPtr rec = kw->getRecord(0);
|
||||
DeckItemPtr item = rec->getItem(0);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/EclipseState.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
@@ -34,7 +35,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE( PARSE_PLYSHLOG_OK) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path deckFile("testdata/integration_tests/POLYMER/plyshlog.data");
|
||||
DeckPtr deck = parser->parseFile(deckFile.string());
|
||||
DeckPtr deck = parser->parseFile(deckFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr kw = deck->getKeyword("PLYSHLOG");
|
||||
DeckRecordConstPtr rec1 = kw->getRecord(0); // reference conditions
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/EclipseState.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
@@ -34,7 +35,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE( PARSE_PLYVISC_OK) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path deckFile("testdata/integration_tests/POLYMER/plyvisc.data");
|
||||
DeckPtr deck = parser->parseFile(deckFile.string());
|
||||
DeckPtr deck = parser->parseFile(deckFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr kw = deck->getKeyword("PLYVISC");
|
||||
DeckRecordConstPtr rec = kw->getRecord(0);
|
||||
DeckItemPtr item = rec->getItem(0);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -38,7 +39,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE(ParsePOROandPERMX) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path poroFile("testdata/integration_tests/PORO/PORO1");
|
||||
DeckPtr deck = parser->parseFile(poroFile.string());
|
||||
DeckPtr deck = parser->parseFile(poroFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("PORO" , 0);
|
||||
DeckKeywordConstPtr kw2 = deck->getKeyword("PERMX" , 0);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckDoubleItem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
@@ -62,7 +63,7 @@ PVTG\n\
|
||||
|
||||
|
||||
static void check_parser(ParserPtr parser) {
|
||||
DeckPtr deck = parser->parseString(pvtgData);
|
||||
DeckPtr deck = parser->parseString(pvtgData, ParseMode());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("PVTG" , 0);
|
||||
BOOST_CHECK_EQUAL(5U , kw1->size());
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckDoubleItem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
@@ -62,7 +63,7 @@ PVTO\n\
|
||||
|
||||
|
||||
static void check_parser(ParserPtr parser) {
|
||||
DeckPtr deck = parser->parseString(pvtoData);
|
||||
DeckPtr deck = parser->parseString(pvtoData, ParseMode());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("PVTO" , 0);
|
||||
BOOST_CHECK_EQUAL(5U , kw1->size());
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -38,7 +39,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE( parse_EQUIL_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path pvtgFile("testdata/integration_tests/RSVD/RSVD.txt");
|
||||
DeckPtr deck = parser->parseFile(pvtgFile.string());
|
||||
DeckPtr deck = parser->parseFile(pvtgFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("RSVD" , 0);
|
||||
BOOST_CHECK_EQUAL( 6U , kw1->size() );
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckDoubleItem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserDoubleItem.hpp>
|
||||
|
||||
@@ -35,7 +36,7 @@ const char *parserData =
|
||||
" 1.0 1.0 0.1 9.0 /\n";
|
||||
|
||||
static void check_parser(ParserPtr parser) {
|
||||
DeckPtr deck = parser->parseString(parserData);
|
||||
DeckPtr deck = parser->parseString(parserData, ParseMode());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("SGOF");
|
||||
BOOST_CHECK_EQUAL(1U , kw1->size());
|
||||
|
||||
@@ -47,7 +48,7 @@ static void check_parser(ParserPtr parser) {
|
||||
}
|
||||
|
||||
static void check_SgofTable(ParserPtr parser) {
|
||||
DeckPtr deck = parser->parseString(parserData);
|
||||
DeckPtr deck = parser->parseString(parserData, ParseMode());
|
||||
Opm::SgofTable sgofTable;
|
||||
sgofTable.initFORUNITTESTONLY(deck->getKeyword("SGOF"), /*recordIdx=*/0);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckDoubleItem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserDoubleItem.hpp>
|
||||
|
||||
@@ -55,7 +56,7 @@ const char *parserData =
|
||||
" 1.0 1* 0.1 9.0 /\n";
|
||||
|
||||
static void check_parser(ParserPtr parser) {
|
||||
DeckPtr deck = parser->parseString(parserData);
|
||||
DeckPtr deck = parser->parseString(parserData, ParseMode());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("SWOF");
|
||||
BOOST_CHECK_EQUAL(1U , kw1->size());
|
||||
|
||||
@@ -67,7 +68,7 @@ static void check_parser(ParserPtr parser) {
|
||||
}
|
||||
|
||||
static void check_SwofTable(ParserPtr parser) {
|
||||
DeckPtr deck = parser->parseString(parserData);
|
||||
DeckPtr deck = parser->parseString(parserData, ParseMode());
|
||||
Opm::SwofTable swofTable;
|
||||
swofTable.initFORUNITTESTONLY(deck->getKeyword("SWOF"), /*recordIdx=*/0);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -40,7 +41,7 @@ BOOST_AUTO_TEST_CASE( parse_TITLE_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path fileWithTitleKeyword("testdata/integration_tests/TITLE/TITLE1.txt");
|
||||
|
||||
DeckPtr deck = parser->parseFile(fileWithTitleKeyword.string());
|
||||
DeckPtr deck = parser->parseFile(fileWithTitleKeyword.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK_EQUAL(size_t(2), deck->size());
|
||||
BOOST_CHECK_EQUAL (true, deck->hasKeyword("TITLE"));
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/EclipseState.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
@@ -34,7 +35,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE( PARSE_TOPS_OK) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path deckFile("testdata/integration_tests/GRID/TOPS.DATA");
|
||||
DeckPtr deck = parser->parseFile(deckFile.string());
|
||||
DeckPtr deck = parser->parseFile(deckFile.string(), ParseMode());
|
||||
EclipseState state(deck);
|
||||
EclipseGridConstPtr grid = state.getEclipseGrid();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -37,7 +38,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE(ParseTVDP) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path poroFile("testdata/integration_tests/TVDP/TVDP1");
|
||||
DeckPtr deck = parser->parseFile(poroFile.string());
|
||||
DeckPtr deck = parser->parseFile(poroFile.string(), ParseMode());
|
||||
|
||||
BOOST_CHECK_EQUAL( false , deck->hasKeyword("TVDP*"));
|
||||
BOOST_CHECK( deck->hasKeyword("TVDPA"));
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -40,7 +41,7 @@ BOOST_AUTO_TEST_CASE( parse_VFPPROD_OK ) {
|
||||
boost::filesystem::path file("testdata/integration_tests/VFPPROD/VFPPROD1");
|
||||
BOOST_CHECK( parser->isRecognizedKeyword("VFPPROD"));
|
||||
|
||||
DeckPtr deck = parser->parseFile(file.string());
|
||||
DeckPtr deck = parser->parseFile(file.string(), ParseMode());
|
||||
|
||||
DeckKeywordConstPtr VFPPROD1 = deck->getKeyword("VFPPROD" , 0);
|
||||
DeckKeywordConstPtr BPR = deck->getKeyword("BPR" , 0);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -38,7 +39,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE( parse_WCHONHIST_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path wconhistFile("testdata/integration_tests/WCONHIST/WCONHIST1");
|
||||
DeckPtr deck = parser->parseFile(wconhistFile.string());
|
||||
DeckPtr deck = parser->parseFile(wconhistFile.string(), ParseMode());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("WCONHIST" , 0);
|
||||
BOOST_CHECK_EQUAL( 3U , kw1->size() );
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -52,7 +53,7 @@ BOOST_AUTO_TEST_CASE(ParseWellProbe) {
|
||||
BOOST_CHECK_THROW(parser->parseString(invalidDeckString), std::invalid_argument);
|
||||
*/
|
||||
|
||||
DeckPtr deck = parser->parseString(validDeckString);
|
||||
DeckPtr deck = parser->parseString(validDeckString, ParseMode());
|
||||
BOOST_CHECK( !deck->hasKeyword("WELL_PROBE"));
|
||||
BOOST_CHECK( deck->hasKeyword("WBHP"));
|
||||
BOOST_CHECK( deck->hasKeyword("WOPR"));
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#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/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
@@ -38,7 +39,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE( parse_WCONPROD_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path wconprodFile("testdata/integration_tests/WellWithWildcards/WCONPROD1");
|
||||
DeckPtr deck = parser->parseFile(wconprodFile.string());
|
||||
DeckPtr deck = parser->parseFile(wconprodFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 30,30,30);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -73,7 +74,7 @@ BOOST_AUTO_TEST_CASE( parse_WCONPROD_OK ) {
|
||||
BOOST_AUTO_TEST_CASE( parse_WCONINJE_OK ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path wconprodFile("testdata/integration_tests/WellWithWildcards/WCONINJE1");
|
||||
DeckPtr deck = parser->parseFile(wconprodFile.string());
|
||||
DeckPtr deck = parser->parseFile(wconprodFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 30,30,30 );
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#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/Parser/ParserKeywords.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
|
||||
@@ -31,10 +32,13 @@ using namespace Opm;
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_parse ) {
|
||||
Parser parser(false);
|
||||
ParseMode parseMode;
|
||||
parseMode.unknownKeyword = InputError::IGNORE;
|
||||
|
||||
parser.addKeyword<ParserKeywords::SPECGRID>();
|
||||
parser.addKeyword<ParserKeywords::FAULTS>();
|
||||
auto deck = parser.parseFile("testdata/integration_tests/Resinsight/DECK1.DATA" , false);
|
||||
|
||||
auto deck = parser.parseFile("testdata/integration_tests/Resinsight/DECK1.DATA" , parseMode);
|
||||
|
||||
BOOST_CHECK( deck->hasKeyword<ParserKeywords::SPECGRID>() );
|
||||
BOOST_CHECK( deck->hasKeyword<ParserKeywords::FAULTS>() );
|
||||
@@ -43,10 +47,12 @@ BOOST_AUTO_TEST_CASE( test_parse ) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_state ) {
|
||||
Parser parser(false);
|
||||
ParseMode parseMode;
|
||||
parseMode.unknownKeyword = InputError::IGNORE;
|
||||
|
||||
parser.addKeyword<ParserKeywords::SPECGRID>();
|
||||
parser.addKeyword<ParserKeywords::FAULTS>();
|
||||
auto deck = parser.parseFile("testdata/integration_tests/Resinsight/DECK1.DATA" , false);
|
||||
auto deck = parser.parseFile("testdata/integration_tests/Resinsight/DECK1.DATA" , parseMode);
|
||||
auto grid = std::make_shared<EclipseGrid>( deck );
|
||||
auto faults = std::make_shared<FaultCollection>( deck , grid );
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#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/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
|
||||
@@ -40,7 +41,7 @@ BOOST_AUTO_TEST_CASE(CreateSchedule) {
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE1");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -55,7 +56,7 @@ BOOST_AUTO_TEST_CASE(CreateSchedule_Comments_After_Keywords) {
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_COMMENTS_AFTER_KEYWORDS");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -68,7 +69,7 @@ BOOST_AUTO_TEST_CASE(CreateSchedule_Comments_After_Keywords) {
|
||||
BOOST_AUTO_TEST_CASE(WCONPROD_MissingCmode) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_MISSING_CMODE");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
BOOST_CHECK_NO_THROW( new Schedule(grid , deck, ioConfig) );
|
||||
@@ -78,7 +79,7 @@ BOOST_AUTO_TEST_CASE(WCONPROD_MissingCmode) {
|
||||
BOOST_AUTO_TEST_CASE(WCONPROD_Missing_DATA) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_CMODE_MISSING_DATA");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
BOOST_CHECK_THROW( new Schedule(grid , deck, ioConfig) , std::invalid_argument );
|
||||
@@ -89,7 +90,7 @@ BOOST_AUTO_TEST_CASE(WellTestRefDepth) {
|
||||
BOOST_CHECK_EQUAL(2, 2);
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(40,60,30);
|
||||
BOOST_CHECK_EQUAL(3, 3);
|
||||
IOConfigPtr ioConfig;
|
||||
@@ -109,7 +110,7 @@ BOOST_AUTO_TEST_CASE(WellTestOpen) {
|
||||
BOOST_CHECK_EQUAL(2, 2);
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(40,60,30);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -149,7 +150,7 @@ BOOST_AUTO_TEST_CASE(WellTestOpen) {
|
||||
BOOST_AUTO_TEST_CASE(WellTesting) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(40,60,30);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -265,7 +266,7 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
|
||||
BOOST_AUTO_TEST_CASE(WellTestCOMPDAT_DEFAULTED_ITEMS) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_COMPDAT1");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(40,60,30);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid, deck, ioConfig));
|
||||
@@ -275,7 +276,7 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT_DEFAULTED_ITEMS) {
|
||||
BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(40,60,30);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -307,7 +308,7 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) {
|
||||
BOOST_AUTO_TEST_CASE(GroupTreeTest_GRUPTREE_with_explicit_L0_parenting) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_GRUPTREE_EXPLICIT_PARENTING");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -336,7 +337,7 @@ BOOST_AUTO_TEST_CASE(GroupTreeTest_GRUPTREE_with_explicit_L0_parenting) {
|
||||
BOOST_AUTO_TEST_CASE(GroupTreeTest_GRUPTREE_correct) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELSPECS_GRUPTREE");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr schedule(new Schedule(grid , deck, ioConfig));
|
||||
@@ -355,7 +356,7 @@ BOOST_AUTO_TEST_CASE(GroupTreeTest_GRUPTREE_correct) {
|
||||
BOOST_AUTO_TEST_CASE(GroupTreeTest_WELSPECS_AND_GRUPTREE_correct_iter_function) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELSPECS_GROUPS");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr schedule(new Schedule(grid , deck, ioConfig));
|
||||
@@ -382,7 +383,7 @@ BOOST_AUTO_TEST_CASE(GroupTreeTest_WELSPECS_AND_GRUPTREE_correct_iter_function)
|
||||
BOOST_AUTO_TEST_CASE(GroupTreeTest_WELSPECS_AND_GRUPTREE_correct_tree) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELSPECS_GROUPS");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr schedule(new Schedule(grid , deck, ioConfig));
|
||||
@@ -427,7 +428,7 @@ BOOST_AUTO_TEST_CASE(GroupTreeTest_WELSPECS_AND_GRUPTREE_correct_tree) {
|
||||
BOOST_AUTO_TEST_CASE(GroupTreeTest_GRUPTREE_WITH_REPARENT_correct_tree) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS_REPARENT");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr schedule(new Schedule(grid , deck, ioConfig));
|
||||
@@ -460,7 +461,7 @@ BOOST_AUTO_TEST_CASE(GroupTreeTest_GRUPTREE_WITH_REPARENT_correct_tree) {
|
||||
BOOST_AUTO_TEST_CASE(GroupTreeTest_PrintGrouptree) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELSPECS_GROUPS");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -474,7 +475,7 @@ BOOST_AUTO_TEST_CASE(GroupTreeTest_PrintGrouptree) {
|
||||
BOOST_AUTO_TEST_CASE( WellTestGroups ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched( new Schedule(grid , deck, ioConfig));
|
||||
@@ -516,7 +517,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) {
|
||||
BOOST_AUTO_TEST_CASE( WellTestGroupAndWellRelation ) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS_AND_GROUPS");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched( new Schedule(grid , deck, ioConfig));
|
||||
@@ -545,7 +546,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroupAndWellRelation ) {
|
||||
BOOST_AUTO_TEST_CASE(WellTestWELSPECSDataLoaded) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(40,60,30);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -578,7 +579,7 @@ BOOST_AUTO_TEST_CASE(WellTestWELSPECSDataLoaded) {
|
||||
BOOST_AUTO_TEST_CASE(WellTestWELSPECS_InvalidConfig_Throws) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELL_INVALID_WELSPECS");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
BOOST_CHECK_THROW(new Schedule(grid , deck, ioConfig), std::invalid_argument);
|
||||
@@ -617,7 +618,7 @@ BOOST_AUTO_TEST_CASE(WellTestWELOPENControlsSet) {
|
||||
BOOST_AUTO_TEST_CASE(WellTestWGRUPCONWellPropertiesSet) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WGRUPCON");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 10,10,10 );
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -656,7 +657,7 @@ WELSPECS \n\
|
||||
COMPDAT \n\
|
||||
'W1' 2* 1 1 'OPEN' 1* 32.948 0.311 3047.839 2* 'X' 22.100 /\n\
|
||||
/\n";
|
||||
DeckPtr deck = parser->parseString(deckString);
|
||||
DeckPtr deck = parser->parseString(deckString, ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 30,30,10 );
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -674,7 +675,7 @@ COMPDAT \n\
|
||||
BOOST_AUTO_TEST_CASE(OpmCode) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/wells_group.data");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10,10,3);
|
||||
IOConfigPtr ioConfig;
|
||||
BOOST_CHECK_NO_THROW( new Schedule(grid , deck, ioConfig) );
|
||||
@@ -685,7 +686,7 @@ BOOST_AUTO_TEST_CASE(OpmCode) {
|
||||
BOOST_AUTO_TEST_CASE(WELLS_SHUT) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_SHUT_WELL");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 20,40,1 );
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -709,7 +710,7 @@ BOOST_AUTO_TEST_CASE(WELLS_SHUT) {
|
||||
BOOST_AUTO_TEST_CASE(WellTestWPOLYMER) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_POLYMER");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>( 30,30,30);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
@@ -758,7 +759,7 @@ BOOST_AUTO_TEST_CASE(TestEvents) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_EVENTS");
|
||||
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string(), ParseMode());
|
||||
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(40,40,30);
|
||||
IOConfigPtr ioConfig;
|
||||
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
|
||||
|
||||
37
opm/parser/eclipse/Parser/InputErrorAction.hpp
Normal file
37
opm/parser/eclipse/Parser/InputErrorAction.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2015 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_INPUT_ERROR_ACTION_HPP
|
||||
#define OPM_INPUT_ERROR_ACTION_HPP
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace InputError {
|
||||
|
||||
enum Action {
|
||||
THROW_EXCEPTION = 0,
|
||||
WARN = 1,
|
||||
IGNORE = 2
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
31
opm/parser/eclipse/Parser/ParseMode.cpp
Normal file
31
opm/parser/eclipse/Parser/ParseMode.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2015 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
ParseMode::ParseMode() {
|
||||
unknownKeyword = InputError::THROW_EXCEPTION;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
56
opm/parser/eclipse/Parser/ParseMode.hpp
Normal file
56
opm/parser/eclipse/Parser/ParseMode.hpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2015 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OPM_PARSE_MODE_HPP
|
||||
#define OPM_PARSE_MODE_HPP
|
||||
|
||||
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
|
||||
/*
|
||||
The ParseMode struct is meant to control the behavior of the
|
||||
parsing and EclipseState construction phase when
|
||||
errors/inconsistencies/... are encountered in the input.
|
||||
|
||||
The ParseMode struct should be used as a simple value object,
|
||||
i.e. apart from the constructor there are no methods - the
|
||||
object can not 'do anything'. It is perfectly legitimate for
|
||||
calling scope to manipulate the fields of a parsemode instance
|
||||
directly.
|
||||
|
||||
For each of the possible problems encountered the possible
|
||||
actions are goverened by the InputError::Action enum:
|
||||
|
||||
InputError::THROW_EXCEPTION
|
||||
InputError::WARN
|
||||
InputError::IGNORE
|
||||
|
||||
*/
|
||||
|
||||
struct ParseMode {
|
||||
ParseMode();
|
||||
InputError::Action unknownKeyword;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/OpmLog/OpmLog.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
|
||||
@@ -32,7 +33,7 @@
|
||||
namespace Opm {
|
||||
|
||||
struct ParserState {
|
||||
bool m_strict;
|
||||
const ParseMode& parseMode;
|
||||
DeckPtr deck;
|
||||
boost::filesystem::path dataFile;
|
||||
boost::filesystem::path rootPath;
|
||||
@@ -43,15 +44,17 @@ namespace Opm {
|
||||
std::string nextKeyword;
|
||||
|
||||
|
||||
ParserState(const ParserState& parent) {
|
||||
m_strict = parent.m_strict;
|
||||
ParserState(const ParserState& parent)
|
||||
: parseMode( parent.parseMode )
|
||||
{
|
||||
deck = parent.deck;
|
||||
pathMap = parent.pathMap;
|
||||
rootPath = parent.rootPath;
|
||||
}
|
||||
|
||||
ParserState(bool strict) {
|
||||
m_strict = strict;
|
||||
ParserState(const ParseMode& __parseMode)
|
||||
: parseMode( __parseMode )
|
||||
{
|
||||
deck = std::make_shared<Deck>();
|
||||
lineNR = 0;
|
||||
}
|
||||
@@ -110,8 +113,8 @@ namespace Opm {
|
||||
is retained in the current implementation.
|
||||
*/
|
||||
|
||||
DeckPtr Parser::parseFile(const std::string &dataFileName, bool strict) const {
|
||||
std::shared_ptr<ParserState> parserState = std::make_shared<ParserState>(strict);
|
||||
DeckPtr Parser::parseFile(const std::string &dataFileName, const ParseMode& parseMode) const {
|
||||
std::shared_ptr<ParserState> parserState = std::make_shared<ParserState>(parseMode);
|
||||
parserState->openFile( dataFileName );
|
||||
|
||||
parseState(parserState);
|
||||
@@ -120,8 +123,8 @@ namespace Opm {
|
||||
return parserState->deck;
|
||||
}
|
||||
|
||||
DeckPtr Parser::parseString(const std::string &data, bool strict) const {
|
||||
std::shared_ptr<ParserState> parserState = std::make_shared<ParserState>(strict);
|
||||
DeckPtr Parser::parseString(const std::string &data, const ParseMode& parseMode) const {
|
||||
std::shared_ptr<ParserState> parserState = std::make_shared<ParserState>(parseMode);
|
||||
parserState->openString( data );
|
||||
|
||||
parseState(parserState);
|
||||
@@ -130,8 +133,8 @@ namespace Opm {
|
||||
return parserState->deck;
|
||||
}
|
||||
|
||||
DeckPtr Parser::parseStream(std::shared_ptr<std::istream> inputStream, bool strict) const {
|
||||
std::shared_ptr<ParserState> parserState = std::make_shared<ParserState>(strict);
|
||||
DeckPtr Parser::parseStream(std::shared_ptr<std::istream> inputStream, const ParseMode& parseMode) const {
|
||||
std::shared_ptr<ParserState> parserState = std::make_shared<ParserState>(parseMode);
|
||||
parserState->openStream( inputStream );
|
||||
|
||||
parseState(parserState);
|
||||
@@ -382,10 +385,14 @@ namespace Opm {
|
||||
return RawKeywordPtr(new RawKeyword(keywordString, parserState->dataFile.string() , parserState->lineNR , targetSize , parserKeyword->isTableCollection()));
|
||||
}
|
||||
} else {
|
||||
if (parserState->m_strict)
|
||||
InputError::Action action = parserState->parseMode.unknownKeyword;
|
||||
if (action == InputError::THROW_EXCEPTION)
|
||||
throw std::invalid_argument("Keyword " + keywordString + " not recognized ");
|
||||
else
|
||||
else {
|
||||
if (action == InputError::WARN)
|
||||
OpmLog::addMessage(Log::MessageType::Warning , "Keyword " + keywordString + " not recognized");
|
||||
return std::shared_ptr<RawKeyword>( );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/RawDeck/RawKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
|
||||
|
||||
namespace Opm {
|
||||
@@ -46,10 +47,11 @@ namespace Opm {
|
||||
Parser(bool addDefault = true);
|
||||
|
||||
/// The starting point of the parsing process. The supplied file is parsed, and the resulting Deck is returned.
|
||||
DeckPtr parseFile(const std::string &dataFile, bool strict = true) const;
|
||||
DeckPtr parseString(const std::string &data, bool strict = true) const;
|
||||
DeckPtr parseStream(std::shared_ptr<std::istream> inputStream , bool strict = true) const;
|
||||
DeckPtr parseFile(const std::string &dataFile, const ParseMode& parseMode) const;
|
||||
DeckPtr parseString(const std::string &data, const ParseMode& parseMode) const;
|
||||
DeckPtr parseStream(std::shared_ptr<std::istream> inputStream , const ParseMode& parseMode) const;
|
||||
|
||||
|
||||
/// Method to add ParserKeyword instances, these holding type and size information about the keywords and their data.
|
||||
void addParserKeyword(ParserKeywordConstPtr parserKeyword);
|
||||
bool dropParserKeyword(const std::string& parserKeywordName);
|
||||
|
||||
@@ -23,12 +23,13 @@
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ParserKeyword_includeValid) {
|
||||
boost::filesystem::path inputFilePath("testdata/parser/includeValid.data");
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck = parser->parseFile(inputFilePath.string());
|
||||
Opm::DeckConstPtr deck = parser->parseFile(inputFilePath.string() , Opm::ParseMode());
|
||||
|
||||
BOOST_CHECK_EQUAL(true , deck->hasKeyword("OIL"));
|
||||
BOOST_CHECK_EQUAL(false , deck->hasKeyword("WATER"));
|
||||
@@ -38,7 +39,7 @@ BOOST_AUTO_TEST_CASE(ParserKeyword_includeInvalid) {
|
||||
boost::filesystem::path inputFilePath("testdata/parser/includeInvalid.data");
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
BOOST_CHECK_THROW(parser->parseFile(inputFilePath.string()), std::runtime_error);
|
||||
BOOST_CHECK_THROW(parser->parseFile(inputFilePath.string() , Opm::ParseMode()), std::runtime_error);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ParserKeyword_includeWrongCase) {
|
||||
@@ -53,9 +54,9 @@ BOOST_AUTO_TEST_CASE(ParserKeyword_includeWrongCase) {
|
||||
// exactly the same spelling as their names on disk. Eclipse seems
|
||||
// to be a bit more relaxed when it comes to this, so we might
|
||||
// have to change the current behavior one not-so-fine day...
|
||||
BOOST_CHECK_THROW(parser->parseFile(inputFile1Path.string()), std::runtime_error);
|
||||
BOOST_CHECK_THROW(parser->parseFile(inputFile2Path.string()), std::runtime_error);
|
||||
BOOST_CHECK_THROW(parser->parseFile(inputFile3Path.string()), std::runtime_error);
|
||||
BOOST_CHECK_THROW(parser->parseFile(inputFile1Path.string(), Opm::ParseMode()), std::runtime_error);
|
||||
BOOST_CHECK_THROW(parser->parseFile(inputFile2Path.string(), Opm::ParseMode()), std::runtime_error);
|
||||
BOOST_CHECK_THROW(parser->parseFile(inputFile3Path.string(), Opm::ParseMode()), std::runtime_error);
|
||||
#else
|
||||
// for case-insensitive filesystems, the include statement will
|
||||
// always work regardless of how the capitalization of the
|
||||
|
||||
Reference in New Issue
Block a user