mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06: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:
parent
8f96d8b131
commit
b5666c333a
@ -59,12 +59,15 @@ void RicNewCellIndexFilterFeature::onActionTriggered( bool isChecked )
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
|
||||
RimCellIndexFilter* lastCreatedOrUpdated = filtColl->addNewCellIndexFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
if ( sourceCase )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
RimCellIndexFilter* lastCreatedOrUpdated = filtColl->addNewCellIndexFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,11 +64,13 @@ void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
}
|
||||
|
||||
auto sourceCase = cellFilterCollection->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
if ( auto lastCreatedOrUpdated = cellFilterCollection->addNewPolygonFilter( sourceCase, polygon ) )
|
||||
auto sourceCase = cellFilterCollection->firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
if ( sourceCase )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
if ( auto lastCreatedOrUpdated = cellFilterCollection->addNewPolygonFilter( sourceCase, polygon ) )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,11 @@
|
||||
|
||||
#include "RicNewRangeFilterSliceFeature.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
@ -45,13 +47,16 @@ void RicNewRangeFilterSliceFeature::onActionTriggered( bool isChecked )
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
|
||||
int gridIndex = 0;
|
||||
RimCellFilter* lastCreatedOrUpdated = filtColl->addNewCellRangeFilter( sourceCase, gridIndex, m_sliceDirection );
|
||||
if ( lastCreatedOrUpdated )
|
||||
if ( sourceCase )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
int gridIndex = 0;
|
||||
RimCellFilter* lastCreatedOrUpdated = filtColl->addNewCellRangeFilter( sourceCase, gridIndex, m_sliceDirection );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,11 @@
|
||||
|
||||
#include "RicNewUserDefinedFilterFeature.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimUserDefinedFilter.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
@ -41,12 +43,15 @@ void RicNewUserDefinedFilterFeature::onActionTriggered( bool isChecked )
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
|
||||
RimUserDefinedFilter* lastCreatedOrUpdated = filtColl->addNewUserDefinedFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
if ( sourceCase )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
RimUserDefinedFilter* lastCreatedOrUpdated = filtColl->addNewUserDefinedFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RicNewUserDefinedIndexFilterFeature.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimUserDefinedIndexFilter.h"
|
||||
@ -42,12 +43,15 @@ void RicNewUserDefinedIndexFilterFeature::onActionTriggered( bool isChecked )
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
|
||||
auto* lastCreatedOrUpdated = filtColl->addNewUserDefinedIndexFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
if ( sourceCase )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
auto* lastCreatedOrUpdated = filtColl->addNewUserDefinedIndexFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,10 @@ void RicNewAzimuthDipIntersectionFeatureCmd::redo()
|
||||
intersection->setName( "Azimuth and Dip" );
|
||||
intersection->configureForAzimuthLine();
|
||||
|
||||
RimCase* rimCase = m_intersectionCollection->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
cvf::BoundingBox bBox = rimCase->allCellsBoundingBox();
|
||||
RimCase* rimCase = m_intersectionCollection->firstAncestorOrThisOfTypeAsserted<Rim3dView>()->ownerCase();
|
||||
if ( !rimCase ) return;
|
||||
|
||||
cvf::BoundingBox bBox = rimCase->allCellsBoundingBox();
|
||||
if ( bBox.isValid() )
|
||||
{
|
||||
intersection->setLengthUp( cvf::Math::floor( bBox.extent()[2] / 2 ) );
|
||||
|
@ -33,10 +33,12 @@
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseViewCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuAdvancedSnapshotExportWidget.h"
|
||||
@ -146,7 +148,7 @@ void RicAdvancedSnapshotExportFeature::exportMultipleSnapshots( const QString& f
|
||||
|
||||
exportViewVariations( copyOfEclipseView, msd, folder );
|
||||
|
||||
eclCase->reservoirViews().removeChild( copyOfEclipseView );
|
||||
removeViewFromViewCollection( copyOfEclipseView );
|
||||
|
||||
delete copyOfEclipseView;
|
||||
}
|
||||
@ -207,7 +209,7 @@ void RicAdvancedSnapshotExportFeature::exportViewVariations( Rim3dView* rimView,
|
||||
exportViewVariationsToFolder( copyOfView, msd, folder );
|
||||
}
|
||||
|
||||
eclCase->reservoirViews().removeChild( copyOfView );
|
||||
removeViewFromViewCollection( copyOfView );
|
||||
|
||||
delete copyOfView;
|
||||
}
|
||||
@ -338,3 +340,19 @@ QString RicAdvancedSnapshotExportFeature::resultName( Rim3dView* rimView )
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAdvancedSnapshotExportFeature::removeViewFromViewCollection( RimEclipseView* view )
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
if ( !project ) return;
|
||||
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
if ( !oilField ) return;
|
||||
|
||||
RimEclipseViewCollection* viewColl = oilField->eclipseViewCollection();
|
||||
if ( !viewColl ) return;
|
||||
viewColl->removeView( view );
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ class RimAdvancedSnapshotExportDefinition;
|
||||
class RimProject;
|
||||
class Rim3dView;
|
||||
class RimGridView;
|
||||
class RimEclipseView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -45,4 +46,5 @@ public:
|
||||
private:
|
||||
static void exportViewVariationsToFolder( RimGridView* rimView, RimAdvancedSnapshotExportDefinition* msd, const QString& folder );
|
||||
static QString resultName( Rim3dView* rimView );
|
||||
static void removeViewFromViewCollection( RimEclipseView* view );
|
||||
};
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "RicPasteFeatureImpl.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilter.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
@ -42,17 +43,9 @@ bool RicPasteCellFiltersFeature::isCommandEnabled() const
|
||||
|
||||
std::vector<caf::PdmPointer<RimCellFilter>> typedObjects;
|
||||
objectGroup.objectsByType( &typedObjects );
|
||||
if ( typedObjects.empty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( typedObjects.empty() ) return false;
|
||||
|
||||
if ( dynamic_cast<RimCellFilterCollection*>( caf::SelectionManager::instance()->selectedItem() ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return dynamic_cast<RimCellFilterCollection*>( caf::SelectionManager::instance()->selectedItem() ) != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -63,7 +56,11 @@ void RicPasteCellFiltersFeature::onActionTriggered( bool isChecked )
|
||||
auto cellFilterCollection = dynamic_cast<RimCellFilterCollection*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( !cellFilterCollection ) return;
|
||||
|
||||
auto eclipseCase = cellFilterCollection->firstAncestorOfType<RimCase>();
|
||||
auto view = cellFilterCollection->firstAncestorOfType<Rim3dView>();
|
||||
if ( !view ) return;
|
||||
|
||||
auto eclipseCase = view->ownerCase();
|
||||
if ( !eclipseCase ) return;
|
||||
|
||||
caf::PdmObjectGroup objectGroup;
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
|
||||
|
@ -186,9 +186,8 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup( caf::PdmObjectGroup&
|
||||
|
||||
gridCaseGroup->updateConnectedEditors();
|
||||
|
||||
for ( size_t rvIdx = 0; rvIdx < rimResultReservoir->reservoirViews.size(); rvIdx++ )
|
||||
for ( RimEclipseView* riv : rimResultReservoir->reservoirViews() )
|
||||
{
|
||||
RimEclipseView* riv = rimResultReservoir->reservoirViews()[rvIdx];
|
||||
riv->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -24,21 +24,22 @@
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapProjection.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimEclipseContourMapViewCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include "RimGeoMechContourMapViewCollection.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimSurfaceInViewCollection.h"
|
||||
|
||||
@ -86,7 +87,7 @@ void RicNewContourMapViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimEclipseView* reservoirView = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>();
|
||||
RimEclipseContourMapView* existingEclipseContourMap = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseContourMapView>();
|
||||
RimEclipseCase* eclipseCase = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimEclipseCase>();
|
||||
RimEclipseCase* eclipseCase = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>();
|
||||
RimEclipseContourMapView* eclipseContourMap = nullptr;
|
||||
|
||||
RimGeoMechView* geoMechView = caf::SelectionManager::instance()->selectedItemOfType<RimGeoMechView>();
|
||||
@ -97,11 +98,19 @@ void RicNewContourMapViewFeature::onActionTriggered( bool isChecked )
|
||||
// Find case to insert into
|
||||
if ( existingEclipseContourMap )
|
||||
{
|
||||
eclipseContourMap = createEclipseContourMapFromExistingContourMap( eclipseCase, existingEclipseContourMap );
|
||||
eclipseCase = existingEclipseContourMap->eclipseCase();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
eclipseContourMap = createEclipseContourMapFromExistingContourMap( eclipseCase, existingEclipseContourMap );
|
||||
}
|
||||
}
|
||||
else if ( reservoirView )
|
||||
{
|
||||
eclipseContourMap = createEclipseContourMapFrom3dView( eclipseCase, reservoirView );
|
||||
eclipseCase = reservoirView->eclipseCase();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
eclipseContourMap = createEclipseContourMapFrom3dView( eclipseCase, reservoirView );
|
||||
}
|
||||
}
|
||||
else if ( eclipseCase )
|
||||
{
|
||||
@ -138,6 +147,12 @@ void RicNewContourMapViewFeature::onActionTriggered( bool isChecked )
|
||||
eclipseContourMap->createDisplayModelAndRedraw();
|
||||
eclipseContourMap->zoomAll();
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
|
||||
oilField->eclipseContourMapCollection()->updateConnectedEditors();
|
||||
|
||||
Riu3DMainWindowTools::setExpanded( eclipseContourMap );
|
||||
}
|
||||
else if ( geoMechContourMap )
|
||||
@ -268,6 +283,8 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMapFr
|
||||
|
||||
contourMap->initAfterReadRecursively();
|
||||
|
||||
eclipseCase->contourMapCollection()->updateConnectedEditors();
|
||||
|
||||
return contourMap;
|
||||
}
|
||||
|
||||
|
@ -42,10 +42,9 @@ bool RicVec3dPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eventObj
|
||||
|
||||
cvf::Vec3d pickedPosition = eventObject.m_pickItemInfos.front().globalPickedPoint();
|
||||
|
||||
RimCase* ownerCase = rimView->firstAncestorOrThisOfType<RimCase>();
|
||||
if ( ownerCase )
|
||||
if ( rimView->ownerCase() )
|
||||
{
|
||||
double zPickOffset = ownerCase->characteristicCellSize() * m_zOffsetFactor;
|
||||
double zPickOffset = rimView->ownerCase()->characteristicCellSize() * m_zOffsetFactor;
|
||||
pickedPosition.z() += zPickOffset;
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ void RivWellPathPartMgr::appendPerforationsToModel( cvf::ModelBasicList*
|
||||
QDateTime currentTimeStamp;
|
||||
if ( m_rimView )
|
||||
{
|
||||
auto rimCase = m_rimView->firstAncestorOrThisOfType<RimCase>();
|
||||
auto rimCase = m_rimView->ownerCase();
|
||||
|
||||
if ( rimCase )
|
||||
{
|
||||
|
@ -382,8 +382,13 @@ void RivSurfacePartMgr::generatePartGeometry()
|
||||
void RivSurfacePartMgr::generateNativePartGeometry()
|
||||
{
|
||||
cvf::Vec3d displayModOffset( 0, 0, 0 );
|
||||
auto ownerCase = m_surfaceInView->firstAncestorOrThisOfType<RimCase>();
|
||||
if ( ownerCase ) displayModOffset = ownerCase->displayModelOffset();
|
||||
|
||||
auto view = m_surfaceInView->firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( view )
|
||||
{
|
||||
auto ownerCase = view->ownerCase();
|
||||
if ( ownerCase ) displayModOffset = ownerCase->displayModelOffset();
|
||||
}
|
||||
|
||||
m_usedSurfaceData = m_surfaceInView->surface()->surfaceData();
|
||||
if ( m_usedSurfaceData.isNull() ) return;
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
122
ApplicationLibCode/ProjectDataModel/RimEclipseViewCollection.cpp
Normal file
122
ApplicationLibCode/ProjectDataModel/RimEclipseViewCollection.cpp
Normal file
@ -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];
|
||||
|
@ -554,18 +554,15 @@ public:
|
||||
m_currentReservoir->eclipseCaseData()->results( m_porosityModelEnum )->recalculateStatistics( m_currentEclResultAddress );
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i )
|
||||
for ( RimEclipseView* view : m_currentReservoir->reservoirViews() )
|
||||
{
|
||||
if ( m_currentReservoir->reservoirViews[i] )
|
||||
{
|
||||
// As new result might have been introduced, update all editors connected
|
||||
m_currentReservoir->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
|
||||
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
m_currentReservoir->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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -658,18 +658,15 @@ public:
|
||||
m_currentReservoir->eclipseCaseData()->results( m_porosityModelEnum )->recalculateStatistics( m_currentEclResultAddress );
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i )
|
||||
for ( RimEclipseView* view : m_currentReservoir->reservoirViews() )
|
||||
{
|
||||
if ( m_currentReservoir->reservoirViews[i] )
|
||||
{
|
||||
// As new result might have been introduced, update all editors connected
|
||||
m_currentReservoir->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
|
||||
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
m_currentReservoir->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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1033,18 +1030,15 @@ public:
|
||||
->recalculateStatistics( RigEclipseResultAddress( m_currentResultAddress ) );
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i )
|
||||
for ( RimEclipseView* view : m_currentReservoir->reservoirViews() )
|
||||
{
|
||||
if ( m_currentReservoir->reservoirViews[i] )
|
||||
{
|
||||
// As new result might have been introduced, update all editors connected
|
||||
m_currentReservoir->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
|
||||
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
m_currentReservoir->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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ void RiuAdvancedSnapshotExportWidget::addSnapshotItemFromActiveView()
|
||||
multiSnapshot->timeStepStart = activeView->currentTimeStep();
|
||||
multiSnapshot->timeStepEnd = activeView->currentTimeStep();
|
||||
|
||||
auto sourceCase = activeView->firstAncestorOrThisOfType<RimCase>();
|
||||
auto sourceCase = activeView->ownerCase();
|
||||
if ( sourceCase )
|
||||
{
|
||||
multiSnapshot->additionalCases().push_back( sourceCase );
|
||||
|
@ -325,13 +325,31 @@ def view(self, view_id):
|
||||
Returns:
|
||||
:class:`rips.generated.generated_classes.View`
|
||||
"""
|
||||
views = self.views()
|
||||
project = self.ancestor(rips.project.Project)
|
||||
views = project.views()
|
||||
for view_object in views:
|
||||
if view_object.id == view_id:
|
||||
return view_object
|
||||
return None
|
||||
|
||||
|
||||
@add_method(Case)
|
||||
def views(self):
|
||||
"""Get all views of a case
|
||||
|
||||
Returns:
|
||||
List of :class:`rips.generated.generated_classes.View`
|
||||
"""
|
||||
project = self.ancestor(rips.project.Project)
|
||||
views = project.views()
|
||||
views_for_case = []
|
||||
for view_object in views:
|
||||
view_object.print_object_info()
|
||||
if view_object.id == self.id:
|
||||
views_for_case.append(view_object)
|
||||
return views_for_case
|
||||
|
||||
|
||||
@add_method(Case)
|
||||
def create_view(self):
|
||||
"""Create a new view in the current case
|
||||
@ -990,8 +1008,10 @@ def simulation_wells(self):
|
||||
:class:`rips.generated.generated_classes.SimulationWell`
|
||||
|
||||
"""
|
||||
wells = self.descendants(SimulationWell)
|
||||
return wells
|
||||
if self.views():
|
||||
# Use the first view to get simulation wells.
|
||||
return self.views()[0].descendants(SimulationWell)
|
||||
return []
|
||||
|
||||
|
||||
@add_method(Case)
|
||||
|
@ -14,6 +14,7 @@ import PdmObject_pb2
|
||||
from .resinsight_classes import SimulationWell
|
||||
|
||||
from .case import Case
|
||||
from .view import View
|
||||
from .pdmobject import PdmObjectBase, add_method
|
||||
|
||||
from typing import List, Optional
|
||||
@ -80,4 +81,8 @@ def cells(
|
||||
|
||||
@add_method(SimulationWell)
|
||||
def case(self: SimulationWell) -> Optional[Case]:
|
||||
return self.ancestor(Case)
|
||||
view = self.ancestor(View)
|
||||
if view:
|
||||
return view.case()
|
||||
else:
|
||||
return None
|
||||
|
@ -187,12 +187,24 @@ def export_property(self, undefined_value=0.0):
|
||||
)
|
||||
|
||||
|
||||
@add_method(ViewWindow)
|
||||
def extract_address(address) -> int:
|
||||
# Address form: "RimReservoir:123345345345435"
|
||||
parts = address.split(":")
|
||||
return int(parts[1])
|
||||
|
||||
|
||||
@add_method(View)
|
||||
def case(self):
|
||||
"""Get the case the view belongs to"""
|
||||
mycase = self.ancestor(rips.case.Case)
|
||||
assert mycase is not None
|
||||
return mycase
|
||||
project = self.ancestor(rips.project.Project)
|
||||
|
||||
eclipse_case_addr = extract_address(self.eclipse_case)
|
||||
|
||||
cases = project.cases()
|
||||
for c in cases:
|
||||
if c.address() == eclipse_case_addr:
|
||||
return c
|
||||
return None
|
||||
|
||||
|
||||
@add_method(ViewWindow)
|
||||
|
@ -462,18 +462,15 @@ void RiaNNCInputValuesStateHandler::finish()
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED_NOT_SAVED;
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < m_eclipseCase->reservoirViews.size(); ++i )
|
||||
for ( RimEclipseView* view : m_eclipseCase->reservoirViews() )
|
||||
{
|
||||
if ( m_eclipseCase->reservoirViews[i] )
|
||||
{
|
||||
// As new result might have been introduced, update all editors connected
|
||||
m_eclipseCase->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
|
||||
m_eclipseCase->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
|
||||
m_eclipseCase->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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user