mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 08:25:03 -05:00
Refactor connection between cases and views.
Eclipse grid views and contour maps are not longer a child of the case. The views are not separate collections (one for grid and one for contour maps) on root level.
This commit is contained in:
1 parent
8f96d8b131
commit
b5666c333a
57 files changed
+626
-286
No files matched your search
@@ -279,17 +279,19 @@ void RimAnnotationInViewCollection::defineEditorAttribute( const caf::PdmFieldHa
|
||||
|
||||
if ( attr )
|
||||
{
|
||||
auto rimCase = firstAncestorOrThisOfType<RimCase>();
|
||||
if ( rimCase )
|
||||
if ( auto view = firstAncestorOrThisOfType<Rim3dView>() )
|
||||
{
|
||||
auto bb = rimCase->allCellsBoundingBox();
|
||||
attr->m_minimum = -bb.max().z();
|
||||
attr->m_maximum = -bb.min().z();
|
||||
}
|
||||
else
|
||||
{
|
||||
attr->m_minimum = 0;
|
||||
attr->m_maximum = 10000;
|
||||
if ( auto rimCase = view->ownerCase() )
|
||||
{
|
||||
auto bb = rimCase->allCellsBoundingBox();
|
||||
attr->m_minimum = -bb.max().z();
|
||||
attr->m_maximum = -bb.min().z();
|
||||
}
|
||||
else
|
||||
{
|
||||
attr->m_minimum = 0;
|
||||
attr->m_maximum = 10000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimResultSelectionUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotRectAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEmCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseViewCollection.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -268,6 +269,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotRectAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEmCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinePickerInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseViewCollection.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_USE_QT_CHARTS)
|
||||
|
||||
@@ -298,7 +298,8 @@ QString RimCellFilter::modeString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const cvf::StructGridInterface* RimCellFilter::selectedGrid() const
|
||||
{
|
||||
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
auto rimCase = firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
if ( !rimCase ) return nullptr;
|
||||
|
||||
int clampedIndex = gridIndex();
|
||||
if ( clampedIndex >= RigReservoirGridTools::gridCount( rimCase ) )
|
||||
|
||||
@@ -160,7 +160,10 @@ void RimCellFilterCollection::initAfterRead()
|
||||
|
||||
// Copy by xml serialization does not give a RimCase parent the first time initAfterRead is called here when creating a new a contour
|
||||
// view from a 3d view. The second time we get called it is ok, so just skip setting up the filter connections if we have no case.
|
||||
auto rimCase = firstAncestorOrThisOfType<RimCase>();
|
||||
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( rimView == nullptr ) return;
|
||||
|
||||
auto rimCase = rimView->ownerCase();
|
||||
if ( rimCase == nullptr ) return;
|
||||
|
||||
for ( const auto& filter : m_cellFilters )
|
||||
|
||||
@@ -145,7 +145,7 @@ void RimFlowCharacteristicsPlot::setFromFlowSolution( RimFlowDiagSolution* flowS
|
||||
{
|
||||
auto eclCase = flowSolution->firstAncestorOrThisOfType<RimEclipseResultCase>();
|
||||
m_case = eclCase;
|
||||
if ( !eclCase->reservoirViews.empty() )
|
||||
if ( !eclCase->reservoirViews().empty() )
|
||||
{
|
||||
m_cellFilterView = eclCase->reservoirViews()[0];
|
||||
}
|
||||
@@ -399,7 +399,7 @@ void RimFlowCharacteristicsPlot::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
{
|
||||
m_case = defaultCase;
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
if ( !m_case()->reservoirViews.empty() )
|
||||
if ( !m_case()->reservoirViews().empty() )
|
||||
{
|
||||
m_cellFilterView = m_case()->reservoirViews()[0];
|
||||
}
|
||||
@@ -506,7 +506,7 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
{
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
m_currentlyPlottedTimeSteps.clear();
|
||||
if ( !m_case()->reservoirViews.empty() )
|
||||
if ( !m_case()->reservoirViews().empty() )
|
||||
{
|
||||
m_cellFilterView = m_case()->reservoirViews()[0];
|
||||
}
|
||||
|
||||
@@ -706,7 +706,7 @@ QList<caf::PdmOptionItemInfo> RimWellConnectivityTable::calculateValueOptions( c
|
||||
else if ( fieldNeedingOptions == &m_cellFilterView && m_case() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) );
|
||||
for ( RimEclipseView* view : m_case()->reservoirViews.childrenByType() )
|
||||
for ( RimEclipseView* view : m_case()->reservoirViews() )
|
||||
{
|
||||
CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" );
|
||||
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );
|
||||
|
||||
@@ -104,11 +104,9 @@ QString RimGeoMechContourMapView::createAutoName() const
|
||||
|
||||
QStringList generatedAutoTags;
|
||||
|
||||
auto ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
if ( nameConfig()->addCaseName() )
|
||||
if ( nameConfig()->addCaseName() && ownerCase() )
|
||||
{
|
||||
generatedAutoTags.push_back( ownerCase->caseUserDescription() );
|
||||
generatedAutoTags.push_back( ownerCase()->caseUserDescription() );
|
||||
}
|
||||
|
||||
if ( nameConfig()->addAggregationType() )
|
||||
|
||||
@@ -226,11 +226,9 @@ QString RimGeoMechView::createAutoName() const
|
||||
|
||||
QStringList generatedAutoTags;
|
||||
|
||||
RimCase* ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
if ( nameConfig()->addCaseName() )
|
||||
if ( nameConfig()->addCaseName() && ownerCase() )
|
||||
{
|
||||
generatedAutoTags.push_back( ownerCase->caseUserDescription() );
|
||||
generatedAutoTags.push_back( ownerCase()->caseUserDescription() );
|
||||
}
|
||||
|
||||
if ( nameConfig()->addProperty() )
|
||||
|
||||
@@ -1136,7 +1136,7 @@ QList<caf::PdmOptionItemInfo> RimGridCrossPlotDataSet::calculateValueOptions( co
|
||||
if ( eclipseCase )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) );
|
||||
for ( RimEclipseView* view : eclipseCase->reservoirViews.childrenByType() )
|
||||
for ( RimEclipseView* view : eclipseCase->reservoirViews() )
|
||||
{
|
||||
CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" );
|
||||
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );
|
||||
|
||||
@@ -656,7 +656,7 @@ void RimBoxIntersection::switchSingelPlaneState()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimBoxIntersection::currentCellBoundingBox()
|
||||
{
|
||||
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
auto rimCase = firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
|
||||
return rimCase->activeCellsBoundingBox();
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ void RimIntersectionCollection::appendIntersectionNoUpdate( RimExtrudedCurveInte
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionCollection::synchronize2dIntersectionViews()
|
||||
{
|
||||
auto ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
auto ownerCase = firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
ownerCase->intersectionViewCollection()->syncFromExistingIntersections( true );
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -72,8 +72,13 @@ void RimIntersectionResultsDefinitionCollection::appendIntersectionResultDefinit
|
||||
|
||||
if ( interResDef->activeCase() == nullptr )
|
||||
{
|
||||
auto ownerCase = firstAncestorOrThisOfType<RimCase>();
|
||||
interResDef->setActiveCase( ownerCase );
|
||||
if ( auto gridView = firstAncestorOrThisOfType<Rim3dView>() )
|
||||
{
|
||||
if ( auto ownerCase = gridView->ownerCase() )
|
||||
{
|
||||
interResDef->setActiveCase( ownerCase );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ RimCase* Rim2dIntersectionView::ownerCase() const
|
||||
|
||||
if ( !rimCase )
|
||||
{
|
||||
rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
rimCase = firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
}
|
||||
|
||||
return rimCase;
|
||||
|
||||
@@ -1013,12 +1013,14 @@ void Rim3dOverlayInfoConfig::updateSeismicInfo( RimSeismicView* seisView )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::update3DInfoIn2dViews() const
|
||||
{
|
||||
RimCase* rimCase = firstAncestorOrThisOfType<RimCase>();
|
||||
if ( rimCase )
|
||||
if ( auto rimView = firstAncestorOrThisOfType<Rim3dView>() )
|
||||
{
|
||||
for ( Rim2dIntersectionView* view : rimCase->intersectionViewCollection()->views() )
|
||||
if ( RimCase* rimCase = rimView->ownerCase() )
|
||||
{
|
||||
view->update3dInfo();
|
||||
for ( Rim2dIntersectionView* view : rimCase->intersectionViewCollection()->views() )
|
||||
{
|
||||
view->update3dInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,9 +190,11 @@ void RimAdvancedSnapshotExportDefinition::fieldChangedByUi( const caf::PdmFieldH
|
||||
{
|
||||
actCellInfo = RigReservoirGridTools::activeCellInfo( view() );
|
||||
|
||||
auto rimCase = view()->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
mainGrid = RigReservoirGridTools::mainGrid( rimCase );
|
||||
auto rimCase = view()->ownerCase();
|
||||
if ( rimCase )
|
||||
{
|
||||
mainGrid = RigReservoirGridTools::mainGrid( rimCase );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mainGrid && actCellInfo )
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "RimEclipseResultAddressCollection.h"
|
||||
#include "RimEclipseStatisticsCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseViewCollection.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimGridCollection.h"
|
||||
@@ -91,7 +92,7 @@ RimEclipseCase::RimEclipseCase()
|
||||
{
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "EclipseCase", ":/Case48x48.png", "", "", "Reservoir", "Abstract base class for Eclipse Cases" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &reservoirViews, "ReservoirViews", "Views", "", "", "", "All Eclipse Views in the case" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_reservoirViews_OBSOLETE, "ReservoirViews", "Views", "", "", "", "All Eclipse Views in the case" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_matrixModelResults, "MatrixModelResults", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_fractureModelResults, "FractureModelResults", "" );
|
||||
@@ -105,8 +106,8 @@ RimEclipseCase::RimEclipseCase()
|
||||
// https://github.com/OPM/ResInsight/issues/7308
|
||||
m_filesContainingFaults.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps" );
|
||||
m_contourMapCollection = new RimEclipseContourMapViewCollection;
|
||||
CAF_PDM_InitFieldNoDefault( &m_contourMapCollection_OBSOLETE, "ContourMaps", "2d Contour Maps" );
|
||||
m_contourMapCollection_OBSOLETE = new RimEclipseContourMapViewCollection;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_inputPropertyCollection, "InputPropertyCollection", "" );
|
||||
m_inputPropertyCollection = new RimEclipseInputPropertyCollection;
|
||||
@@ -132,8 +133,6 @@ RimEclipseCase::RimEclipseCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase::~RimEclipseCase()
|
||||
{
|
||||
reservoirViews.deleteChildren();
|
||||
|
||||
delete m_matrixModelResults();
|
||||
delete m_fractureModelResults();
|
||||
delete m_inputPropertyCollection;
|
||||
@@ -276,17 +275,32 @@ void RimEclipseCase::initAfterRead()
|
||||
{
|
||||
RimCase::initAfterRead();
|
||||
|
||||
size_t j;
|
||||
for ( j = 0; j < reservoirViews().size(); j++ )
|
||||
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2024.03.0" ) )
|
||||
{
|
||||
RimEclipseView* riv = reservoirViews()[j];
|
||||
CVF_ASSERT( riv );
|
||||
// Move views to view collection.
|
||||
RimEclipseViewCollection* viewColl = viewCollection();
|
||||
for ( size_t j = 0; j < m_reservoirViews_OBSOLETE.size(); j++ )
|
||||
{
|
||||
RimEclipseView* riv = m_reservoirViews_OBSOLETE()[j];
|
||||
CVF_ASSERT( riv );
|
||||
|
||||
riv->setEclipseCase( this );
|
||||
}
|
||||
for ( RimEclipseContourMapView* contourMap : m_contourMapCollection->views() )
|
||||
{
|
||||
contourMap->setEclipseCase( this );
|
||||
riv->setEclipseCase( this );
|
||||
m_reservoirViews_OBSOLETE.removeChild( riv );
|
||||
viewColl->addView( riv );
|
||||
}
|
||||
|
||||
m_reservoirViews_OBSOLETE.clearWithoutDelete();
|
||||
|
||||
// Move contour maps
|
||||
auto mapViewColl = contourMapCollection();
|
||||
for ( RimEclipseContourMapView* contourMap : m_contourMapCollection_OBSOLETE->views() )
|
||||
{
|
||||
contourMap->setEclipseCase( this );
|
||||
m_contourMapCollection_OBSOLETE->removeChild( contourMap );
|
||||
mapViewColl->push_back( contourMap );
|
||||
}
|
||||
|
||||
m_contourMapCollection_OBSOLETE->clearWithoutDelete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,29 +309,10 @@ void RimEclipseCase::initAfterRead()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RimEclipseCase::createAndAddReservoirView()
|
||||
{
|
||||
RimEclipseView* rimEclipseView = new RimEclipseView();
|
||||
RimEclipseViewCollection* viewColl = viewCollection();
|
||||
if ( !viewColl ) return nullptr;
|
||||
|
||||
rimEclipseView->setEclipseCase( this );
|
||||
|
||||
// Set default values
|
||||
if ( rimEclipseView->currentGridCellResults() )
|
||||
{
|
||||
auto defaultResult = rimEclipseView->currentGridCellResults()->defaultResult();
|
||||
rimEclipseView->cellResult()->setFromEclipseResultAddress( defaultResult );
|
||||
}
|
||||
|
||||
auto prefs = RiaPreferences::current();
|
||||
rimEclipseView->faultCollection()->setActive( prefs->enableFaultsByDefault() );
|
||||
|
||||
rimEclipseView->cellEdgeResult()->setResultVariable( "MULT" );
|
||||
rimEclipseView->cellEdgeResult()->setActive( false );
|
||||
rimEclipseView->fractureColors()->setDefaultResultName();
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively( rimEclipseView );
|
||||
|
||||
reservoirViews().push_back( rimEclipseView );
|
||||
|
||||
return rimEclipseView;
|
||||
return viewColl->addView( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -334,7 +329,10 @@ RimEclipseView* RimEclipseCase::createCopyAndAddView( const RimEclipseView* sour
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively( rimEclipseView );
|
||||
|
||||
reservoirViews().push_back( rimEclipseView );
|
||||
RimEclipseViewCollection* viewColl = viewCollection();
|
||||
if ( !viewColl ) return nullptr;
|
||||
|
||||
viewColl->addView( rimEclipseView );
|
||||
|
||||
// Resolve references after reservoir view has been inserted into Rim structures
|
||||
rimEclipseView->resolveReferencesRecursively();
|
||||
@@ -468,10 +466,8 @@ void RimEclipseCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
||||
computeCachedData();
|
||||
|
||||
for ( size_t i = 0; i < reservoirViews().size(); i++ )
|
||||
for ( RimEclipseView* reservoirView : reservoirViews() )
|
||||
{
|
||||
RimEclipseView* reservoirView = reservoirViews()[i];
|
||||
|
||||
reservoirView->scheduleReservoirGridGeometryRegen();
|
||||
reservoirView->scheduleSimWellGeometryRegen();
|
||||
reservoirView->createDisplayModelAndRedraw();
|
||||
@@ -554,20 +550,10 @@ void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
{
|
||||
if ( uiConfigName == "MainWindow.ProjectTree" )
|
||||
{
|
||||
std::vector<PdmObjectHandle*> children = reservoirViews.children();
|
||||
|
||||
for ( auto child : children )
|
||||
uiTreeOrdering.add( child );
|
||||
|
||||
if ( !m_2dIntersectionViewCollection->views().empty() )
|
||||
{
|
||||
uiTreeOrdering.add( &m_2dIntersectionViewCollection );
|
||||
}
|
||||
|
||||
if ( !m_contourMapCollection->views().empty() )
|
||||
{
|
||||
uiTreeOrdering.add( &m_contourMapCollection );
|
||||
}
|
||||
}
|
||||
else if ( uiConfigName == "MainWindow.DataSources" )
|
||||
{
|
||||
@@ -668,9 +654,15 @@ RimCaseCollection* RimEclipseCase::parentCaseCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseContourMapViewCollection* RimEclipseCase::contourMapCollection()
|
||||
RimEclipseContourMapViewCollection* RimEclipseCase::contourMapCollection() const
|
||||
{
|
||||
return m_contourMapCollection;
|
||||
RimProject* project = RimProject::current();
|
||||
if ( !project ) return nullptr;
|
||||
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
if ( !oilField ) return nullptr;
|
||||
|
||||
return oilField->eclipseContourMapCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1080,12 +1072,12 @@ bool RimEclipseCase::openReserviorCase()
|
||||
std::vector<Rim3dView*> RimEclipseCase::allSpecialViews() const
|
||||
{
|
||||
std::vector<Rim3dView*> views;
|
||||
for ( RimEclipseView* view : reservoirViews )
|
||||
for ( RimEclipseView* view : reservoirViews() )
|
||||
{
|
||||
views.push_back( view );
|
||||
}
|
||||
|
||||
for ( RimEclipseContourMapView* view : m_contourMapCollection->views() )
|
||||
for ( RimEclipseContourMapView* view : contourMapViews() )
|
||||
{
|
||||
views.push_back( view );
|
||||
}
|
||||
@@ -1198,3 +1190,57 @@ void RimEclipseCase::updateResultAddressCollection()
|
||||
m_resultAddressCollections.deleteChildren();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseViewCollection* RimEclipseCase::viewCollection() const
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
if ( !project ) return nullptr;
|
||||
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
if ( !oilField ) return nullptr;
|
||||
|
||||
return oilField->eclipseViewCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseView*> RimEclipseCase::reservoirViews() const
|
||||
{
|
||||
std::vector<RimEclipseView*> views;
|
||||
if ( RimEclipseViewCollection* viewColl = viewCollection() )
|
||||
{
|
||||
for ( auto view : viewColl->views() )
|
||||
{
|
||||
if ( view && view->eclipseCase() && view->eclipseCase() == this )
|
||||
{
|
||||
views.push_back( view );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return views;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseContourMapView*> RimEclipseCase::contourMapViews() const
|
||||
{
|
||||
std::vector<RimEclipseContourMapView*> views;
|
||||
if ( RimEclipseContourMapViewCollection* viewColl = contourMapCollection() )
|
||||
{
|
||||
for ( auto view : viewColl->views() )
|
||||
{
|
||||
if ( view && view->eclipseCase() && view->eclipseCase() == this )
|
||||
{
|
||||
views.push_back( view );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return views;
|
||||
}
|
||||
@@ -52,6 +52,7 @@ class RimIdenticalGridCaseGroup;
|
||||
class RimReservoirCellResultsStorage;
|
||||
class RimEclipseResultAddressCollection;
|
||||
class RifReaderSettings;
|
||||
class RimEclipseViewCollection;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@@ -66,8 +67,7 @@ public:
|
||||
RimEclipseCase();
|
||||
~RimEclipseCase() override;
|
||||
|
||||
// Fields:
|
||||
caf::PdmChildArrayField<RimEclipseView*> reservoirViews;
|
||||
std::vector<RimEclipseView*> reservoirViews() const;
|
||||
|
||||
std::vector<QString> filesContainingFaults() const;
|
||||
void setFilesContainingFaults( const std::vector<QString>& val );
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
virtual QString locationOnDisc() const { return QString(); }
|
||||
|
||||
RimCaseCollection* parentCaseCollection();
|
||||
RimEclipseContourMapViewCollection* contourMapCollection();
|
||||
RimEclipseContourMapViewCollection* contourMapCollection() const;
|
||||
RimEclipseInputPropertyCollection* inputPropertyCollection() const;
|
||||
|
||||
QStringList timeStepStrings() const override;
|
||||
@@ -137,14 +137,18 @@ protected:
|
||||
|
||||
// Internal methods
|
||||
protected:
|
||||
void computeCachedData();
|
||||
void setReservoirData( RigEclipseCaseData* eclipseCase );
|
||||
std::vector<QString> additionalFiles() const;
|
||||
void computeCachedData();
|
||||
void setReservoirData( RigEclipseCaseData* eclipseCase );
|
||||
std::vector<QString> additionalFiles() const;
|
||||
RimEclipseViewCollection* viewCollection() const;
|
||||
RimEclipseContourMapViewCollection* contourMapViewCollection() const;
|
||||
|
||||
private:
|
||||
void createTimeStepFormatString();
|
||||
std::vector<Rim3dView*> allSpecialViews() const override;
|
||||
void buildResultChildNodes();
|
||||
void createTimeStepFormatString();
|
||||
std::vector<Rim3dView*> allSpecialViews() const override;
|
||||
std::vector<RimEclipseContourMapView*> contourMapViews() const;
|
||||
|
||||
void buildResultChildNodes();
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_flipXAxis;
|
||||
@@ -156,8 +160,6 @@ protected:
|
||||
private:
|
||||
caf::PdmField<bool> m_releaseResultMemory;
|
||||
|
||||
caf::PdmChildField<RimEclipseContourMapViewCollection*> m_contourMapCollection;
|
||||
|
||||
cvf::ref<RigEclipseCaseData> m_rigEclipseCase;
|
||||
QString m_timeStepFormatString;
|
||||
std::map<QString, cvf::Color3f> m_wellToColorMap;
|
||||
@@ -168,4 +170,8 @@ private:
|
||||
caf::PdmChildField<RimReservoirCellResultsStorage*> m_fractureModelResults;
|
||||
|
||||
caf::PdmField<std::vector<caf::FilePath>> m_filesContainingFaults;
|
||||
|
||||
// Obsolete fields:
|
||||
caf::PdmChildArrayField<RimEclipseView*> m_reservoirViews_OBSOLETE;
|
||||
caf::PdmChildField<RimEclipseContourMapViewCollection*> m_contourMapCollection_OBSOLETE;
|
||||
};
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "RigHexIntersectionTools.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
@@ -385,7 +386,10 @@ std::vector<double> RimEclipseContourMapProjection::retrieveParameterWeights()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimEclipseContourMapProjection::eclipseCase() const
|
||||
{
|
||||
return firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
auto view = firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( !view ) return nullptr;
|
||||
|
||||
return dynamic_cast<RimEclipseCase*>( view->ownerCase() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -108,11 +108,9 @@ QString RimEclipseContourMapView::createAutoName() const
|
||||
|
||||
QStringList generatedAutoTags;
|
||||
|
||||
RimCase* ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
if ( nameConfig()->addCaseName() )
|
||||
if ( nameConfig()->addCaseName() && ownerCase() )
|
||||
{
|
||||
generatedAutoTags.push_back( ownerCase->caseUserDescription() );
|
||||
generatedAutoTags.push_back( ownerCase()->caseUserDescription() );
|
||||
}
|
||||
|
||||
if ( nameConfig()->addAggregationType() )
|
||||
|
||||
@@ -47,3 +47,19 @@ void RimEclipseContourMapViewCollection::onChildDeleted( caf::PdmChildArrayField
|
||||
auto eclipseCase = firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclipseCase ) eclipseCase->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseContourMapViewCollection::clearWithoutDelete()
|
||||
{
|
||||
m_contourMapViews.clearWithoutDelete();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseContourMapViewCollection::removeChild( RimEclipseContourMapView* contourMap )
|
||||
{
|
||||
m_contourMapViews.removeChild( contourMap );
|
||||
}
|
||||
@@ -37,6 +37,9 @@ public:
|
||||
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
void clearWithoutDelete();
|
||||
void removeChild( RimEclipseContourMapView* contourMap );
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimEclipseContourMapView*> m_contourMapViews;
|
||||
};
|
||||
@@ -500,12 +500,11 @@ RimEclipseResultCase::~RimEclipseResultCase()
|
||||
{
|
||||
// Disconnect all comparison views. In debug build on Windows, a crash occurs. The comparison view is also set to zero in the destructor
|
||||
// of Rim3dView()
|
||||
for ( auto v : reservoirViews )
|
||||
for ( auto v : reservoirViews() )
|
||||
{
|
||||
if ( v ) v->setComparisonView( nullptr );
|
||||
}
|
||||
|
||||
reservoirViews.deleteChildren();
|
||||
m_flowDiagSolutions.deleteChildren();
|
||||
}
|
||||
|
||||
|
||||
@@ -769,7 +769,9 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
auto eclipseCase = firstAncestorOrThisOfTypeAsserted<RimEclipseCase>();
|
||||
RimEclipseView* eclView = firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
|
||||
auto eclipseCase = eclView->eclipseCase();
|
||||
if ( eclipseCase && eclipseCase->eclipseCaseData() && eclipseCase->eclipseCaseData()->mainGrid() )
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
@@ -792,7 +794,9 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_timeLapseBaseTimestep )
|
||||
{
|
||||
RimEclipseCase* currentCase = firstAncestorOrThisOfTypeAsserted<RimEclipseCase>();
|
||||
RimEclipseView* eclView = firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
|
||||
RimEclipseCase* currentCase = eclView->eclipseCase();
|
||||
|
||||
RimEclipseCase* baseCase = currentCase;
|
||||
if ( m_differenceCase )
|
||||
@@ -802,13 +806,16 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( "Disabled", RigEclipseResultAddress::noTimeLapseValue() ) );
|
||||
|
||||
std::vector<QDateTime> stepDates = baseCase->timeStepDates();
|
||||
for ( size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx )
|
||||
if ( baseCase )
|
||||
{
|
||||
QString displayString = stepDates[stepIdx].toString( RiaQDateTimeTools::dateFormatString() );
|
||||
displayString += QString( " (#%1)" ).arg( stepIdx );
|
||||
std::vector<QDateTime> stepDates = baseCase->timeStepDates();
|
||||
for ( size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx )
|
||||
{
|
||||
QString displayString = stepDates[stepIdx].toString( RiaQDateTimeTools::dateFormatString() );
|
||||
displayString += QString( " (#%1)" ).arg( stepIdx );
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( displayString, static_cast<int>( stepIdx ) ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( displayString, static_cast<int>( stepIdx ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,11 +444,9 @@ void RimEclipseStatisticsCase::computeStatistics()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseStatisticsCase::scheduleACTIVEGeometryRegenOnReservoirViews()
|
||||
{
|
||||
for ( size_t i = 0; i < reservoirViews().size(); i++ )
|
||||
for ( RimEclipseView* reservoirView : reservoirViews() )
|
||||
{
|
||||
RimEclipseView* reservoirView = reservoirViews()[i];
|
||||
CVF_ASSERT( reservoirView );
|
||||
|
||||
reservoirView->scheduleGeometryRegen( ACTIVE );
|
||||
}
|
||||
}
|
||||
@@ -755,9 +753,8 @@ void RimEclipseStatisticsCase::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
caf::ProgressInfo progInfo( reservoirViews().size() + 1, "Updating Well Data for Views" );
|
||||
|
||||
// Update views
|
||||
for ( size_t i = 0; i < reservoirViews().size(); i++ )
|
||||
for ( RimEclipseView* reservoirView : reservoirViews() )
|
||||
{
|
||||
RimEclipseView* reservoirView = reservoirViews()[i];
|
||||
CVF_ASSERT( reservoirView );
|
||||
|
||||
reservoirView->wellCollection()->wells.deleteChildren();
|
||||
@@ -961,18 +958,16 @@ bool RimEclipseStatisticsCase::hasComputedStatistics() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseStatisticsCase::updateConnectedEditorsAndReservoirViews()
|
||||
{
|
||||
for ( size_t i = 0; i < reservoirViews.size(); ++i )
|
||||
auto views = reservoirViews();
|
||||
for ( RimEclipseView* view : reservoirViews() )
|
||||
{
|
||||
if ( reservoirViews[i] )
|
||||
{
|
||||
// As new result might have been introduced, update all editors connected
|
||||
reservoirViews[i]->cellResult()->updateConnectedEditors();
|
||||
// As new result might have been introduced, update all editors connected
|
||||
view->cellResult()->updateConnectedEditors();
|
||||
|
||||
// It is usually not needed to create new display model, but if any derived geometry based on generated data
|
||||
// (from Octave) a full display model rebuild is required
|
||||
reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
reservoirViews[i]->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
// It is usually not needed to create new display model, but if any derived geometry based on generated data
|
||||
// (from Octave) a full display model rebuild is required
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
view->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
@@ -1007,18 +1002,18 @@ void RimEclipseStatisticsCase::computeStatisticsAndUpdateViews()
|
||||
scheduleACTIVEGeometryRegenOnReservoirViews();
|
||||
updateConnectedEditorsAndReservoirViews();
|
||||
|
||||
if ( reservoirViews.empty() )
|
||||
if ( reservoirViews().empty() )
|
||||
{
|
||||
RicNewViewFeature::addReservoirView( this, nullptr );
|
||||
}
|
||||
|
||||
if ( reservoirViews.size() == 1 )
|
||||
if ( reservoirViews().size() == 1 )
|
||||
{
|
||||
// If only one view, set the first result as active
|
||||
|
||||
if ( auto cellResultsData = results( RiaDefines::PorosityModelType::MATRIX_MODEL ) )
|
||||
{
|
||||
auto firstView = reservoirViews[0];
|
||||
auto firstView = reservoirViews()[0];
|
||||
|
||||
std::vector<RigEclipseResultAddress> resAddresses = cellResultsData->existingResults();
|
||||
if ( firstView && !resAddresses.empty() )
|
||||
|
||||
@@ -327,7 +327,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults( const QList<ResSpec>
|
||||
|
||||
for ( RimEclipseCase* eclipseCase : m_sourceCases )
|
||||
{
|
||||
if ( eclipseCase->reservoirViews.empty() )
|
||||
if ( eclipseCase->reservoirViews().empty() )
|
||||
{
|
||||
eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->freeAllocatedResultsData( categoriesToExclude, timeStepIdx );
|
||||
eclipseCase->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->freeAllocatedResultsData( categoriesToExclude, timeStepIdx );
|
||||
|
||||
@@ -144,7 +144,9 @@ RimEclipseView::RimEclipseView()
|
||||
"EclipseView",
|
||||
"The Eclipse 3d Reservoir View" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_customEclipseCase, "CustomEclipseCase", "Custom Case" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_customEclipseCase_OBSOLETE, "CustomEclipseCase", "Custom Case" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_cellResult, "GridCellResult", "CellResult", "Cell Result", ":/CellResult.png" );
|
||||
m_cellResult = new RimEclipseCellColors();
|
||||
@@ -392,7 +394,7 @@ void RimEclipseView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
RimGridView::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_customEclipseCase )
|
||||
if ( changedField == &m_eclipseCase )
|
||||
{
|
||||
propagateEclipseCaseToChildObjects();
|
||||
|
||||
@@ -1262,11 +1264,9 @@ QString RimEclipseView::createAutoName() const
|
||||
|
||||
QStringList generatedAutoTags;
|
||||
|
||||
RimCase* ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
if ( nameConfig()->addCaseName() )
|
||||
if ( m_eclipseCase && nameConfig()->addCaseName() )
|
||||
{
|
||||
generatedAutoTags.push_back( ownerCase->caseUserDescription() );
|
||||
generatedAutoTags.push_back( m_eclipseCase->caseUserDescription() );
|
||||
}
|
||||
|
||||
if ( nameConfig()->addProperty() )
|
||||
@@ -1568,8 +1568,6 @@ void RimEclipseView::setEclipseCase( RimEclipseCase* reservoir )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimEclipseView::eclipseCase() const
|
||||
{
|
||||
if ( m_customEclipseCase() != nullptr ) return m_customEclipseCase();
|
||||
|
||||
return m_eclipseCase;
|
||||
}
|
||||
|
||||
@@ -1897,6 +1895,8 @@ void RimEclipseView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
{
|
||||
Rim3dView::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
uiOrdering.add( &m_eclipseCase );
|
||||
|
||||
caf::PdmUiGroup* cellGroup = uiOrdering.addNewGroup( "Cell Visibility" );
|
||||
cellGroup->add( &m_showInactiveCells );
|
||||
cellGroup->add( &m_showInvalidCells );
|
||||
@@ -1904,10 +1904,6 @@ void RimEclipseView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "View Name" );
|
||||
nameConfig()->uiOrdering( uiConfigName, *nameGroup );
|
||||
|
||||
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup( "Advanced" );
|
||||
advancedGroup->setCollapsedByDefault();
|
||||
advancedGroup->add( &m_customEclipseCase );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
@@ -1984,27 +1980,15 @@ std::set<RivCellSetEnum> RimEclipseView::allVisibleFaultGeometryTypes() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimEclipseView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_customEclipseCase )
|
||||
if ( fieldNeedingOptions == &m_eclipseCase )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
if ( m_eclipseCase && m_eclipseCase->mainGrid() )
|
||||
for ( auto eclCase : RimEclipseCaseTools::allEclipseGridCases() )
|
||||
{
|
||||
auto currentGridCount = m_eclipseCase->mainGrid()->gridCount();
|
||||
|
||||
for ( auto eclCase : RimEclipseCaseTools::allEclipseGridCases() )
|
||||
{
|
||||
// Find all grid cases with same number of LGRs. If the grid count differs, a crash will happen related to
|
||||
// RimGridCollection::mainEclipseGrid(). This function is using firstAncestorOrThisOfType() to find the Eclipse case. If the
|
||||
// custom case in RimEclipseView has a different number of LGRs, a crash will happen
|
||||
|
||||
if ( eclCase && ( eclCase != m_eclipseCase ) && eclCase->mainGrid() && eclCase->mainGrid()->gridCount() == currentGridCount )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( eclCase->caseUserDescription(), eclCase, false, eclCase->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( eclCase->caseUserDescription(), eclCase, false, eclCase->uiIconProvider() ) );
|
||||
}
|
||||
|
||||
return options;
|
||||
|
||||
@@ -245,8 +245,8 @@ private:
|
||||
caf::PdmChildField<RimEclipsePropertyFilterCollection*> m_propertyFilterCollection;
|
||||
caf::PdmPointer<RimEclipsePropertyFilterCollection> m_overridePropertyFilterCollection;
|
||||
|
||||
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_customEclipseCase;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_customEclipseCase_OBSOLETE;
|
||||
|
||||
cvf::ref<RivReservoirViewPartMgr> m_reservoirGridPartManager;
|
||||
cvf::ref<RivReservoirSimWellsPartMgr> m_simWellsPartManager;
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimEclipseViewCollection.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimStimPlanColors.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimEclipseViewCollection, "EclipseViewCollection", "EclipseViewCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseViewCollection::RimEclipseViewCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Views", ":/3DView16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_views, "Views", "Eclipse Views" );
|
||||
|
||||
setDeletable( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseViewCollection::~RimEclipseViewCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseView*> RimEclipseViewCollection::views() const
|
||||
{
|
||||
return m_views.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseViewCollection::isEmpty()
|
||||
{
|
||||
return !m_views.hasChildren();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RimEclipseViewCollection::addView( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
RimEclipseView* view = new RimEclipseView();
|
||||
|
||||
view->setEclipseCase( eclipseCase );
|
||||
|
||||
// Set default values
|
||||
if ( view->currentGridCellResults() )
|
||||
{
|
||||
auto defaultResult = view->currentGridCellResults()->defaultResult();
|
||||
view->cellResult()->setFromEclipseResultAddress( defaultResult );
|
||||
}
|
||||
|
||||
auto prefs = RiaPreferences::current();
|
||||
view->faultCollection()->setActive( prefs->enableFaultsByDefault() );
|
||||
|
||||
view->cellEdgeResult()->setResultVariable( "MULT" );
|
||||
view->cellEdgeResult()->setActive( false );
|
||||
view->fractureColors()->setDefaultResultName();
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively( view );
|
||||
|
||||
m_views.push_back( view );
|
||||
|
||||
view->loadDataAndUpdate();
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseViewCollection::addView( RimEclipseView* view )
|
||||
{
|
||||
m_views.push_back( view );
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseViewCollection::removeView( RimEclipseView* view )
|
||||
{
|
||||
m_views.removeChild( view );
|
||||
updateConnectedEditors();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimEclipseView;
|
||||
class RimEclipseCase;
|
||||
|
||||
class RimEclipseViewCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimEclipseViewCollection();
|
||||
~RimEclipseViewCollection() override;
|
||||
|
||||
bool isEmpty();
|
||||
|
||||
RimEclipseView* addView( RimEclipseCase* eclipseCase );
|
||||
void addView( RimEclipseView* view );
|
||||
|
||||
void removeView( RimEclipseView* view );
|
||||
|
||||
std::vector<RimEclipseView*> views() const;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimEclipseView*> m_views;
|
||||
};
|
||||
@@ -96,9 +96,9 @@ void RimGridStatisticsPlot::setDefaults()
|
||||
m_property->setResultType( RiaDefines::ResultCatType::STATIC_NATIVE );
|
||||
m_property->setResultVariable( "PORO" );
|
||||
|
||||
if ( eclipseCase && !eclipseCase->reservoirViews.children().empty() )
|
||||
if ( eclipseCase && !eclipseCase->reservoirViews().empty() )
|
||||
{
|
||||
m_cellFilterView.setValue( eclipseCase->reservoirViews.childrenByType().front() );
|
||||
m_cellFilterView.setValue( eclipseCase->reservoirViews().front() );
|
||||
}
|
||||
|
||||
m_numHistogramBins = 15;
|
||||
@@ -196,7 +196,7 @@ QList<caf::PdmOptionItemInfo> RimGridStatisticsPlot::calculateValueOptions( cons
|
||||
if ( eclipseCase )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) );
|
||||
for ( RimEclipseView* view : eclipseCase->reservoirViews.childrenByType() )
|
||||
for ( RimEclipseView* view : eclipseCase->reservoirViews() )
|
||||
{
|
||||
CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" );
|
||||
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );
|
||||
|
||||
@@ -378,9 +378,8 @@ void RimGridView::onCreatePartCollectionFromSelection( cvf::Collection<cvf::Part
|
||||
{
|
||||
RiuEclipseSelectionItem* eclipseSelItem = static_cast<RiuEclipseSelectionItem*>( items[i] );
|
||||
|
||||
if ( eclipseSelItem && eclipseSelItem->m_view == this )
|
||||
if ( eclipseSelItem && eclipseSelItem->m_view == this && eclipseSelItem->m_resultDefinition->eclipseCase() )
|
||||
{
|
||||
CVF_ASSERT( eclipseSelItem->m_resultDefinition->eclipseCase() );
|
||||
CVF_ASSERT( eclipseSelItem->m_resultDefinition->eclipseCase()->eclipseCaseData() );
|
||||
|
||||
RivSingleCellPartGenerator partGen( eclipseSelItem->m_resultDefinition->eclipseCase()->eclipseCaseData(),
|
||||
|
||||
@@ -398,9 +398,10 @@ void RimIdenticalGridCaseGroup::clearStatisticsResults()
|
||||
rimStaticsCase->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->clearAllResults();
|
||||
}
|
||||
|
||||
for ( size_t j = 0; j < rimStaticsCase->reservoirViews.size(); j++ )
|
||||
auto views = rimStaticsCase->reservoirViews();
|
||||
for ( size_t j = 0; j < views.size(); j++ )
|
||||
{
|
||||
RimEclipseView* rimReservoirView = rimStaticsCase->reservoirViews[j];
|
||||
RimEclipseView* rimReservoirView = views[j];
|
||||
rimReservoirView->cellResult()->setResultVariable( RiaResultNames::undefinedResultName() );
|
||||
rimReservoirView->cellEdgeResult()->setResultVariable( RiaResultNames::undefinedResultName() );
|
||||
rimReservoirView->loadDataAndUpdate();
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimCompletionTemplateCollection.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseContourMapViewCollection.h"
|
||||
#include "RimEclipseViewCollection.h"
|
||||
#include "RimEnsembleWellLogsCollection.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
@@ -75,6 +77,12 @@ RimOilField::RimOilField()
|
||||
CAF_PDM_InitFieldNoDefault( &seismicViewCollection, "SeismicViewCollection", "Seismic Views" );
|
||||
seismicViewCollection = new RimSeismicViewCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &eclipseViewCollection, "EclipseViewCollection", "Eclipse Views", ":/3DView16x16.png" );
|
||||
eclipseViewCollection = new RimEclipseViewCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &eclipseContourMapCollection, "ContourMaps", "2d Contour Maps" );
|
||||
eclipseContourMapCollection = new RimEclipseContourMapViewCollection;
|
||||
|
||||
completionTemplateCollection = new RimCompletionTemplateCollection;
|
||||
analysisModels = new RimEclipseCaseCollection();
|
||||
wellPathCollection = new RimWellPathCollection();
|
||||
|
||||
@@ -42,6 +42,8 @@ class RimSeismicViewCollection;
|
||||
class RimSurfaceCollection;
|
||||
class RimEnsembleWellLogsCollection;
|
||||
class RimPolygonCollection;
|
||||
class RimEclipseViewCollection;
|
||||
class RimEclipseContourMapViewCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -61,20 +63,22 @@ public:
|
||||
RimValveTemplateCollection* valveTemplateCollection();
|
||||
const RimValveTemplateCollection* valveTemplateCollection() const;
|
||||
|
||||
caf::PdmChildField<RimEclipseCaseCollection*> analysisModels;
|
||||
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
|
||||
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
|
||||
caf::PdmChildField<RimCompletionTemplateCollection*> completionTemplateCollection;
|
||||
caf::PdmChildField<RimSummaryCaseMainCollection*> summaryCaseMainCollection;
|
||||
caf::PdmChildField<RimObservedDataCollection*> observedDataCollection;
|
||||
caf::PdmChildField<RimFormationNamesCollection*> formationNamesCollection;
|
||||
caf::PdmChildField<RimAnnotationCollection*> annotationCollection;
|
||||
caf::PdmChildField<RimMeasurement*> measurement;
|
||||
caf::PdmChildField<RimSurfaceCollection*> surfaceCollection;
|
||||
caf::PdmChildField<RimSeismicDataCollection*> seismicDataCollection;
|
||||
caf::PdmChildField<RimSeismicViewCollection*> seismicViewCollection;
|
||||
caf::PdmChildField<RimEnsembleWellLogsCollection*> ensembleWellLogsCollection;
|
||||
caf::PdmChildField<RimPolygonCollection*> polygonCollection;
|
||||
caf::PdmChildField<RimEclipseCaseCollection*> analysisModels;
|
||||
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
|
||||
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
|
||||
caf::PdmChildField<RimCompletionTemplateCollection*> completionTemplateCollection;
|
||||
caf::PdmChildField<RimSummaryCaseMainCollection*> summaryCaseMainCollection;
|
||||
caf::PdmChildField<RimObservedDataCollection*> observedDataCollection;
|
||||
caf::PdmChildField<RimFormationNamesCollection*> formationNamesCollection;
|
||||
caf::PdmChildField<RimAnnotationCollection*> annotationCollection;
|
||||
caf::PdmChildField<RimMeasurement*> measurement;
|
||||
caf::PdmChildField<RimSurfaceCollection*> surfaceCollection;
|
||||
caf::PdmChildField<RimSeismicDataCollection*> seismicDataCollection;
|
||||
caf::PdmChildField<RimSeismicViewCollection*> seismicViewCollection;
|
||||
caf::PdmChildField<RimEclipseViewCollection*> eclipseViewCollection;
|
||||
caf::PdmChildField<RimEnsembleWellLogsCollection*> ensembleWellLogsCollection;
|
||||
caf::PdmChildField<RimPolygonCollection*> polygonCollection;
|
||||
caf::PdmChildField<RimEclipseContourMapViewCollection*> eclipseContourMapCollection;
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
#include "RimDialogData.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseContourMapViewCollection.h"
|
||||
#include "RimEclipseViewCollection.h"
|
||||
#include "RimEnsembleWellLogsCollection.h"
|
||||
#include "RimFileWellPath.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
@@ -1490,6 +1492,7 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
if ( oilField )
|
||||
{
|
||||
if ( oilField->analysisModels() ) uiTreeOrdering.add( oilField->analysisModels() );
|
||||
if ( oilField->eclipseViewCollection() ) uiTreeOrdering.add( oilField->eclipseViewCollection() );
|
||||
if ( oilField->geoMechModels() ) uiTreeOrdering.add( oilField->geoMechModels() );
|
||||
if ( oilField->wellPathCollection() ) uiTreeOrdering.add( oilField->wellPathCollection() );
|
||||
if ( oilField->polygonCollection() ) uiTreeOrdering.add( oilField->polygonCollection() );
|
||||
@@ -1503,6 +1506,7 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
if ( oilField->formationNamesCollection() ) uiTreeOrdering.add( oilField->formationNamesCollection() );
|
||||
if ( oilField->completionTemplateCollection() ) uiTreeOrdering.add( oilField->completionTemplateCollection() );
|
||||
if ( oilField->annotationCollection() ) uiTreeOrdering.add( oilField->annotationCollection() );
|
||||
if ( oilField->eclipseContourMapCollection() ) uiTreeOrdering.add( oilField->eclipseContourMapCollection() );
|
||||
}
|
||||
|
||||
uiTreeOrdering.add( colorLegendCollection() );
|
||||
|
||||
@@ -567,8 +567,7 @@ void RimSimWellInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& u
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInViewCollection::assignDefaultWellColors()
|
||||
{
|
||||
auto ownerCase = firstAncestorOrThisOfTypeAsserted<RimEclipseCase>();
|
||||
|
||||
auto ownerCase = m_reservoirView->eclipseCase();
|
||||
for ( size_t wIdx = 0; wIdx < wells.size(); ++wIdx )
|
||||
{
|
||||
RimSimWellInView* well = wells[wIdx];
|
||||
|
||||
Reference in new issue
Block a user