mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-16 02:12:12 -05:00
Merge pull request #9048 from OPM/9047-performance-avoid-update-project
- Avoid update of project when creating new objects - Added icon resource cache - Avoid use of descendantsIncludingThisOfType()
This commit is contained in:
1 parent
7d246c1535
commit
ccbda23b96
29 files changed
+184
-149
No files matched your search
@@ -126,6 +126,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -251,6 +252,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_USE_QT_CHARTS)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
|
||||
#include "RimEclipseCaseTools.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
@@ -33,7 +34,6 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RicEclipsePropertyFilterFeatureImpl.h"
|
||||
#include "RicSelectOrCreateViewFeatureImpl.h"
|
||||
@@ -268,18 +268,12 @@ QList<caf::PdmOptionItemInfo>
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
|
||||
for ( RimEclipseResultCase* c : resultCases )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
proj->descendantsIncludingThisOfType( cases );
|
||||
for ( RimEclipseResultCase* c : cases )
|
||||
if ( c->defaultFlowDiagSolution() )
|
||||
{
|
||||
if ( c->defaultFlowDiagSolution() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,29 +393,23 @@ QList<caf::PdmOptionItemInfo>
|
||||
void RimFlowCharacteristicsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
{
|
||||
// Ensure a case is selected if one is available
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
RimEclipseResultCase* defaultCase = nullptr;
|
||||
|
||||
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
|
||||
for ( RimEclipseResultCase* c : resultCases )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
proj->descendantsIncludingThisOfType( cases );
|
||||
RimEclipseResultCase* defaultCase = nullptr;
|
||||
for ( RimEclipseResultCase* c : cases )
|
||||
if ( c->defaultFlowDiagSolution() )
|
||||
{
|
||||
if ( c->defaultFlowDiagSolution() )
|
||||
{
|
||||
if ( !defaultCase ) defaultCase = c; // Select first
|
||||
}
|
||||
if ( !defaultCase ) defaultCase = c; // Select first
|
||||
}
|
||||
if ( !m_case() && defaultCase )
|
||||
}
|
||||
if ( !m_case() && defaultCase )
|
||||
{
|
||||
m_case = defaultCase;
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
if ( !m_case()->reservoirViews.empty() )
|
||||
{
|
||||
m_case = defaultCase;
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
if ( !m_case()->reservoirViews.empty() )
|
||||
{
|
||||
m_cellFilterView = m_case()->reservoirViews()[0];
|
||||
}
|
||||
m_cellFilterView = m_case()->reservoirViews()[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
#include "RigWellResultPoint.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseTools.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimTofAccumulatedPhaseFractionsPlot.h"
|
||||
@@ -43,11 +43,11 @@
|
||||
#include "RimWellAllocationPlotLegend.h"
|
||||
#include "RimWellFlowRateCurve.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
@@ -732,17 +732,10 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions( cons
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
|
||||
for ( RimEclipseResultCase* c : resultCases )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
proj->descendantsIncludingThisOfType( cases );
|
||||
|
||||
for ( RimEclipseResultCase* c : cases )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_flowDiagSolution )
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellDistributionPlot.h"
|
||||
|
||||
#include "RimEclipseCaseTools.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
@@ -38,10 +39,6 @@
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
//#include "cvfBase.h"
|
||||
//#include "cvfTrace.h"
|
||||
//#include "cvfDebugTimer.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
//==================================================================================================
|
||||
@@ -480,16 +477,10 @@ QList<caf::PdmOptionItemInfo> RimWellDistributionPlot::calculateValueOptions( co
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* ownerProj = nullptr;
|
||||
firstAncestorOrThisOfType( ownerProj );
|
||||
if ( ownerProj )
|
||||
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
|
||||
for ( RimEclipseResultCase* c : resultCases )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> caseArr;
|
||||
ownerProj->descendantsIncludingThisOfType( caseArr );
|
||||
for ( RimEclipseResultCase* c : caseArr )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellDistributionPlotCollection.h"
|
||||
|
||||
#include "RimEclipseCaseTools.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellDistributionPlot.h"
|
||||
|
||||
@@ -42,10 +43,6 @@
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
//#include "cvfBase.h"
|
||||
//#include "cvfTrace.h"
|
||||
//#include "cvfDebugTimer.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@@ -258,16 +255,10 @@ QList<caf::PdmOptionItemInfo>
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* ownerProj = nullptr;
|
||||
firstAncestorOrThisOfType( ownerProj );
|
||||
if ( ownerProj )
|
||||
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
|
||||
for ( RimEclipseResultCase* c : resultCases )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> caseArr;
|
||||
ownerProj->descendantsIncludingThisOfType( caseArr );
|
||||
for ( RimEclipseResultCase* c : caseArr )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022 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 "RimEclipseCaseTools.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseCase*> RimEclipseCaseTools::eclipseCases()
|
||||
{
|
||||
if ( RimProject::current() )
|
||||
{
|
||||
return RimProject::current()->eclipseCases();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseResultCase*> RimEclipseCaseTools::eclipseResultCases()
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> resultCases;
|
||||
|
||||
auto eclipseCases = RimEclipseCaseTools::eclipseCases();
|
||||
for ( auto ec : eclipseCases )
|
||||
{
|
||||
auto resultCase = dynamic_cast<RimEclipseResultCase*>( ec );
|
||||
if ( resultCase != nullptr )
|
||||
{
|
||||
resultCases.push_back( resultCase );
|
||||
}
|
||||
}
|
||||
|
||||
return resultCases;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022 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 <vector>
|
||||
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultCase;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimEclipseCaseTools
|
||||
{
|
||||
public:
|
||||
static std::vector<RimEclipseCase*> eclipseCases();
|
||||
static std::vector<RimEclipseResultCase*> eclipseResultCases();
|
||||
};
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "RimEclipseResultAddress.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimEclipseCaseTools.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimEclipseResultAddress, "EclipseResultAddress" );
|
||||
|
||||
@@ -104,16 +104,10 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultAddress::calculateValueOptions( co
|
||||
|
||||
if ( fieldNeedingOptions == &m_eclipseCase )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
auto cases = RimEclipseCaseTools::eclipseCases();
|
||||
for ( auto* c : cases )
|
||||
{
|
||||
std::vector<RimEclipseCase*> cases;
|
||||
proj->descendantsIncludingThisOfType( cases );
|
||||
for ( auto* c : cases )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,8 +125,8 @@ CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
|
||||
RimProject::RimProject( void )
|
||||
: m_nextValidCaseId( 0 )
|
||||
, m_nextValidCaseGroupId( 0 )
|
||||
, m_nextValidViewId( 1 )
|
||||
, m_nextValidPlotId( 1 )
|
||||
, m_nextValidViewId( -1 )
|
||||
, m_nextValidPlotId( -1 )
|
||||
, m_nextValidSummaryCaseId( 1 )
|
||||
, m_nextValidEnsembleId( 1 )
|
||||
{
|
||||
@@ -279,8 +279,8 @@ void RimProject::close()
|
||||
|
||||
m_nextValidCaseId = 0;
|
||||
m_nextValidCaseGroupId = 0;
|
||||
m_nextValidViewId = 1;
|
||||
m_nextValidPlotId = 1;
|
||||
m_nextValidViewId = -1;
|
||||
m_nextValidPlotId = -1;
|
||||
m_nextValidSummaryCaseId = 1;
|
||||
m_nextValidEnsembleId = 1;
|
||||
}
|
||||
@@ -579,12 +579,15 @@ void RimProject::assignViewIdToView( Rim3dView* view )
|
||||
{
|
||||
if ( view )
|
||||
{
|
||||
std::vector<Rim3dView*> views;
|
||||
this->descendantsIncludingThisOfType( views );
|
||||
|
||||
for ( Rim3dView* existingView : views )
|
||||
if ( m_nextValidViewId < 0 )
|
||||
{
|
||||
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
|
||||
std::vector<Rim3dView*> views;
|
||||
this->descendantsIncludingThisOfType( views );
|
||||
|
||||
for ( Rim3dView* existingView : views )
|
||||
{
|
||||
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
view->setId( m_nextValidViewId++ );
|
||||
@@ -598,12 +601,15 @@ void RimProject::assignPlotIdToPlotWindow( RimPlotWindow* plotWindow )
|
||||
{
|
||||
if ( plotWindow )
|
||||
{
|
||||
std::vector<RimPlotWindow*> plotWindows;
|
||||
this->descendantsIncludingThisOfType( plotWindows );
|
||||
|
||||
for ( RimPlotWindow* existingPlotWindow : plotWindows )
|
||||
if ( m_nextValidPlotId < 0 )
|
||||
{
|
||||
m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 );
|
||||
std::vector<RimPlotWindow*> plotWindows;
|
||||
this->descendantsIncludingThisOfType( plotWindows );
|
||||
|
||||
for ( RimPlotWindow* existingPlotWindow : plotWindows )
|
||||
{
|
||||
m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
plotWindow->setId( m_nextValidPlotId++ );
|
||||
@@ -1475,11 +1481,8 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( viewLinkerCollection()->viewLinker() )
|
||||
{
|
||||
// Use object instead of field to avoid duplicate entries in the tree view
|
||||
uiTreeOrdering.add( viewLinkerCollection() );
|
||||
}
|
||||
// Use object instead of field to avoid duplicate entries in the tree view
|
||||
uiTreeOrdering.add( viewLinkerCollection() );
|
||||
|
||||
RimOilField* oilField = activeOilField();
|
||||
if ( oilField )
|
||||
|
||||
@@ -251,15 +251,7 @@ void RimWellLogPlotCollection::removeExtractors( const RigGeoMechCaseData* caseD
|
||||
void RimWellLogPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
// Make sure the plot collection disappears with the last plot
|
||||
if ( m_wellLogPlots().empty() )
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
if ( project )
|
||||
{
|
||||
project->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateWellLogPlotToolBar();
|
||||
|
||||
Reference in new issue
Block a user