add parseContext
and errorGuard
parameters to Opm::checkDeck()
this requires a small downstream cleanup.
This commit is contained in:
parent
9afaa32ca7
commit
c25275d0ee
@ -26,6 +26,8 @@ namespace Opm {
|
|||||||
|
|
||||||
class Deck;
|
class Deck;
|
||||||
class Parser;
|
class Parser;
|
||||||
|
class ParseContext;
|
||||||
|
class ErrorGuard;
|
||||||
|
|
||||||
enum DeckChecks {
|
enum DeckChecks {
|
||||||
SectionTopology = 0x0001,
|
SectionTopology = 0x0001,
|
||||||
@ -40,7 +42,7 @@ enum DeckChecks {
|
|||||||
|
|
||||||
// some semantical correctness checks of the deck. this method adds a warning to
|
// some semantical correctness checks of the deck. this method adds a warning to
|
||||||
// the deck object if any issue is found ...
|
// the deck object if any issue is found ...
|
||||||
bool checkDeck( const Deck& deck, const Parser&, size_t enabledChecks = AllChecks);
|
bool checkDeck( const Deck& deck, const Parser& parser, const ParseContext& parseContext, ErrorGuard& errorGuard, size_t enabledChecks = AllChecks);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,11 @@
|
|||||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||||
|
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||||
|
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
bool checkDeck( const Deck& deck, const Parser& parser, size_t enabledChecks) {
|
bool checkDeck( const Deck& deck, const Parser& parser, const ParseContext& parseContext, ErrorGuard& errorGuard, size_t enabledChecks) {
|
||||||
bool deckValid = true;
|
bool deckValid = true;
|
||||||
|
|
||||||
// make sure that the deck does not contain unknown keywords
|
// make sure that the deck does not contain unknown keywords
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
|
BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
|
||||||
Opm::Parser parser;
|
Opm::Parser parser;
|
||||||
|
Opm::ParseContext parseContext;
|
||||||
|
Opm::ErrorGuard errorGuard;
|
||||||
|
|
||||||
{
|
{
|
||||||
const char *correctDeckString =
|
const char *correctDeckString =
|
||||||
@ -50,7 +52,7 @@ BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
|
|||||||
"SCHEDULE\n";
|
"SCHEDULE\n";
|
||||||
|
|
||||||
auto deck = parser.parseString(correctDeckString);
|
auto deck = parser.parseString(correctDeckString);
|
||||||
BOOST_CHECK(Opm::checkDeck(deck, parser));
|
BOOST_CHECK(Opm::checkDeck(deck, parser, parseContext, errorGuard));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -63,8 +65,8 @@ BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
|
|||||||
"SCHEDULE\n";
|
"SCHEDULE\n";
|
||||||
|
|
||||||
auto deck = parser.parseString(correctDeckString);
|
auto deck = parser.parseString(correctDeckString);
|
||||||
BOOST_CHECK(!Opm::checkDeck(deck, parser));
|
BOOST_CHECK(!Opm::checkDeck(deck, parser, parseContext, errorGuard));
|
||||||
BOOST_CHECK(Opm::checkDeck(deck, parser, ~Opm::SectionTopology));
|
BOOST_CHECK(Opm::checkDeck(deck, parser, parseContext, errorGuard, ~Opm::SectionTopology));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -89,13 +91,13 @@ BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
|
|||||||
"SCHEDULE\n";
|
"SCHEDULE\n";
|
||||||
|
|
||||||
auto deck = parser.parseString(incorrectDeckString);
|
auto deck = parser.parseString(incorrectDeckString);
|
||||||
BOOST_CHECK(!Opm::checkDeck(deck, parser));
|
BOOST_CHECK(!Opm::checkDeck(deck, parser, parseContext, errorGuard));
|
||||||
|
|
||||||
// this is supposed to succeed as we don't ensure that all keywords are in the
|
// this is supposed to succeed as we don't ensure that all keywords are in the
|
||||||
// correct section
|
// correct section
|
||||||
BOOST_CHECK(Opm::checkDeck(deck, parser, Opm::SectionTopology));
|
BOOST_CHECK(Opm::checkDeck(deck, parser, parseContext, errorGuard, Opm::SectionTopology));
|
||||||
|
|
||||||
// this fails because of the incorrect BOX keyword
|
// this fails because of the incorrect BOX keyword
|
||||||
BOOST_CHECK(!Opm::checkDeck(deck, parser, Opm::SectionTopology | Opm::KeywordSection));
|
BOOST_CHECK(!Opm::checkDeck(deck, parser, parseContext, errorGuard, Opm::SectionTopology | Opm::KeywordSection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user