Query all IDs of (FIP) regions in State
Enable support for querying what fluid-in-point regions are defined in the deck. For now the only interesting regions are the ones specified by the FIPNUM keyword in the REGIONS section. The implementation is somewhat inefficient (n log n over the number of cells in the grid), but since this is likely to only be called when default-expanding SUMMARY section keywords this isn't too bad, since the implementation is so dead simple.
This commit is contained in:
@@ -580,3 +580,31 @@ BOOST_AUTO_TEST_CASE(TestIOConfigCreationWithSolutionRPTSOL) {
|
||||
BOOST_CHECK_EQUAL(true, ioConfig->getWriteRestartFile(0));
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(getRegions) {
|
||||
const char* input =
|
||||
"START -- 0 \n"
|
||||
"10 MAI 2007 / \n"
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 2 2 1 /\n"
|
||||
"GRID\n"
|
||||
"DXV \n 2*400 /\n"
|
||||
"DYV \n 2*400 /\n"
|
||||
"DZV \n 1*400 /\n"
|
||||
"REGIONS\n"
|
||||
"FIPNUM\n"
|
||||
"1 1 2 3 /\n";
|
||||
|
||||
const auto deck = Parser().parseString(input, ParseContext());
|
||||
EclipseState es( deck, ParseContext() );
|
||||
|
||||
std::vector< int > ref = { 1, 2, 3 };
|
||||
const auto regions = es.getRegions( "FIPNUM" );
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( ref.begin(), ref.end(),
|
||||
regions.begin(), regions.end() );
|
||||
|
||||
BOOST_CHECK( es.getRegions( "EQLNUM" ).empty() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user