2012-05-18 09:45:23 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2014-09-23 15:04:57 +02:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2012-05-18 09:45:23 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2012-05-18 09:45:23 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-05-18 09:45:23 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#include "RimProject.h"
|
2013-05-06 10:55:00 +02:00
|
|
|
|
2018-11-05 14:28:07 +01:00
|
|
|
#include "RiaCompletionTypeCalculationScheduler.h"
|
|
|
|
|
#include "RiaFieldHandleTools.h"
|
|
|
|
|
#include "RiaFilePathTools.h"
|
2019-09-06 10:40:57 +02:00
|
|
|
#include "RiaGuiApplication.h"
|
2018-01-04 13:12:07 +01:00
|
|
|
#include "RiaProjectFileVersionTools.h"
|
2022-03-11 13:24:01 +01:00
|
|
|
#include "RiaTextStringTools.h"
|
2013-03-22 16:12:00 +01:00
|
|
|
#include "RiaVersionInfo.h"
|
2015-08-01 23:04:04 +02:00
|
|
|
|
2020-02-24 15:42:23 +01:00
|
|
|
#include "RicfCommandObject.h"
|
2017-01-10 09:51:39 +01:00
|
|
|
#include "RigEclipseCaseData.h"
|
2017-01-09 19:51:15 +01:00
|
|
|
#include "RigGridBase.h"
|
2015-08-01 23:04:04 +02:00
|
|
|
|
2019-09-11 09:33:03 +02:00
|
|
|
#include "PlotTemplates/RimPlotTemplateFolderItem.h"
|
2019-04-05 10:11:30 +02:00
|
|
|
#include "RimAdvancedSnapshotExportDefinition.h"
|
2020-02-12 16:48:25 +01:00
|
|
|
#include "RimAnalysisPlotCollection.h"
|
2018-11-23 13:33:59 +01:00
|
|
|
#include "RimAnnotationCollection.h"
|
2018-11-26 14:48:06 +01:00
|
|
|
#include "RimAnnotationInViewCollection.h"
|
2015-08-25 12:40:55 +02:00
|
|
|
#include "RimCalcScript.h"
|
2015-11-18 09:35:38 +01:00
|
|
|
#include "RimCase.h"
|
2014-07-24 10:11:43 +02:00
|
|
|
#include "RimCaseCollection.h"
|
2020-04-30 16:54:25 +02:00
|
|
|
#include "RimColorLegendCollection.h"
|
2015-08-01 23:04:04 +02:00
|
|
|
#include "RimCommandObject.h"
|
2018-12-13 19:49:37 +01:00
|
|
|
#include "RimCompletionTemplateCollection.h"
|
2015-11-18 09:35:38 +01:00
|
|
|
#include "RimContextCommandBuilder.h"
|
2020-04-17 09:31:42 +02:00
|
|
|
#include "RimCorrelationPlotCollection.h"
|
2017-06-30 16:14:15 +02:00
|
|
|
#include "RimDialogData.h"
|
2015-08-01 23:04:04 +02:00
|
|
|
#include "RimEclipseCase.h"
|
|
|
|
|
#include "RimEclipseCaseCollection.h"
|
2021-05-26 12:10:45 +02:00
|
|
|
#include "RimEnsembleWellLogsCollection.h"
|
2017-01-13 09:50:43 +01:00
|
|
|
#include "RimFlowPlotCollection.h"
|
2016-08-24 08:30:12 +02:00
|
|
|
#include "RimFormationNamesCollection.h"
|
2017-12-20 13:14:43 +01:00
|
|
|
#include "RimFractureTemplate.h"
|
2018-02-26 20:54:45 +01:00
|
|
|
#include "RimFractureTemplateCollection.h"
|
2015-08-01 23:04:04 +02:00
|
|
|
#include "RimGeoMechCase.h"
|
|
|
|
|
#include "RimGeoMechModels.h"
|
2022-04-22 12:18:34 +02:00
|
|
|
#include "RimGridCalculationCollection.h"
|
2019-04-05 10:11:30 +02:00
|
|
|
#include "RimGridCrossPlotCollection.h"
|
2016-11-16 09:21:27 +01:00
|
|
|
#include "RimGridSummaryCase.h"
|
2018-01-19 12:52:50 +01:00
|
|
|
#include "RimGridView.h"
|
2014-07-24 10:11:43 +02:00
|
|
|
#include "RimIdenticalGridCaseGroup.h"
|
2015-09-07 14:29:46 +02:00
|
|
|
#include "RimMainPlotCollection.h"
|
2018-12-19 14:41:17 +01:00
|
|
|
#include "RimMeasurement.h"
|
2019-11-13 12:22:50 +01:00
|
|
|
#include "RimMultiPlotCollection.h"
|
2017-09-14 15:44:01 +02:00
|
|
|
#include "RimObservedDataCollection.h"
|
2019-09-06 10:40:57 +02:00
|
|
|
#include "RimObservedSummaryData.h"
|
2014-07-24 10:11:43 +02:00
|
|
|
#include "RimOilField.h"
|
2019-11-14 20:48:11 +01:00
|
|
|
#include "RimPlotWindow.h"
|
2018-01-08 10:37:57 +01:00
|
|
|
#include "RimPltPlotCollection.h"
|
2019-04-05 10:11:30 +02:00
|
|
|
#include "RimPolylinesFromFileAnnotation.h"
|
2018-01-08 10:37:57 +01:00
|
|
|
#include "RimRftPlotCollection.h"
|
2019-04-05 10:11:30 +02:00
|
|
|
#include "RimSaturationPressurePlotCollection.h"
|
2014-07-24 10:11:43 +02:00
|
|
|
#include "RimScriptCollection.h"
|
2020-11-04 13:46:17 +01:00
|
|
|
#include "RimStimPlanModelPlotCollection.h"
|
2019-12-09 09:21:06 +01:00
|
|
|
#include "RimSummaryCalculation.h"
|
2018-02-26 20:54:45 +01:00
|
|
|
#include "RimSummaryCalculationCollection.h"
|
2020-04-08 16:17:47 +02:00
|
|
|
#include "RimSummaryCaseCollection.h"
|
2017-09-06 16:32:46 +02:00
|
|
|
#include "RimSummaryCaseMainCollection.h"
|
2017-11-07 20:40:45 +01:00
|
|
|
#include "RimSummaryCrossPlotCollection.h"
|
2022-03-04 10:52:17 +01:00
|
|
|
#include "RimSummaryMultiPlotCollection.h"
|
2020-01-03 13:49:12 +01:00
|
|
|
#include "RimSurfaceCollection.h"
|
2018-01-19 12:52:50 +01:00
|
|
|
#include "RimTools.h"
|
2019-04-05 10:11:30 +02:00
|
|
|
#include "RimUserDefinedPolylinesAnnotation.h"
|
|
|
|
|
#include "RimValveTemplate.h"
|
|
|
|
|
#include "RimValveTemplateCollection.h"
|
2020-11-13 10:56:25 +01:00
|
|
|
#include "RimVfpPlotCollection.h"
|
2015-09-07 14:29:46 +02:00
|
|
|
#include "RimViewLinker.h"
|
2015-09-08 10:17:35 +02:00
|
|
|
#include "RimViewLinkerCollection.h"
|
2019-10-09 09:21:28 +02:00
|
|
|
#include "RimViewWindow.h"
|
2018-01-08 10:37:57 +01:00
|
|
|
#include "RimWellLogFile.h"
|
2015-09-07 14:29:46 +02:00
|
|
|
#include "RimWellLogPlotCollection.h"
|
2018-01-08 10:37:57 +01:00
|
|
|
#include "RimWellPath.h"
|
2013-05-16 14:10:22 +02:00
|
|
|
#include "RimWellPathCollection.h"
|
2020-01-03 13:49:12 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
#include "Tools/RiaVariableMapper.h"
|
|
|
|
|
|
2020-11-13 15:37:08 +01:00
|
|
|
#ifdef USE_QTCHARTS
|
2021-04-28 13:45:04 +02:00
|
|
|
#include "RimEnsembleFractureStatisticsPlot.h"
|
|
|
|
|
#include "RimEnsembleFractureStatisticsPlotCollection.h"
|
2020-11-13 15:37:08 +01:00
|
|
|
#include "RimGridStatisticsPlot.h"
|
|
|
|
|
#include "RimGridStatisticsPlotCollection.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-06-17 09:11:38 +02:00
|
|
|
#include "SsiHubImportCommands/RimWellPathImport.h"
|
2013-02-14 13:16:56 +01:00
|
|
|
|
2018-01-19 12:52:50 +01:00
|
|
|
#include "RiuMainWindow.h"
|
2019-09-06 10:40:57 +02:00
|
|
|
#include "RiuPlotMainWindow.h"
|
2015-08-18 16:36:37 +02:00
|
|
|
|
2015-08-25 12:40:55 +02:00
|
|
|
#include "OctaveScriptCommands/RicExecuteScriptForCasesFeature.h"
|
|
|
|
|
|
|
|
|
|
#include "cafCmdFeature.h"
|
2015-11-18 09:35:38 +01:00
|
|
|
#include "cafCmdFeatureManager.h"
|
2017-11-19 01:12:39 +01:00
|
|
|
#include "cafCmdFeatureMenuBuilder.h"
|
2018-01-19 12:52:50 +01:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2017-01-09 19:51:15 +01:00
|
|
|
#include "cvfBoundingBox.h"
|
|
|
|
|
|
2019-05-06 10:36:05 +02:00
|
|
|
#include <QDebug>
|
2014-07-24 10:11:43 +02:00
|
|
|
#include <QDir>
|
2015-11-18 09:35:38 +01:00
|
|
|
#include <QMenu>
|
2022-12-08 07:08:22 +01:00
|
|
|
|
2019-12-10 14:58:47 +01:00
|
|
|
#include <algorithm>
|
2015-11-18 09:35:38 +01:00
|
|
|
|
2020-02-24 15:42:23 +01:00
|
|
|
CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
RimProject::RimProject( void )
|
2019-11-21 08:14:24 +01:00
|
|
|
: m_nextValidCaseId( 0 )
|
|
|
|
|
, m_nextValidCaseGroupId( 0 )
|
2022-06-13 13:54:55 +02:00
|
|
|
, m_nextValidViewId( -1 )
|
|
|
|
|
, m_nextValidPlotId( -1 )
|
2020-04-08 14:30:38 +02:00
|
|
|
, m_nextValidSummaryCaseId( 1 )
|
2020-04-08 16:17:47 +02:00
|
|
|
, m_nextValidEnsembleId( 1 )
|
2012-05-18 09:45:23 +02:00
|
|
|
{
|
2020-03-03 10:43:07 +01:00
|
|
|
CAF_PDM_InitScriptableObjectWithNameAndComment( "Project", "", "", "", "Project", "The ResInsight Project" );
|
2019-10-09 09:21:28 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitField( &m_projectFileVersionString, "ProjectFileVersionString", QString( STRPRODUCTVER ), "" );
|
2019-09-06 10:40:57 +02:00
|
|
|
m_projectFileVersionString.uiCapability()->setUiHidden( true );
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_globalPathList, "ReferencedExternalFiles", "" );
|
2019-12-10 14:58:47 +01:00
|
|
|
m_globalPathList.uiCapability()->setUiHidden( true );
|
|
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &oilFields, "OilFields", "Oil Fields" );
|
2021-10-13 13:39:46 +02:00
|
|
|
oilFields.uiCapability()->setUiTreeHidden( true );
|
2013-02-14 14:30:01 +01:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &colorLegendCollection, "ColorLegendCollection", "Color Legend Collection" );
|
2020-04-30 16:54:25 +02:00
|
|
|
colorLegendCollection = new RimColorLegendCollection();
|
2020-05-13 14:28:06 +02:00
|
|
|
colorLegendCollection->createStandardColorLegends();
|
2020-04-30 16:54:25 +02:00
|
|
|
|
2022-01-07 08:31:52 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &scriptCollection, "ScriptCollection", "Octave Scripts", ":/octave.png" );
|
2021-10-13 13:39:46 +02:00
|
|
|
scriptCollection.uiCapability()->setUiTreeHidden( true );
|
2019-07-30 10:36:05 +02:00
|
|
|
scriptCollection.xmlCapability()->disableIO();
|
2013-04-26 19:05:35 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &wellPathImport, "WellPathImport", "WellPathImport" );
|
2013-09-06 13:06:39 +02:00
|
|
|
wellPathImport = new RimWellPathImport();
|
2021-10-13 13:39:46 +02:00
|
|
|
wellPathImport.uiCapability()->setUiTreeHidden( true );
|
2019-09-06 10:40:57 +02:00
|
|
|
wellPathImport.uiCapability()->setUiTreeChildrenHidden( true );
|
|
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_mainPlotCollection, "MainPlotCollection", "Plots" );
|
|
|
|
|
m_mainPlotCollection.uiCapability()->setUiTreeHidden( true );
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2022-04-22 09:58:51 +02:00
|
|
|
CAF_PDM_InitFieldNoDefault( &viewLinkerCollection, "LinkedViews", "Linked Views", ":/LinkView.svg" );
|
2021-10-13 13:39:46 +02:00
|
|
|
viewLinkerCollection.uiCapability()->setUiTreeHidden( true );
|
2015-09-08 10:17:35 +02:00
|
|
|
viewLinkerCollection = new RimViewLinkerCollection;
|
2015-09-01 17:14:22 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &calculationCollection, "CalculationCollection", "Calculation Collection" );
|
2017-10-23 14:42:38 +02:00
|
|
|
calculationCollection = new RimSummaryCalculationCollection;
|
2017-10-12 07:30:37 +02:00
|
|
|
|
2022-04-22 12:18:34 +02:00
|
|
|
CAF_PDM_InitFieldNoDefault( &gridCalculationCollection, "GridCalculationCollection", "Grid Calculation Collection" );
|
|
|
|
|
gridCalculationCollection = new RimGridCalculationCollection;
|
|
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" );
|
2013-09-12 08:11:56 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" );
|
2016-12-09 11:11:16 +01:00
|
|
|
|
2022-01-28 13:19:52 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewStates, "TreeViewStates", "" );
|
|
|
|
|
mainWindowTreeViewStates.uiCapability()->setUiHidden( true );
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &mainWindowCurrentModelIndexPaths, "TreeViewCurrentModelIndexPaths", "" );
|
|
|
|
|
mainWindowCurrentModelIndexPaths.uiCapability()->setUiHidden( true );
|
2016-10-06 15:01:59 +02:00
|
|
|
|
2022-01-28 13:19:52 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &plotWindowTreeViewStates, "PlotWindowTreeViewStates", "" );
|
|
|
|
|
plotWindowTreeViewStates.uiCapability()->setUiHidden( true );
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &plotWindowCurrentModelIndexPaths, "PlotWindowTreeViewCurrentModelIndexPaths", "" );
|
|
|
|
|
plotWindowCurrentModelIndexPaths.uiCapability()->setUiHidden( true );
|
2013-04-19 13:20:46 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitField( &m_show3DWindow, "show3DWindow", true, "Show 3D Window" );
|
2019-09-06 10:40:57 +02:00
|
|
|
m_show3DWindow.uiCapability()->setUiHidden( true );
|
2016-10-04 14:23:34 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitField( &m_showPlotWindow, "showPlotWindow", false, "Show Plot Window" );
|
2019-09-06 10:40:57 +02:00
|
|
|
m_showPlotWindow.uiCapability()->setUiHidden( true );
|
2016-10-04 14:23:34 +02:00
|
|
|
|
2022-10-31 13:26:26 +01:00
|
|
|
CAF_PDM_InitField( &m_subWindowsTiled3DWindow_OBSOLETE, "tiled3DWindow", false, "Tile 3D Window" );
|
|
|
|
|
m_subWindowsTiled3DWindow_OBSOLETE.uiCapability()->setUiHidden( true );
|
2019-04-02 19:18:00 +02:00
|
|
|
|
2022-10-31 13:26:26 +01:00
|
|
|
CAF_PDM_InitField( &m_subWindowsTiledPlotWindow_OBSOLETE, "tiledPlotWindow", false, "Tile Plot Window" );
|
|
|
|
|
m_subWindowsTiledPlotWindow_OBSOLETE.uiCapability()->setUiHidden( true );
|
2019-04-02 19:18:00 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_dialogData, "DialogData", "DialogData" );
|
2017-06-30 16:14:15 +02:00
|
|
|
m_dialogData = new RimDialogData();
|
2021-10-13 13:39:46 +02:00
|
|
|
m_dialogData.uiCapability()->setUiTreeHidden( true );
|
2019-09-06 10:40:57 +02:00
|
|
|
m_dialogData.uiCapability()->setUiTreeChildrenHidden( true );
|
2017-06-30 16:14:15 +02:00
|
|
|
|
2013-06-12 09:36:50 +02:00
|
|
|
// Obsolete fields. The content is moved to OilFields and friends
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &casesObsolete, "Reservoirs", "" );
|
2022-06-02 15:57:00 +02:00
|
|
|
RiaFieldHandleTools::disableWriteAndSetFieldHidden( &casesObsolete );
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &caseGroupsObsolete, "CaseGroups", "" );
|
2022-06-02 15:57:00 +02:00
|
|
|
RiaFieldHandleTools::disableWriteAndSetFieldHidden( &caseGroupsObsolete );
|
2013-06-12 09:36:50 +02:00
|
|
|
|
2022-10-31 13:26:26 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_subWindowsTileMode3DWindow, "TileMode3DWindow", "TileMode3DWindow" );
|
|
|
|
|
m_subWindowsTileMode3DWindow.uiCapability()->setUiHidden( true );
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_subWindowsTileModePlotWindow, "TileModePlotWindow", "TileModePlotWindow" );
|
|
|
|
|
m_subWindowsTileModePlotWindow.uiCapability()->setUiHidden( true );
|
|
|
|
|
|
2013-06-12 09:36:50 +02:00
|
|
|
// Initialization
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
scriptCollection = new RimScriptCollection();
|
2019-09-06 10:40:57 +02:00
|
|
|
scriptCollection->directory.uiCapability()->setUiHidden( true );
|
|
|
|
|
scriptCollection->uiCapability()->setUiName( "Scripts" );
|
|
|
|
|
scriptCollection->uiCapability()->setUiIconFromResourceString( ":/octave.png" );
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
m_mainPlotCollection = new RimMainPlotCollection();
|
2015-08-27 16:13:49 +02:00
|
|
|
|
2022-05-11 19:46:17 +02:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_plotTemplateTopFolder, "PlotTemplateCollection", "Plot Templates" );
|
|
|
|
|
m_plotTemplateTopFolder = new RimPlotTemplateFolderItem();
|
|
|
|
|
m_plotTemplateTopFolder.xmlCapability()->disableIO();
|
2019-09-11 09:33:03 +02:00
|
|
|
|
2013-06-07 14:54:02 +02:00
|
|
|
// For now, create a default first oilfield that contains the rest of the project
|
2019-09-06 10:40:57 +02:00
|
|
|
oilFields.push_back( new RimOilField );
|
2013-06-07 14:54:02 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
this->setUiHidden( true );
|
2012-05-18 09:45:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 11:13:38 +01:00
|
|
|
RimProject::~RimProject( void )
|
|
|
|
|
{
|
|
|
|
|
}
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-04-22 14:35:25 +02:00
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimProject* RimProject::current()
|
|
|
|
|
{
|
|
|
|
|
return RiaApplication::instance()->project();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::close()
|
|
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection() )
|
2015-11-30 15:07:54 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
m_mainPlotCollection()->deleteAllContainedObjects();
|
2016-05-25 14:05:31 +02:00
|
|
|
}
|
|
|
|
|
|
2022-05-31 13:08:07 +02:00
|
|
|
oilFields.deleteChildren();
|
2019-09-06 10:40:57 +02:00
|
|
|
oilFields.push_back( new RimOilField );
|
2013-06-12 09:36:50 +02:00
|
|
|
|
2022-05-31 13:08:07 +02:00
|
|
|
casesObsolete.deleteChildren();
|
|
|
|
|
caseGroupsObsolete.deleteChildren();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2022-05-31 13:08:07 +02:00
|
|
|
wellPathImport->regions().deleteChildren();
|
2013-09-06 15:59:25 +02:00
|
|
|
|
2022-05-31 13:08:07 +02:00
|
|
|
commandObjects.deleteChildren();
|
2013-09-13 10:42:27 +02:00
|
|
|
|
2022-05-31 13:08:07 +02:00
|
|
|
multiSnapshotDefinitions.deleteChildren();
|
2016-12-21 07:12:50 +01:00
|
|
|
|
2018-08-02 15:38:35 +02:00
|
|
|
m_dialogData->clearProjectSpecificData();
|
|
|
|
|
|
2017-10-18 11:18:43 +02:00
|
|
|
calculationCollection->deleteAllContainedObjects();
|
2022-04-22 12:18:34 +02:00
|
|
|
gridCalculationCollection->deleteAllContainedObjects();
|
2020-05-13 14:28:06 +02:00
|
|
|
colorLegendCollection->deleteCustomColorLegends();
|
2017-10-18 11:18:43 +02:00
|
|
|
|
2015-09-16 14:26:25 +02:00
|
|
|
delete viewLinkerCollection->viewLinker();
|
2018-01-16 16:49:28 +01:00
|
|
|
viewLinkerCollection->viewLinker = nullptr;
|
2015-09-04 11:22:44 +02:00
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
fileName = "";
|
2013-05-08 10:41:56 +02:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
m_globalPathList = "";
|
|
|
|
|
|
2022-01-28 13:19:52 +01:00
|
|
|
mainWindowCurrentModelIndexPaths = "";
|
|
|
|
|
mainWindowTreeViewStates = "";
|
|
|
|
|
plotWindowCurrentModelIndexPaths = "";
|
|
|
|
|
plotWindowTreeViewStates = "";
|
2019-10-18 15:32:20 +02:00
|
|
|
|
2019-12-09 09:21:06 +01:00
|
|
|
m_nextValidCaseId = 0;
|
|
|
|
|
m_nextValidCaseGroupId = 0;
|
2022-06-13 13:54:55 +02:00
|
|
|
m_nextValidViewId = -1;
|
|
|
|
|
m_nextValidPlotId = -1;
|
2020-04-08 14:30:38 +02:00
|
|
|
m_nextValidSummaryCaseId = 1;
|
2020-04-08 16:17:47 +02:00
|
|
|
m_nextValidEnsembleId = 1;
|
2012-05-18 09:45:23 +02:00
|
|
|
}
|
|
|
|
|
|
2013-05-16 14:10:22 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-05-16 14:10:22 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::initAfterRead()
|
|
|
|
|
{
|
2019-12-10 14:58:47 +01:00
|
|
|
this->distributePathsFromGlobalPathList();
|
|
|
|
|
|
2013-06-06 15:07:31 +02:00
|
|
|
// Create an empty oil field in case the project did not contain one
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( oilFields.size() < 1 )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
oilFields.push_back( new RimOilField );
|
2013-06-06 15:07:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle old project files with obsolete structure.
|
|
|
|
|
// Move caseGroupsObsolete and casesObsolete to oilFields()[idx]->analysisModels()
|
2018-01-16 16:49:28 +01:00
|
|
|
RimEclipseCaseCollection* analysisModels = activeOilField() ? activeOilField()->analysisModels() : nullptr;
|
2019-09-06 10:40:57 +02:00
|
|
|
bool movedOneRimIdenticalGridCaseGroup = false;
|
|
|
|
|
for ( size_t cgIdx = 0; cgIdx < caseGroupsObsolete.size(); ++cgIdx )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
|
|
|
|
RimIdenticalGridCaseGroup* sourceCaseGroup = caseGroupsObsolete[cgIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( analysisModels )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
analysisModels->caseGroups.push_back( sourceCaseGroup );
|
2013-06-06 15:07:31 +02:00
|
|
|
movedOneRimIdenticalGridCaseGroup = true; // moved at least one so assume the others will be moved too...
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( movedOneRimIdenticalGridCaseGroup )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
2022-05-31 13:08:07 +02:00
|
|
|
caseGroupsObsolete.clearWithoutDelete();
|
2013-06-06 15:07:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool movedOneRimCase = false;
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t cIdx = 0; cIdx < casesObsolete().size(); ++cIdx )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( analysisModels )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
2015-09-01 17:04:08 +02:00
|
|
|
RimEclipseCase* sourceCase = casesObsolete[cIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
casesObsolete.set( cIdx, nullptr );
|
|
|
|
|
analysisModels->cases.push_back( sourceCase );
|
2013-06-06 15:07:31 +02:00
|
|
|
movedOneRimCase = true; // moved at least one so assume the others will be moved too...
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( movedOneRimCase )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
2022-05-31 13:08:07 +02:00
|
|
|
casesObsolete.clearWithoutDelete();
|
2013-06-06 15:07:31 +02:00
|
|
|
}
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2013-06-06 15:07:31 +02:00
|
|
|
// Set project pointer to each well path
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++ )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
|
|
|
|
RimOilField* oilField = oilFields[oilFieldIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( oilField == nullptr || oilField->wellPathCollection == nullptr ) continue;
|
2013-06-06 15:07:31 +02:00
|
|
|
}
|
2022-10-31 13:26:26 +01:00
|
|
|
|
|
|
|
|
if ( m_subWindowsTiled3DWindow_OBSOLETE ) m_subWindowsTileMode3DWindow = RiaDefines::WindowTileMode::DEFAULT;
|
|
|
|
|
if ( m_subWindowsTiledPlotWindow_OBSOLETE ) m_subWindowsTileModePlotWindow = RiaDefines::WindowTileMode::DEFAULT;
|
2013-05-16 14:10:22 +02:00
|
|
|
}
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::setupBeforeSave()
|
|
|
|
|
{
|
2021-10-21 15:46:50 +02:00
|
|
|
if ( RiaGuiApplication::isRunning() )
|
2016-10-04 14:23:34 +02:00
|
|
|
{
|
2021-10-21 15:46:50 +02:00
|
|
|
RiaGuiApplication* guiApp = RiaGuiApplication::instance();
|
|
|
|
|
|
|
|
|
|
if ( guiApp )
|
|
|
|
|
{
|
2022-05-21 16:11:55 +02:00
|
|
|
m_show3DWindow = guiApp->isMain3dWindowVisible();
|
|
|
|
|
m_showPlotWindow = guiApp->isMainPlotWindowVisible();
|
2021-10-21 15:46:50 +02:00
|
|
|
}
|
2016-10-04 14:23:34 +02:00
|
|
|
}
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
m_projectFileVersionString = STRPRODUCTVER;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimMainPlotCollection* RimProject::mainPlotCollection() const
|
|
|
|
|
{
|
|
|
|
|
return m_mainPlotCollection();
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-10 14:58:47 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
bool RimProject::writeProjectFile()
|
|
|
|
|
{
|
|
|
|
|
this->transferPathsToGlobalPathList();
|
|
|
|
|
bool couldOpenFile = this->writeFile();
|
|
|
|
|
this->distributePathsFromGlobalPathList();
|
|
|
|
|
|
|
|
|
|
return couldOpenFile;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-24 07:35:31 +02:00
|
|
|
/// Support list of multiple script paths divided by ';'
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-06-02 06:53:05 +02:00
|
|
|
void RimProject::setScriptDirectories( const QString& scriptDirectories, int maxFolderDepth )
|
2012-05-18 09:45:23 +02:00
|
|
|
{
|
2022-05-31 13:08:07 +02:00
|
|
|
scriptCollection->calcScripts().deleteChildren();
|
|
|
|
|
scriptCollection->subDirectories().deleteChildren();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
QStringList pathList = scriptDirectories.split( ';' );
|
|
|
|
|
foreach ( QString path, pathList )
|
2012-05-18 09:45:23 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
QDir dir( path );
|
|
|
|
|
if ( !path.isEmpty() && dir.exists() && dir.isReadable() )
|
2013-04-24 07:35:31 +02:00
|
|
|
{
|
|
|
|
|
RimScriptCollection* sharedScriptLocation = new RimScriptCollection;
|
2019-09-06 10:40:57 +02:00
|
|
|
sharedScriptLocation->directory = path;
|
|
|
|
|
sharedScriptLocation->setUiName( dir.dirName() );
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2022-06-02 06:53:05 +02:00
|
|
|
sharedScriptLocation->readContentFromDisc( maxFolderDepth );
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
scriptCollection->subDirectories.push_back( sharedScriptLocation );
|
2013-04-24 07:35:31 +02:00
|
|
|
}
|
2012-05-18 09:45:23 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-11 09:33:03 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::setPlotTemplateFolders( const QStringList& plotTemplateFolders )
|
|
|
|
|
{
|
2022-05-11 19:46:17 +02:00
|
|
|
if ( !m_plotTemplateTopFolder() )
|
2019-09-19 11:39:32 +02:00
|
|
|
{
|
2022-05-11 19:46:17 +02:00
|
|
|
m_plotTemplateTopFolder = new RimPlotTemplateFolderItem();
|
2019-09-19 11:39:32 +02:00
|
|
|
}
|
2019-09-11 09:33:03 +02:00
|
|
|
|
2022-05-11 19:46:17 +02:00
|
|
|
m_plotTemplateTopFolder->createRootFolderItemsFromFolderPaths( plotTemplateFolders );
|
2019-09-11 09:33:03 +02:00
|
|
|
}
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
QString RimProject::projectFileVersionString() const
|
|
|
|
|
{
|
|
|
|
|
return m_projectFileVersionString;
|
|
|
|
|
}
|
2013-02-14 13:16:56 +01:00
|
|
|
|
2018-01-04 13:12:07 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-01-04 13:12:07 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
bool RimProject::isProjectFileVersionEqualOrOlderThan( const QString& otherProjectFileVersion ) const
|
2018-01-04 13:12:07 +01:00
|
|
|
{
|
|
|
|
|
QString candidateProjectFileVersion = projectFileVersionString();
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
return !RiaProjectFileVersionTools::isCandidateVersionNewerThanOther( candidateProjectFileVersion,
|
|
|
|
|
otherProjectFileVersion );
|
2018-01-04 13:12:07 +01:00
|
|
|
}
|
2013-04-23 08:11:52 +02:00
|
|
|
|
2013-04-08 08:44:33 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-04-08 08:44:33 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::setProjectFileNameAndUpdateDependencies( const QString& projectFileName )
|
2013-04-08 08:44:33 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
// Extract the filename of the project file when it was saved
|
|
|
|
|
QString oldProjectFileName = this->fileName;
|
2013-04-12 08:31:59 +02:00
|
|
|
// Replace with the new actual filename
|
2018-09-24 21:32:58 +02:00
|
|
|
this->fileName = projectFileName;
|
2013-04-08 12:01:40 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
QFileInfo fileInfo( projectFileName );
|
|
|
|
|
QString newProjectPath = fileInfo.path();
|
|
|
|
|
|
|
|
|
|
QFileInfo fileInfoOld( oldProjectFileName );
|
|
|
|
|
QString oldProjectPath = fileInfoOld.path();
|
2013-04-12 08:31:59 +02:00
|
|
|
|
2020-10-12 13:17:47 +02:00
|
|
|
std::vector<caf::FilePath*> filePaths = allFilePaths();
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( caf::FilePath* filePath : filePaths )
|
2018-01-19 12:52:50 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
bool foundFile = false;
|
2018-01-19 12:52:50 +01:00
|
|
|
std::vector<QString> searchedPaths;
|
|
|
|
|
|
2019-11-04 15:08:09 +01:00
|
|
|
QString newFilePath =
|
|
|
|
|
RimTools::relocateFile( filePath->path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
2019-09-06 10:40:57 +02:00
|
|
|
filePath->setPath( newFilePath );
|
2018-01-19 12:52:50 +01:00
|
|
|
}
|
2013-04-12 08:31:59 +02:00
|
|
|
|
2013-10-24 09:50:16 +02:00
|
|
|
// Update path to well path file cache
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimOilField* oilField : oilFields )
|
2016-08-24 08:30:12 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( oilField == nullptr ) continue;
|
|
|
|
|
if ( oilField->wellPathCollection() != nullptr )
|
2017-05-03 12:31:45 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
oilField->wellPathCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
2017-05-03 12:31:45 +02:00
|
|
|
}
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( oilField->formationNamesCollection() != nullptr )
|
2016-08-24 08:30:12 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
oilField->formationNamesCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
2016-08-24 08:30:12 +02:00
|
|
|
}
|
2017-08-03 13:21:19 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
CVF_ASSERT( oilField->fractureDefinitionCollection() );
|
|
|
|
|
oilField->fractureDefinitionCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
2016-08-24 08:30:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-08 10:37:57 +01:00
|
|
|
{
|
|
|
|
|
std::vector<RimWellLogFile*> rimWellLogFiles;
|
2019-09-06 10:40:57 +02:00
|
|
|
this->descendantsIncludingThisOfType( rimWellLogFiles );
|
2018-01-08 10:37:57 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( auto rimWellLogFile : rimWellLogFiles )
|
2018-01-08 10:37:57 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
rimWellLogFile->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
2018-01-08 10:37:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
2016-08-24 08:30:12 +02:00
|
|
|
|
2013-10-24 09:50:16 +02:00
|
|
|
wellPathImport->updateFilePaths();
|
2013-05-08 10:41:56 +02:00
|
|
|
}
|
2013-04-08 12:01:40 +02:00
|
|
|
|
2020-04-08 14:30:38 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::assignCaseIdToSummaryCase( RimSummaryCase* summaryCase )
|
|
|
|
|
{
|
|
|
|
|
if ( summaryCase )
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimSummaryCase*> summaryCases = allSummaryCases();
|
|
|
|
|
for ( RimSummaryCase* s : summaryCases )
|
|
|
|
|
{
|
|
|
|
|
m_nextValidSummaryCaseId = std::max( m_nextValidSummaryCaseId, s->caseId() + 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
summaryCase->setCaseId( m_nextValidSummaryCaseId++ );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 16:17:47 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::assignIdToEnsemble( RimSummaryCaseCollection* summaryCaseCollection )
|
|
|
|
|
{
|
|
|
|
|
if ( summaryCaseCollection )
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimSummaryCaseCollection*> summaryGroups = RimProject::summaryGroups();
|
|
|
|
|
for ( RimSummaryCaseCollection* s : summaryGroups )
|
|
|
|
|
{
|
|
|
|
|
m_nextValidEnsembleId = std::max( m_nextValidEnsembleId, s->ensembleId() + 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
summaryCaseCollection->setEnsembleId( m_nextValidEnsembleId );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-30 20:51:25 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimCase*> RimProject::allGridCases() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
|
|
|
|
|
|
// TODO: Move code from allCases here
|
|
|
|
|
allCases( cases );
|
|
|
|
|
|
|
|
|
|
return cases;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-08 10:41:56 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-05-08 10:41:56 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::assignCaseIdToCase( RimCase* reservoirCase )
|
2013-05-08 10:41:56 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( reservoirCase )
|
2013-05-08 10:41:56 +02:00
|
|
|
{
|
2019-10-09 09:21:28 +02:00
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
|
this->descendantsIncludingThisOfType( cases );
|
2013-05-08 10:41:56 +02:00
|
|
|
|
2019-10-09 09:21:28 +02:00
|
|
|
for ( RimCase* rimCase : cases )
|
|
|
|
|
{
|
2019-10-18 15:32:20 +02:00
|
|
|
m_nextValidCaseId = std::max( m_nextValidCaseId, rimCase->caseId() + 1 );
|
2019-10-09 09:21:28 +02:00
|
|
|
}
|
|
|
|
|
|
2022-08-17 22:12:23 -07:00
|
|
|
reservoirCase->setCaseId( m_nextValidCaseId++ );
|
2013-05-08 10:41:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-10 15:35:33 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-05-10 15:35:33 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup )
|
2013-05-10 15:35:33 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( caseGroup )
|
2013-05-10 15:35:33 +02:00
|
|
|
{
|
2019-10-09 09:21:28 +02:00
|
|
|
std::vector<RimIdenticalGridCaseGroup*> identicalCaseGroups;
|
|
|
|
|
this->descendantsIncludingThisOfType( identicalCaseGroups );
|
|
|
|
|
|
|
|
|
|
for ( RimIdenticalGridCaseGroup* existingCaseGroup : identicalCaseGroups )
|
|
|
|
|
{
|
2019-10-18 15:32:20 +02:00
|
|
|
m_nextValidCaseGroupId = std::max( m_nextValidCaseGroupId, existingCaseGroup->groupId() + 1 );
|
2019-10-09 09:21:28 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-18 15:32:20 +02:00
|
|
|
caseGroup->groupId = m_nextValidCaseGroupId++;
|
2013-05-10 15:35:33 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 11:43:22 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-14 20:48:11 +01:00
|
|
|
void RimProject::assignViewIdToView( Rim3dView* view )
|
2019-07-15 11:43:22 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( view )
|
2019-07-15 11:43:22 +02:00
|
|
|
{
|
2022-06-13 13:54:55 +02:00
|
|
|
if ( m_nextValidViewId < 0 )
|
2019-10-09 09:21:28 +02:00
|
|
|
{
|
2022-06-13 13:54:55 +02:00
|
|
|
std::vector<Rim3dView*> views;
|
|
|
|
|
this->descendantsIncludingThisOfType( views );
|
|
|
|
|
|
|
|
|
|
for ( Rim3dView* existingView : views )
|
|
|
|
|
{
|
|
|
|
|
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
|
|
|
|
|
}
|
2019-10-09 09:21:28 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-18 15:32:20 +02:00
|
|
|
view->setId( m_nextValidViewId++ );
|
2019-07-15 11:43:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-14 20:48:11 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::assignPlotIdToPlotWindow( RimPlotWindow* plotWindow )
|
|
|
|
|
{
|
|
|
|
|
if ( plotWindow )
|
|
|
|
|
{
|
2022-06-13 13:54:55 +02:00
|
|
|
if ( m_nextValidPlotId < 0 )
|
2019-11-14 20:48:11 +01:00
|
|
|
{
|
2022-06-13 13:54:55 +02:00
|
|
|
std::vector<RimPlotWindow*> plotWindows;
|
|
|
|
|
this->descendantsIncludingThisOfType( plotWindows );
|
|
|
|
|
|
|
|
|
|
for ( RimPlotWindow* existingPlotWindow : plotWindows )
|
|
|
|
|
{
|
|
|
|
|
m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 );
|
|
|
|
|
}
|
2019-11-14 20:48:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plotWindow->setId( m_nextValidPlotId++ );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-08 10:41:56 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-04-30 20:51:25 +02:00
|
|
|
/// TODO: This function is deprecated, use allGridCases()
|
2013-05-08 10:41:56 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::allCases( std::vector<RimCase*>& cases ) const
|
2013-05-08 10:41:56 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++ )
|
2013-04-08 12:01:40 +02:00
|
|
|
{
|
2013-06-06 15:07:31 +02:00
|
|
|
RimOilField* oilField = oilFields[oilFieldIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !oilField ) continue;
|
2013-04-08 12:01:40 +02:00
|
|
|
|
2015-06-25 12:11:06 +02:00
|
|
|
RimEclipseCaseCollection* analysisModels = oilField->analysisModels();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( analysisModels )
|
2013-05-08 10:41:56 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t caseIdx = 0; caseIdx < analysisModels->cases.size(); caseIdx++ )
|
2015-05-15 18:51:49 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
cases.push_back( analysisModels->cases[caseIdx] );
|
2015-05-15 18:51:49 +02:00
|
|
|
}
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t cgIdx = 0; cgIdx < analysisModels->caseGroups.size(); cgIdx++ )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
2015-05-15 18:51:49 +02:00
|
|
|
// Load the Main case of each IdenticalGridCaseGroup
|
|
|
|
|
RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups[cgIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( cg == nullptr ) continue;
|
2015-05-15 18:51:49 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( cg->statisticsCaseCollection() )
|
2015-05-15 18:51:49 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t caseIdx = 0; caseIdx < cg->statisticsCaseCollection()->reservoirs.size(); caseIdx++ )
|
2015-05-18 15:23:51 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
cases.push_back( cg->statisticsCaseCollection()->reservoirs[caseIdx] );
|
2015-05-18 15:23:51 +02:00
|
|
|
}
|
2015-05-15 18:51:49 +02:00
|
|
|
}
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( cg->caseCollection() )
|
2015-05-15 18:51:49 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t caseIdx = 0; caseIdx < cg->caseCollection()->reservoirs.size(); caseIdx++ )
|
2015-05-18 15:23:51 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
cases.push_back( cg->caseCollection()->reservoirs[caseIdx] );
|
2015-05-18 15:23:51 +02:00
|
|
|
}
|
2015-05-15 18:51:49 +02:00
|
|
|
}
|
2013-06-06 15:07:31 +02:00
|
|
|
}
|
2015-05-15 18:51:49 +02:00
|
|
|
}
|
2013-06-06 15:07:31 +02:00
|
|
|
|
2015-05-15 18:51:49 +02:00
|
|
|
RimGeoMechModels* geomModels = oilField->geoMechModels();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( geomModels )
|
2015-05-15 18:51:49 +02:00
|
|
|
{
|
2020-09-10 12:54:43 +02:00
|
|
|
for ( auto acase : geomModels->cases() )
|
2013-06-06 15:07:31 +02:00
|
|
|
{
|
2020-09-10 12:54:43 +02:00
|
|
|
cases.push_back( acase );
|
2013-06-06 15:07:31 +02:00
|
|
|
}
|
2013-04-08 12:01:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
2013-04-08 08:44:33 +02:00
|
|
|
}
|
|
|
|
|
|
2016-05-31 13:42:27 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2016-05-31 13:42:27 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-12-01 09:34:43 +01:00
|
|
|
std::vector<RimSummaryCase*> RimProject::allSummaryCases() const
|
2016-05-31 13:42:27 +02:00
|
|
|
{
|
2017-12-01 09:34:43 +01:00
|
|
|
std::vector<RimSummaryCase*> sumCases;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimOilField* oilField : oilFields )
|
2016-05-31 13:42:27 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !oilField ) continue;
|
2017-09-06 16:32:46 +02:00
|
|
|
RimSummaryCaseMainCollection* sumCaseMainColl = oilField->summaryCaseMainCollection();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( sumCaseMainColl )
|
2016-05-31 13:42:27 +02:00
|
|
|
{
|
2017-09-07 14:13:51 +02:00
|
|
|
std::vector<RimSummaryCase*> allSummaryCases = sumCaseMainColl->allSummaryCases();
|
2022-05-11 10:47:12 +02:00
|
|
|
if ( !allSummaryCases.empty() )
|
|
|
|
|
{
|
|
|
|
|
sumCases.insert( sumCases.end(), allSummaryCases.begin(), allSummaryCases.end() );
|
|
|
|
|
}
|
2017-09-28 14:42:06 +02:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 10:47:12 +02:00
|
|
|
auto& observedDataColl = oilField->observedDataCollection();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( observedDataColl != nullptr && observedDataColl->allObservedSummaryData().size() > 0 )
|
2017-09-28 14:42:06 +02:00
|
|
|
{
|
2019-08-20 15:09:13 +02:00
|
|
|
auto observedData = observedDataColl->allObservedSummaryData();
|
2019-09-06 10:40:57 +02:00
|
|
|
sumCases.insert( sumCases.end(), observedData.begin(), observedData.end() );
|
2016-05-31 13:42:27 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-01 09:34:43 +01:00
|
|
|
return sumCases;
|
2017-09-18 20:27:20 +02:00
|
|
|
}
|
|
|
|
|
|
2018-04-06 08:16:14 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-04-06 08:16:14 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimSummaryCaseCollection*> RimProject::summaryGroups() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimSummaryCaseCollection*> groups;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimOilField* oilField : oilFields )
|
2018-04-06 08:16:14 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !oilField ) continue;
|
2018-04-06 08:16:14 +02:00
|
|
|
RimSummaryCaseMainCollection* sumCaseMainColl = oilField->summaryCaseMainCollection();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( sumCaseMainColl )
|
2018-04-06 08:16:14 +02:00
|
|
|
{
|
|
|
|
|
std::vector<RimSummaryCaseCollection*> g = sumCaseMainColl->summaryCaseCollections();
|
2019-09-06 10:40:57 +02:00
|
|
|
groups.insert( groups.end(), g.begin(), g.end() );
|
2018-04-06 08:16:14 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return groups;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-25 15:14:47 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-06-25 15:14:47 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimSummaryCaseMainCollection* RimProject::firstSummaryCaseMainCollection() const
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( oilFields.empty() ) return nullptr;
|
2018-06-25 15:14:47 +02:00
|
|
|
return oilFields[0]->summaryCaseMainCollection;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-18 20:27:20 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-09-07 13:33:27 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-11-24 10:46:54 +01:00
|
|
|
void RimProject::allNotLinkedViews( std::vector<Rim3dView*>& views )
|
2015-09-07 13:33:27 +02:00
|
|
|
{
|
|
|
|
|
std::vector<RimCase*> cases;
|
2019-09-06 10:40:57 +02:00
|
|
|
allCases( cases );
|
2015-09-07 13:33:27 +02:00
|
|
|
|
2022-11-24 10:46:54 +01:00
|
|
|
std::vector<Rim3dView*> alreadyLinkedViews;
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( viewLinkerCollection->viewLinker() )
|
2015-09-07 13:33:27 +02:00
|
|
|
{
|
2022-11-04 15:48:25 +01:00
|
|
|
alreadyLinkedViews = viewLinkerCollection->viewLinker()->allViews();
|
2015-09-07 13:33:27 +02:00
|
|
|
}
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++ )
|
2015-09-07 13:33:27 +02:00
|
|
|
{
|
|
|
|
|
RimCase* rimCase = cases[caseIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !rimCase ) continue;
|
2015-09-07 13:33:27 +02:00
|
|
|
|
2018-01-09 10:11:28 +01:00
|
|
|
std::vector<Rim3dView*> caseViews = rimCase->views();
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t viewIdx = 0; viewIdx < caseViews.size(); viewIdx++ )
|
2015-09-07 13:33:27 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
RimGridView* gridView = dynamic_cast<RimGridView*>( caseViews[viewIdx] );
|
|
|
|
|
|
|
|
|
|
if ( !gridView ) continue;
|
2018-01-15 14:52:22 +01:00
|
|
|
|
2015-09-07 13:33:27 +02:00
|
|
|
bool isLinked = false;
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t lnIdx = 0; lnIdx < alreadyLinkedViews.size(); lnIdx++ )
|
2015-09-07 13:33:27 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( gridView == alreadyLinkedViews[lnIdx] )
|
2015-09-07 13:33:27 +02:00
|
|
|
{
|
|
|
|
|
isLinked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !isLinked )
|
2015-09-07 13:33:27 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
views.push_back( gridView );
|
2015-09-07 13:33:27 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-11 09:47:30 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::allViews( std::vector<Rim3dView*>& views ) const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
|
allCases( cases );
|
|
|
|
|
|
|
|
|
|
for ( size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++ )
|
|
|
|
|
{
|
|
|
|
|
RimCase* rimCase = cases[caseIdx];
|
|
|
|
|
if ( !rimCase ) continue;
|
|
|
|
|
|
|
|
|
|
std::vector<Rim3dView*> caseViews = rimCase->views();
|
|
|
|
|
for ( size_t viewIdx = 0; viewIdx < caseViews.size(); viewIdx++ )
|
|
|
|
|
{
|
|
|
|
|
if ( caseViews[viewIdx] )
|
|
|
|
|
{
|
|
|
|
|
views.push_back( caseViews[viewIdx] );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-30 13:30:46 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-08-30 13:30:46 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::allVisibleViews( std::vector<Rim3dView*>& views ) const
|
2015-08-30 13:30:46 +02:00
|
|
|
{
|
|
|
|
|
std::vector<RimCase*> cases;
|
2019-09-06 10:40:57 +02:00
|
|
|
allCases( cases );
|
|
|
|
|
|
|
|
|
|
for ( size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++ )
|
2015-08-30 13:30:46 +02:00
|
|
|
{
|
|
|
|
|
RimCase* rimCase = cases[caseIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !rimCase ) continue;
|
2015-08-30 13:30:46 +02:00
|
|
|
|
2018-01-09 10:11:28 +01:00
|
|
|
std::vector<Rim3dView*> caseViews = rimCase->views();
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t viewIdx = 0; viewIdx < caseViews.size(); viewIdx++ )
|
2015-08-30 13:30:46 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( caseViews[viewIdx] && caseViews[viewIdx]->viewer() )
|
2015-08-30 13:30:46 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
views.push_back( caseViews[viewIdx] );
|
2015-08-30 13:30:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-05-16 14:10:22 +02:00
|
|
|
|
2018-01-15 14:52:22 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-01-15 14:52:22 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::allVisibleGridViews( std::vector<RimGridView*>& views ) const
|
2018-01-15 14:52:22 +01:00
|
|
|
{
|
|
|
|
|
std::vector<Rim3dView*> visibleViews;
|
2019-09-06 10:40:57 +02:00
|
|
|
this->allVisibleViews( visibleViews );
|
2018-01-15 14:52:22 +01:00
|
|
|
for ( Rim3dView* view : visibleViews )
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
RimGridView* gridView = dynamic_cast<RimGridView*>( view );
|
|
|
|
|
if ( gridView ) views.push_back( gridView );
|
2018-01-15 14:52:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-16 14:10:22 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-05-16 14:10:22 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-09-11 12:41:45 +02:00
|
|
|
void RimProject::scheduleCreateDisplayModelAndRedrawAllViews()
|
2013-05-16 14:10:22 +02:00
|
|
|
{
|
2015-05-15 18:51:49 +02:00
|
|
|
std::vector<RimCase*> cases;
|
2019-09-06 10:40:57 +02:00
|
|
|
allCases( cases );
|
|
|
|
|
for ( size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++ )
|
2013-05-16 14:10:22 +02:00
|
|
|
{
|
2015-05-15 18:51:49 +02:00
|
|
|
RimCase* rimCase = cases[caseIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( rimCase == nullptr ) continue;
|
2018-01-09 10:11:28 +01:00
|
|
|
std::vector<Rim3dView*> views = rimCase->views();
|
2013-06-06 15:07:31 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t viewIdx = 0; viewIdx < views.size(); viewIdx++ )
|
2013-05-16 14:10:22 +02:00
|
|
|
{
|
2015-05-15 18:51:49 +02:00
|
|
|
views[viewIdx]->scheduleCreateDisplayModelAndRedraw();
|
2013-05-16 14:10:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-18 14:49:31 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-09-18 14:49:31 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::allOilFields( std::vector<RimOilField*>& allOilFields ) const
|
2017-09-18 14:49:31 +02:00
|
|
|
{
|
2018-09-24 21:32:58 +02:00
|
|
|
allOilFields.clear();
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& oilField : this->oilFields )
|
2017-09-18 14:49:31 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
allOilFields.push_back( oilField );
|
2017-09-18 14:49:31 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-31 13:57:16 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-06-06 15:07:31 +02:00
|
|
|
/// Currently there will be only one oil field in Resinsight, so return hardcoded first oil field
|
|
|
|
|
/// from the RimOilField collection.
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimOilField* RimProject::activeOilField()
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
CVF_ASSERT( oilFields.size() == 1 );
|
|
|
|
|
|
2013-06-12 09:36:50 +02:00
|
|
|
return oilFields[0];
|
2013-06-06 15:07:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-31 16:16:28 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
/// Currently there will be only one oil field in Resinsight, so return hardcoded first oil field
|
|
|
|
|
/// from the RimOilField collection.
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
const RimOilField* RimProject::activeOilField() const
|
2017-05-31 16:16:28 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
CVF_ASSERT( oilFields.size() == 1 );
|
|
|
|
|
|
2017-05-31 16:16:28 +02:00
|
|
|
return oilFields[0];
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-06 15:07:31 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-05-31 13:57:16 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-09-08 10:53:25 +02:00
|
|
|
void RimProject::computeUtmAreaOfInterest()
|
2013-05-31 13:57:16 +02:00
|
|
|
{
|
2015-05-15 18:51:49 +02:00
|
|
|
std::vector<RimCase*> cases;
|
2019-09-06 10:40:57 +02:00
|
|
|
allCases( cases );
|
2013-05-31 13:57:16 +02:00
|
|
|
|
|
|
|
|
cvf::BoundingBox projectBB;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t i = 0; i < cases.size(); i++ )
|
2013-05-31 13:57:16 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
RimEclipseCase* rimCase = dynamic_cast<RimEclipseCase*>( cases[i] );
|
2013-05-31 13:57:16 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( rimCase && rimCase->eclipseCaseData() )
|
2013-05-31 13:57:16 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t gridIdx = 0; gridIdx < rimCase->eclipseCaseData()->gridCount(); gridIdx++ )
|
2013-05-31 13:57:16 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
RigGridBase* rigGrid = rimCase->eclipseCaseData()->grid( gridIdx );
|
2013-05-31 13:57:16 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
projectBB.add( rigGrid->boundingBox() );
|
2013-05-31 13:57:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
2015-05-15 18:51:49 +02:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Todo : calculate BBox of GeoMechCase
|
|
|
|
|
}
|
2013-05-31 13:57:16 +02:00
|
|
|
}
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( projectBB.isValid() )
|
2013-05-31 13:57:16 +02:00
|
|
|
{
|
2013-09-08 10:53:25 +02:00
|
|
|
double north, south, east, west;
|
2013-05-31 13:57:16 +02:00
|
|
|
|
2013-09-08 10:53:25 +02:00
|
|
|
north = projectBB.max().y();
|
|
|
|
|
south = projectBB.min().y();
|
|
|
|
|
|
|
|
|
|
west = projectBB.min().x();
|
|
|
|
|
east = projectBB.max().x();
|
|
|
|
|
|
|
|
|
|
wellPathImport->north = north;
|
|
|
|
|
wellPathImport->south = south;
|
2019-09-06 10:40:57 +02:00
|
|
|
wellPathImport->east = east;
|
|
|
|
|
wellPathImport->west = west;
|
2013-05-31 13:57:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-06 11:00:21 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-08-06 11:00:21 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::actionsBasedOnSelection( QMenu& contextMenu )
|
2015-08-06 11:00:21 +02:00
|
|
|
{
|
2017-11-19 01:12:39 +01:00
|
|
|
caf::CmdFeatureMenuBuilder menuBuilder = RimContextCommandBuilder::commandsFromSelection();
|
2015-08-18 16:36:37 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
menuBuilder.appendToMenu( &contextMenu );
|
2015-08-06 11:00:21 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-18 16:36:37 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-08-18 16:36:37 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-10-04 14:23:34 +02:00
|
|
|
bool RimProject::show3DWindow() const
|
|
|
|
|
{
|
|
|
|
|
return m_show3DWindow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2016-10-04 14:23:34 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
bool RimProject::showPlotWindow() const
|
|
|
|
|
{
|
|
|
|
|
return m_showPlotWindow;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-02 19:18:00 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-10-31 13:26:26 +01:00
|
|
|
RiaDefines::WindowTileMode RimProject::subWindowsTileMode3DWindow() const
|
2019-04-02 19:18:00 +02:00
|
|
|
{
|
2022-10-31 13:26:26 +01:00
|
|
|
return m_subWindowsTileMode3DWindow();
|
2019-04-02 19:18:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-10-31 13:26:26 +01:00
|
|
|
RiaDefines::WindowTileMode RimProject::subWindowsTileModePlotWindow() const
|
2019-04-02 19:18:00 +02:00
|
|
|
{
|
2022-10-31 13:26:26 +01:00
|
|
|
return m_subWindowsTileModePlotWindow();
|
2019-04-02 19:18:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-10-31 13:26:26 +01:00
|
|
|
void RimProject::setSubWindowsTileMode3DWindow( RiaDefines::WindowTileMode tileMode )
|
2019-04-02 19:18:00 +02:00
|
|
|
{
|
2022-10-31 13:26:26 +01:00
|
|
|
m_subWindowsTileMode3DWindow = tileMode;
|
2019-04-02 19:18:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-10-31 13:26:26 +01:00
|
|
|
void RimProject::setSubWindowsTileModePlotWindow( RiaDefines::WindowTileMode tileMode )
|
2019-04-02 19:18:00 +02:00
|
|
|
{
|
2022-10-31 13:26:26 +01:00
|
|
|
m_subWindowsTileModePlotWindow = tileMode;
|
2019-04-02 19:18:00 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-31 16:16:28 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-05-31 16:16:28 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-06-02 10:35:52 +02:00
|
|
|
void RimProject::reloadCompletionTypeResultsInAllViews()
|
|
|
|
|
{
|
2022-05-05 11:29:07 +02:00
|
|
|
RiaCompletionTypeCalculationScheduler::instance()->clearCompletionTypeResultsInAllCases();
|
2018-09-11 12:41:45 +02:00
|
|
|
scheduleCreateDisplayModelAndRedrawAllViews();
|
2018-10-03 15:57:09 +02:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
m_mainPlotCollection()->scheduleUpdatePlotsWithCompletions();
|
2017-06-21 11:06:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-06-30 16:14:15 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimDialogData* RimProject::dialogData() const
|
|
|
|
|
{
|
|
|
|
|
return m_dialogData;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 13:52:29 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-11 13:52:29 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimEclipseCase*> RimProject::eclipseCases() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimEclipseCase*> allCases;
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& oilField : oilFields )
|
2017-10-11 13:52:29 +02:00
|
|
|
{
|
|
|
|
|
const auto& cases = oilField->analysisModels->cases;
|
2019-09-06 10:40:57 +02:00
|
|
|
allCases.insert( allCases.end(), cases.begin(), cases.end() );
|
2017-10-11 13:52:29 +02:00
|
|
|
}
|
|
|
|
|
return allCases;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 11:11:05 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-04-13 11:11:05 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
RimEclipseCase* RimProject::eclipseCaseFromGridFileName( const QString& gridFileName ) const
|
2018-04-13 11:11:05 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimEclipseCase* eclCase : eclipseCases() )
|
2018-04-13 11:11:05 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( RiaFilePathTools::toInternalSeparator( eclCase->gridFileName() ) ==
|
|
|
|
|
RiaFilePathTools::toInternalSeparator( gridFileName ) )
|
2018-04-13 11:11:05 +02:00
|
|
|
{
|
|
|
|
|
return eclCase;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-18 14:28:54 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimEclipseCase* RimProject::eclipseCaseFromCaseId( const int caseId ) const
|
|
|
|
|
{
|
|
|
|
|
for ( RimEclipseCase* eclCase : eclipseCases() )
|
|
|
|
|
{
|
|
|
|
|
if ( eclCase->caseId() == caseId )
|
|
|
|
|
{
|
|
|
|
|
return eclCase;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 13:52:29 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-11 13:52:29 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<QString> RimProject::simulationWellNames() const
|
|
|
|
|
{
|
|
|
|
|
std::set<QString> wellNames;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimOilField* oilField : oilFields )
|
2017-10-11 13:52:29 +02:00
|
|
|
{
|
|
|
|
|
auto analysisCaseColl = oilField->analysisModels();
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimEclipseCase* eclCase : analysisCaseColl->cases() )
|
2017-10-11 13:52:29 +02:00
|
|
|
{
|
|
|
|
|
const auto& eclData = eclCase->eclipseCaseData();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( eclData == nullptr ) continue;
|
2017-10-11 13:52:29 +02:00
|
|
|
|
|
|
|
|
const auto names = eclData->simulationWellNames();
|
2019-09-06 10:40:57 +02:00
|
|
|
wellNames.insert( names.begin(), names.end() );
|
2017-10-11 13:52:29 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-09-06 10:40:57 +02:00
|
|
|
return std::vector<QString>( wellNames.begin(), wellNames.end() );
|
2017-10-11 13:52:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-11 13:52:29 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
RimWellPath* RimProject::wellPathFromSimWellName( const QString& simWellName, int branchIndex )
|
2017-10-11 13:52:29 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimWellPath* const path : allWellPaths() )
|
2017-10-11 13:52:29 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( QString::compare( path->associatedSimulationWellName(), simWellName ) == 0 &&
|
|
|
|
|
( branchIndex < 0 || path->associatedSimulationWellBranch() == branchIndex ) )
|
2017-10-11 13:52:29 +02:00
|
|
|
{
|
2017-11-08 16:35:58 +01:00
|
|
|
return path;
|
2017-10-11 13:52:29 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-25 09:55:00 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-25 09:55:00 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
RimWellPath* RimProject::wellPathByName( const QString& wellPathName ) const
|
2017-11-08 16:35:58 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimWellPath* const path : allWellPaths() )
|
2017-11-08 16:35:58 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( path->name() == wellPathName ) return path;
|
2017-11-08 16:35:58 +01:00
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-11-08 16:35:58 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-10-25 09:55:00 +02:00
|
|
|
std::vector<RimWellPath*> RimProject::allWellPaths() const
|
|
|
|
|
{
|
2020-10-06 15:00:39 +02:00
|
|
|
std::vector<RimWellPath*> wellPaths;
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& oilField : oilFields() )
|
2017-10-25 09:55:00 +02:00
|
|
|
{
|
|
|
|
|
auto wellPathColl = oilField->wellPathCollection();
|
2020-10-07 16:18:24 +02:00
|
|
|
for ( auto wellPath : wellPathColl->allWellPaths() )
|
2017-10-25 09:55:00 +02:00
|
|
|
{
|
2020-10-06 15:00:39 +02:00
|
|
|
wellPaths.push_back( wellPath );
|
2017-10-25 09:55:00 +02:00
|
|
|
}
|
|
|
|
|
}
|
2020-10-06 15:00:39 +02:00
|
|
|
return wellPaths;
|
2017-10-25 09:55:00 +02:00
|
|
|
}
|
|
|
|
|
|
2018-11-23 13:33:59 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimTextAnnotation*> RimProject::textAnnotations() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimTextAnnotation*> annotations;
|
2018-11-26 14:48:06 +01:00
|
|
|
|
|
|
|
|
// 'Global' text annotations
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& oilField : oilFields() )
|
2018-11-23 13:33:59 +01:00
|
|
|
{
|
|
|
|
|
auto annotationColl = oilField->annotationCollection();
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& annotation : annotationColl->textAnnotations() )
|
2018-11-23 13:33:59 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
annotations.push_back( annotation );
|
2018-11-23 13:33:59 +01:00
|
|
|
}
|
|
|
|
|
}
|
2018-11-26 14:48:06 +01:00
|
|
|
|
|
|
|
|
// 'Local' text annotations
|
|
|
|
|
std::vector<RimGridView*> visibleViews;
|
2019-09-06 10:40:57 +02:00
|
|
|
allVisibleGridViews( visibleViews );
|
|
|
|
|
for ( const auto& view : visibleViews )
|
2018-11-26 14:48:06 +01:00
|
|
|
{
|
|
|
|
|
std::vector<RimAnnotationInViewCollection*> annotationColls;
|
2019-09-06 10:40:57 +02:00
|
|
|
view->descendantsIncludingThisOfType( annotationColls );
|
2018-11-26 14:48:06 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( annotationColls.size() == 1 )
|
2018-11-26 14:48:06 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& annotation : annotationColls.front()->textAnnotations() )
|
2018-11-26 14:48:06 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
annotations.push_back( annotation );
|
2018-11-26 14:48:06 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-23 13:33:59 +01:00
|
|
|
return annotations;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimReachCircleAnnotation*> RimProject::reachCircleAnnotations() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimReachCircleAnnotation*> annotations;
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& oilField : oilFields() )
|
2018-11-23 13:33:59 +01:00
|
|
|
{
|
|
|
|
|
auto annotationColl = oilField->annotationCollection();
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& annotation : annotationColl->reachCircleAnnotations() )
|
2018-11-23 13:33:59 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
annotations.push_back( annotation );
|
2018-11-23 13:33:59 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return annotations;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-26 14:06:17 +01:00
|
|
|
std::vector<RimPolylinesAnnotation*> RimProject::polylineAnnotations() const
|
2018-11-23 13:33:59 +01:00
|
|
|
{
|
2018-11-26 14:06:17 +01:00
|
|
|
std::vector<RimPolylinesAnnotation*> annotations;
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& oilField : oilFields() )
|
2018-11-23 13:33:59 +01:00
|
|
|
{
|
|
|
|
|
auto annotationColl = oilField->annotationCollection();
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& annotation : annotationColl->userDefinedPolylineAnnotations() )
|
2018-11-23 13:33:59 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
annotations.push_back( annotation );
|
2018-11-23 13:33:59 +01:00
|
|
|
}
|
2018-11-26 14:06:17 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& annotation : annotationColl->polylinesFromFileAnnotations() )
|
2018-11-26 14:06:17 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
annotations.push_back( annotation );
|
2018-11-26 14:06:17 +01:00
|
|
|
}
|
2018-11-23 13:33:59 +01:00
|
|
|
}
|
|
|
|
|
return annotations;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-20 16:10:45 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-20 16:10:45 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimGeoMechCase*> RimProject::geoMechCases() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimGeoMechCase*> cases;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++ )
|
2017-10-20 16:10:45 +02:00
|
|
|
{
|
|
|
|
|
RimOilField* oilField = oilFields[oilFieldIdx];
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !oilField ) continue;
|
2017-10-20 16:10:45 +02:00
|
|
|
|
|
|
|
|
RimGeoMechModels* geomModels = oilField->geoMechModels();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( geomModels )
|
2017-10-20 16:10:45 +02:00
|
|
|
{
|
2020-09-10 12:54:43 +02:00
|
|
|
for ( auto acase : geomModels->cases() )
|
2017-10-20 16:10:45 +02:00
|
|
|
{
|
2020-09-10 12:54:43 +02:00
|
|
|
cases.push_back( acase );
|
2017-10-20 16:10:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cases;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-20 13:14:43 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-12-20 13:14:43 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimFractureTemplateCollection*> RimProject::allFractureTemplateCollections() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimFractureTemplateCollection*> templColls;
|
2019-09-06 10:40:57 +02:00
|
|
|
std::vector<RimOilField*> rimOilFields;
|
2017-12-20 13:14:43 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
allOilFields( rimOilFields );
|
|
|
|
|
for ( RimOilField* oilField : rimOilFields )
|
2017-12-20 13:14:43 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
templColls.push_back( oilField->fractureDefinitionCollection() );
|
2017-12-20 13:14:43 +01:00
|
|
|
}
|
|
|
|
|
return templColls;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-12-20 13:14:43 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimFractureTemplate*> RimProject::allFractureTemplates() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimFractureTemplate*> templates;
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimFractureTemplateCollection* templColl : allFractureTemplateCollections() )
|
2017-12-20 13:14:43 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimFractureTemplate* templ : templColl->fractureTemplates() )
|
2017-12-20 13:14:43 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
templates.push_back( templ );
|
2017-12-20 13:14:43 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return templates;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-13 19:49:37 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimValveTemplateCollection*> RimProject::allValveTemplateCollections() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimValveTemplateCollection*> templColls;
|
|
|
|
|
std::vector<RimOilField*> rimOilFields;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
allOilFields( rimOilFields );
|
|
|
|
|
for ( RimOilField* oilField : rimOilFields )
|
2018-12-13 19:49:37 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
templColls.push_back( oilField->valveTemplateCollection() );
|
2018-12-13 19:49:37 +01:00
|
|
|
}
|
|
|
|
|
return templColls;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimValveTemplate*> RimProject::allValveTemplates() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimValveTemplate*> templates;
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimValveTemplateCollection* templColl : allValveTemplateCollections() )
|
2018-12-13 19:49:37 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( RimValveTemplate* templ : templColl->valveTemplates() )
|
2018-12-13 19:49:37 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
templates.push_back( templ );
|
2018-12-13 19:49:37 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return templates;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-28 11:12:05 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-08-28 11:12:05 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2021-01-21 12:58:46 +01:00
|
|
|
caf::AppEnum<RiaDefines::EclipseUnitSystem> RimProject::commonUnitSystemForAllCases() const
|
2018-08-28 11:12:05 +02:00
|
|
|
{
|
|
|
|
|
std::vector<RimCase*> rimCases;
|
2019-09-06 10:40:57 +02:00
|
|
|
allCases( rimCases );
|
2018-08-28 11:12:05 +02:00
|
|
|
|
2021-01-21 12:58:46 +01:00
|
|
|
RiaDefines::EclipseUnitSystem commonUnitSystem = RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
|
2018-08-28 11:12:05 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& c : rimCases )
|
2018-08-28 11:12:05 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
auto eclipseCase = dynamic_cast<RimEclipseCase*>( c );
|
|
|
|
|
if ( eclipseCase && eclipseCase->eclipseCaseData() )
|
2018-08-28 11:12:05 +02:00
|
|
|
{
|
2021-01-21 12:58:46 +01:00
|
|
|
if ( commonUnitSystem == RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN )
|
2018-08-28 11:12:05 +02:00
|
|
|
{
|
|
|
|
|
commonUnitSystem = eclipseCase->eclipseCaseData()->unitsType();
|
|
|
|
|
}
|
2019-09-06 10:40:57 +02:00
|
|
|
else if ( commonUnitSystem != eclipseCase->eclipseCaseData()->unitsType() )
|
2018-08-28 11:12:05 +02:00
|
|
|
{
|
2021-01-21 12:58:46 +01:00
|
|
|
commonUnitSystem = RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
|
2018-08-28 11:12:05 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return commonUnitSystem;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-19 14:41:17 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimMeasurement* RimProject::measurement() const
|
|
|
|
|
{
|
|
|
|
|
return activeOilField()->measurement;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-11 09:33:03 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-05-25 11:01:45 +02:00
|
|
|
RimPlotTemplateFolderItem* RimProject::rootPlotTemplateItem() const
|
2019-09-11 09:33:03 +02:00
|
|
|
{
|
2022-05-11 19:46:17 +02:00
|
|
|
return m_plotTemplateTopFolder;
|
2019-09-11 09:33:03 +02:00
|
|
|
}
|
|
|
|
|
|
2020-10-12 13:17:47 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<caf::FilePath*> RimProject::allFilePaths() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<caf::FilePath*> filePaths;
|
|
|
|
|
fieldContentsByType( this, filePaths );
|
|
|
|
|
|
|
|
|
|
return filePaths;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-02 10:35:52 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-06-21 11:06:38 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::reloadCompletionTypeResultsForEclipseCase( RimEclipseCase* eclipseCase )
|
2017-06-21 11:06:38 +02:00
|
|
|
{
|
2018-01-09 10:11:28 +01:00
|
|
|
std::vector<Rim3dView*> views = eclipseCase->views();
|
2017-06-21 11:06:38 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( size_t viewIdx = 0; viewIdx < views.size(); viewIdx++ )
|
2017-06-21 11:06:38 +02:00
|
|
|
{
|
|
|
|
|
views[viewIdx]->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-18 12:50:04 +01:00
|
|
|
RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews( { eclipseCase } );
|
2017-05-31 16:16:28 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-06 15:55:17 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-08-06 15:55:17 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
2015-08-06 15:55:17 +02:00
|
|
|
{
|
2022-01-28 13:19:52 +01:00
|
|
|
if ( uiConfigName == "PlotWindow.Plots" )
|
2015-09-07 14:01:19 +02:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection )
|
2016-06-27 11:07:01 +02:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->summaryMultiPlotCollection() )
|
2022-03-04 10:52:17 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->summaryMultiPlotCollection() );
|
2022-03-04 10:52:17 +01:00
|
|
|
}
|
|
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->analysisPlotCollection() )
|
2020-02-12 16:48:25 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->analysisPlotCollection() );
|
2016-06-27 11:07:01 +02:00
|
|
|
}
|
2017-09-26 10:49:13 +02:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->correlationPlotCollection() )
|
2020-04-17 09:31:42 +02:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->correlationPlotCollection() );
|
2020-04-17 09:31:42 +02:00
|
|
|
}
|
|
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->summaryCrossPlotCollection() )
|
2019-01-14 11:14:18 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->summaryCrossPlotCollection() );
|
2019-01-14 11:14:18 +01:00
|
|
|
}
|
|
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->wellLogPlotCollection() )
|
2019-01-14 11:14:18 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->wellLogPlotCollection() );
|
2019-01-14 11:14:18 +01:00
|
|
|
}
|
|
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->rftPlotCollection() )
|
2019-01-14 11:14:18 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->rftPlotCollection() );
|
2019-01-14 11:14:18 +01:00
|
|
|
}
|
2017-11-07 20:40:45 +01:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->pltPlotCollection() )
|
2016-06-27 11:07:01 +02:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->pltPlotCollection() );
|
2016-06-27 11:07:01 +02:00
|
|
|
}
|
2017-01-13 09:50:43 +01:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->flowPlotCollection() )
|
2017-01-13 09:50:43 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->flowPlotCollection() );
|
2017-01-13 09:50:43 +01:00
|
|
|
}
|
2019-02-21 12:52:23 +01:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->gridCrossPlotCollection() )
|
2019-02-21 12:52:23 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->gridCrossPlotCollection() );
|
2019-02-21 12:52:23 +01:00
|
|
|
}
|
2019-03-18 12:41:44 +01:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->saturationPressurePlotCollection() )
|
2019-03-18 12:41:44 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->saturationPressurePlotCollection() );
|
2019-03-18 12:41:44 +01:00
|
|
|
}
|
2019-10-31 13:48:40 +01:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->multiPlotCollection() )
|
2019-10-31 13:48:40 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->multiPlotCollection() );
|
2019-10-31 13:48:40 +01:00
|
|
|
}
|
2020-05-14 06:39:55 +02:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->stimPlanModelPlotCollection() )
|
2020-05-14 06:39:55 +02:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->stimPlanModelPlotCollection() );
|
2020-05-14 06:39:55 +02:00
|
|
|
}
|
2020-11-13 10:56:25 +01:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->vfpPlotCollection() )
|
2020-11-13 10:56:25 +01:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
uiTreeOrdering.add( m_mainPlotCollection->vfpPlotCollection() );
|
2020-11-13 10:56:25 +01:00
|
|
|
}
|
2020-11-13 15:37:08 +01:00
|
|
|
#ifdef USE_QTCHARTS
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->gridStatisticsPlotCollection() ||
|
|
|
|
|
m_mainPlotCollection->ensembleFractureStatisticsPlotCollection() )
|
2020-11-13 15:37:08 +01:00
|
|
|
{
|
2022-01-28 13:19:52 +01:00
|
|
|
auto statisticsItemCollection = uiTreeOrdering.add( "Statistics Plots", ":/Folder.png" );
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->gridStatisticsPlotCollection() )
|
|
|
|
|
statisticsItemCollection->add( m_mainPlotCollection->gridStatisticsPlotCollection() );
|
2021-04-28 13:45:04 +02:00
|
|
|
|
2022-08-19 05:30:25 -07:00
|
|
|
if ( m_mainPlotCollection->ensembleFractureStatisticsPlotCollection() )
|
|
|
|
|
statisticsItemCollection->add( m_mainPlotCollection->ensembleFractureStatisticsPlotCollection() );
|
2020-11-13 15:37:08 +01:00
|
|
|
}
|
|
|
|
|
#endif
|
2016-06-27 11:07:01 +02:00
|
|
|
}
|
2022-01-28 13:19:52 +01:00
|
|
|
}
|
|
|
|
|
else if ( uiConfigName == "PlotWindow.DataSources" )
|
|
|
|
|
{
|
|
|
|
|
RimOilField* oilField = activeOilField();
|
|
|
|
|
if ( oilField )
|
|
|
|
|
{
|
|
|
|
|
if ( oilField->summaryCaseMainCollection() )
|
|
|
|
|
{
|
|
|
|
|
uiTreeOrdering.add( oilField->summaryCaseMainCollection() );
|
|
|
|
|
}
|
|
|
|
|
if ( oilField->observedDataCollection() )
|
|
|
|
|
{
|
|
|
|
|
uiTreeOrdering.add( oilField->observedDataCollection() );
|
|
|
|
|
}
|
|
|
|
|
if ( oilField->ensembleWellLogsCollection() )
|
|
|
|
|
{
|
|
|
|
|
uiTreeOrdering.add( oilField->ensembleWellLogsCollection() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-11 19:17:46 +02:00
|
|
|
else if ( uiConfigName == "PlotWindow.Scripts" || uiConfigName == "MainWindow.Scripts" )
|
2022-01-28 13:19:52 +01:00
|
|
|
{
|
2020-04-01 13:31:40 +02:00
|
|
|
uiTreeOrdering.add( scriptCollection() );
|
2016-06-27 11:07:01 +02:00
|
|
|
}
|
2022-05-11 19:46:17 +02:00
|
|
|
else if ( uiConfigName == "PlotWindow.Templates" )
|
|
|
|
|
{
|
|
|
|
|
uiTreeOrdering.add( m_plotTemplateTopFolder );
|
|
|
|
|
}
|
2022-05-11 19:17:46 +02:00
|
|
|
else if ( uiConfigName == "MainWindow.DataSources" )
|
|
|
|
|
{
|
|
|
|
|
RimOilField* oilField = activeOilField();
|
|
|
|
|
if ( oilField )
|
|
|
|
|
{
|
|
|
|
|
if ( oilField->analysisModels() ) uiTreeOrdering.add( oilField->analysisModels() );
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-06-27 11:07:01 +02:00
|
|
|
else
|
2015-08-28 12:10:36 +02:00
|
|
|
{
|
2022-06-13 13:54:55 +02:00
|
|
|
// Use object instead of field to avoid duplicate entries in the tree view
|
|
|
|
|
uiTreeOrdering.add( viewLinkerCollection() );
|
2016-06-27 11:07:01 +02:00
|
|
|
|
|
|
|
|
RimOilField* oilField = activeOilField();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( oilField )
|
2016-05-09 12:13:54 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( oilField->analysisModels() ) uiTreeOrdering.add( oilField->analysisModels() );
|
|
|
|
|
if ( oilField->geoMechModels() ) uiTreeOrdering.add( oilField->geoMechModels() );
|
|
|
|
|
if ( oilField->wellPathCollection() ) uiTreeOrdering.add( oilField->wellPathCollection() );
|
2020-01-03 13:49:12 +01:00
|
|
|
if ( oilField->surfaceCollection() ) uiTreeOrdering.add( oilField->surfaceCollection() );
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( oilField->formationNamesCollection() ) uiTreeOrdering.add( oilField->formationNamesCollection() );
|
|
|
|
|
if ( oilField->completionTemplateCollection() )
|
|
|
|
|
uiTreeOrdering.add( oilField->completionTemplateCollection() );
|
|
|
|
|
if ( oilField->annotationCollection() ) uiTreeOrdering.add( oilField->annotationCollection() );
|
2016-05-09 12:13:54 +02:00
|
|
|
}
|
2015-08-06 15:55:17 +02:00
|
|
|
|
2020-04-30 16:54:25 +02:00
|
|
|
uiTreeOrdering.add( colorLegendCollection() );
|
2016-06-27 11:07:01 +02:00
|
|
|
}
|
2015-08-06 15:55:17 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
uiTreeOrdering.skipRemainingChildren( true );
|
|
|
|
|
}
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::transferPathsToGlobalPathList()
|
2019-12-10 14:58:47 +01:00
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
RiaVariableMapper variableMapper( m_globalPathList() );
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
std::vector<caf::FilePath*> filePaths = allFilePaths();
|
|
|
|
|
for ( caf::FilePath* filePath : filePaths )
|
2019-12-10 14:58:47 +01:00
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
QString path = filePath->path();
|
|
|
|
|
if ( !path.isEmpty() )
|
2019-12-10 14:58:47 +01:00
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
QString pathId = variableMapper.addPathAndGetId( path );
|
|
|
|
|
filePath->setPath( pathId );
|
2019-12-10 14:58:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
for ( auto summaryCase : allSummaryCases() )
|
2019-12-10 14:58:47 +01:00
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
if ( summaryCase->displayNameType() == RimCaseDisplayNameTools::DisplayName::CUSTOM )
|
2019-12-10 14:58:47 +01:00
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
// At this point, after the replace of variables into caf::FilePath objects, the variable name is stored in
|
|
|
|
|
// the summary case object. Read out the variable name and append "_name" for custom summary variables.
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
QString variableName = summaryCase->summaryHeaderFilename();
|
|
|
|
|
variableName = variableName.remove( RiaVariableMapper::variableToken() );
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
variableName = RiaVariableMapper::variableToken() + variableName + RiaVariableMapper::postfixName() +
|
|
|
|
|
RiaVariableMapper::variableToken();
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
QString variableValue = summaryCase->displayCaseName();
|
|
|
|
|
variableMapper.addVariable( variableName, variableValue );
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
summaryCase->setCustomCaseName( variableName );
|
2019-12-10 14:58:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
for ( auto gridCase : allGridCases() )
|
2019-12-10 14:58:47 +01:00
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
if ( gridCase->displayNameType() == RimCaseDisplayNameTools::DisplayName::CUSTOM )
|
|
|
|
|
{
|
|
|
|
|
// At this point, after the replace of variables into caf::FilePath objects, the variable name is stored in
|
|
|
|
|
// the summary case object. Read out the variable name and append "_name" for custom summary variables.
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
QString variableName = gridCase->gridFileName();
|
|
|
|
|
variableName = variableName.remove( RiaVariableMapper::variableToken() );
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
variableName = RiaVariableMapper::variableToken() + variableName + RiaVariableMapper::postfixName() +
|
|
|
|
|
RiaVariableMapper::variableToken();
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
QString variableValue = gridCase->caseUserDescription();
|
|
|
|
|
variableMapper.addVariable( variableName, variableValue );
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
gridCase->setCustomCaseName( variableName );
|
2019-12-10 14:58:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
variableMapper.replaceVariablesInValues();
|
|
|
|
|
|
|
|
|
|
m_globalPathList = variableMapper.variableTableAsText();
|
2019-12-10 14:58:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimProject::distributePathsFromGlobalPathList()
|
|
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
RiaVariableMapper pathListMapper( m_globalPathList() );
|
2019-12-10 14:58:47 +01:00
|
|
|
|
2020-10-12 13:17:47 +02:00
|
|
|
std::vector<caf::FilePath*> filePaths = allFilePaths();
|
2019-12-10 14:58:47 +01:00
|
|
|
for ( caf::FilePath* filePath : filePaths )
|
|
|
|
|
{
|
|
|
|
|
QString pathIdCandidate = filePath->path().trimmed();
|
2022-12-08 07:08:22 +01:00
|
|
|
QStringList pathIdComponents = pathIdCandidate.split( RiaVariableMapper::variableToken() );
|
2019-12-10 14:58:47 +01:00
|
|
|
|
|
|
|
|
if ( pathIdComponents.size() == 3 && pathIdComponents[0].size() == 0 && pathIdComponents[1].size() > 0 &&
|
|
|
|
|
pathIdComponents[2].size() == 0 )
|
|
|
|
|
{
|
|
|
|
|
bool isFound = false;
|
2022-12-08 07:08:22 +01:00
|
|
|
QString path = pathListMapper.valueForVariable( pathIdCandidate, &isFound );
|
2019-12-10 14:58:47 +01:00
|
|
|
if ( isFound )
|
|
|
|
|
{
|
|
|
|
|
filePath->setPath( path );
|
|
|
|
|
}
|
2022-12-08 07:08:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( auto summaryCase : allSummaryCases() )
|
|
|
|
|
{
|
|
|
|
|
if ( summaryCase->displayNameType() == RimCaseDisplayNameTools::DisplayName::CUSTOM )
|
|
|
|
|
{
|
|
|
|
|
auto variableName = summaryCase->displayCaseName();
|
|
|
|
|
|
|
|
|
|
bool isFound = false;
|
|
|
|
|
QString variableValue = pathListMapper.valueForVariable( variableName, &isFound );
|
|
|
|
|
if ( isFound )
|
2019-12-10 14:58:47 +01:00
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
summaryCase->setCustomCaseName( variableValue );
|
|
|
|
|
}
|
|
|
|
|
else if ( variableName.contains( RiaVariableMapper::postfixName() + RiaVariableMapper::variableToken() ) )
|
|
|
|
|
{
|
|
|
|
|
// The variable name is not found in the variable list, but the name indicates a variable. Reset to full
|
|
|
|
|
// case name.
|
|
|
|
|
summaryCase->setDisplayNameOption( RimCaseDisplayNameTools::DisplayName::FULL_CASE_NAME );
|
2019-12-10 14:58:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
2022-12-08 07:08:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( auto gridCase : allGridCases() )
|
|
|
|
|
{
|
|
|
|
|
if ( gridCase->displayNameType() == RimCaseDisplayNameTools::DisplayName::CUSTOM )
|
2019-12-10 14:58:47 +01:00
|
|
|
{
|
2022-12-08 07:08:22 +01:00
|
|
|
auto variableName = gridCase->caseUserDescription();
|
|
|
|
|
|
|
|
|
|
bool isFound = false;
|
|
|
|
|
QString variableValue = pathListMapper.valueForVariable( variableName, &isFound );
|
|
|
|
|
if ( isFound )
|
|
|
|
|
{
|
|
|
|
|
gridCase->setCustomCaseName( variableValue );
|
|
|
|
|
}
|
|
|
|
|
else if ( variableName.contains( RiaVariableMapper::postfixName() + RiaVariableMapper::variableToken() ) )
|
|
|
|
|
{
|
|
|
|
|
// The variable name is not found in the variable list, but the name indicates a variable. Reset to full
|
|
|
|
|
// case name.
|
|
|
|
|
gridCase->setDisplayNameType( RimCaseDisplayNameTools::DisplayName::FULL_CASE_NAME );
|
|
|
|
|
}
|
2019-12-10 14:58:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|