2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2019-05-06 03:36:05 -05:00
|
|
|
//
|
2012-05-18 02:45:23 -05: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-05-06 03:36:05 -05:00
|
|
|
//
|
2012-05-18 02:45:23 -05: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-05-06 03:36:05 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-05-18 02:45:23 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
2019-05-06 03:36:05 -05:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
2012-05-18 02:45:23 -05:00
|
|
|
#pragma once
|
2016-06-28 03:58:22 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
#include "RiaDefines.h"
|
2013-09-13 02:23:33 -05:00
|
|
|
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "cafPdmField.h"
|
2019-05-06 03:36:05 -05:00
|
|
|
#include "cafPdmObject.h"
|
2019-09-05 02:43:17 -05:00
|
|
|
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "cvfFont.h"
|
2019-05-06 03:36:05 -05:00
|
|
|
#include "cvfObject.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
#include <QMutex>
|
2020-10-22 06:57:48 -05:00
|
|
|
#include <QPointer>
|
2019-05-06 03:36:05 -05:00
|
|
|
#include <QProcess>
|
2019-07-26 07:54:54 -05:00
|
|
|
#include <QProcessEnvironment>
|
2019-05-06 03:36:05 -05:00
|
|
|
#include <QString>
|
2019-02-04 07:23:16 -06:00
|
|
|
|
2020-09-24 03:54:18 -05:00
|
|
|
#include <gsl/gsl>
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
#include <iostream>
|
2016-10-05 01:23:07 -05:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class QAction;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2016-06-28 03:58:22 -05:00
|
|
|
class Drawable;
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
class RIProcess;
|
2016-06-28 03:58:22 -05:00
|
|
|
|
2021-01-06 08:03:38 -06:00
|
|
|
class RiaGrpcServer;
|
2016-06-28 03:58:22 -05:00
|
|
|
class RiaPreferences;
|
|
|
|
class RiaProjectModifier;
|
|
|
|
class RiaSocketServer;
|
|
|
|
|
2017-01-10 02:51:39 -06:00
|
|
|
class RigEclipseCaseData;
|
2016-06-28 03:58:22 -05:00
|
|
|
|
|
|
|
class RimCommandObject;
|
2015-05-15 01:40:27 -05:00
|
|
|
class RimEclipseCase;
|
2015-05-21 03:05:33 -05:00
|
|
|
class RimEclipseView;
|
2019-11-30 03:23:24 -06:00
|
|
|
class RimWellPath;
|
2018-01-15 07:52:22 -06:00
|
|
|
class RimGridView;
|
2013-05-06 03:55:00 -05:00
|
|
|
class RimProject;
|
2016-06-28 03:58:22 -05:00
|
|
|
class RimSummaryPlot;
|
2018-01-09 03:11:28 -06:00
|
|
|
class Rim3dView;
|
2016-08-31 10:34:31 -05:00
|
|
|
class RimViewWindow;
|
2019-10-09 02:21:28 -05:00
|
|
|
class RimWellLogFile;
|
2015-09-10 01:14:28 -05:00
|
|
|
class RimWellLogPlot;
|
2017-01-13 06:32:02 -06:00
|
|
|
class RimWellAllocationPlot;
|
2016-06-28 03:58:22 -05:00
|
|
|
|
2019-03-06 04:13:54 -06:00
|
|
|
class RiuMainWindow;
|
2017-01-17 06:06:57 -06:00
|
|
|
class RiuMainWindowBase;
|
2018-04-26 23:28:08 -05:00
|
|
|
class RiuPlotMainWindow;
|
2016-10-05 01:23:07 -05:00
|
|
|
class RiuRecentFileActionProvider;
|
2017-08-29 02:38:41 -05:00
|
|
|
class RiaArgumentParser;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
namespace caf
|
|
|
|
{
|
2019-05-06 03:36:05 -05:00
|
|
|
class UiProcess;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace cvf
|
|
|
|
{
|
|
|
|
class ProgramOptions;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
2019-05-06 03:36:05 -05:00
|
|
|
/// Base class for all ResInsight applications. I.e. console and GUI
|
|
|
|
///
|
2012-05-18 02:45:23 -05:00
|
|
|
//==================================================================================================
|
2019-05-06 03:36:05 -05:00
|
|
|
class RiaApplication
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
public:
|
2020-04-23 16:08:14 -05:00
|
|
|
enum class ProjectLoadAction
|
2017-07-28 04:28:55 -05:00
|
|
|
{
|
2019-05-06 03:36:05 -05:00
|
|
|
PLA_NONE = 0,
|
2017-07-28 04:28:55 -05:00
|
|
|
PLA_CALCULATE_STATISTICS = 1
|
|
|
|
};
|
|
|
|
|
2020-04-23 16:08:14 -05:00
|
|
|
enum class ApplicationStatus
|
2019-05-06 03:36:05 -05:00
|
|
|
{
|
|
|
|
KEEP_GOING = 0,
|
|
|
|
EXIT_COMPLETED,
|
|
|
|
EXIT_WITH_ERROR
|
|
|
|
};
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
public:
|
2019-09-06 03:40:57 -05:00
|
|
|
static RiaApplication* instance();
|
2019-05-06 03:36:05 -05:00
|
|
|
RiaApplication();
|
|
|
|
virtual ~RiaApplication();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static const char* getVersionStringApp( bool includeCrtInfo );
|
2019-05-06 03:36:05 -05:00
|
|
|
static bool enableDevelopmentFeatures();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
void setActiveReservoirView( Rim3dView* );
|
2019-05-06 03:36:05 -05:00
|
|
|
Rim3dView* activeReservoirView();
|
|
|
|
const Rim3dView* activeReservoirView() const;
|
|
|
|
RimGridView* activeGridView();
|
2019-10-17 03:35:01 -05:00
|
|
|
RimGridView* activeMainOrComparisonGridView();
|
2020-11-04 03:27:05 -06:00
|
|
|
int currentScriptCaseId() const;
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
RimProject* project();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
void createMockModel();
|
|
|
|
void createResultsMockModel();
|
|
|
|
void createLargeResultsMockModel();
|
|
|
|
void createMockModelCustomized();
|
|
|
|
void createInputMockModel();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool openFile( const QString& fileName );
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool isProjectSavedToDisc() const;
|
|
|
|
QString currentProjectPath() const;
|
|
|
|
QString createAbsolutePathFromProjectRelativePath( QString projectRelativePath );
|
2019-10-15 08:46:19 -05:00
|
|
|
|
|
|
|
bool loadProject( const QString& projectFileName );
|
2019-09-06 03:40:57 -05:00
|
|
|
bool loadProject( const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier );
|
2019-10-15 08:46:19 -05:00
|
|
|
|
2020-09-24 03:54:18 -05:00
|
|
|
bool saveProject( gsl::not_null<QString*> errorMessage );
|
|
|
|
bool saveProjectAs( const QString& fileName, gsl::not_null<QString*> errorMessage );
|
2019-10-15 08:46:19 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static bool hasValidProjectFileExtension( const QString& fileName );
|
2019-05-06 03:36:05 -05:00
|
|
|
void closeProject();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
QString lastUsedDialogDirectory( const QString& dialogName );
|
|
|
|
QString lastUsedDialogDirectoryWithFallbackToProjectFolder( const QString& dialogName );
|
|
|
|
QString lastUsedDialogDirectoryWithFallback( const QString& dialogName, const QString& fallbackDirectory );
|
|
|
|
void setLastUsedDialogDirectory( const QString& dialogName, const QString& directory );
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool openOdbCaseFromFile( const QString& fileName, bool applyTimeStepFilter = false );
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2020-09-24 03:54:18 -05:00
|
|
|
std::vector<RimWellPath*> addWellPathsToModel( QList<QString> wellPathFilePaths,
|
2020-10-19 06:16:00 -05:00
|
|
|
bool importGrouped,
|
2020-09-24 03:54:18 -05:00
|
|
|
gsl::not_null<QStringList*> errorMessages );
|
2019-11-30 03:23:24 -06:00
|
|
|
void addWellPathFormationsToModel( QList<QString> wellPathFilePaths );
|
2020-09-24 03:54:18 -05:00
|
|
|
std::vector<RimWellLogFile*> addWellLogsToModel( const QList<QString>& wellLogFilePaths,
|
|
|
|
gsl::not_null<QStringList*> errorMessages );
|
2013-09-08 03:53:25 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
QString scriptDirectories() const;
|
|
|
|
QString scriptEditorPath() const;
|
2013-09-12 01:11:56 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
QString octavePath() const;
|
|
|
|
QStringList octaveArguments() const;
|
2019-07-26 07:54:54 -05:00
|
|
|
QProcessEnvironment octaveProcessEnvironment() const;
|
2015-10-05 09:09:51 -05:00
|
|
|
|
2021-01-06 08:03:38 -06:00
|
|
|
QString pythonPath() const;
|
|
|
|
virtual QProcessEnvironment pythonProcessEnvironment() const;
|
2019-07-26 07:54:54 -05:00
|
|
|
|
2020-02-12 04:43:15 -06:00
|
|
|
bool launchProcess( const QString& program, const QStringList& arguments, const QProcessEnvironment& processEnvironment );
|
2019-09-06 03:40:57 -05:00
|
|
|
bool launchProcessForMultipleCases( const QString& program,
|
|
|
|
const QStringList& arguments,
|
|
|
|
const std::vector<int>& caseIds,
|
|
|
|
const QProcessEnvironment& processEnvironment );
|
2019-05-06 03:36:05 -05:00
|
|
|
void terminateProcess();
|
|
|
|
void waitForProcess() const;
|
2019-03-06 04:13:54 -06:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
RiaPreferences* preferences();
|
2019-09-05 12:37:52 -05:00
|
|
|
void applyPreferences();
|
2016-06-27 04:07:01 -05:00
|
|
|
|
2019-08-08 03:45:02 -05:00
|
|
|
QString commandLineParameterHelp();
|
2019-09-06 03:40:57 -05:00
|
|
|
void setCommandLineHelpText( const QString& commandLineHelpText );
|
2016-08-31 10:34:31 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void setCacheDataObject( const QString& key, const QVariant& dataObject );
|
|
|
|
QVariant cacheDataObject( const QString& key ) const;
|
2017-04-25 08:01:31 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void executeCommandFile( const QString& commandFile );
|
|
|
|
void addCommandObject( RimCommandObject* commandObject );
|
2019-05-06 03:36:05 -05:00
|
|
|
void executeCommandObjects();
|
|
|
|
void waitUntilCommandObjectsHasBeenProcessed();
|
2016-10-04 02:29:45 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
int launchUnitTests();
|
2016-10-05 01:23:07 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
const QString startDir() const;
|
2019-09-06 03:40:57 -05:00
|
|
|
void setStartDir( const QString& startDir );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static std::vector<QString> readFileListFromTextFile( QString listFileName );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
cvf::Font* defaultSceneFont();
|
2020-06-08 04:09:11 -05:00
|
|
|
cvf::Font* sceneFont( int fontSize );
|
2019-05-06 03:36:05 -05:00
|
|
|
cvf::Font* defaultAnnotationFont();
|
|
|
|
cvf::Font* defaultWellLabelFont();
|
|
|
|
|
|
|
|
// Public implementation specific overrides
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual void initialize();
|
2020-09-24 03:54:18 -05:00
|
|
|
virtual ApplicationStatus handleArguments( gsl::not_null<cvf::ProgramOptions*> progOpt ) = 0;
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual int launchUnitTestsWithConsole();
|
|
|
|
virtual void addToRecentFiles( const QString& fileName ) {}
|
|
|
|
virtual void showFormattedTextInMessageBoxOrConsole( const QString& errMsg ) = 0;
|
2019-06-09 08:35:31 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
protected:
|
|
|
|
// Protected implementation specific overrides
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) = 0;
|
|
|
|
virtual void onFileSuccessfullyLoaded( const QString& fileName, RiaDefines::ImportFileType fileType ) {}
|
2019-10-15 08:46:19 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
virtual void onProjectBeingOpened() {}
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual void onProjectOpened() = 0;
|
|
|
|
virtual void onProjectOpeningError( const QString& errMsg ) = 0;
|
2019-05-06 03:36:05 -05:00
|
|
|
virtual void onProjectBeingClosed() {}
|
|
|
|
virtual void onProjectClosed() = 0;
|
2019-10-15 08:46:19 -05:00
|
|
|
virtual void onProjectBeingSaved() {}
|
|
|
|
virtual void onProjectSaved() {}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual void startMonitoringWorkProgress( caf::UiProcess* uiProcess ) {}
|
2019-05-06 03:36:05 -05:00
|
|
|
virtual void stopMonitoringWorkProgress() {}
|
|
|
|
|
2020-01-27 06:12:28 -06:00
|
|
|
void loadAndUpdatePlotData();
|
|
|
|
|
2020-02-11 06:49:36 -06:00
|
|
|
friend class RiaRegressionTestRunner;
|
|
|
|
void resetProject();
|
|
|
|
|
2020-09-24 03:54:18 -05:00
|
|
|
bool generateCode( const QString& outputPath, gsl::not_null<QString*> errMsg );
|
2020-02-21 04:35:14 -06:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
protected:
|
|
|
|
cvf::ref<cvf::Font> m_defaultSceneFont;
|
|
|
|
cvf::ref<cvf::Font> m_defaultAnnotationFont;
|
|
|
|
cvf::ref<cvf::Font> m_defaultWellLabelFont;
|
|
|
|
|
|
|
|
caf::PdmPointer<Rim3dView> m_activeReservoirView;
|
2020-10-22 06:57:48 -05:00
|
|
|
std::unique_ptr<RimProject> m_project;
|
2019-05-06 03:36:05 -05:00
|
|
|
|
2020-10-22 06:57:48 -05:00
|
|
|
QPointer<RiaSocketServer> m_socketServer;
|
|
|
|
std::unique_ptr<caf::UiProcess> m_workerProcess;
|
2016-10-05 03:04:41 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
// Execute for all settings
|
2020-10-22 06:57:48 -05:00
|
|
|
std::list<int> m_scriptCaseIds;
|
|
|
|
int m_currentScriptCaseId;
|
|
|
|
QString m_currentProgram;
|
|
|
|
QStringList m_currentArguments;
|
|
|
|
std::unique_ptr<RiaPreferences> m_preferences;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
std::map<QString, QString> m_fileDialogDefaultDirectories;
|
|
|
|
QString m_startupDefaultDirectory;
|
2019-08-08 03:45:02 -05:00
|
|
|
QString m_commandLineHelpText;
|
2019-09-06 03:40:57 -05:00
|
|
|
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
|
2017-08-29 02:38:41 -05:00
|
|
|
|
2020-10-23 03:57:57 -05:00
|
|
|
std::list<caf::PdmPointer<RimCommandObject>> m_commandQueue;
|
|
|
|
QMutex m_commandQueueLock;
|
2018-05-03 02:53:54 -05:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
bool m_runningWorkerProcess;
|
2016-12-22 01:44:36 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
private:
|
2019-05-06 03:36:05 -05:00
|
|
|
static RiaApplication* s_riaApplication;
|
|
|
|
};
|