Substantial edits to Eclipse3DProperties
* Removed all references to state, need to fix initPORV * Made TransMult return raw pointer const GridProperty over shared pointer. * Moved getDirectionProperty and hasDirectionProperty out of API ** Removed tests as these methods are no longer public * Moved grid properties stuff to new class * Removed use of deck in SatfuncInitializers, moved to TableManager * Removed shared_ptr for several members of EclipseState and 3DProperties * Moved region-property from EclipseState to Eclipse3DProperties * Moved initGridopts from EclipseState to Eclipse3DProperties * Made several Eclipse3DProperties methods private * Postprocessors take raw pointers, not shared_ptr---these will be phased out * Fixed return reference instead of copy several places ** GridProperties<T> in Eclipse3DProperties are now references, not shared_ptr ** Eclipse3DProperties takes const Deck&, not shared_ptr * Removed obsolete tests
This commit is contained in:
@@ -105,50 +105,51 @@ const std::string& inputStr_vap_dis = "RUNSPEC\n"
|
||||
"REGIONS\n"
|
||||
"\n";
|
||||
|
||||
static DeckPtr createDeck(const ParseContext& parseContext , const std::string& input) {
|
||||
static DeckPtr createDeck(const ParseContext& parseContext, const std::string& input) {
|
||||
Opm::Parser parser;
|
||||
return parser.parseString(input, parseContext);
|
||||
}
|
||||
|
||||
|
||||
static std::shared_ptr<GridProperties<int>> getGridProperties() {
|
||||
static GridProperties<int> getGridProperties() {
|
||||
GridPropertySupportedKeywordInfo<int> kwInfo = GridPropertySupportedKeywordInfo<int>("EQLNUM", 3, "");
|
||||
std::vector<GridPropertySupportedKeywordInfo<int>> supportedKeywordsVec;
|
||||
supportedKeywordsVec.push_back(kwInfo);
|
||||
EclipseGridConstPtr eclipseGrid = std::make_shared<const EclipseGrid>(3, 3, 3);
|
||||
std::shared_ptr<GridProperties<int>> gridProperties = std::make_shared<GridProperties<int>>(eclipseGrid, std::move(supportedKeywordsVec));
|
||||
gridProperties->addKeyword("EQLNUM");
|
||||
const EclipseGrid eclipseGrid(3, 3, 3);
|
||||
GridProperties<int> gridProperties(eclipseGrid, std::move(supportedKeywordsVec));
|
||||
gridProperties.addKeyword("EQLNUM");
|
||||
return gridProperties;
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigGetThresholdPressureTableTest) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext, inputStr);
|
||||
SimulationConfigConstPtr simulationConfigPtr;
|
||||
BOOST_CHECK_NO_THROW(simulationConfigPtr = std::make_shared<const SimulationConfig>(parseContext , deck, getGridProperties()));
|
||||
BOOST_CHECK_NO_THROW( simulationConfigPtr = std::make_shared<const SimulationConfig>( parseContext, deck, gp ) );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigNOTHPRES) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_noTHPRES);
|
||||
SimulationConfig simulationConfig(parseContext , deck, getGridProperties());
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.hasThresholdPressure());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRNotUsed) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_noTHPRES);
|
||||
SimulationConfig simulationConfig(parseContext , deck, getGridProperties());
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.useCPR());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRUsed) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_cpr);
|
||||
SUMMARYSection summary(*deck);
|
||||
SimulationConfig simulationConfig(parseContext , deck, getGridProperties());
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( true , simulationConfig.useCPR());
|
||||
BOOST_CHECK_EQUAL( false , summary.hasKeyword("CPR"));
|
||||
}
|
||||
@@ -156,9 +157,10 @@ BOOST_AUTO_TEST_CASE(SimulationConfigCPRUsed) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRInSUMMARYSection) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_cpr_in_SUMMARY);
|
||||
SUMMARYSection summary(*deck);
|
||||
SimulationConfig simulationConfig(parseContext , deck, getGridProperties());
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.useCPR());
|
||||
BOOST_CHECK_EQUAL( true , summary.hasKeyword("CPR"));
|
||||
}
|
||||
@@ -166,9 +168,10 @@ BOOST_AUTO_TEST_CASE(SimulationConfigCPRInSUMMARYSection) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRBoth) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_cpr_BOTH);
|
||||
SUMMARYSection summary(*deck);
|
||||
SimulationConfig simulationConfig(parseContext , deck, getGridProperties());
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( true , simulationConfig.useCPR());
|
||||
BOOST_CHECK_EQUAL( true , summary.hasKeyword("CPR"));
|
||||
|
||||
@@ -190,13 +193,15 @@ BOOST_AUTO_TEST_CASE(SimulationConfigCPRRUnspecWithData) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfig_VAPOIL_DISGAS) {
|
||||
ParseContext parseContext;
|
||||
auto gp1 = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
SimulationConfig simulationConfig(parseContext , deck, getGridProperties());
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp1);
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.hasDISGAS());
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.hasVAPOIL());
|
||||
|
||||
auto gp2 = getGridProperties();
|
||||
DeckPtr deck_vd = createDeck(parseContext, inputStr_vap_dis);
|
||||
SimulationConfig simulationConfig_vd(parseContext , deck_vd, getGridProperties());
|
||||
SimulationConfig simulationConfig_vd(parseContext , deck_vd, gp2);
|
||||
BOOST_CHECK_EQUAL( true , simulationConfig_vd.hasDISGAS());
|
||||
BOOST_CHECK_EQUAL( true , simulationConfig_vd.hasVAPOIL());
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
|
||||
|
||||
@@ -139,23 +140,21 @@ static DeckPtr createDeck(const ParseContext& parseContext , const std::string&
|
||||
return parser.parseString(input , parseContext);
|
||||
}
|
||||
|
||||
|
||||
static std::shared_ptr<GridProperties<int>> getGridProperties(int defaultEqlnum = 3, bool addKeyword = true) {
|
||||
GridPropertySupportedKeywordInfo<int> kwInfo = GridPropertySupportedKeywordInfo<int>("EQLNUM", defaultEqlnum, "");
|
||||
static GridProperties<int> getGridProperties(int defaultEqlnum = 3, bool addKeyword = true) {
|
||||
GridPropertySupportedKeywordInfo<int> kwInfo = GridPropertySupportedKeywordInfo<int>( "EQLNUM", defaultEqlnum, "" );
|
||||
std::vector<GridPropertySupportedKeywordInfo<int>> supportedKeywordsVec( 1, kwInfo );
|
||||
EclipseGridConstPtr eclipseGrid = std::make_shared<const EclipseGrid>(3, 3, 3);
|
||||
std::shared_ptr<GridProperties<int>> gridProperties = std::make_shared<GridProperties<int>>(eclipseGrid, std::move( supportedKeywordsVec ) );
|
||||
const EclipseGrid eclipseGrid( 3, 3, 3 );
|
||||
GridProperties<int> gridProperties( eclipseGrid, std::move( supportedKeywordsVec ) );
|
||||
if (addKeyword) {
|
||||
gridProperties->addKeyword("EQLNUM");
|
||||
gridProperties.addKeyword( "EQLNUM" );
|
||||
}
|
||||
return gridProperties;
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ThresholdPressureTest) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
static std::shared_ptr<GridProperties<int>> gridProperties = getGridProperties();
|
||||
auto gridProperties = getGridProperties();
|
||||
ThresholdPressureConstPtr thp = std::make_shared<ThresholdPressure>(parseContext , deck, gridProperties);
|
||||
|
||||
|
||||
@@ -172,7 +171,7 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureTest) {
|
||||
BOOST_AUTO_TEST_CASE(ThresholdPressureEmptyTest) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStrNoSolutionSection);
|
||||
static std::shared_ptr<GridProperties<int>> gridProperties = getGridProperties();
|
||||
auto gridProperties = getGridProperties();
|
||||
ThresholdPressureConstPtr thresholdPressurePtr = std::make_shared<ThresholdPressure>(parseContext , deck, gridProperties);
|
||||
BOOST_CHECK_EQUAL(0, thresholdPressurePtr->size());
|
||||
}
|
||||
@@ -182,7 +181,7 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureNoTHPREStest) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck_no_thpres = createDeck(parseContext , inputStrNoTHPRESinSolutionNorRUNSPEC);
|
||||
DeckPtr deck_no_thpres2 = createDeck(parseContext , inputStrTHPRESinRUNSPECnotSoultion);
|
||||
static std::shared_ptr<GridProperties<int>> gridProperties = getGridProperties();
|
||||
auto gridProperties = getGridProperties();
|
||||
|
||||
ThresholdPressureConstPtr thresholdPressurePtr;
|
||||
BOOST_CHECK_NO_THROW(thresholdPressurePtr = std::make_shared<ThresholdPressure>(parseContext , deck_no_thpres, gridProperties));
|
||||
@@ -202,7 +201,7 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureThrowTest) {
|
||||
DeckPtr deck_highRegNum = createDeck(parseContext , inputStrTooHighRegionNumbers);
|
||||
DeckPtr deck_missingData = createDeck(parseContext , inputStrMissingData);
|
||||
DeckPtr deck_missingPressure = createDeck(parseContext , inputStrMissingPressure);
|
||||
static std::shared_ptr<GridProperties<int>> gridProperties = getGridProperties();
|
||||
auto gridProperties = getGridProperties();
|
||||
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,deck_irrevers, gridProperties), std::runtime_error);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,deck_inconsistency, gridProperties), std::runtime_error);
|
||||
@@ -210,11 +209,11 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureThrowTest) {
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,deck_missingData, gridProperties), std::runtime_error);
|
||||
|
||||
{
|
||||
static std::shared_ptr<GridProperties<int>> gridPropertiesEQLNUMkeywordNotAdded = getGridProperties(3, false);
|
||||
auto gridPropertiesEQLNUMkeywordNotAdded = getGridProperties(3, false);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext , deck, gridPropertiesEQLNUMkeywordNotAdded), std::runtime_error);
|
||||
}
|
||||
{
|
||||
static std::shared_ptr<GridProperties<int>> gridPropertiesEQLNUMall0 = getGridProperties(0);
|
||||
auto gridPropertiesEQLNUMall0 = getGridProperties(0);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext , deck, gridPropertiesEQLNUMall0), std::runtime_error);
|
||||
}
|
||||
|
||||
@@ -240,7 +239,7 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureThrowTest) {
|
||||
BOOST_AUTO_TEST_CASE(HasPair) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
static std::shared_ptr<GridProperties<int>> gridProperties = getGridProperties();
|
||||
auto gridProperties = getGridProperties();
|
||||
ThresholdPressure thp(parseContext , deck , gridProperties);
|
||||
|
||||
BOOST_CHECK_EQUAL( true , thp.hasRegionBarrier( 1 , 2 ));
|
||||
|
||||
Reference in New Issue
Block a user