From 73ac3e5db15aa57a9cc3fa3f49ce43674e363ae5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 13 May 2020 17:57:21 +0200 Subject: [PATCH] #5925 Simplify computation of fault data --- .../ProjectDataModel/RimEclipseCase.cpp | 36 ++++++++++++------- .../ProjectDataModel/RimEclipseCase.h | 2 ++ .../RimEclipseCaseCollection.cpp | 23 ++++-------- .../RimEclipseCaseCollection.h | 2 +- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 06599bbf29..625d823d9f 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -609,18 +609,7 @@ void RimEclipseCase::computeCachedData() { auto task = pInf.task( "Calculating faults", 17 ); - bool computeFaults = RiaApplication::instance()->preferences()->readerSettings()->importFaults(); - if ( computeFaults ) - { - bool computeNncs = RiaApplication::instance()->preferences()->readerSettings()->importNNCs(); - bool includeInactiveCells = - RiaApplication::instance()->preferences()->readerSettings()->includeInactiveCellsInFaultGeometry(); - - rigEclipseCase->mainGrid()->calculateFaults( rigEclipseCase->activeCellInfo( - RiaDefines::PorosityModelType::MATRIX_MODEL ), - computeNncs, - includeInactiveCells ); - } + ensureFaultDataIsComputed(); } { @@ -701,6 +690,29 @@ void RimEclipseCase::loadAndSyncronizeInputProperties( bool includeGridFileName RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( inputPropertyCollection(), eclipseCaseData(), filenames ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseCase::ensureFaultDataIsComputed() +{ + RigEclipseCaseData* rigEclipseCase = eclipseCaseData(); + if ( rigEclipseCase ) + { + bool computeFaults = RiaApplication::instance()->preferences()->readerSettings()->importFaults(); + if ( computeFaults ) + { + bool computeNncs = RiaApplication::instance()->preferences()->readerSettings()->importNNCs(); + bool includeInactiveCells = + RiaApplication::instance()->preferences()->readerSettings()->includeInactiveCellsInFaultGeometry(); + + rigEclipseCase->mainGrid()->calculateFaults( rigEclipseCase->activeCellInfo( + RiaDefines::PorosityModelType::MATRIX_MODEL ), + computeNncs, + includeInactiveCells ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index e9239009c3..5f9a34a952 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -115,6 +115,8 @@ public: void loadAndSyncronizeInputProperties( bool includeGridFileName ); + void ensureFaultDataIsComputed(); + protected: void initAfterRead() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.cpp index cd985e81c0..c7d3da81b2 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.cpp @@ -78,8 +78,7 @@ RimIdenticalGridCaseGroup* RimEclipseCaseCollection::createIdenticalCaseGroupFro { CVF_ASSERT( mainCase ); - RigEclipseCaseData* rigEclipseCase = mainCase->eclipseCaseData(); - RigMainGrid* equalGrid = registerCaseInGridCollection( rigEclipseCase ); + RigMainGrid* equalGrid = registerCaseInGridCollection( mainCase ); CVF_ASSERT( equalGrid ); RimIdenticalGridCaseGroup* group = new RimIdenticalGridCaseGroup; @@ -116,9 +115,10 @@ void RimEclipseCaseCollection::removeCaseFromAllGroups( RimEclipseCase* reservoi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection( RigEclipseCaseData* rigEclipseCase ) +RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection( RimEclipseCase* rimEclipseCase ) { - CVF_ASSERT( rigEclipseCase ); + CVF_ASSERT( rimEclipseCase && rimEclipseCase->eclipseCaseData() ); + RigEclipseCaseData* rigEclipseCase = rimEclipseCase->eclipseCaseData(); RigMainGrid* equalGrid = m_gridCollection->findEqualGrid( rigEclipseCase->mainGrid() ); @@ -132,17 +132,7 @@ RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection( RigEclipseC // This is the first insertion of this grid, compute cached data rigEclipseCase->mainGrid()->computeCachedData(); - bool computeFaults = RiaApplication::instance()->preferences()->readerSettings()->importFaults(); - if ( computeFaults ) - { - bool computeNncs = RiaApplication::instance()->preferences()->readerSettings()->importNNCs(); - bool includeInactiveCells = - RiaApplication::instance()->preferences()->readerSettings()->includeInactiveCellsInFaultGeometry(); - rigEclipseCase->mainGrid()->calculateFaults( rigEclipseCase->activeCellInfo( - RiaDefines::PorosityModelType::MATRIX_MODEL ), - computeNncs, - includeInactiveCells ); - } + rimEclipseCase->ensureFaultDataIsComputed(); equalGrid = rigEclipseCase->mainGrid(); } @@ -159,8 +149,7 @@ void RimEclipseCaseCollection::insertCaseInCaseGroup( RimIdenticalGridCaseGroup* { CVF_ASSERT( rimReservoir ); - RigEclipseCaseData* rigEclipseCase = rimReservoir->eclipseCaseData(); - registerCaseInGridCollection( rigEclipseCase ); + registerCaseInGridCollection( rimReservoir ); caseGroup->addCase( rimReservoir ); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.h b/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.h index afdd44e6ac..a6451b5cae 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.h @@ -58,6 +58,6 @@ public: void recomputeStatisticsForAllCaseGroups(); private: - RigMainGrid* registerCaseInGridCollection( RigEclipseCaseData* rigEclipseCase ); + RigMainGrid* registerCaseInGridCollection( RimEclipseCase* rimEclipseCase ); cvf::ref m_gridCollection; };