Connection keywords support well matching
Looking up well keywords uses the well matching algorithm. This covers all cases supplied by the eclipse documentation, and extends it slightly by also allowing matching.
This commit is contained in:
parent
9eb23b2971
commit
3f98a747df
@ -218,45 +218,35 @@ inline void keywordC( std::vector< ERT::smspec_node >& list,
|
||||
|
||||
for( const auto& record : keyword ) {
|
||||
|
||||
if( record.getItem( 0 ).defaultApplied( 0 ) ) {
|
||||
for( const auto& well : schedule.getWells() ) {
|
||||
const auto& wellitem = record.getItem( 0 );
|
||||
|
||||
const auto& name = well->name();
|
||||
const auto wells = wellitem.defaultApplied( 0 )
|
||||
? schedule.getWells()
|
||||
: schedule.getWellsMatching( wellitem.getTrimmedString( 0 ) );
|
||||
|
||||
for( const auto& completion : *well->getCompletions( last_timestep ) ) {
|
||||
auto cijk = getijk( *completion );
|
||||
if( wells.empty() )
|
||||
handleMissingWell( parseContext, keyword.name(), wellitem.getTrimmedString( 0 ) );
|
||||
|
||||
/* well defaulted, block coordinates defaulted */
|
||||
if( record.getItem( 1 ).defaultApplied( 0 ) ) {
|
||||
list.emplace_back( keywordstring, name, dims.data(), cijk.data() );
|
||||
}
|
||||
/* well defaulted, block coordinates specified */
|
||||
else {
|
||||
auto recijk = getijk( record, 1 );
|
||||
if( std::equal( recijk.begin(), recijk.end(), cijk.begin() ) )
|
||||
list.emplace_back( keywordstring, name, dims.data(), cijk.data() );
|
||||
}
|
||||
for( const auto* well : wells ) {
|
||||
const auto& name = well->name();
|
||||
|
||||
/*
|
||||
* we don't want to add completions that don't exist, so we iterate
|
||||
* over a well's completions regardless of the desired block is
|
||||
* defaulted or not
|
||||
*/
|
||||
for( const auto& completion : *well->getCompletions( last_timestep ) ) {
|
||||
/* block coordinates defaulted */
|
||||
auto cijk = getijk( *completion );
|
||||
|
||||
if( record.getItem( 1 ).defaultApplied( 0 ) ) {
|
||||
list.emplace_back( keywordstring, name, dims.data(), cijk.data() );
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
const auto& name = record.getItem( 0 ).get< std::string >( 0 );
|
||||
if( !schedule.hasWell( name ) ) {
|
||||
handleMissingWell( parseContext, keyword.name(), name );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* all specified */
|
||||
if( !record.getItem( 1 ).defaultApplied( 0 ) ) {
|
||||
auto ijk = getijk( record, 1 );
|
||||
list.emplace_back( keywordstring, name, dims.data(), ijk.data() );
|
||||
}
|
||||
else {
|
||||
const auto& well = *schedule.getWell( name );
|
||||
/* well specified, block coordinates defaulted */
|
||||
for( const auto& completion : *well.getCompletions( last_timestep ) ) {
|
||||
auto ijk = getijk( *completion );
|
||||
list.emplace_back( keywordstring, name, dims.data(), ijk.data() );
|
||||
else {
|
||||
/* block coordinates specified */
|
||||
auto recijk = getijk( record, 1 );
|
||||
if( std::equal( recijk.begin(), recijk.end(), cijk.begin() ) )
|
||||
list.emplace_back( keywordstring, name, dims.data(), cijk.data() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +55,9 @@ static DeckPtr createDeck( const std::string& summary ) {
|
||||
"/\n"
|
||||
"COMPDAT\n"
|
||||
"'PRODUCER' 5 5 1 1 'OPEN' 1* -1 0.5 / \n"
|
||||
"'W_1' 3 7 1 3 'OPEN' 1* 32.948 0.311 3047.839 2* 'X' 22.100 / \n"
|
||||
"'W_1' 3 7 2 2 'OPEN' 1* * 0.311 4332.346 2* 'X' 22.123 / \n"
|
||||
"'W_1' 2 2 1 1 /\n"
|
||||
"'WX2' 2 2 1 1 /\n"
|
||||
"/\n"
|
||||
"SUMMARY\n"
|
||||
+ summary;
|
||||
@ -170,18 +171,26 @@ BOOST_AUTO_TEST_CASE(regions) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(completions) {
|
||||
const auto input = "CWIR\n"
|
||||
const auto input = "CWIR\n" // all specified
|
||||
"'PRODUCER' /\n"
|
||||
"'WX2' 1 1 1 /\n"
|
||||
"'WX2' 2 2 2 /\n"
|
||||
"'WX2' 2 2 1 /\n"
|
||||
"/\n"
|
||||
"CWIT\n"
|
||||
"CWIT\n" // block defaulted
|
||||
"'W_1' /\n"
|
||||
"/\n"
|
||||
"CGIT\n" // well defaulted
|
||||
"* 2 2 1 /\n"
|
||||
"/\n"
|
||||
"CGIR\n" // all defaulted
|
||||
" '*' /\n"
|
||||
"/\n";
|
||||
|
||||
const auto summary = createSummary( input );
|
||||
const auto keywords = { "CWIR", "CWIR", "CWIR",
|
||||
"CWIT", "CWIT", "CWIT" };
|
||||
const auto keywords = { "CGIR", "CGIR", "CGIR", "CGIR",
|
||||
"CGIT", "CGIT",
|
||||
"CWIR", "CWIR",
|
||||
"CWIT", "CWIT" };
|
||||
const auto names = sorted_keywords( summary );
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||
|
Loading…
Reference in New Issue
Block a user