Remove isMinpvActive() function, use getMinpvMode() instead.
This commit is contained in:
@@ -159,6 +159,7 @@ EclipseState/Grid/GridPropertyInitializers.hpp
|
||||
EclipseState/Grid/Box.hpp
|
||||
EclipseState/Grid/BoxManager.hpp
|
||||
EclipseState/Grid/FaceDir.hpp
|
||||
EclipseState/Grid/MinpvMode.hpp
|
||||
EclipseState/Grid/MULTREGTScanner.hpp
|
||||
EclipseState/Grid/TransMult.hpp
|
||||
EclipseState/Grid/FaultFace.hpp
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace Opm {
|
||||
GRID/EGRID file.
|
||||
*/
|
||||
EclipseGrid::EclipseGrid(const std::string& filename )
|
||||
: m_minpv("MINPV"),
|
||||
m_minpvf("MINPVF"),
|
||||
: m_minpvValue(0),
|
||||
m_minpvMode(MinpvMode::Inactive),
|
||||
m_pinch("PINCH")
|
||||
{
|
||||
ecl_grid_type * new_ptr = ecl_grid_load_case( filename.c_str() );
|
||||
@@ -52,8 +52,8 @@ namespace Opm {
|
||||
}
|
||||
|
||||
EclipseGrid::EclipseGrid(const ecl_grid_type * src_ptr)
|
||||
: m_minpv("MINPV"),
|
||||
m_minpvf("MINPVF"),
|
||||
: m_minpvValue(0),
|
||||
m_minpvMode(MinpvMode::Inactive),
|
||||
m_pinch("PINCH")
|
||||
{
|
||||
m_grid.reset( ecl_grid_alloc_copy( src_ptr ) , ecl_grid_free );
|
||||
@@ -72,8 +72,8 @@ namespace Opm {
|
||||
|
||||
EclipseGrid::EclipseGrid(size_t nx, size_t ny , size_t nz,
|
||||
double dx, double dy, double dz)
|
||||
: m_minpv("MINPV"),
|
||||
m_minpvf("MINPVF"),
|
||||
: m_minpvValue(0),
|
||||
m_minpvMode(MinpvMode::Inactive),
|
||||
m_pinch("PINCH")
|
||||
{
|
||||
m_nx = nx;
|
||||
@@ -97,8 +97,8 @@ namespace Opm {
|
||||
} // anonymous namespace
|
||||
|
||||
EclipseGrid::EclipseGrid(std::shared_ptr<const Deck> deck, LoggerPtr logger)
|
||||
: m_minpv("MINPV"),
|
||||
m_minpvf("MINPVF"),
|
||||
: m_minpvValue(0),
|
||||
m_minpvMode(MinpvMode::Inactive),
|
||||
m_pinch("PINCH")
|
||||
{
|
||||
const bool hasRUNSPEC = Section::hasRUNSPEC(deck);
|
||||
@@ -161,12 +161,18 @@ namespace Opm {
|
||||
m_pinch.setValue( deck->getKeyword("PINCH")->getRecord(0)->getItem("THRESHOLD_THICKNESS")->getSIDouble(0) );
|
||||
}
|
||||
|
||||
if (deck->hasKeyword("MINPV") && deck->hasKeyword("MINPVFIL")) {
|
||||
throw std::invalid_argument("Can not have both MINPV and MINPVFIL in deck.");
|
||||
}
|
||||
|
||||
if (deck->hasKeyword("MINPV")) {
|
||||
m_minpv.setValue( deck->getKeyword("MINPV")->getRecord(0)->getItem("MINPV")->getSIDouble(0) );
|
||||
m_minpvValue = deck->getKeyword("MINPV")->getRecord(0)->getItem("MINPV")->getSIDouble(0);
|
||||
m_minpvMode = MinpvMode::EclSTD;
|
||||
}
|
||||
|
||||
if (deck->hasKeyword("MINPVF")) {
|
||||
m_minpvf.setValue( deck->getKeyword("MINPVF")->getRecord(0)->getItem("MINPVF")->getSIDouble(0) );
|
||||
if (deck->hasKeyword("MINPVFIL")) {
|
||||
m_minpvValue = deck->getKeyword("MINPVFIL")->getRecord(0)->getItem("MINPVFIL")->getSIDouble(0);
|
||||
m_minpvMode = MinpvMode::OpmFIL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,21 +202,14 @@ namespace Opm {
|
||||
return m_pinch.getValue();
|
||||
}
|
||||
|
||||
bool EclipseGrid::isMinpvActive( ) const {
|
||||
return m_minpv.hasValue();
|
||||
MinpvMode EclipseGrid::getMinpvMode() const {
|
||||
return m_minpvMode;
|
||||
}
|
||||
|
||||
double EclipseGrid::getMinpvValue( ) const {
|
||||
return m_minpv.getValue();
|
||||
return m_minpvValue;
|
||||
}
|
||||
|
||||
bool EclipseGrid::isMinpvfActive( ) const {
|
||||
return m_minpvf.hasValue();
|
||||
}
|
||||
|
||||
double EclipseGrid::getMinpvfValue( ) const {
|
||||
return m_minpvf.getValue();
|
||||
}
|
||||
|
||||
void EclipseGrid::assertGlobalIndex(size_t globalIndex) const {
|
||||
if (globalIndex >= getCartesianSize())
|
||||
@@ -500,8 +499,6 @@ namespace Opm {
|
||||
|
||||
bool EclipseGrid::equal(const EclipseGrid& other) const {
|
||||
return (m_pinch.equal( other.m_pinch ) &&
|
||||
m_minpv.equal( other.m_minpv ) &&
|
||||
m_minpvf.equal(other.m_minpvf ) &&
|
||||
ecl_grid_compare( c_ptr() , other.c_ptr() , true , false , false ));
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/MinpvMode.hpp>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
|
||||
#include <memory>
|
||||
@@ -81,10 +81,10 @@ namespace Opm {
|
||||
size_t getCartesianSize( ) const;
|
||||
bool isPinchActive( ) const;
|
||||
double getPinchThresholdThickness( ) const;
|
||||
bool isMinpvActive( ) const;
|
||||
|
||||
MinpvMode getMinpvMode() const;
|
||||
double getMinpvValue( ) const;
|
||||
bool isMinpvfActive() const;
|
||||
double getMinpvfValue() const;
|
||||
|
||||
bool hasCellInfo() const;
|
||||
|
||||
void assertGlobalIndex(size_t globalIndex) const;
|
||||
@@ -109,8 +109,8 @@ namespace Opm {
|
||||
const ecl_grid_type * c_ptr() const;
|
||||
private:
|
||||
std::shared_ptr<ecl_grid_type> m_grid;
|
||||
Value<double> m_minpv;
|
||||
Value<double> m_minpvf;
|
||||
double m_minpvValue;
|
||||
MinpvMode m_minpvMode;
|
||||
Value<double> m_pinch;
|
||||
size_t m_nx;
|
||||
size_t m_ny;
|
||||
|
||||
@@ -160,7 +160,7 @@ static Opm::DeckPtr createMinpvDefaultCPDeck() {
|
||||
" 1000*1 / \n"
|
||||
"MINPV \n"
|
||||
" / \n"
|
||||
"MINPVF \n"
|
||||
"MINPVFIL \n"
|
||||
" / \n"
|
||||
"EDIT\n"
|
||||
"\n";
|
||||
@@ -185,7 +185,29 @@ static Opm::DeckPtr createMinpvCPDeck() {
|
||||
" 1000*1 / \n"
|
||||
"MINPV \n"
|
||||
" 10 / \n"
|
||||
"MINPVF \n"
|
||||
"EDIT\n"
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Opm::DeckPtr createMinpvFilCPDeck() {
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"COORD\n"
|
||||
" 726*1 / \n"
|
||||
"ZCORN \n"
|
||||
" 8000*1 / \n"
|
||||
"ACTNUM \n"
|
||||
" 1000*1 / \n"
|
||||
"MINPVFIL \n"
|
||||
" 20 / \n"
|
||||
"EDIT\n"
|
||||
"\n";
|
||||
@@ -728,41 +750,24 @@ BOOST_AUTO_TEST_CASE(ConstructorMINPV) {
|
||||
Opm::DeckConstPtr deck1 = createCPDeck();
|
||||
Opm::DeckConstPtr deck2 = createMinpvDefaultCPDeck();
|
||||
Opm::DeckConstPtr deck3 = createMinpvCPDeck();
|
||||
Opm::DeckConstPtr deck4 = createMinpvFilCPDeck();
|
||||
|
||||
Opm::EclipseGrid grid1(deck1);
|
||||
Opm::EclipseGrid grid2(deck2);
|
||||
Opm::EclipseGrid grid3(deck3);
|
||||
Opm::EclipseGrid grid4(deck4);
|
||||
|
||||
BOOST_CHECK(!grid1.equal( grid2 ));
|
||||
BOOST_CHECK(!grid1.equal( grid3 ));
|
||||
BOOST_CHECK(!grid2.equal( grid3 ));
|
||||
BOOST_CHECK(!grid1.isMinpvActive());
|
||||
BOOST_CHECK_THROW(grid1.getMinpvValue(), std::logic_error);
|
||||
BOOST_CHECK(grid2.isMinpvActive());
|
||||
BOOST_CHECK_EQUAL(grid2.getMinpvValue(), 1e-6);
|
||||
BOOST_CHECK(grid3.isMinpvActive());
|
||||
BOOST_CHECK_EQUAL(grid1.getMinpvMode(), Opm::MinpvMode::Inactive);
|
||||
BOOST_CHECK_EQUAL(grid3.getMinpvMode(), Opm::MinpvMode::EclSTD);
|
||||
BOOST_CHECK_EQUAL(grid3.getMinpvValue(), 10.0);
|
||||
BOOST_CHECK_EQUAL(grid4.getMinpvMode(), Opm::MinpvMode::OpmFIL);
|
||||
BOOST_CHECK_EQUAL(grid4.getMinpvValue(), 20.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ConstructorMINPVF) {
|
||||
Opm::DeckConstPtr deck1 = createCPDeck();
|
||||
Opm::DeckConstPtr deck2 = createMinpvDefaultCPDeck();
|
||||
Opm::DeckConstPtr deck3 = createMinpvCPDeck();
|
||||
|
||||
Opm::EclipseGrid grid1(deck1);
|
||||
Opm::EclipseGrid grid2(deck2);
|
||||
Opm::EclipseGrid grid3(deck3);
|
||||
|
||||
BOOST_CHECK(!grid1.equal( grid2 ));
|
||||
BOOST_CHECK(!grid1.equal( grid3 ));
|
||||
BOOST_CHECK(!grid2.equal( grid3 ));
|
||||
BOOST_CHECK(!grid1.isMinpvfActive());
|
||||
BOOST_CHECK_THROW(grid1.getMinpvfValue(), std::logic_error);
|
||||
BOOST_CHECK(grid2.isMinpvfActive());
|
||||
BOOST_CHECK_EQUAL(grid2.getMinpvfValue(), 1e-6);
|
||||
BOOST_CHECK(grid3.isMinpvfActive());
|
||||
BOOST_CHECK_EQUAL(grid3.getMinpvfValue(), 20.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user