Decouple SummaryConfig From LibECL

This commit reimplements the SummaryNode class in order not to use
the ecl::smspec_node class from LibECL.  Consequently, we remove
class SummaryConfig's binding to LibECL.

Class SummaryNode maintains the same information as before.  We also
implement a "named constructor" strategy to assign data members that
only make sense for a subset of the node categories.  The previous
member function 'type' is renamed to 'category' to identify the
attachment category (e.g., Well, Group, Field, Block, Region).  In
turn, we introduce a new 'type' member function to identify the
parameter kind (e.g, pressure, rate, cumulative total, well count)
represented by a given node.  We furthermore capture whether or not
the node is a user defined quantity (i.e., a UDQ).

We reimplement the keyword classifier operations that are currently
needed as free functions named 'is_*()' in SummaryConfig.cpp.

Note that in addition to the renamed member functions of class
SummaryNode, this commit also switches the summary key strategy for
block parameters.  Rather than capturing the 'ijk' values
individually as "BOSAT:3,3,6", we now store the equivalent global
(Cartesian) index (i.e., as "BOSAT:523").  Code that directly
constructs block parameter keys must be updated accordingly.

Chase the API change in the 'Summary' constructor and update unit
tests as needed.
This commit is contained in:
Bård Skaflestad
2019-09-27 16:50:42 +02:00
parent dff62946dd
commit 70daf0f2c8
4 changed files with 487 additions and 177 deletions

View File

@@ -112,7 +112,7 @@ static Deck createDeck( const std::string& summary ) {
static std::vector< std::string > sorted_names( const SummaryConfig& summary ) {
std::vector< std::string > ret;
for( const auto& x : summary ) {
auto wgname = x.wgname();
auto wgname = x.namedEntity();
if(wgname.size())
ret.push_back( wgname );
}
@@ -133,7 +133,7 @@ static std::vector< std::string > sorted_keywords( const SummaryConfig& summary
static std::vector< std::string > sorted_key_names( const SummaryConfig& summary ) {
std::vector< std::string > ret;
for( const auto& x : summary ) {
ret.push_back( x.gen_key() );
ret.push_back( x.uniqueNodeKey() );
}
std::sort( ret.begin(), ret.end() );
@@ -657,13 +657,13 @@ BOOST_AUTO_TEST_CASE( summary_require3DField ) {
{
const auto input = "BSGAS\n"
"3 3 6 /\n"
"4 3 6 /\n"
"3 3 6 /\n" // 523
"4 3 6 /\n" // 524
"/";
const auto summary = createSummary( input );
BOOST_CHECK( summary.require3DField( "SGAS"));
BOOST_CHECK( summary.hasSummaryKey( "BSGAS:3,3,6" ) );
BOOST_CHECK( summary.hasSummaryKey( "BSGAS:523" ) );
}
@@ -761,8 +761,10 @@ BOOST_AUTO_TEST_CASE(Summary_Segment)
BOOST_REQUIRE(sofr != summary.end());
BOOST_CHECK_EQUAL(sofr->type(), ecl_smspec_var_type::ECL_SMSPEC_SEGMENT_VAR);
BOOST_CHECK_EQUAL(sofr->wgname(), "PROD01");
BOOST_CHECK_MESSAGE(sofr->category() == SummaryNode::Category::Segment,
R"("SOFR" keyword category must be "Segment")"
);
BOOST_CHECK_EQUAL(sofr->namedEntity(), "PROD01");
}
BOOST_CHECK(deck.hasKeyword("SGFR"));