Removed getDims() and disable this EclipseGrid
* Removed method getDims since getNXYZ already exists * Now we throw if EclipseGrid get lean deck * Removed tests for assertCellInfo and hasCellInfo * Fixed ResinsightTests to use GridDims
This commit is contained in:
@@ -66,7 +66,6 @@ namespace Opm {
|
|||||||
m_deckUnitSystem( deck.getActiveUnitSystem() )
|
m_deckUnitSystem( deck.getActiveUnitSystem() )
|
||||||
|
|
||||||
{
|
{
|
||||||
if (m_inputGrid->hasCellInfo())
|
|
||||||
m_inputGrid->resetACTNUM(m_eclipseProperties.getIntGridProperty("ACTNUM").getData().data());
|
m_inputGrid->resetACTNUM(m_eclipseProperties.getIntGridProperty("ACTNUM").getData().data());
|
||||||
|
|
||||||
if (deck.hasKeyword( "TITLE" )) {
|
if (deck.hasKeyword( "TITLE" )) {
|
||||||
|
|||||||
@@ -93,18 +93,9 @@ namespace Opm {
|
|||||||
m_pinchoutMode( src.m_pinchoutMode ),
|
m_pinchoutMode( src.m_pinchoutMode ),
|
||||||
m_multzMode( src.m_multzMode )
|
m_multzMode( src.m_multzMode )
|
||||||
{
|
{
|
||||||
if (src.hasCellInfo())
|
|
||||||
m_grid.reset( ecl_grid_alloc_copy( src.c_ptr() ) );
|
m_grid.reset( ecl_grid_alloc_copy( src.c_ptr() ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
This creates a grid which only has dimension, and no pointer to
|
|
||||||
a true grid structure. This grid will answer false to
|
|
||||||
hasCellInfo() - but can be used in all situations where the grid
|
|
||||||
dependency is really only on the dimensions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EclipseGrid::EclipseGrid(size_t nx, size_t ny , size_t nz,
|
EclipseGrid::EclipseGrid(size_t nx, size_t ny , size_t nz,
|
||||||
double dx, double dy, double dz)
|
double dx, double dy, double dz)
|
||||||
: GridDims(nx, ny, nz),
|
: GridDims(nx, ny, nz),
|
||||||
@@ -161,7 +152,7 @@ namespace Opm {
|
|||||||
m_multzMode(PinchMode::ModeEnum::TOP)
|
m_multzMode(PinchMode::ModeEnum::TOP)
|
||||||
{
|
{
|
||||||
|
|
||||||
const std::array<int, 3> dims = getDims();
|
const std::array<int, 3> dims = getNXYZ();
|
||||||
initGrid(dims, deck);
|
initGrid(dims, deck);
|
||||||
|
|
||||||
if (actnum != nullptr)
|
if (actnum != nullptr)
|
||||||
@@ -185,6 +176,8 @@ namespace Opm {
|
|||||||
initCornerPointGrid(dims , deck);
|
initCornerPointGrid(dims , deck);
|
||||||
} else if (hasCartesianKeywords(deck)) {
|
} else if (hasCartesianKeywords(deck)) {
|
||||||
initCartesianGrid(dims , deck);
|
initCartesianGrid(dims , deck);
|
||||||
|
} else {
|
||||||
|
throw std::invalid_argument("EclipseGrid needs cornerpoint or cartesian keywords.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deck.hasKeyword<ParserKeywords::PINCH>()) {
|
if (deck.hasKeyword<ParserKeywords::PINCH>()) {
|
||||||
@@ -225,14 +218,11 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t EclipseGrid::activeIndex(size_t globalIndex) const {
|
size_t EclipseGrid::activeIndex(size_t globalIndex) const {
|
||||||
assertCellInfo();
|
|
||||||
{
|
|
||||||
int active_index = ecl_grid_get_active_index1( m_grid.get() , globalIndex );
|
int active_index = ecl_grid_get_active_index1( m_grid.get() , globalIndex );
|
||||||
if (active_index < 0)
|
if (active_index < 0)
|
||||||
throw std::invalid_argument("Input argument does not correspond to an active cell");
|
throw std::invalid_argument("Input argument does not correspond to an active cell");
|
||||||
return static_cast<size_t>( active_index );
|
return static_cast<size_t>( active_index );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool EclipseGrid::isPinchActive( ) const {
|
bool EclipseGrid::isPinchActive( ) const {
|
||||||
@@ -539,26 +529,7 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
This function checks if the grid has a pointer to an underlying
|
|
||||||
ecl_grid_type; which must be used to read cell info as
|
|
||||||
size/depth/active of individual cells.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool EclipseGrid::hasCellInfo() const {
|
|
||||||
return static_cast<bool>( m_grid );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EclipseGrid::assertCellInfo() const {
|
|
||||||
if (!hasCellInfo())
|
|
||||||
throw std::invalid_argument("Tried to access cell information in a grid with only dimensions");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const ecl_grid_type * EclipseGrid::c_ptr() const {
|
const ecl_grid_type * EclipseGrid::c_ptr() const {
|
||||||
assertCellInfo();
|
|
||||||
return m_grid.get();
|
return m_grid.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,13 +677,11 @@ namespace Opm {
|
|||||||
|
|
||||||
|
|
||||||
void EclipseGrid::resetACTNUM( const int * actnum) {
|
void EclipseGrid::resetACTNUM( const int * actnum) {
|
||||||
assertCellInfo();
|
|
||||||
ecl_grid_reset_actnum( m_grid.get() , actnum );
|
ecl_grid_reset_actnum( m_grid.get() , actnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EclipseGrid::fwriteEGRID( const std::string& filename, bool output_metric ) const {
|
void EclipseGrid::fwriteEGRID( const std::string& filename, bool output_metric ) const {
|
||||||
assertCellInfo();
|
|
||||||
ecl_grid_fwrite_EGRID( m_grid.get() , filename.c_str(), output_metric );
|
ecl_grid_fwrite_EGRID( m_grid.get() , filename.c_str(), output_metric );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,25 +49,6 @@ namespace Opm {
|
|||||||
- Size of cells
|
- Size of cells
|
||||||
- Real world position of cells
|
- Real world position of cells
|
||||||
- Active/inactive status of cells
|
- Active/inactive status of cells
|
||||||
|
|
||||||
However in may cases the only required information is the
|
|
||||||
dimension of the grid. To facilitate simpler use, in particular
|
|
||||||
in testing, the grid dimensions are internalized separate from
|
|
||||||
the ecl_grid_type pointer. This means that in many cases a grid
|
|
||||||
without the underlying ecl_grid_type pointer is sufficient. To
|
|
||||||
create such a 'naked' grid you can parse a deck with only
|
|
||||||
DIMENS / SPECGRID and no further grid related keywords, or
|
|
||||||
alternatively use the:
|
|
||||||
|
|
||||||
EclipseGrid::EclipseGrid(nx,ny,nz)
|
|
||||||
|
|
||||||
constructor.
|
|
||||||
|
|
||||||
To query a grid instance if it has proper underlying grid
|
|
||||||
support use the method:
|
|
||||||
|
|
||||||
bool EclipseGrid::hasCellInfo();
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class EclipseGrid : public GridDims {
|
class EclipseGrid : public GridDims {
|
||||||
@@ -105,7 +86,6 @@ namespace Opm {
|
|||||||
MinpvMode::ModeEnum getMinpvMode() const;
|
MinpvMode::ModeEnum getMinpvMode() const;
|
||||||
double getMinpvValue( ) const;
|
double getMinpvValue( ) const;
|
||||||
|
|
||||||
bool hasCellInfo() const;
|
|
||||||
std::array<double, 3> getCellCenter(size_t i,size_t j, size_t k) const;
|
std::array<double, 3> getCellCenter(size_t i,size_t j, size_t k) const;
|
||||||
std::array<double, 3> getCellCenter(size_t globalIndex) const;
|
std::array<double, 3> getCellCenter(size_t globalIndex) const;
|
||||||
double getCellVolume(size_t globalIndex) const;
|
double getCellVolume(size_t globalIndex) const;
|
||||||
@@ -140,8 +120,6 @@ namespace Opm {
|
|||||||
PinchMode::ModeEnum m_pinchoutMode;
|
PinchMode::ModeEnum m_pinchoutMode;
|
||||||
PinchMode::ModeEnum m_multzMode;
|
PinchMode::ModeEnum m_multzMode;
|
||||||
|
|
||||||
void assertCellInfo() const;
|
|
||||||
|
|
||||||
void initCornerPointGrid(const std::array<int,3>& dims ,
|
void initCornerPointGrid(const std::array<int,3>& dims ,
|
||||||
const std::vector<double>& coord ,
|
const std::vector<double>& coord ,
|
||||||
const std::vector<double>& zcorn ,
|
const std::vector<double>& zcorn ,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp>
|
||||||
@@ -42,7 +42,7 @@ namespace Opm {
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
FaultCollection::FaultCollection(const GRIDSection& gridSection,
|
FaultCollection::FaultCollection(const GRIDSection& gridSection,
|
||||||
const EclipseGrid& grid) {
|
const GridDims& grid) {
|
||||||
const auto& faultKeywords = gridSection.getKeywordList<ParserKeywords::FAULTS>();
|
const auto& faultKeywords = gridSection.getKeywordList<ParserKeywords::FAULTS>();
|
||||||
|
|
||||||
for (auto keyword_iter = faultKeywords.begin(); keyword_iter != faultKeywords.end(); ++keyword_iter) {
|
for (auto keyword_iter = faultKeywords.begin(); keyword_iter != faultKeywords.end(); ++keyword_iter) {
|
||||||
@@ -57,7 +57,7 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FaultCollection::addFaultFaces(const EclipseGrid& grid,
|
void FaultCollection::addFaultFaces(const GridDims& grid,
|
||||||
const DeckRecord& faultRecord,
|
const DeckRecord& faultRecord,
|
||||||
const std::string& faultName)
|
const std::string& faultName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,23 +21,21 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
|
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
class DeckRecord;
|
class DeckRecord;
|
||||||
class EclipseGrid;
|
class GridDims;
|
||||||
class GRIDSection;
|
class GRIDSection;
|
||||||
|
|
||||||
|
|
||||||
class FaultCollection {
|
class FaultCollection {
|
||||||
public:
|
public:
|
||||||
FaultCollection();
|
FaultCollection();
|
||||||
FaultCollection(const GRIDSection& gridSection, const EclipseGrid& grid);
|
FaultCollection(const GRIDSection& gridSection, const GridDims& grid);
|
||||||
|
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
bool hasFault(const std::string& faultName) const;
|
bool hasFault(const std::string& faultName) const;
|
||||||
@@ -51,7 +49,7 @@ public:
|
|||||||
void setTransMult(const std::string& faultName , double transMult);
|
void setTransMult(const std::string& faultName , double transMult);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addFaultFaces(const EclipseGrid& grid,
|
void addFaultFaces(const GridDims& grid,
|
||||||
const DeckRecord& faultRecord,
|
const DeckRecord& faultRecord,
|
||||||
const std::string& faultName);
|
const std::string& faultName);
|
||||||
OrderedMap<Fault> m_faults;
|
OrderedMap<Fault> m_faults;
|
||||||
|
|||||||
@@ -102,10 +102,6 @@ namespace Opm {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::array<int, 3> GridDims::getDims() const {
|
|
||||||
return std::array<int, 3> { int(m_nx), int(m_ny), int(m_nz) };
|
|
||||||
}
|
|
||||||
|
|
||||||
// keyword must be DIMENS or SPECGRID
|
// keyword must be DIMENS or SPECGRID
|
||||||
std::vector<int> readDims(const DeckKeyword& keyword) {
|
std::vector<int> readDims(const DeckKeyword& keyword) {
|
||||||
const auto& record = keyword.getRecord(0);
|
const auto& record = keyword.getRecord(0);
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ namespace Opm {
|
|||||||
protected:
|
protected:
|
||||||
GridDims();
|
GridDims();
|
||||||
|
|
||||||
const std::array<int, 3> getDims() const;
|
|
||||||
|
|
||||||
size_t m_nx;
|
size_t m_nx;
|
||||||
size_t m_ny;
|
size_t m_ny;
|
||||||
size_t m_nz;
|
size_t m_nz;
|
||||||
|
|||||||
@@ -119,8 +119,14 @@ BOOST_AUTO_TEST_CASE(HasGridKeywords) {
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(CreateGridNoCells) {
|
BOOST_AUTO_TEST_CASE(CreateGridNoCells) {
|
||||||
Opm::DeckPtr deck = createDeckHeaders();
|
Opm::DeckPtr deckptr = createDeckHeaders();
|
||||||
Opm::EclipseGrid grid( deck );
|
const Opm::Deck& deck = *deckptr;
|
||||||
|
{
|
||||||
|
Opm::EclipseGrid* gridptr = nullptr;
|
||||||
|
BOOST_CHECK_THROW( gridptr = new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
||||||
|
delete gridptr;
|
||||||
|
}
|
||||||
|
const Opm::GridDims grid(deck);
|
||||||
BOOST_CHECK_EQUAL( 10 , grid.getNX());
|
BOOST_CHECK_EQUAL( 10 , grid.getNX());
|
||||||
BOOST_CHECK_EQUAL( 10 , grid.getNY());
|
BOOST_CHECK_EQUAL( 10 , grid.getNY());
|
||||||
BOOST_CHECK_EQUAL( 10 , grid.getNZ());
|
BOOST_CHECK_EQUAL( 10 , grid.getNZ());
|
||||||
@@ -344,8 +350,6 @@ BOOST_AUTO_TEST_CASE(CREATE_SIMPLE) {
|
|||||||
BOOST_CHECK_EQUAL( grid.getNY() , 20 );
|
BOOST_CHECK_EQUAL( grid.getNY() , 20 );
|
||||||
BOOST_CHECK_EQUAL( grid.getNZ() , 30 );
|
BOOST_CHECK_EQUAL( grid.getNZ() , 30 );
|
||||||
BOOST_CHECK_EQUAL( grid.getCartesianSize() , 6000 );
|
BOOST_CHECK_EQUAL( grid.getCartesianSize() , 6000 );
|
||||||
BOOST_CHECK_EQUAL( true , grid.hasCellInfo() );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(DEPTHZ_EQUAL_TOPS) {
|
BOOST_AUTO_TEST_CASE(DEPTHZ_EQUAL_TOPS) {
|
||||||
@@ -425,9 +429,13 @@ BOOST_AUTO_TEST_CASE(HasINVALIDCartKeywords) {
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(CreateMissingGRID_throws) {
|
BOOST_AUTO_TEST_CASE(CreateMissingGRID_throws) {
|
||||||
Opm::DeckPtr deck = createDeckHeaders();
|
auto deckptr = createDeckHeaders();
|
||||||
Opm::EclipseGrid grid( deck );
|
const Opm::Deck& deck = *deckptr;
|
||||||
BOOST_CHECK_EQUAL( false , grid.hasCellInfo() );
|
{
|
||||||
|
Opm::EclipseGrid* gridptr = nullptr;
|
||||||
|
BOOST_CHECK_THROW( gridptr = new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
||||||
|
delete gridptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -456,7 +464,8 @@ static Opm::DeckPtr createInvalidDXYZCARTDeck() {
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(CreateCartesianGRID) {
|
BOOST_AUTO_TEST_CASE(CreateCartesianGRID) {
|
||||||
Opm::DeckPtr deck = createInvalidDXYZCARTDeck();
|
auto deckptr = createInvalidDXYZCARTDeck();
|
||||||
|
const Opm::Deck& deck = *deckptr;
|
||||||
BOOST_CHECK_THROW(new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
BOOST_CHECK_THROW(new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,9 +495,13 @@ static Opm::DeckPtr createInvalidDXYZCARTDeckDEPTHZ() {
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDDEPTHZ) {
|
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDDEPTHZ) {
|
||||||
Opm::DeckPtr deck = createInvalidDXYZCARTDeckDEPTHZ();
|
auto deckptr = createInvalidDXYZCARTDeckDEPTHZ();
|
||||||
Opm::EclipseGrid grid( deck );
|
const Opm::Deck& deck = *deckptr;
|
||||||
BOOST_CHECK_EQUAL( false , grid.hasCellInfo() );
|
{
|
||||||
|
Opm::EclipseGrid* gridptr = nullptr;
|
||||||
|
BOOST_CHECK_THROW( gridptr = new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
||||||
|
delete gridptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -539,8 +552,14 @@ static Opm::DeckPtr createInvalidDEPTHZDeck1 () {
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDInvalidDEPTHZ1) {
|
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDInvalidDEPTHZ1) {
|
||||||
Opm::DeckPtr deck = createInvalidDEPTHZDeck1();
|
auto deckptr = createInvalidDEPTHZDeck1();
|
||||||
BOOST_CHECK_THROW(new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
const Opm::Deck& deck = *deckptr;
|
||||||
|
{
|
||||||
|
Opm::EclipseGrid* gridptr = nullptr;
|
||||||
|
BOOST_CHECK_THROW( gridptr = new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
||||||
|
delete gridptr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -567,20 +586,26 @@ static Opm::DeckPtr createInvalidDEPTHZDeck2 () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDInvalidDEPTHZ2) {
|
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDInvalidDEPTHZ2) {
|
||||||
Opm::DeckPtr deck = createInvalidDEPTHZDeck2();
|
auto deckptr = createInvalidDEPTHZDeck2();
|
||||||
BOOST_CHECK_THROW(new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
const Opm::Deck& deck = *deckptr;
|
||||||
|
{
|
||||||
|
Opm::EclipseGrid* gridptr = nullptr;
|
||||||
|
BOOST_CHECK_THROW( gridptr = new Opm::EclipseGrid( deck ) , std::invalid_argument);
|
||||||
|
delete gridptr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDOnlyTopLayerDZ) {
|
BOOST_AUTO_TEST_CASE(CreateCartesianGRIDOnlyTopLayerDZ) {
|
||||||
Opm::DeckPtr deck = createOnlyTopDZCartGrid();
|
Opm::DeckPtr deck = createOnlyTopDZCartGrid();
|
||||||
std::shared_ptr<Opm::EclipseGrid> grid(new Opm::EclipseGrid( deck ));
|
Opm::EclipseGrid grid( *deck );
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL( 10 , grid->getNX( ));
|
BOOST_CHECK_EQUAL( 10 , grid.getNX( ));
|
||||||
BOOST_CHECK_EQUAL( 5 , grid->getNY( ));
|
BOOST_CHECK_EQUAL( 5 , grid.getNY( ));
|
||||||
BOOST_CHECK_EQUAL( 20 , grid->getNZ( ));
|
BOOST_CHECK_EQUAL( 20 , grid.getNZ( ));
|
||||||
BOOST_CHECK_EQUAL( 1000 , grid->getNumActive());
|
BOOST_CHECK_EQUAL( 1000 , grid.getNumActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -968,11 +993,9 @@ BOOST_AUTO_TEST_CASE(GridActnumVia3D) {
|
|||||||
|
|
||||||
BOOST_CHECK_NO_THROW(ep.getIntGridProperty("ACTNUM"));
|
BOOST_CHECK_NO_THROW(ep.getIntGridProperty("ACTNUM"));
|
||||||
BOOST_CHECK_NO_THROW(grid->getNumActive());
|
BOOST_CHECK_NO_THROW(grid->getNumActive());
|
||||||
BOOST_CHECK(grid->hasCellInfo());
|
|
||||||
BOOST_CHECK_EQUAL(grid->getNumActive(), 2 * 2 * 2 - 1);
|
BOOST_CHECK_EQUAL(grid->getNumActive(), 2 * 2 * 2 - 1);
|
||||||
|
|
||||||
BOOST_CHECK_NO_THROW(grid2.getNumActive());
|
BOOST_CHECK_NO_THROW(grid2.getNumActive());
|
||||||
BOOST_CHECK(grid2.hasCellInfo());
|
|
||||||
BOOST_CHECK_EQUAL(grid2.getNumActive(), 2 * 2 * 2 - 1);
|
BOOST_CHECK_EQUAL(grid2.getNumActive(), 2 * 2 * 2 - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -981,7 +1004,6 @@ BOOST_AUTO_TEST_CASE(GridActnumViaState) {
|
|||||||
|
|
||||||
BOOST_CHECK_NO_THROW(Opm::EclipseState(deck, Opm::ParseContext()));
|
BOOST_CHECK_NO_THROW(Opm::EclipseState(deck, Opm::ParseContext()));
|
||||||
Opm::EclipseState es(deck, Opm::ParseContext());
|
Opm::EclipseState es(deck, Opm::ParseContext());
|
||||||
BOOST_CHECK(es.getInputGrid()->hasCellInfo());
|
|
||||||
BOOST_CHECK_EQUAL(es.getInputGrid()->getNumActive(), 2 * 2 * 2 - 1);
|
BOOST_CHECK_EQUAL(es.getInputGrid()->getNumActive(), 2 * 2 * 2 - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BOOST_TEST_MODULE BoxTest
|
#define BOOST_TEST_MODULE ResinsightIntegrationTests
|
||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <boost/test/test_tools.hpp>
|
#include <boost/test/test_tools.hpp>
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@
|
|||||||
#include <opm/parser/eclipse/Parser/ParserKeywords/G.hpp>
|
#include <opm/parser/eclipse/Parser/ParserKeywords/G.hpp>
|
||||||
#include <opm/parser/eclipse/Parser/ParserKeywords/S.hpp>
|
#include <opm/parser/eclipse/Parser/ParserKeywords/S.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
||||||
|
|
||||||
|
|
||||||
@@ -46,10 +47,18 @@ BOOST_AUTO_TEST_CASE( test_parse ) {
|
|||||||
parser.addKeyword<ParserKeywords::SPECGRID>();
|
parser.addKeyword<ParserKeywords::SPECGRID>();
|
||||||
parser.addKeyword<ParserKeywords::FAULTS>();
|
parser.addKeyword<ParserKeywords::FAULTS>();
|
||||||
|
|
||||||
auto deck = parser.parseFile("testdata/integration_tests/Resinsight/DECK1.DATA" , parseContext);
|
auto deckptr = parser.parseFile("testdata/integration_tests/Resinsight/DECK1.DATA" , parseContext);
|
||||||
|
const Deck& deck = *deckptr;
|
||||||
|
|
||||||
BOOST_CHECK( deck->hasKeyword<ParserKeywords::SPECGRID>() );
|
BOOST_CHECK( deck.hasKeyword<ParserKeywords::SPECGRID>() );
|
||||||
BOOST_CHECK( deck->hasKeyword<ParserKeywords::FAULTS>() );
|
BOOST_CHECK( deck.hasKeyword<ParserKeywords::FAULTS>() );
|
||||||
|
|
||||||
|
{
|
||||||
|
GridDims* grid = nullptr;
|
||||||
|
BOOST_CHECK_NO_THROW( grid = new GridDims(deck) );
|
||||||
|
BOOST_CHECK_NO_THROW( grid->getCartesianSize() );
|
||||||
|
delete grid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -64,9 +73,14 @@ BOOST_AUTO_TEST_CASE( test_state ) {
|
|||||||
parser.addKeyword<ParserKeywords::SPECGRID>();
|
parser.addKeyword<ParserKeywords::SPECGRID>();
|
||||||
parser.addKeyword<ParserKeywords::FAULTS>();
|
parser.addKeyword<ParserKeywords::FAULTS>();
|
||||||
parser.addKeyword<ParserKeywords::GRID>();
|
parser.addKeyword<ParserKeywords::GRID>();
|
||||||
auto deck = parser.parseFile("testdata/integration_tests/Resinsight/DECK1.DATA" , parseContext);
|
auto deckptr = parser.parseFile("testdata/integration_tests/Resinsight/DECK1.DATA" , parseContext);
|
||||||
|
const Deck& deck = *deckptr;
|
||||||
|
|
||||||
auto grid = std::make_shared<EclipseGrid>(deck);
|
GridDims grid(deck);
|
||||||
GRIDSection gsec(*deck);
|
GRIDSection gsec(deck);
|
||||||
FaultCollection faults(gsec, *grid);
|
FaultCollection faults(gsec, grid);
|
||||||
|
BOOST_CHECK_EQUAL( grid.getNX(), 20U);
|
||||||
|
BOOST_CHECK_EQUAL( grid.getNY(), 20U);
|
||||||
|
BOOST_CHECK_EQUAL( grid.getNZ(), 10U);
|
||||||
|
BOOST_CHECK_EQUAL( faults.size(), 2U);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user