Parser will inspect keyword->action; only INTERNALIZE are stored
This commit is contained in:
parent
b99d5d75cc
commit
f019d40dd4
@ -14,12 +14,17 @@ add_executable(runParsePORO ParsePORO.cpp)
|
||||
target_link_libraries(runParsePORO Parser ${Boost_LIBRARIES})
|
||||
add_test(NAME runParsePORO WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND runParsePORO)
|
||||
|
||||
add_executable(runParseACTION ParseACTION.cpp)
|
||||
target_link_libraries(runParseACTION Parser ${Boost_LIBRARIES})
|
||||
add_test(NAME runParseACTION WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND runParseACTION)
|
||||
|
||||
add_executable(runIncludeTest IncludeTest.cpp)
|
||||
target_link_libraries(runIncludeTest Parser ${Boost_LIBRARIES})
|
||||
add_test(NAME runIncludeTest WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND runIncludeTest)
|
||||
|
||||
|
||||
|
||||
|
||||
add_executable(runParseEQUIL ParseEQUIL.cpp)
|
||||
target_link_libraries(runParseEQUIL Parser ${Boost_LIBRARIES})
|
||||
add_test(NAME runParseEQUIL
|
||||
|
72
opm/parser/eclipse/IntegrationTests/ParseACTION.cpp
Normal file
72
opm/parser/eclipse/IntegrationTests/ParseACTION.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright 2013 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/>.
|
||||
*/
|
||||
|
||||
#define BOOST_TEST_MODULE ParserIntegrationTests
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( parse_ACTION_OK ) {
|
||||
ParserPtr parser(new Parser( false ));
|
||||
boost::filesystem::path actionFile("testdata/integration_tests/ACTION/ACTION.txt");
|
||||
ParserKeywordConstPtr DIMENS( new ParserKeyword("DIMENS" , (size_t) 1 , IGNORE));
|
||||
|
||||
BOOST_REQUIRE( parser->loadKeywordFromFile( boost::filesystem::path( std::string(KEYWORD_DIRECTORY) + std::string("/W/WCONHIST") )) );
|
||||
parser->addKeyword( DIMENS );
|
||||
|
||||
BOOST_REQUIRE( parser->hasKeyword( "DIMENS" ));
|
||||
BOOST_REQUIRE( parser->hasKeyword( "WCONHIST" ));
|
||||
|
||||
DeckPtr deck = parser->parse(actionFile.string());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("WCONHIST" , 0);
|
||||
BOOST_CHECK_EQUAL( 3U , kw1->size() );
|
||||
|
||||
|
||||
DeckRecordConstPtr rec1 = kw1->getRecord(0);
|
||||
BOOST_CHECK_EQUAL( 11U , rec1->size() );
|
||||
|
||||
DeckRecordConstPtr rec3 = kw1->getRecord(2);
|
||||
BOOST_CHECK_EQUAL( 11U , rec3->size() );
|
||||
|
||||
DeckItemConstPtr item1 = rec1->getItem("WellName");
|
||||
DeckItemConstPtr item1_index = rec1->getItem(0);
|
||||
|
||||
BOOST_CHECK_EQUAL( item1 , item1_index );
|
||||
BOOST_CHECK_EQUAL( "OP_1" , item1->getString(0));
|
||||
|
||||
|
||||
item1 = rec3->getItem("WellName");
|
||||
BOOST_CHECK_EQUAL( "OP_3" , item1->getString(0));
|
||||
|
||||
|
||||
BOOST_CHECK_EQUAL( false , deck->hasKeyword( "DIMENS" ));
|
||||
}
|
@ -109,10 +109,12 @@ namespace Opm {
|
||||
|
||||
if (hasKeyword(rawKeyword->getKeywordName())) {
|
||||
ParserKeywordConstPtr parserKeyword = m_parserKeywords.at(rawKeyword->getKeywordName());
|
||||
DeckKeywordConstPtr deckKeyword = parserKeyword->parse(rawKeyword);
|
||||
deck->addKeyword(deckKeyword);
|
||||
if (parserKeyword->getAction() == INTERNALIZE) {
|
||||
DeckKeywordConstPtr deckKeyword = parserKeyword->parse(rawKeyword);
|
||||
deck->addKeyword(deckKeyword);
|
||||
}
|
||||
} else {
|
||||
DeckKeywordPtr deckKeyword(new DeckKeyword(rawKeyword->getKeywordName(), false));
|
||||
DeckKeywordConstPtr deckKeyword(new DeckKeyword(rawKeyword->getKeywordName(), false));
|
||||
deck->addKeyword(deckKeyword);
|
||||
}
|
||||
}
|
||||
|
12
testdata/integration_tests/ACTION/ACTION.txt
vendored
Normal file
12
testdata/integration_tests/ACTION/ACTION.txt
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
DIMENS
|
||||
10 10 10 /
|
||||
|
||||
WCONHIST
|
||||
'OP_1' 'OPEN' 'ORAT' 4000.000 4.000 1.46402E+006 5* /
|
||||
'OP_2' 'OPEN' 'ORAT' 7998.000 2.000 1461075.000 5* /
|
||||
'OP_3' 'OPEN' 'ORAT' 7999.000 1.000 1471824.000 1 0.25 0.25 0.25 1* /
|
||||
/
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user