Implements support for RUNSUM-related keywords NARROW and SEPARATE
This commit is contained in:
parent
0910e55be7
commit
d5c4487808
@ -177,7 +177,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
bool createRunSummary() const {
|
||||
return m_createRunSummary;
|
||||
return runSummaryConfig.create;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -197,7 +197,13 @@ namespace Opm {
|
||||
std::set<std::string> short_keywords;
|
||||
std::set<std::string> summary_keywords;
|
||||
|
||||
bool m_createRunSummary;
|
||||
struct {
|
||||
bool create { false };
|
||||
bool narrow { false };
|
||||
bool separate { true };
|
||||
} runSummaryConfig;
|
||||
|
||||
void handleProcessingInstruction(const std::string& keyword);
|
||||
};
|
||||
|
||||
} //namespace Opm
|
||||
|
@ -133,7 +133,6 @@ namespace {
|
||||
"NLINEARS",
|
||||
"NLINSMAX",
|
||||
"NLINSMIN",
|
||||
"RUNSUM",
|
||||
"STEPTYPE",
|
||||
"WNEWTON",
|
||||
};
|
||||
@ -149,6 +148,17 @@ namespace {
|
||||
return is_in_set(udq_blacklistkw, keyword);
|
||||
}
|
||||
|
||||
bool is_processing_instruction(const std::string& keyword) {
|
||||
static const keyword_set processing_instructionkw {
|
||||
"NARROW",
|
||||
"RUNSUM",
|
||||
"SEPARATE",
|
||||
"SUMMARY",
|
||||
};
|
||||
|
||||
return is_in_set(processing_instructionkw, keyword);
|
||||
}
|
||||
|
||||
bool is_udq(const std::string& keyword) {
|
||||
// Does 'keyword' match one of the patterns
|
||||
// AU*, BU*, CU*, FU*, GU*, RU*, SU*, or WU*?
|
||||
@ -438,10 +448,6 @@ inline void keywordR2R( SummaryConfig::keyword_list& /* list */,
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors ) {
|
||||
|
||||
/* RUNSUM is not a region keyword but a directive for how to format and
|
||||
* print output. Unfortunately its *recognised* as a region keyword
|
||||
* because of its structure and position. Hence the special handling of ignoring it.
|
||||
*/
|
||||
if( keyword.name() == "RPTONLY" ) return;
|
||||
|
||||
if( is_region_to_region(keyword.name()) ) {
|
||||
@ -971,14 +977,12 @@ SummaryConfig::SummaryConfig( const Deck& deck,
|
||||
const GridDims& dims) {
|
||||
SUMMARYSection section( deck );
|
||||
|
||||
// The kw_iter++ hoops is to skip the initial 'SUMMARY' keyword.
|
||||
auto kw_iter = section.begin();
|
||||
if (kw_iter != section.end())
|
||||
kw_iter++;
|
||||
|
||||
for(; kw_iter != section.end(); ++kw_iter) {
|
||||
const auto& kw = *kw_iter;
|
||||
handleKW( this->keywords, kw, schedule, tables, parseContext, errors, dims);
|
||||
for (const auto &kw : section) {
|
||||
if (is_processing_instruction(kw.name())) {
|
||||
handleProcessingInstruction(kw.name());
|
||||
} else {
|
||||
handleKW( this->keywords, kw, schedule, tables, parseContext, errors, dims);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& meta_pair : meta_keywords) {
|
||||
@ -1118,4 +1122,15 @@ bool SummaryConfig::operator==(const Opm::SummaryConfig& data) const {
|
||||
this->summary_keywords == data.summary_keywords;
|
||||
}
|
||||
|
||||
void SummaryConfig::handleProcessingInstruction(const std::string& keyword) {
|
||||
if (keyword == "RUNSUM") {
|
||||
runSummaryConfig.create = true;
|
||||
} else if (keyword == "NARROW") {
|
||||
runSummaryConfig.narrow = true;
|
||||
} else if (keyword == "SEPARATE") {
|
||||
Opm::OpmLog::info("Keyword SEPARATE has no effect (treated as always on).");
|
||||
runSummaryConfig.separate = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -867,7 +867,20 @@ BOOST_AUTO_TEST_CASE(Summary_Segment)
|
||||
BOOST_CHECK(!summary.hasSummaryKey("SWFR:INJE01:1"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ProcessingInstructions) {
|
||||
const std::string deck_string = R"(
|
||||
RUNSUM
|
||||
NARROW
|
||||
SEPARATE
|
||||
)";
|
||||
|
||||
const auto& summary_config = createSummary(deck_string);
|
||||
|
||||
BOOST_CHECK(!summary_config.hasKeyword("NARROW"));
|
||||
BOOST_CHECK(!summary_config.hasKeyword("RUNSUM"));
|
||||
BOOST_CHECK(!summary_config.hasKeyword("SEPARATE"));
|
||||
BOOST_CHECK(!summary_config.hasKeyword("SUMMARY"));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EnableRSM) {
|
||||
|
Loading…
Reference in New Issue
Block a user