Segment Summary Vectors: Use Explict Keyword Whitelisting
We only support a small subset of segment-related summary vectors and must avoid being tricked by other SUMMARY section keywords that happen to begin with a character 'S' (e.g., SUMMARY itself or the SUMTHIN keyword). Add an explicit white-list of the vectors we do support and bypass all others in helper function 'keywordS()'. Introduce a dummy 'SUMTHIN' specification to SOFR_TEST.DATA to ensure that we don't accidentally match this in 'keywordS()'.
This commit is contained in:
parent
258bcbc186
commit
af8f8c6bfd
@ -381,6 +381,26 @@ inline std::array< int, 3 > getijk( const Connection& completion ) {
|
||||
}
|
||||
}
|
||||
|
||||
bool isKnownSegmentKeyword(const DeckKeyword& keyword)
|
||||
{
|
||||
const auto& kw = keyword.name();
|
||||
|
||||
if (kw.size() > 4) {
|
||||
// Easy check first--handles SUMMARY and SUMTHIN &c.
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto kw_whitelist = std::vector<const char*> {
|
||||
"SOFR", "SGFR", "SWFR", "SPR",
|
||||
};
|
||||
|
||||
return std::any_of(kw_whitelist.begin(), kw_whitelist.end(),
|
||||
[&kw](const char* known) -> bool
|
||||
{
|
||||
return kw == known;
|
||||
});
|
||||
}
|
||||
|
||||
bool isMultiSegmentWell(const std::size_t last_timestep,
|
||||
const Well* well)
|
||||
{
|
||||
@ -546,8 +566,9 @@ inline std::array< int, 3 > getijk( const Connection& completion ) {
|
||||
// SGFR
|
||||
// / -- All segments in all MS wells at all times.
|
||||
|
||||
if (keyword.name() == "SUMMARY") {
|
||||
// The SUMMARY keyword itself invokes keywordS(). Ignore it.
|
||||
if (! isKnownSegmentKeyword(keyword)) {
|
||||
// Ignore keywords that have not been explicitly white-listed
|
||||
// for treatment as segment summary vectors.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,12 @@ SUMMARY
|
||||
|
||||
-- ALL
|
||||
|
||||
-- SUMTHIN is here to verify that the explicit keyword white-listing
|
||||
-- in SummaryConfig.cpp works correctly. We should not treat SUMTHIN
|
||||
-- as a segment-related summary vector.
|
||||
SUMTHIN
|
||||
1 /
|
||||
|
||||
SOFR
|
||||
'PROD01' 1 /
|
||||
'PROD01' 10 /
|
||||
|
Loading…
Reference in New Issue
Block a user