Merge pull request #1234 from joakim-hove/region-cache-fp
Region cache fp
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
class Eclipse3DProperties;
|
||||
class Schedule;
|
||||
class EclipseGrid;
|
||||
|
||||
@@ -31,7 +30,7 @@ namespace out {
|
||||
class RegionCache {
|
||||
public:
|
||||
RegionCache() = default;
|
||||
RegionCache(const Eclipse3DProperties& properties, const EclipseGrid& grid, const Schedule& schedule);
|
||||
RegionCache(const std::vector<int>& fipnum, const EclipseGrid& grid, const Schedule& schedule);
|
||||
const std::vector<std::pair<std::string,size_t>>& connections( int region_id ) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -30,17 +30,15 @@
|
||||
namespace Opm {
|
||||
namespace out {
|
||||
|
||||
RegionCache::RegionCache(const Eclipse3DProperties& properties, const EclipseGrid& grid, const Schedule& schedule) {
|
||||
const auto& fipnum_data = properties.getIntGridProperty("FIPNUM").getData();
|
||||
RegionCache::RegionCache(const std::vector<int>& fipnum, const EclipseGrid& grid, const Schedule& schedule) {
|
||||
|
||||
const auto& wells = schedule.getWellsatEnd();
|
||||
for (const auto& well : wells) {
|
||||
const auto& connections = well.getConnections( );
|
||||
for (const auto& c : connections) {
|
||||
size_t global_index = grid.getGlobalIndex( c.getI() , c.getJ() , c.getK());
|
||||
if (grid.cellActive( global_index )) {
|
||||
size_t active_index = grid.activeIndex( global_index );
|
||||
int region_id = fipnum_data[global_index];
|
||||
if (grid.cellActive(c.getI(), c.getJ(), c.getK())) {
|
||||
size_t active_index = grid.activeIndex(c.getI(), c.getJ(), c.getK());
|
||||
int region_id = fipnum[active_index];
|
||||
auto& well_index_list = this->connection_map[ region_id ];
|
||||
well_index_list.push_back( { well.name() , active_index } );
|
||||
}
|
||||
|
||||
@@ -2052,7 +2052,11 @@ SummaryImplementation(const EclipseState& es,
|
||||
const Schedule& sched,
|
||||
const std::string& basename)
|
||||
: grid_ (std::cref(grid))
|
||||
, regCache_ (es.get3DProperties(), grid, sched)
|
||||
#ifdef ENABLE_3DPROPS_TESTING
|
||||
, regCache_ (es.get3DProperties().getIntGridProperty("FIPNUM").compressedCopy(grid), grid, sched)
|
||||
#else
|
||||
, regCache_ (es.fieldProps().get<int>("FIPNMUM"), grid, sched)
|
||||
#endif
|
||||
, deferredSMSpec_(makeDeferredSMSpecCreation(es, grid, sched))
|
||||
, rset_ (makeResultSet(es.cfg().io(), basename))
|
||||
, fmt_ { es.cfg().io().getFMTOUT() }
|
||||
|
||||
@@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(create) {
|
||||
EclipseState es(deck);
|
||||
const EclipseGrid& grid = es.getInputGrid();
|
||||
Schedule schedule( deck, es);
|
||||
out::RegionCache rc(es.get3DProperties() , grid, schedule);
|
||||
out::RegionCache rc(es.get3DProperties().getIntGridProperty("FIPNUM").compressedCopy(grid) , grid, schedule);
|
||||
|
||||
{
|
||||
const auto& empty = rc.connections( 4 );
|
||||
|
||||
Reference in New Issue
Block a user