mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support Creating ECLGraph from "ecl_grid_type*"
This commit introduces a new static function ECLGraph::load(const ecl_grid_type*, const ECLInitFileData&) This is in order to simplify constructing the backing graph from ResInsight's .EGRID input--especially to have consistent view of a model's active cells irrespective of which simulator created the result set.
This commit is contained in:
parent
b17749ccbd
commit
99ce43ccdb
@ -1261,8 +1261,8 @@ public:
|
|||||||
/// If available in the INIT file, the constructor will
|
/// If available in the INIT file, the constructor will
|
||||||
/// also leverage the transmissibility data when
|
/// also leverage the transmissibility data when
|
||||||
/// constructing the active cell neighbourship table.
|
/// constructing the active cell neighbourship table.
|
||||||
Impl(const boost::filesystem::path& grid,
|
Impl(const ecl_grid_type* grid,
|
||||||
const ECLInitFileData& init);
|
const ECLInitFileData& init);
|
||||||
|
|
||||||
/// Retrieve number of grids.
|
/// Retrieve number of grids.
|
||||||
///
|
///
|
||||||
@ -1909,21 +1909,17 @@ isViable(const std::vector<ECL::CartesianGridData>& grids,
|
|||||||
|
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
|
|
||||||
Opm::ECLGraph::Impl::Impl(const boost::filesystem::path& grid,
|
Opm::ECLGraph::Impl::Impl(const ecl_grid_type* grid,
|
||||||
const ECLInitFileData& init)
|
const ECLInitFileData& init)
|
||||||
{
|
{
|
||||||
const auto G = ECL::loadCase(grid);
|
const auto numGrids = ECL::numGrids(grid);
|
||||||
|
|
||||||
const auto numGrids = ECL::numGrids(G.get());
|
|
||||||
|
|
||||||
this->grid_.reserve(numGrids);
|
this->grid_.reserve(numGrids);
|
||||||
this->activeOffset_.reserve(numGrids + 1);
|
this->activeOffset_.reserve(numGrids + 1);
|
||||||
this->activeOffset_.push_back(0);
|
this->activeOffset_.push_back(0);
|
||||||
|
|
||||||
for (auto gridID = 0*numGrids; gridID < numGrids; ++gridID)
|
for (auto gridID = 0*numGrids; gridID < numGrids; ++gridID) {
|
||||||
{
|
this->grid_.emplace_back(ECL::getGrid(grid, gridID), init, gridID);
|
||||||
this->grid_.emplace_back(ECL::getGrid(G.get(), gridID),
|
|
||||||
init, gridID);
|
|
||||||
|
|
||||||
this->activeOffset_.push_back(this->activeOffset_.back() +
|
this->activeOffset_.push_back(this->activeOffset_.back() +
|
||||||
this->grid_.back().numCells());
|
this->grid_.back().numCells());
|
||||||
@ -1933,34 +1929,34 @@ Opm::ECLGraph::Impl::Impl(const boost::filesystem::path& grid,
|
|||||||
this->gridID_[this->activeGrids_.back()] = gridID;
|
this->gridID_[this->activeGrids_.back()] = gridID;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->defineNNCs(G.get(), init);
|
this->defineNNCs(grid, init);
|
||||||
this->defineActivePhases(init);
|
this->defineActivePhases(init);
|
||||||
|
|
||||||
// Extract geometry of main grid.
|
// Extract geometry of main grid.
|
||||||
{
|
{
|
||||||
// Size
|
// Size
|
||||||
{
|
{
|
||||||
this->geomGrid_.size[0] = ecl_grid_get_nx(G.get());
|
this->geomGrid_.size[0] = ecl_grid_get_nx(grid);
|
||||||
this->geomGrid_.size[1] = ecl_grid_get_ny(G.get());
|
this->geomGrid_.size[1] = ecl_grid_get_ny(grid);
|
||||||
this->geomGrid_.size[2] = ecl_grid_get_nz(G.get());
|
this->geomGrid_.size[2] = ecl_grid_get_nz(grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// COORD
|
// COORD
|
||||||
{
|
{
|
||||||
const auto ncoord =
|
const auto ncoord =
|
||||||
static_cast<std::size_t>(ecl_grid_get_coord_size(G.get()));
|
static_cast<std::size_t>(ecl_grid_get_coord_size(grid));
|
||||||
this->geomGrid_.coord.resize(ncoord, 0.0);
|
this->geomGrid_.coord.resize(ncoord, 0.0);
|
||||||
|
|
||||||
ecl_grid_init_coord_data_double(G.get(), this->geomGrid_.coord.data());
|
ecl_grid_init_coord_data_double(grid, this->geomGrid_.coord.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZCORN
|
// ZCORN
|
||||||
{
|
{
|
||||||
const auto nzcorn =
|
const auto nzcorn =
|
||||||
static_cast<std::size_t>(ecl_grid_get_zcorn_size(G.get()));
|
static_cast<std::size_t>(ecl_grid_get_zcorn_size(grid));
|
||||||
this->geomGrid_.zcorn.resize(nzcorn, 0.0);
|
this->geomGrid_.zcorn.resize(nzcorn, 0.0);
|
||||||
|
|
||||||
ecl_grid_init_zcorn_data_double(G.get(), this->geomGrid_.zcorn.data());
|
ecl_grid_init_zcorn_data_double(grid, this->geomGrid_.zcorn.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACTNUM
|
// ACTNUM
|
||||||
@ -1972,7 +1968,7 @@ Opm::ECLGraph::Impl::Impl(const boost::filesystem::path& grid,
|
|||||||
|
|
||||||
this->geomGrid_.actnum.assign(nglob, 1);
|
this->geomGrid_.actnum.assign(nglob, 1);
|
||||||
|
|
||||||
ecl_grid_init_actnum_data(G.get(), this->geomGrid_.actnum.data());
|
ecl_grid_init_actnum_data(grid, this->geomGrid_.actnum.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2431,7 +2427,16 @@ Opm::ECLGraph
|
|||||||
Opm::ECLGraph::load(const boost::filesystem::path& grid,
|
Opm::ECLGraph::load(const boost::filesystem::path& grid,
|
||||||
const ECLInitFileData& init)
|
const ECLInitFileData& init)
|
||||||
{
|
{
|
||||||
auto pImpl = ImplPtr{new Impl(grid, init)};
|
auto G = ECL::loadCase(grid);
|
||||||
|
|
||||||
|
return ECLGraph::load(G.get(), init);
|
||||||
|
}
|
||||||
|
|
||||||
|
Opm::ECLGraph
|
||||||
|
Opm::ECLGraph::load(const ecl_grid_type* grid,
|
||||||
|
const ECLInitFileData& init)
|
||||||
|
{
|
||||||
|
auto pImpl = ImplPtr{ new Impl(grid, init) };
|
||||||
|
|
||||||
return { std::move(pImpl) };
|
return { std::move(pImpl) };
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,11 @@
|
|||||||
/// on-disk ECLIPSE output, featuring on-demand property loading from
|
/// on-disk ECLIPSE output, featuring on-demand property loading from
|
||||||
/// backing object (e.g., restart vectors at various time points).
|
/// backing object (e.g., restart vectors at various time points).
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
struct ecl_grid_struct;
|
||||||
|
typedef ecl_grid_struct ecl_grid_type;
|
||||||
|
} // extern "C"
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
/// Package an ECLIPSE result set (represented as GRID, INIT, and
|
/// Package an ECLIPSE result set (represented as GRID, INIT, and
|
||||||
@ -92,6 +97,10 @@ namespace Opm {
|
|||||||
load(const boost::filesystem::path& gridFile,
|
load(const boost::filesystem::path& gridFile,
|
||||||
const ECLInitFileData& init);
|
const ECLInitFileData& init);
|
||||||
|
|
||||||
|
static ECLGraph
|
||||||
|
load(const ecl_grid_type* grid,
|
||||||
|
const ECLInitFileData& init);
|
||||||
|
|
||||||
/// Retrieve number of grids in model.
|
/// Retrieve number of grids in model.
|
||||||
///
|
///
|
||||||
/// \return The number of LGR grids plus one (the main grid).
|
/// \return The number of LGR grids plus one (the main grid).
|
||||||
|
Loading…
Reference in New Issue
Block a user