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.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2017-06-13 15:41:52 +02:00
|
|
|
#include "RiaDefines.h"
|
2018-08-28 11:12:05 +02:00
|
|
|
#include "RiaEclipseUnitTools.h"
|
2017-05-31 16:16:28 +02:00
|
|
|
|
2015-08-01 23:04:04 +02:00
|
|
|
#include "cafPdmChildArrayField.h"
|
2015-07-31 18:58:23 +02:00
|
|
|
#include "cafPdmChildField.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
#include "cafPdmDocument.h"
|
2017-10-11 13:52:29 +02:00
|
|
|
#include "cvfCollection.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2015-08-06 11:00:21 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
2017-01-10 09:51:39 +01:00
|
|
|
class RigEclipseCaseData;
|
2013-03-22 15:43:42 +01:00
|
|
|
class RigGridManager;
|
2013-05-06 10:55:00 +02:00
|
|
|
class RigMainGrid;
|
2017-10-11 13:52:29 +02:00
|
|
|
class RigWellPath;
|
2016-12-09 10:01:50 +01:00
|
|
|
|
2018-11-23 13:33:59 +01:00
|
|
|
class RimTextAnnotation;
|
|
|
|
|
class RimReachCircleAnnotation;
|
2018-11-26 14:06:17 +01:00
|
|
|
class RimPolylinesAnnotation;
|
2017-10-23 14:42:38 +02:00
|
|
|
class RimSummaryCalculationCollection;
|
2019-12-09 09:21:06 +01:00
|
|
|
class RimSummaryCalculation;
|
2015-07-31 18:58:23 +02:00
|
|
|
class RimCase;
|
2014-07-24 10:11:43 +02:00
|
|
|
class RimCommandObject;
|
2018-12-19 14:41:17 +01:00
|
|
|
class RimCommandObject;
|
2017-06-30 16:14:15 +02:00
|
|
|
class RimDialogData;
|
2015-07-31 18:58:23 +02:00
|
|
|
class RimEclipseCase;
|
2017-10-20 16:10:45 +02:00
|
|
|
class RimGeoMechCase;
|
2015-07-31 18:58:23 +02:00
|
|
|
class RimIdenticalGridCaseGroup;
|
2015-09-01 17:14:22 +02:00
|
|
|
class RimMainPlotCollection;
|
2018-12-19 14:41:17 +01:00
|
|
|
class RimMeasurement;
|
2019-09-06 10:40:57 +02:00
|
|
|
class RimAdvancedSnapshotExportDefinition;
|
2019-08-20 15:09:13 +02:00
|
|
|
class RimObservedSummaryData;
|
2015-07-31 18:58:23 +02:00
|
|
|
class RimOilField;
|
2020-04-30 16:54:25 +02:00
|
|
|
class RimColorLegendCollection;
|
2015-07-31 18:58:23 +02:00
|
|
|
class RimScriptCollection;
|
2016-05-31 13:42:27 +02:00
|
|
|
class RimSummaryCase;
|
2018-04-06 08:16:14 +02:00
|
|
|
class RimSummaryCaseCollection;
|
2018-06-25 15:14:47 +02:00
|
|
|
class RimSummaryCaseMainCollection;
|
2018-01-09 10:11:28 +01:00
|
|
|
class Rim3dView;
|
2018-01-15 14:52:22 +01:00
|
|
|
class RimGridView;
|
2019-11-14 20:48:11 +01:00
|
|
|
class RimPlotWindow;
|
2016-12-09 10:01:50 +01:00
|
|
|
class RimViewLinker;
|
|
|
|
|
class RimViewLinkerCollection;
|
2019-10-09 09:21:28 +02:00
|
|
|
class RimViewWindow;
|
2017-10-11 13:52:29 +02:00
|
|
|
class RimWellPath;
|
2017-10-20 16:10:45 +02:00
|
|
|
class RimWellPathImport;
|
2017-12-20 13:14:43 +01:00
|
|
|
class RimFractureTemplateCollection;
|
|
|
|
|
class RimFractureTemplate;
|
2018-12-13 19:49:37 +01:00
|
|
|
class RimValveTemplateCollection;
|
|
|
|
|
class RimValveTemplate;
|
|
|
|
|
class RimCompletionTemplateCollection;
|
2019-09-11 09:33:03 +02:00
|
|
|
class RimPlotTemplateFolderItem;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2015-08-06 15:55:17 +02:00
|
|
|
namespace caf
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
class PdmUiTreeOrdering;
|
2015-08-06 15:55:17 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-06 11:00:21 +02:00
|
|
|
class QAction;
|
2015-08-17 10:51:13 +02:00
|
|
|
class QMenu;
|
2015-08-06 11:00:21 +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
|
|
|
//==================================================================================================
|
|
|
|
|
class RimProject : public caf::PdmDocument
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
CAF_PDM_HEADER_INIT;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
public:
|
2019-09-06 10:40:57 +02:00
|
|
|
RimProject( void );
|
|
|
|
|
~RimProject( void ) override;
|
2020-04-22 14:35:25 +02:00
|
|
|
static RimProject* current();
|
2019-09-06 10:40:57 +02:00
|
|
|
|
|
|
|
|
caf::PdmChildArrayField<RimOilField*> oilFields;
|
2020-04-30 16:54:25 +02:00
|
|
|
caf::PdmChildField<RimColorLegendCollection*> colorLegendCollection;
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::PdmChildField<RimScriptCollection*> scriptCollection;
|
|
|
|
|
caf::PdmChildField<RimWellPathImport*> wellPathImport;
|
|
|
|
|
caf::PdmChildField<RimMainPlotCollection*> mainPlotCollection;
|
|
|
|
|
caf::PdmChildField<RimViewLinkerCollection*> viewLinkerCollection;
|
|
|
|
|
caf::PdmChildField<RimSummaryCalculationCollection*> calculationCollection;
|
|
|
|
|
caf::PdmChildArrayField<RimCommandObject*> commandObjects;
|
|
|
|
|
|
2019-03-25 11:07:12 +01:00
|
|
|
caf::PdmChildArrayField<RimAdvancedSnapshotExportDefinition*> multiSnapshotDefinitions;
|
2016-12-16 14:05:11 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::PdmField<QString> mainWindowTreeViewState;
|
|
|
|
|
caf::PdmField<QString> mainWindowCurrentModelIndexPath;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::PdmField<QString> plotWindowTreeViewState;
|
|
|
|
|
caf::PdmField<QString> plotWindowCurrentModelIndexPath;
|
2015-08-25 12:40:55 +02:00
|
|
|
|
2019-12-10 14:58:47 +01:00
|
|
|
bool writeProjectFile();
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void setScriptDirectories( const QString& scriptDirectories );
|
2019-09-11 09:33:03 +02:00
|
|
|
void setPlotTemplateFolders( const QStringList& plotTemplateFolders );
|
2019-05-06 10:36:05 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
QString projectFileVersionString() const;
|
|
|
|
|
bool isProjectFileVersionEqualOrOlderThan( const QString& otherProjectFileVersion ) const;
|
|
|
|
|
void close();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void setProjectFileNameAndUpdateDependencies( const QString& projectFileName );
|
2013-04-08 08:44:33 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void assignCaseIdToCase( RimCase* reservoirCase );
|
|
|
|
|
void assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup );
|
2019-11-14 20:48:11 +01:00
|
|
|
void assignViewIdToView( Rim3dView* view );
|
|
|
|
|
void assignPlotIdToPlotWindow( RimPlotWindow* plotWindow );
|
2019-12-09 09:21:06 +01:00
|
|
|
void assignCalculationIdToCalculation( RimSummaryCalculation* calculation );
|
2020-04-08 14:30:38 +02:00
|
|
|
void assignCaseIdToSummaryCase( RimSummaryCase* summaryCase );
|
2020-04-08 16:17:47 +02:00
|
|
|
void assignIdToEnsemble( RimSummaryCaseCollection* summaryCaseCollection );
|
2013-05-15 10:51:41 +02:00
|
|
|
|
2020-04-30 20:51:25 +02:00
|
|
|
std::vector<RimCase*> allGridCases() const;
|
|
|
|
|
void allCases( std::vector<RimCase*>& cases ) const; // Deprecated, use allGridCases()
|
2017-12-01 09:34:43 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
std::vector<RimSummaryCase*> allSummaryCases() const;
|
2018-04-06 08:16:14 +02:00
|
|
|
std::vector<RimSummaryCaseCollection*> summaryGroups() const;
|
2019-09-06 10:40:57 +02:00
|
|
|
RimSummaryCaseMainCollection* firstSummaryCaseMainCollection() const;
|
2018-06-25 15:14:47 +02:00
|
|
|
|
2019-11-04 11:34:34 +01:00
|
|
|
void allViews( std::vector<Rim3dView*>& views ) const;
|
2019-09-06 10:40:57 +02:00
|
|
|
void allVisibleViews( std::vector<Rim3dView*>& views ) const;
|
|
|
|
|
void allVisibleGridViews( std::vector<RimGridView*>& views ) const;
|
|
|
|
|
void allNotLinkedViews( std::vector<RimGridView*>& views );
|
2015-08-30 13:30:46 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void scheduleCreateDisplayModelAndRedrawAllViews();
|
2013-05-16 14:10:22 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void computeUtmAreaOfInterest();
|
2013-05-31 13:57:16 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void allOilFields( std::vector<RimOilField*>& allOilFields ) const;
|
|
|
|
|
RimOilField* activeOilField();
|
|
|
|
|
const RimOilField* activeOilField() const;
|
2013-02-14 13:16:56 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void actionsBasedOnSelection( QMenu& contextMenu );
|
2015-08-06 11:00:21 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
bool show3DWindow() const;
|
|
|
|
|
bool showPlotWindow() const;
|
2016-10-04 14:23:34 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
bool subWindowsTiled3DWindow() const;
|
|
|
|
|
bool subWindowsTiledPlotWindow() const;
|
2019-04-02 19:18:00 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void setSubWindowsTiledIn3DWindow( bool tiled );
|
|
|
|
|
void setSubWindowsTiledInPlotWindow( bool tiled );
|
2019-04-02 19:18:00 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void reloadCompletionTypeResultsInAllViews();
|
|
|
|
|
void reloadCompletionTypeResultsForEclipseCase( RimEclipseCase* eclipseCase );
|
2017-06-02 10:35:52 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
RimDialogData* dialogData() const;
|
2017-10-11 13:52:29 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
std::vector<RimEclipseCase*> eclipseCases() const;
|
|
|
|
|
RimEclipseCase* eclipseCaseFromGridFileName( const QString& gridFileName ) const;
|
2018-04-13 11:11:05 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
std::vector<QString> simulationWellNames() const;
|
2017-12-07 14:51:58 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
RimWellPath* wellPathFromSimWellName( const QString& simWellName, int branchIndex = -1 );
|
|
|
|
|
RimWellPath* wellPathByName( const QString& wellPathName ) const;
|
|
|
|
|
std::vector<RimWellPath*> allWellPaths() const;
|
|
|
|
|
std::vector<RimTextAnnotation*> textAnnotations() const;
|
|
|
|
|
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
|
|
|
|
std::vector<RimPolylinesAnnotation*> polylineAnnotations() const;
|
2017-05-31 16:16:28 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
std::vector<RimGeoMechCase*> geoMechCases() const;
|
2017-10-20 16:10:45 +02:00
|
|
|
|
2017-12-20 13:14:43 +01:00
|
|
|
std::vector<RimFractureTemplateCollection*> allFractureTemplateCollections() const;
|
2018-12-13 19:49:37 +01:00
|
|
|
std::vector<RimFractureTemplate*> allFractureTemplates() const;
|
|
|
|
|
|
|
|
|
|
std::vector<RimValveTemplateCollection*> allValveTemplateCollections() const;
|
|
|
|
|
std::vector<RimValveTemplate*> allValveTemplates() const;
|
2017-12-20 13:14:43 +01:00
|
|
|
|
2018-10-09 12:23:44 +02:00
|
|
|
RiaEclipseUnitTools::UnitSystemType commonUnitSystemForAllCases() const;
|
2018-12-19 14:41:17 +01:00
|
|
|
RimMeasurement* measurement() const;
|
2018-08-28 11:12:05 +02:00
|
|
|
|
2019-09-11 09:33:03 +02:00
|
|
|
RimPlotTemplateFolderItem* rootPlotTemlateItem() const;
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
protected:
|
|
|
|
|
// Overridden methods
|
2019-09-06 10:40:57 +02:00
|
|
|
void initAfterRead() override;
|
|
|
|
|
void setupBeforeSave() override;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
2015-08-06 15:55:17 +02:00
|
|
|
|
2018-01-19 12:52:50 +01:00
|
|
|
private:
|
|
|
|
|
template <typename T>
|
2020-01-08 09:35:14 +01:00
|
|
|
void fieldContentsByType( caf::PdmObjectHandle* object, std::vector<T*>& fieldContents );
|
2018-01-19 12:52:50 +01:00
|
|
|
|
2019-12-10 14:58:47 +01:00
|
|
|
void transferPathsToGlobalPathList();
|
|
|
|
|
void distributePathsFromGlobalPathList();
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
private:
|
2019-12-10 14:58:47 +01:00
|
|
|
caf::PdmField<QString> m_globalPathList;
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::PdmField<QString> m_projectFileVersionString;
|
2017-06-30 16:14:15 +02:00
|
|
|
|
2019-09-11 09:33:03 +02:00
|
|
|
caf::PdmChildField<RimDialogData*> m_dialogData;
|
|
|
|
|
caf::PdmChildField<RimPlotTemplateFolderItem*> m_plotTemplateFolderItem;
|
2017-06-30 16:14:15 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::PdmField<bool> m_show3DWindow;
|
|
|
|
|
caf::PdmField<bool> m_showPlotWindow;
|
2015-05-08 14:13:26 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::PdmField<bool> m_subWindowsTiled3DWindow;
|
|
|
|
|
caf::PdmField<bool> m_subWindowsTiledPlotWindow;
|
2019-04-02 19:18:00 +02:00
|
|
|
|
2019-10-18 15:32:20 +02:00
|
|
|
int m_nextValidCaseId;
|
|
|
|
|
int m_nextValidCaseGroupId;
|
|
|
|
|
int m_nextValidViewId;
|
2019-11-14 20:48:11 +01:00
|
|
|
int m_nextValidPlotId;
|
2019-12-09 09:21:06 +01:00
|
|
|
int m_nextValidCalculationId;
|
2020-04-08 14:30:38 +02:00
|
|
|
int m_nextValidSummaryCaseId;
|
2020-04-08 16:17:47 +02:00
|
|
|
int m_nextValidEnsembleId;
|
2019-10-18 15:32:20 +02:00
|
|
|
|
2016-10-04 14:23:34 +02:00
|
|
|
caf::PdmChildArrayField<RimEclipseCase*> casesObsolete; // obsolete
|
|
|
|
|
caf::PdmChildArrayField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete
|
2012-05-18 09:45:23 +02:00
|
|
|
};
|
2018-01-19 12:52:50 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-01-19 12:52:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
template <typename T>
|
2020-01-08 09:35:14 +01:00
|
|
|
void RimProject::fieldContentsByType( caf::PdmObjectHandle* object, std::vector<T*>& fieldContents )
|
2018-01-19 12:52:50 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !object ) return;
|
2018-01-19 12:52:50 +01:00
|
|
|
|
|
|
|
|
std::vector<caf::PdmFieldHandle*> allFieldsInObject;
|
2019-09-06 10:40:57 +02:00
|
|
|
object->fields( allFieldsInObject );
|
2018-01-19 12:52:50 +01:00
|
|
|
|
|
|
|
|
std::vector<caf::PdmObjectHandle*> children;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& field : allFieldsInObject )
|
2018-01-19 12:52:50 +01:00
|
|
|
{
|
2020-03-31 14:44:31 +02:00
|
|
|
auto xmlFieldCapability = field->xmlCapability();
|
|
|
|
|
if ( xmlFieldCapability && !xmlFieldCapability->isIOWritable() ) continue;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::PdmField<T>* typedField = dynamic_cast<caf::PdmField<T>*>( field );
|
2020-01-08 09:35:14 +01:00
|
|
|
if ( typedField ) fieldContents.push_back( &typedField->v() );
|
2018-01-19 12:52:50 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::PdmField<std::vector<T>>* typedFieldInVector = dynamic_cast<caf::PdmField<std::vector<T>>*>( field );
|
|
|
|
|
if ( typedFieldInVector )
|
2018-01-19 12:52:50 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( T& typedFieldFromVector : typedFieldInVector->v() )
|
2018-01-19 12:52:50 +01:00
|
|
|
{
|
2020-01-08 09:35:14 +01:00
|
|
|
fieldContents.push_back( &typedFieldFromVector );
|
2018-01-19 12:52:50 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
field->childObjects( &children );
|
2018-01-19 12:52:50 +01:00
|
|
|
}
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& child : children )
|
2018-01-19 12:52:50 +01:00
|
|
|
{
|
2020-01-08 09:35:14 +01:00
|
|
|
fieldContentsByType( child, fieldContents );
|
2018-01-19 12:52:50 +01:00
|
|
|
}
|
|
|
|
|
}
|