Merge pull request #1234 from joakim-hove/region-cache-fp

Region cache fp
This commit is contained in:
Joakim Hove
2019-11-27 09:50:29 +01:00
committed by GitHub
4 changed files with 11 additions and 10 deletions
+1 -2
View File
@@ -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:
+4 -6
View File
@@ -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 } );
}
+5 -1
View File
@@ -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() }
+1 -1
View File
@@ -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 );