Removed old Parser::parse() and replaced with new implementation
This commit is contained in:
parent
5c3de27077
commit
5ab04d4b17
@ -24,7 +24,6 @@
|
||||
#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>
|
||||
@ -39,7 +38,7 @@ using namespace Opm;
|
||||
BOOST_AUTO_TEST_CASE( parse_EQUIL_OK ) {
|
||||
ParserPtr parser(new Parser(JSON_CONFIG_FILE));
|
||||
boost::filesystem::path wconhistFile("testdata/EQUIL/EQUIL1");
|
||||
DeckPtr deck = parser->newParse(wconhistFile.string());
|
||||
DeckPtr deck = parser->parse(wconhistFile.string());
|
||||
DeckKeywordConstPtr kw1 = deck->getKeyword("EQUIL" , 0);
|
||||
BOOST_CHECK_EQUAL( 3U , kw1->size() );
|
||||
|
||||
|
@ -33,7 +33,8 @@
|
||||
using namespace Opm;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( parse_WCHONHIST_OK ) {
|
||||
ParserPtr parser(new Parser(JSON_CONFIG_FILE));
|
||||
boost::filesystem::path wconhistFile("testdata/WCONHIST/WCONHIST1");
|
||||
@ -59,40 +60,6 @@ BOOST_AUTO_TEST_CASE( parse_WCHONHIST_OK ) {
|
||||
BOOST_CHECK_EQUAL( "OP_3" , item1->getString(0));
|
||||
|
||||
|
||||
|
||||
BOOST_CHECK_EQUAL( 2U , deck->numKeywords("WCONHIST"));
|
||||
kw1 = deck->getKeyword("WCONHIST" , 1 );
|
||||
rec3 = kw1->getRecord(2);
|
||||
BOOST_CHECK_EQUAL( "OP_3_B" , rec3->getItem("WellName")->getString(0));
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( newParse_WCHONHIST_OK ) {
|
||||
ParserPtr parser(new Parser(JSON_CONFIG_FILE));
|
||||
boost::filesystem::path wconhistFile("testdata/WCONHIST/WCONHIST1");
|
||||
DeckPtr deck = parser->newParse(wconhistFile.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( 2U , deck->numKeywords("WCONHIST"));
|
||||
|
@ -35,12 +35,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
DeckPtr Parser::parse(const std::string &path) {
|
||||
RawDeckPtr rawDeck = readToRawDeck(path);
|
||||
return parseFromRawDeck(rawDeck);
|
||||
}
|
||||
|
||||
DeckPtr Parser::newParse(const std::string &dataFile) {
|
||||
DeckPtr Parser::parse(const std::string &dataFile) {
|
||||
DeckPtr deck(new Deck());
|
||||
|
||||
parseFile( deck , dataFile );
|
||||
@ -74,7 +69,6 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
|
||||
DeckPtr Parser::parseFromRawDeck(RawDeckConstPtr rawDeck) {
|
||||
DeckPtr deck(new Deck());
|
||||
for (size_t i = 0; i < rawDeck->size(); i++) {
|
||||
|
@ -44,8 +44,7 @@ namespace Opm {
|
||||
Parser(const boost::filesystem::path& jsonFile);
|
||||
|
||||
/// The starting point of the parsing process. The supplied file is parsed, and the resulting Deck is returned.
|
||||
DeckPtr parse(const std::string &path);
|
||||
DeckPtr newParse(const std::string &dataFile);
|
||||
DeckPtr parse(const std::string &dataFile);
|
||||
|
||||
/// Function to parse directly from a raw deck
|
||||
DeckPtr parseFromRawDeck(RawDeckConstPtr rawDeck);
|
||||
|
Loading…
Reference in New Issue
Block a user