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,
|
bool isMultiSegmentWell(const std::size_t last_timestep,
|
||||||
const Well* well)
|
const Well* well)
|
||||||
{
|
{
|
||||||
@ -546,8 +566,9 @@ inline std::array< int, 3 > getijk( const Connection& completion ) {
|
|||||||
// SGFR
|
// SGFR
|
||||||
// / -- All segments in all MS wells at all times.
|
// / -- All segments in all MS wells at all times.
|
||||||
|
|
||||||
if (keyword.name() == "SUMMARY") {
|
if (! isKnownSegmentKeyword(keyword)) {
|
||||||
// The SUMMARY keyword itself invokes keywordS(). Ignore it.
|
// Ignore keywords that have not been explicitly white-listed
|
||||||
|
// for treatment as segment summary vectors.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +96,12 @@ SUMMARY
|
|||||||
|
|
||||||
-- ALL
|
-- 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
|
SOFR
|
||||||
'PROD01' 1 /
|
'PROD01' 1 /
|
||||||
'PROD01' 10 /
|
'PROD01' 10 /
|
||||||
|
Loading…
Reference in New Issue
Block a user