mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
commit
4e6455761d
@ -15,6 +15,6 @@ build_script:
|
||||
|
||||
if exist "%QT5%" set Path=%QT5%\bin;%Path%
|
||||
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DRESINSIGHT_BUILD_WITH_QT5=true -DRESINSIGHT_ENABLE_COTIRE=on "-DCMAKE_PREFIX_PATH=%QT5%" ..
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DRESINSIGHT_ENABLE_COTIRE=on "-DCMAKE_PREFIX_PATH=%QT5%" ..
|
||||
|
||||
cmake --build . --target ResInsight_unity --config Release
|
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,27 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: Bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
10
.github/ISSUE_TEMPLATE/enhancement.md
vendored
10
.github/ISSUE_TEMPLATE/enhancement.md
vendored
@ -1,10 +0,0 @@
|
||||
---
|
||||
name: Enhancement
|
||||
about: Describe enhancement.
|
||||
title: 'Context : EnhancementName'
|
||||
labels: Enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: FeatureRequest
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
37
.travis.yml
Normal file
37
.travis.yml
Normal file
@ -0,0 +1,37 @@
|
||||
dist: xenial # For 18.04, use bionic
|
||||
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
packages:
|
||||
- cmake
|
||||
- cmake-data
|
||||
- libqt5opengl5
|
||||
- qt5-qmake
|
||||
- qt5-default
|
||||
- libqt5opengl5-dev
|
||||
- qtbase5-dev
|
||||
- qtscript5-dev
|
||||
|
||||
before_script:
|
||||
- git clone https://github.com/OPM/ResInsight.git
|
||||
|
||||
script:
|
||||
############################################################################
|
||||
# Build main and tests
|
||||
############################################################################
|
||||
- mkdir -p build
|
||||
- cd build
|
||||
|
||||
- cmake -DRESINSIGHT_ENABLE_COTIRE=true ..
|
||||
|
||||
# Build the default target
|
||||
#- make -j8
|
||||
|
||||
# Build the target produced by Cotire
|
||||
- make -j8 ResInsight_unity
|
@ -27,4 +27,8 @@
|
||||
#define PRODUCTVER "@PRODUCTVER@"
|
||||
#define STRPRODUCTVER "@STRPRODUCTVER@"
|
||||
|
||||
#define RESINSIGHT_MAJOR_VERSION "@RESINSIGHT_MAJOR_VERSION@"
|
||||
#define RESINSIGHT_MINOR_VERSION "@RESINSIGHT_MINOR_VERSION@"
|
||||
#define RESINSIGHT_PATCH_VERSION "@RESINSIGHT_PATCH_VERSION@"
|
||||
|
||||
#define RESINSIGHT_OCTAVE_VERSION "@OCTAVE_VERSION_STRING@"
|
||||
|
21
ApplicationCode/Adm/RiaVersionInfo.py.cmake
Normal file
21
ApplicationCode/Adm/RiaVersionInfo.py.cmake
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# Copyright (C) 2019- Equinor ASA
|
||||
#
|
||||
# ResInsight is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
# for more details.
|
||||
#
|
||||
# Python version of RiaVersionInfo.h
|
||||
# Just sets version constants
|
||||
|
||||
RESINSIGHT_MAJOR_VERSION = "@RESINSIGHT_MAJOR_VERSION@"
|
||||
RESINSIGHT_MINOR_VERSION = "@RESINSIGHT_MINOR_VERSION@"
|
||||
RESINSIGHT_PATCH_VERSION = "@RESINSIGHT_PATCH_VERSION@"
|
2713
ApplicationCode/Adm/projectfilekeywords/2019.04/ri-fieldKeywords.txt
Normal file
2713
ApplicationCode/Adm/projectfilekeywords/2019.04/ri-fieldKeywords.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,280 @@
|
||||
// ResInsight version string : 2019.04.0-dev.01
|
||||
// Report generated : Tue 30. Apr 10:17:11 2019
|
||||
//
|
||||
//
|
||||
|
||||
Annotations
|
||||
AsciiDataCurve
|
||||
CalcScript
|
||||
CalculatedSummaryCase
|
||||
CellEdgeResultSlot
|
||||
CellFilter
|
||||
CellPropertyFilter
|
||||
CellPropertyFilters
|
||||
CellRangeFilter
|
||||
CellRangeFilterCollection
|
||||
ChangeDataSourceFeatureUi
|
||||
CmdAddItemExecData
|
||||
CmdDeleteItemExecData
|
||||
CmdFieldChangeExecData
|
||||
CompletionTemplateCollection
|
||||
CrossSection
|
||||
CrossSectionCollection
|
||||
Eclipse2dViewCollection
|
||||
EclipseCase
|
||||
EclipseGeometrySelectionItem
|
||||
Fault
|
||||
Faults
|
||||
FileSummaryCase
|
||||
FishbonesCollection
|
||||
FishbonesMultipleSubs
|
||||
FishbonesPipeProperties
|
||||
FlowCharacteristicsPlot
|
||||
FlowDiagSolution
|
||||
FlowPlotCollection
|
||||
FormationNames
|
||||
FormationNamesCollectionObject
|
||||
FractureContainment
|
||||
FractureDefinitionCollection
|
||||
GeoMech2dViewCollection
|
||||
GeoMechGeometrySelectionItem
|
||||
GeoMechPropertyFilter
|
||||
GeoMechPropertyFilters
|
||||
GeoMechResultDefinition
|
||||
GeoMechResultSlot
|
||||
GeoMechView
|
||||
GridCollection
|
||||
GridCrossPlotCurve
|
||||
GridCrossPlotCurveSet
|
||||
GridInfo
|
||||
GridInfoCollection
|
||||
GridSummaryCase
|
||||
GridTimeHistoryCurve
|
||||
Intersection2dView
|
||||
Intersection2dViewCollection
|
||||
IntersectionBox
|
||||
Legend
|
||||
MainPlotCollection
|
||||
MdiWindowController
|
||||
MockModelSettings
|
||||
ModeledWellPath
|
||||
MultiSnapshotDefinition
|
||||
NoCommonAreaNNC
|
||||
ObservedDataCollection
|
||||
PdmDocument
|
||||
PdmObjectCollection
|
||||
PdmObjectGroup
|
||||
Perforation
|
||||
PerforationCollection
|
||||
PolylineTarget
|
||||
PolylinesFromFileAnnotation
|
||||
PropertyFilter
|
||||
ResInsightAnalysisModels
|
||||
ResInsightGeoMechCase
|
||||
ResInsightGeoMechModels
|
||||
ResInsightOilField
|
||||
ResInsightProject
|
||||
ReservoirCellResultStorage
|
||||
ReservoirView
|
||||
ResultDefinition
|
||||
ResultSlot
|
||||
ResultStorageEntryInfo
|
||||
RftAddress
|
||||
RiaMemoryCleanup
|
||||
RiaPreferences
|
||||
RiaRegressionTest
|
||||
RicCaseAndFileExportSettingsUi
|
||||
RicCellRangeUi
|
||||
RicDeleteItemExecData
|
||||
RicExportCarfinUi
|
||||
RicExportCompletionDataSettingsUi
|
||||
RicExportEclipseInputGridUi
|
||||
RicExportLgrUi
|
||||
RicExportToLasFileObj
|
||||
RicExportToLasFileResampleUi
|
||||
RicExportWellPathsUi
|
||||
RicHoloLensCreateSessionUi
|
||||
RicHoloLensExportToFolderUi
|
||||
RicHoloLensServerSettings
|
||||
RicLinkVisibleViewsFeatureUi
|
||||
RicPasteAsciiDataToSummaryPlotFeatureUi
|
||||
RicSaturationPressureUi
|
||||
RicSaveEclipseInputVisibleCellsUi
|
||||
RicSelectSummaryPlotUI
|
||||
RicSelectViewUI
|
||||
RicSummaryAddressSelection
|
||||
RicSummaryCurveCalculator
|
||||
RicSummaryCurveCreator
|
||||
RicWellPathsUnitSystemSettingsUi
|
||||
RifReaderSettings
|
||||
Rim3dWellLogCurveCollection
|
||||
Rim3dWellLogExtractionCurve
|
||||
Rim3dWellLogFileCurve
|
||||
Rim3dWellLogRftCurve
|
||||
RimAnnotationCollection
|
||||
RimAnnotationCollectionBase
|
||||
RimAnnotationGroupCollection
|
||||
RimAnnotationLineAppearance
|
||||
RimAnnotationTextAppearance
|
||||
RimBinaryExportSettings
|
||||
RimCaseCollection
|
||||
RimCommandExecuteScript
|
||||
RimCommandIssueFieldChanged
|
||||
RimCommandObject
|
||||
RimContourMapView
|
||||
RimCsvUserData
|
||||
RimCurveNameConfig
|
||||
RimDerivedEnsembleCaseCollection
|
||||
RimDialogData
|
||||
RimEclipseContourMapProjection
|
||||
RimEllipseFractureTemplate
|
||||
RimEnsembleCurveFilter
|
||||
RimEnsembleCurveFilterCollection
|
||||
RimEnsembleCurveSet
|
||||
RimEnsembleCurveSetCollection
|
||||
RimEnsembleStatistics
|
||||
RimExportInputSettings
|
||||
RimFaultResultSlot
|
||||
RimFractureExportSettings
|
||||
RimGeoMechContourMapProjection
|
||||
RimGeoMechContourMapView
|
||||
RimGridCrossPlot
|
||||
RimGridCrossPlotCollection
|
||||
RimGridCrossPlotCurveSetNameConfig
|
||||
RimGridCrossPlotNameConfig
|
||||
RimIdenticalGridCaseGroup
|
||||
RimInputProperty
|
||||
RimInputPropertyCollection
|
||||
RimInputReservoir
|
||||
RimMeasurement
|
||||
RimMswCompletionParameters
|
||||
RimMultipleValveLocations
|
||||
RimNoCommonAreaNncCollection
|
||||
RimNonDarcyPerforationParameters
|
||||
RimObservedEclipseUserData
|
||||
RimOilFieldEntry
|
||||
RimOilRegionEntry
|
||||
RimPlotAxisAnnotation
|
||||
RimPlotCellFilterCollection
|
||||
RimPlotCellPropertyFilter
|
||||
RimPolylineAppearance
|
||||
RimPolylinesAnnotationInView
|
||||
RimPolylinesFromFileAnnotationInView
|
||||
RimReachCircleAnnotation
|
||||
RimReachCircleAnnotationInView
|
||||
RimSaturationPressurePlot
|
||||
RimSaturationPressurePlotCollection
|
||||
RimStatisticalCalculation
|
||||
RimStatisticalCollection
|
||||
RimStimPlanColors
|
||||
RimStimPlanFractureTemplate
|
||||
RimStimPlanLegendConfig
|
||||
RimSummaryCalculation
|
||||
RimSummaryCalculationCollection
|
||||
RimSummaryCalculationVariable
|
||||
RimSummaryCurveCollection
|
||||
RimSummaryCurveCollectionModifier
|
||||
RimTensorResults
|
||||
RimTernaryLegendConfig
|
||||
RimTextAnnotation
|
||||
RimTextAnnotationInView
|
||||
RimTimeStepFilter
|
||||
RimUserDefinedPolylinesAnnotationInView
|
||||
RimViewLinkerCollection
|
||||
RimViewNameConfig
|
||||
RimVirtualPerforationResults
|
||||
RimWellLogExtractionCurve
|
||||
RimWellLogExtractionCurveNameConfig
|
||||
RimWellLogFileCurveNameConfig
|
||||
RimWellLogPlotNameConfig
|
||||
RimWellLogRftCurveNameConfig
|
||||
RimWellPathEntry
|
||||
RimWellPathImport
|
||||
RiuCreateMultipleFractionsUi
|
||||
RiuMultipleFractionsOptions
|
||||
ScaleLegend
|
||||
ScriptLocation
|
||||
SimWellFracture
|
||||
SimWellFractureCollection
|
||||
SummaryAddress
|
||||
SummaryCaseCollection
|
||||
SummaryCaseSubCollection
|
||||
SummaryCrossPlot
|
||||
SummaryCrossPlotCollection
|
||||
SummaryCurve
|
||||
SummaryCurveAutoName
|
||||
SummaryCurveFilter
|
||||
SummaryFilterSettings
|
||||
SummaryObservedDataFile
|
||||
SummaryPageDownloadEntity
|
||||
SummaryPlot
|
||||
SummaryPlotCollection
|
||||
SummaryTimeAxisProperties
|
||||
SummaryYAxisProperties
|
||||
TC2
|
||||
TestCommand1
|
||||
TofAccumulatedPhaseFractionsPlot
|
||||
TotalWellAllocationPlot
|
||||
UserDefinedPolylinesAnnotation
|
||||
ValveTemplate
|
||||
ValveTemplateCollection
|
||||
View3dOverlayInfoConfig
|
||||
ViewController
|
||||
ViewLinker
|
||||
Well
|
||||
WellAllocationPlot
|
||||
WellAllocationPlotLegend
|
||||
WellFlowRateCurve
|
||||
WellLogFile
|
||||
WellLogFileChannel
|
||||
WellLogFileCurve
|
||||
WellLogPlot
|
||||
WellLogPlotCollection
|
||||
WellLogPlotTrack
|
||||
WellLogRftCurve
|
||||
WellPath
|
||||
WellPathAicdParameters
|
||||
WellPathAttribute
|
||||
WellPathAttributes
|
||||
WellPathBase
|
||||
WellPathCompletion
|
||||
WellPathCompletionCollection
|
||||
WellPathCompletions
|
||||
WellPathFracture
|
||||
WellPathFractureCollection
|
||||
WellPathGeometryDef
|
||||
WellPathTarget
|
||||
WellPathValve
|
||||
WellPaths
|
||||
WellPltPlot
|
||||
WellPltPlotCollection
|
||||
WellRftPlot
|
||||
WellRftPlotCollection
|
||||
Wells
|
||||
closeProject
|
||||
computeCaseGroupStatistics
|
||||
createLgrForCompletions
|
||||
createMultipleFractures
|
||||
createSaturationPressurePlots
|
||||
exportLgrForCompletions
|
||||
exportMsw
|
||||
exportMultiCaseSnapshots
|
||||
exportProperty
|
||||
exportPropertyInViews
|
||||
exportSimWellFractureCompletions
|
||||
exportSnapshots
|
||||
exportVisibleCells
|
||||
exportWellPathCompletions
|
||||
exportWellPaths
|
||||
loadCase
|
||||
openProject
|
||||
replaceCase
|
||||
replaceCaseImpl_no_support_for_command_file_text_parsing
|
||||
replaceSourceCases
|
||||
runOctaveScript
|
||||
scaleFractureTemplate
|
||||
setExportFolder
|
||||
setFractureContainment
|
||||
setMainWindowSize
|
||||
setStartDir
|
||||
setTimeStep
|
@ -1,6 +1,8 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFractureDefines.h
|
||||
@ -13,10 +15,13 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaMemoryCleanup.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFontCache.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFractureDefines.cpp
|
||||
@ -30,6 +35,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaMemoryCleanup.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFontCache.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
@ -42,7 +48,8 @@ ${SOURCE_GROUP_SOURCE_FILES}
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,21 +16,25 @@
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
#include <QMutex>
|
||||
#include "RiaDefines.h"
|
||||
#ifdef ENABLE_GRPC
|
||||
#include "RiaGrpcServer.h"
|
||||
#endif
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfFont.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include "RiaFontCache.h"
|
||||
#include <QApplication>
|
||||
#include <QMutex>
|
||||
#include <QProcess>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QString>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
@ -66,210 +70,177 @@ class RiaArgumentParser;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class UiProcess;
|
||||
class UiProcess;
|
||||
}
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ProgramOptions;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
/// Base class for all ResInsight applications. I.e. console and GUI
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaApplication : public QApplication
|
||||
class RiaApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum RINavigationPolicy
|
||||
{
|
||||
NAVIGATION_POLICY_CEETRON,
|
||||
NAVIGATION_POLICY_CAD,
|
||||
NAVIGATION_POLICY_GEOQUEST,
|
||||
NAVIGATION_POLICY_RMS
|
||||
};
|
||||
|
||||
enum ProjectLoadAction
|
||||
{
|
||||
PLA_NONE = 0,
|
||||
PLA_NONE = 0,
|
||||
PLA_CALCULATE_STATISTICS = 1
|
||||
};
|
||||
|
||||
typedef RiaFontCache::FontSize FontSize;
|
||||
enum ApplicationStatus
|
||||
{
|
||||
KEEP_GOING = 0,
|
||||
EXIT_COMPLETED,
|
||||
EXIT_WITH_ERROR
|
||||
};
|
||||
|
||||
public:
|
||||
RiaApplication(int& argc, char** argv);
|
||||
~RiaApplication() override;
|
||||
static RiaApplication* instance();
|
||||
RiaApplication();
|
||||
virtual ~RiaApplication();
|
||||
|
||||
static RiaApplication* instance();
|
||||
static const char* getVersionStringApp(bool includeCrtInfo);
|
||||
static bool enableDevelopmentFeatures();
|
||||
|
||||
int parseArgumentsAndRunUnitTestsIfRequested();
|
||||
bool parseArguments();
|
||||
void setActiveReservoirView(Rim3dView*);
|
||||
Rim3dView* activeReservoirView();
|
||||
const Rim3dView* activeReservoirView() const;
|
||||
RimGridView* activeGridView();
|
||||
|
||||
void setActiveReservoirView(Rim3dView*);
|
||||
Rim3dView* activeReservoirView();
|
||||
const Rim3dView* activeReservoirView() const;
|
||||
RimGridView* activeGridView();
|
||||
RimProject* project();
|
||||
|
||||
RimViewWindow* activePlotWindow() const;
|
||||
void createMockModel();
|
||||
void createResultsMockModel();
|
||||
void createLargeResultsMockModel();
|
||||
void createMockModelCustomized();
|
||||
void createInputMockModel();
|
||||
|
||||
RimProject* project();
|
||||
bool openFile(const QString& fileName);
|
||||
|
||||
void createMockModel();
|
||||
void createResultsMockModel();
|
||||
void createLargeResultsMockModel();
|
||||
void createMockModelCustomized();
|
||||
void createInputMockModel();
|
||||
bool isProjectSavedToDisc() const;
|
||||
QString currentProjectPath() const;
|
||||
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
|
||||
bool loadProject(const QString& projectFileName);
|
||||
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
|
||||
bool saveProjectAs(const QString& fileName, QString* errorMessage);
|
||||
static bool hasValidProjectFileExtension(const QString& fileName);
|
||||
void closeProject();
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
bool openFile(const QString& fileName);
|
||||
bool openOdbCaseFromFile(const QString& fileName, bool applyTimeStepFilter = false);
|
||||
|
||||
bool openOdbCaseFromFile(const QString& fileName, bool applyTimeStepFilter = false);
|
||||
void addWellPathsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellPathFormationsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
||||
|
||||
QString currentProjectPath() const;
|
||||
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
|
||||
bool loadProject(const QString& projectFileName);
|
||||
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
|
||||
bool saveProject();
|
||||
bool saveProjectAs(const QString& fileName);
|
||||
bool saveProjectPromptForFileName();
|
||||
static bool hasValidProjectFileExtension(const QString& fileName);
|
||||
QString scriptDirectories() const;
|
||||
QString scriptEditorPath() const;
|
||||
|
||||
bool askUserToSaveModifiedProject();
|
||||
void closeProject();
|
||||
QString octavePath() const;
|
||||
QStringList octaveArguments() const;
|
||||
QProcessEnvironment octaveProcessEnvironment() const;
|
||||
|
||||
void addWellPathsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellPathFormationsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
||||
QString pythonPath() const;
|
||||
QProcessEnvironment pythonProcessEnvironment() const;
|
||||
|
||||
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
||||
bool launchProcess(const QString& program, const QStringList& arguments, const QProcessEnvironment& processEnvironment);
|
||||
bool launchProcessForMultipleCases(const QString& program, const QStringList& arguments, const std::vector<int>& caseIds, const QProcessEnvironment& processEnvironment);
|
||||
void terminateProcess();
|
||||
void waitForProcess() const;
|
||||
|
||||
void processNonGuiEvents();
|
||||
RiaPreferences* preferences();
|
||||
void applyPreferences(const RiaPreferences* oldPreferences = nullptr);
|
||||
|
||||
static const char* getVersionStringApp(bool includeCrtInfo);
|
||||
QString commandLineParameterHelp();
|
||||
void setCommandLineHelpText(const QString& commandLineHelpText);
|
||||
|
||||
bool useShaders() const;
|
||||
void setCacheDataObject(const QString& key, const QVariant& dataObject);
|
||||
QVariant cacheDataObject(const QString& key) const;
|
||||
|
||||
bool showPerformanceInfo() const;
|
||||
void executeCommandFile(const QString& commandFile);
|
||||
void addCommandObject(RimCommandObject* commandObject);
|
||||
void executeCommandObjects();
|
||||
void waitUntilCommandObjectsHasBeenProcessed();
|
||||
|
||||
RINavigationPolicy navigationPolicy() const;
|
||||
QString scriptDirectories() const;
|
||||
QString scriptEditorPath() const;
|
||||
int launchUnitTests();
|
||||
|
||||
QString octavePath() const;
|
||||
QStringList octaveArguments() const;
|
||||
|
||||
bool launchProcess(const QString& program, const QStringList& arguments);
|
||||
bool launchProcessForMultipleCases(const QString& program, const QStringList& arguments, const std::vector<int>& caseIds);
|
||||
void terminateProcess();
|
||||
void waitForProcess() const;
|
||||
|
||||
RiaPreferences* preferences();
|
||||
void applyPreferences(const RiaPreferences* oldPreferences = nullptr);
|
||||
|
||||
cvf::Font* defaultSceneFont();
|
||||
cvf::Font* defaultAnnotationFont();
|
||||
cvf::Font* defaultWellLabelFont();
|
||||
|
||||
QString commandLineParameterHelp() const;
|
||||
void showFormattedTextInMessageBox(const QString& text);
|
||||
|
||||
void setCacheDataObject(const QString& key, const QVariant& dataObject);
|
||||
QVariant cacheDataObject(const QString& key) const;
|
||||
|
||||
void addCommandObject(RimCommandObject* commandObject);
|
||||
void executeCommandObjects();
|
||||
|
||||
int launchUnitTests();
|
||||
int launchUnitTestsWithConsole();
|
||||
|
||||
RiuMainWindow* getOrCreateAndShowMainWindow();
|
||||
RiuMainWindow* mainWindow();
|
||||
|
||||
RiuPlotMainWindow* getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow();
|
||||
RiuMainWindowBase* mainWindowByID(int mainWindowID);
|
||||
|
||||
static RimViewWindow* activeViewWindow();
|
||||
|
||||
bool isMain3dWindowVisible() const;
|
||||
bool isMainPlotWindowVisible() const;
|
||||
|
||||
void closeMainWindowIfOpenButHidden();
|
||||
void closeMainPlotWindowIfOpenButHidden();
|
||||
|
||||
void addToRecentFiles(const QString& fileName);
|
||||
std::vector<QAction*> recentFileActions() const;
|
||||
|
||||
void setStartDir(const QString& startDir);
|
||||
const QString startDir() const;
|
||||
void setStartDir(const QString& startDir);
|
||||
|
||||
static std::vector<QString> readFileListFromTextFile(QString listFileName);
|
||||
|
||||
void waitUntilCommandObjectsHasBeenProcessed();
|
||||
void saveMainWinGeoAndDockToolBarLayout();
|
||||
void savePlotWinGeoAndDockToolBarLayout();
|
||||
cvf::Font* defaultSceneFont();
|
||||
cvf::Font* defaultAnnotationFont();
|
||||
cvf::Font* defaultWellLabelFont();
|
||||
|
||||
static bool enableDevelopmentFeatures();
|
||||
static void clearAllSelections();
|
||||
bool initializeGrpcServer(const cvf::ProgramOptions& progOpt);
|
||||
|
||||
private:
|
||||
void onProjectOpenedOrClosed();
|
||||
void setWindowCaptionFromAppState();
|
||||
// Public implementation specific overrides
|
||||
virtual void initialize();
|
||||
virtual ApplicationStatus handleArguments(cvf::ProgramOptions* progOpt) = 0;
|
||||
virtual int launchUnitTestsWithConsole();
|
||||
virtual void addToRecentFiles(const QString& fileName) {}
|
||||
virtual void showFormattedTextInMessageBoxOrConsole(const QString& errMsg) = 0;
|
||||
|
||||
void createMainWindow();
|
||||
void deleteMainWindow();
|
||||
virtual void launchGrpcServer() = 0;
|
||||
|
||||
void createMainPlotWindow();
|
||||
void deleteMainPlotWindow();
|
||||
#ifdef ENABLE_GRPC
|
||||
virtual RiaGrpcServer* grpcServer() const = 0;
|
||||
#endif
|
||||
protected:
|
||||
// Protected implementation specific overrides
|
||||
virtual void invokeProcessEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) = 0;
|
||||
virtual void onFileSuccessfullyLoaded(const QString& fileName, RiaDefines::ImportFileType fileType) {}
|
||||
virtual void onProjectBeingOpened() {}
|
||||
virtual void onProjectOpened() = 0;
|
||||
virtual void onProjectOpeningError(const QString& errMsg) = 0;
|
||||
virtual void onProjectBeingClosed() {}
|
||||
virtual void onProjectClosed() = 0;
|
||||
virtual void startMonitoringWorkProgress(caf::UiProcess* uiProcess) {}
|
||||
virtual void stopMonitoringWorkProgress() {}
|
||||
|
||||
void loadAndUpdatePlotData();
|
||||
protected:
|
||||
cvf::ref<cvf::Font> m_defaultSceneFont;
|
||||
cvf::ref<cvf::Font> m_defaultAnnotationFont;
|
||||
cvf::ref<cvf::Font> m_defaultWellLabelFont;
|
||||
|
||||
void storeTreeViewState();
|
||||
caf::PdmPointer<Rim3dView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
|
||||
friend RiaArgumentParser;
|
||||
void setHelpText(const QString& helpText);
|
||||
RiaSocketServer* m_socketServer;
|
||||
caf::UiProcess* m_workerProcess;
|
||||
|
||||
bool notify(QObject *, QEvent *) override;
|
||||
|
||||
private slots:
|
||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
caf::PdmPointer<Rim3dView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
|
||||
RiaSocketServer* m_socketServer;
|
||||
|
||||
caf::UiProcess* m_workerProcess;
|
||||
#ifdef ENABLE_GRPC
|
||||
std::unique_ptr<RiaGrpcServer> m_grpcServer;
|
||||
#endif
|
||||
|
||||
// Execute for all settings
|
||||
std::list<int> m_currentCaseIds;
|
||||
QString m_currentProgram;
|
||||
QStringList m_currentArguments;
|
||||
std::list<int> m_currentCaseIds;
|
||||
QString m_currentProgram;
|
||||
QStringList m_currentArguments;
|
||||
RiaPreferences* m_preferences;
|
||||
|
||||
RiaPreferences* m_preferences;
|
||||
std::map<QString, QString> m_fileDialogDefaultDirectories;
|
||||
QString m_startupDefaultDirectory;
|
||||
QString m_commandLineHelpText;
|
||||
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
|
||||
|
||||
std::map<QString, QString> m_fileDialogDefaultDirectories;
|
||||
QString m_startupDefaultDirectory;
|
||||
std::list<RimCommandObject*> m_commandQueue;
|
||||
QMutex m_commandQueueLock;
|
||||
|
||||
cvf::ref<cvf::Font> m_defaultSceneFont;
|
||||
cvf::ref<cvf::Font> m_defaultAnnotationFont;
|
||||
cvf::ref<cvf::Font> m_defaultWellLabelFont;
|
||||
bool m_runningWorkerProcess;
|
||||
|
||||
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
|
||||
|
||||
std::list<RimCommandObject*> m_commandQueue;
|
||||
QMutex m_commandQueueLock;
|
||||
|
||||
QString m_helpText;
|
||||
|
||||
bool m_runningWorkerProcess;
|
||||
|
||||
RiuMainWindow* m_mainWindow;
|
||||
RiuPlotMainWindow* m_mainPlotWindow;
|
||||
|
||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||
private:
|
||||
static RiaApplication* s_riaApplication;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
436
ApplicationCode/Application/RiaConsoleApplication.cpp
Normal file
436
ApplicationCode/Application/RiaConsoleApplication.cpp
Normal file
@ -0,0 +1,436 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RiaConsoleApplication.h"
|
||||
|
||||
#include "RiaArgumentParser.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
#include "RiaSocketServer.h"
|
||||
|
||||
#include "RicImportGeneralDataFeature.h"
|
||||
|
||||
#include "cvfProgramOptions.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaConsoleApplication* RiaConsoleApplication::instance()
|
||||
{
|
||||
RiaConsoleApplication* currentConsoleApp = dynamic_cast<RiaConsoleApplication*>(RiaApplication::instance());
|
||||
CAF_ASSERT(currentConsoleApp && "Should never be called from a method that isn't within the Console context");
|
||||
return currentConsoleApp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaConsoleApplication::RiaConsoleApplication(int& argc, char** argv)
|
||||
: QCoreApplication(argc, argv)
|
||||
, RiaApplication()
|
||||
{
|
||||
installEventFilter(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaConsoleApplication::~RiaConsoleApplication()
|
||||
{
|
||||
RiaLogging::deleteLoggerInstance();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::initialize()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
#pragma warning(disable : 4996) // Temporarily disables warning 4996.
|
||||
|
||||
bool isReOpenStdToConsoleNeeded = false;
|
||||
|
||||
if ( AttachConsole(ATTACH_PARENT_PROCESS) )
|
||||
{
|
||||
int fileType = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE));
|
||||
|
||||
// FILE_TYPE_CHAR indicates a windows console buffer.
|
||||
// FILE_TYPE_PIPE indicates redirection imposed by the starting shell (eg migw shell)
|
||||
// If we are dealing with a pipe, we do not want to do the reopen, and destroy the connection.
|
||||
|
||||
if (fileType == FILE_TYPE_CHAR )
|
||||
{
|
||||
isReOpenStdToConsoleNeeded = true;
|
||||
}
|
||||
}
|
||||
else if ( AllocConsole() )
|
||||
{
|
||||
isReOpenStdToConsoleNeeded = true;
|
||||
}
|
||||
|
||||
if (isReOpenStdToConsoleNeeded)
|
||||
{
|
||||
freopen("conout$", "w", stdout);
|
||||
freopen("conout$", "w", stderr);
|
||||
freopen("conin$", "r", stdin);
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
RiaApplication::initialize();
|
||||
|
||||
RiaLogging::setLoggerInstance(new RiaStdOutLogger);
|
||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||
|
||||
m_socketServer = new RiaSocketServer(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments(cvf::ProgramOptions* progOpt)
|
||||
{
|
||||
CVF_ASSERT(progOpt);
|
||||
|
||||
// Handling of the actual command line options
|
||||
// --------------------------------------------------------
|
||||
if (cvf::Option o = progOpt->option("ignoreArgs"))
|
||||
{
|
||||
return KEEP_GOING;
|
||||
}
|
||||
|
||||
if (progOpt->option("help") || progOpt->option("?"))
|
||||
{
|
||||
this->showFormattedTextInMessageBoxOrConsole("\nThe current command line options in ResInsight are:\n"
|
||||
+ this->commandLineParameterHelp());
|
||||
return RiaApplication::EXIT_COMPLETED;
|
||||
}
|
||||
|
||||
// Unit testing
|
||||
// --------------------------------------------------------
|
||||
if (cvf::Option o = progOpt->option("unittest"))
|
||||
{
|
||||
int testReturnValue = launchUnitTestsWithConsole();
|
||||
if (testReturnValue == 0)
|
||||
{
|
||||
return RiaApplication::EXIT_COMPLETED;
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::error("Error running unit tests");
|
||||
return RiaApplication::EXIT_WITH_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("startdir"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
setStartDir(cvfqt::Utils::toQString(o.value(0)));
|
||||
}
|
||||
|
||||
QString projectFileName;
|
||||
|
||||
if (progOpt->hasOption("last"))
|
||||
{
|
||||
projectFileName = preferences()->lastUsedProjectFileName;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("project"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
projectFileName = cvfqt::Utils::toQString(o.value(0));
|
||||
}
|
||||
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
cvf::ref<RiaProjectModifier> projectModifier;
|
||||
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::PLA_NONE;
|
||||
|
||||
if (cvf::Option o = progOpt->option("replaceCase"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplaceCaseFirstOccurrence(gridFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !gridFileName.isEmpty())
|
||||
{
|
||||
projectModifier->setReplaceCase(caseId, gridFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("replaceSourceCases"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
std::vector<QString> gridFileNames = readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0)));
|
||||
projectModifier->setReplaceSourceCasesFirstOccurrence(gridFileNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int groupId = o.safeValue(optionIdx++).toInt(-1);
|
||||
std::vector<QString> gridFileNames =
|
||||
readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(optionIdx++)));
|
||||
|
||||
if (groupId != -1 && !gridFileNames.empty())
|
||||
{
|
||||
projectModifier->setReplaceSourceCasesById(groupId, gridFileNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectLoadAction = RiaApplication::PLA_CALCULATE_STATISTICS;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("replacePropertiesFolder"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplacePropertiesFolderFirstOccurrence(propertiesFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !propertiesFolder.isEmpty())
|
||||
{
|
||||
projectModifier->setReplacePropertiesFolder(caseId, propertiesFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadProject(projectFileName, projectLoadAction, projectModifier.p());
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("case"))
|
||||
{
|
||||
QStringList fileNames = RicImportGeneralDataFeature::fileNamesFromCaseNames(cvfqt::Utils::toQStringList(o.values()));
|
||||
RicImportGeneralDataFeature::OpenCaseResults results =
|
||||
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(fileNames);
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("commandFile"))
|
||||
{
|
||||
QString commandFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
if (!progOpt->hasOption("startdir"))
|
||||
{
|
||||
QFileInfo commandFileInfo(commandFile);
|
||||
QString commandDir = commandFileInfo.absolutePath();
|
||||
setStartDir(commandDir);
|
||||
}
|
||||
|
||||
cvf::Option projectOption = progOpt->option("commandFileProject");
|
||||
cvf::Option caseOption = progOpt->option("commandFileReplaceCases");
|
||||
if (projectOption && caseOption)
|
||||
{
|
||||
projectFileName = cvfqt::Utils::toQString(projectOption.value(0));
|
||||
|
||||
std::vector<int> caseIds;
|
||||
std::vector<QString> caseListFiles;
|
||||
|
||||
if (caseOption.valueCount() == 1)
|
||||
{
|
||||
caseListFiles.push_back(cvfqt::Utils::toQString(caseOption.safeValue(0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < caseOption.valueCount())
|
||||
{
|
||||
const int caseId = caseOption.safeValue(optionIdx++).toInt(-1);
|
||||
QString caseListFile = cvfqt::Utils::toQString(caseOption.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !caseListFile.isEmpty())
|
||||
{
|
||||
caseIds.push_back(caseId);
|
||||
caseListFiles.push_back(caseListFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caseIds.empty() && !caseListFiles.empty())
|
||||
{
|
||||
QString caseListFile = caseListFiles[0];
|
||||
std::vector<QString> caseFiles = readFileListFromTextFile(caseListFile);
|
||||
for (const QString& caseFile : caseFiles)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
projectModifier.setReplaceCaseFirstOccurrence(caseFile);
|
||||
loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(caseIds.size() == caseListFiles.size());
|
||||
|
||||
std::vector<std::vector<QString>> allCaseFiles;
|
||||
size_t maxFiles = 0;
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
std::vector<QString> caseFiles = readFileListFromTextFile(caseListFiles[i]);
|
||||
allCaseFiles.push_back(caseFiles);
|
||||
maxFiles = std::max(caseFiles.size(), maxFiles);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
for (size_t j = 0; j < maxFiles; ++j)
|
||||
{
|
||||
if (allCaseFiles[i].size() > j)
|
||||
{
|
||||
projectModifier.setReplaceCase(caseIds[i], allCaseFiles[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
return EXIT_COMPLETED;
|
||||
}
|
||||
|
||||
return KEEP_GOING;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::showFormattedTextInMessageBoxOrConsole(const QString& errMsg)
|
||||
{
|
||||
std::cout << errMsg.toStdString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::launchGrpcServer()
|
||||
{
|
||||
#ifdef ENABLE_GRPC
|
||||
m_grpcServer->runInThread();
|
||||
m_idleTimer = new QTimer(this);
|
||||
connect(m_idleTimer, SIGNAL(timeout()), this, SLOT(runIdleProcessing()));
|
||||
m_idleTimer->start(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_GRPC
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaGrpcServer* RiaConsoleApplication::grpcServer() const
|
||||
{
|
||||
return m_grpcServer.get();
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::invokeProcessEvents(QEventLoop::ProcessEventsFlags flags /*= QEventLoop::AllEvents*/)
|
||||
{
|
||||
processEvents(flags);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::onProjectOpeningError(const QString& errMsg)
|
||||
{
|
||||
RiaLogging::error(errMsg);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::onProjectOpened()
|
||||
{
|
||||
processEvents();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::onProjectClosed()
|
||||
{
|
||||
processEvents();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::runIdleProcessing()
|
||||
{
|
||||
#ifdef ENABLE_GRPC
|
||||
if (RiaGrpcServer::receivedExitRequest())
|
||||
{
|
||||
m_grpcServer->quit();
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_grpcServer->processAllQueuedRequests();
|
||||
}
|
||||
#endif
|
||||
}
|
66
ApplicationCode/Application/RiaConsoleApplication.h
Normal file
66
ApplicationCode/Application/RiaConsoleApplication.h
Normal file
@ -0,0 +1,66 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QTimer>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ProgramOptions;
|
||||
}
|
||||
|
||||
class RiaConsoleApplication : public QCoreApplication, public RiaApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static RiaConsoleApplication* instance();
|
||||
|
||||
RiaConsoleApplication(int& argc, char** argv);
|
||||
~RiaConsoleApplication() override;
|
||||
|
||||
// Public RiaApplication overrides
|
||||
void initialize() override;
|
||||
ApplicationStatus handleArguments(cvf::ProgramOptions* progOpt) override;
|
||||
void showFormattedTextInMessageBoxOrConsole(const QString& errMsg) override;
|
||||
void launchGrpcServer() override;
|
||||
#ifdef ENABLE_GRPC
|
||||
RiaGrpcServer* grpcServer() const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Protected implementation specific overrides
|
||||
void invokeProcessEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) override;
|
||||
void onProjectOpeningError(const QString& errMsg) override;
|
||||
void onProjectOpened();
|
||||
void onProjectClosed();
|
||||
|
||||
private slots:
|
||||
void runIdleProcessing();
|
||||
|
||||
private:
|
||||
#ifdef ENABLE_GRPC
|
||||
QPointer<QTimer> m_idleTimer;
|
||||
#endif
|
||||
};
|
||||
|
@ -170,6 +170,15 @@ namespace RiaDefines
|
||||
ImportFileType obtainFileTypeFromFileName(const QString& fileName);
|
||||
QString defaultDirectoryLabel(ImportFileType fileTypes);
|
||||
|
||||
enum CaseType
|
||||
{
|
||||
ECLIPSE_RESULT_CASE = 1,
|
||||
ECLIPSE_INPUT_CASE = 2,
|
||||
ECLIPSE_STAT_CASE = 3,
|
||||
ECLIPSE_SOURCE_CASE = 4,
|
||||
GEOMECH_ODB_CASE = 5
|
||||
};
|
||||
|
||||
enum FontSettingType
|
||||
{
|
||||
SCENE_FONT,
|
||||
|
@ -42,7 +42,9 @@ void caf::AppEnum<RiaEclipseFileNameTools::EclipseFileType>::setUp()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaEclipseFileNameTools::RiaEclipseFileNameTools(const QString& inputFilePath)
|
||||
{
|
||||
m_baseName = findBaseName(inputFilePath);
|
||||
QFileInfo fi(inputFilePath);
|
||||
|
||||
m_baseName = fi.absolutePath() + "/" + fi.baseName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
143
ApplicationCode/Application/RiaFeatureCommandContext.cpp
Normal file
143
ApplicationCode/Application/RiaFeatureCommandContext.cpp
Normal file
@ -0,0 +1,143 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaFeatureCommandContext.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFeatureCommandContext::RiaFeatureCommandContext() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFeatureCommandContext::~RiaFeatureCommandContext() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaFeatureCommandContext::setObject(QObject* object)
|
||||
{
|
||||
m_pointerToQObject = object;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QObject* RiaFeatureCommandContext::object() const
|
||||
{
|
||||
return m_pointerToQObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaFeatureCommandContext::titleString() const
|
||||
{
|
||||
if (m_pointerToQObject)
|
||||
{
|
||||
QVariant variant = m_pointerToQObject->property(titleStringIdentifier().data());
|
||||
|
||||
return variant.toString();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaFeatureCommandContext::contentString() const
|
||||
{
|
||||
if (m_pointerToQObject)
|
||||
{
|
||||
QVariant variant = m_pointerToQObject->property(contentStringIdentifier().data());
|
||||
|
||||
return variant.toString();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaFeatureCommandContext::titleStringIdentifier()
|
||||
{
|
||||
return "titleStringIdentifier";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaFeatureCommandContext::contentStringIdentifier()
|
||||
{
|
||||
return "contentStringIdentifier";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFeatureCommandContext* RiaFeatureCommandContext::instance()
|
||||
{
|
||||
static RiaFeatureCommandContext* commandFileExecutorInstance = new RiaFeatureCommandContext();
|
||||
return commandFileExecutorInstance;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFeatureCommandContextHelper::RiaFeatureCommandContextHelper(QObject* externalObject)
|
||||
{
|
||||
RiaFeatureCommandContext::instance()->setObject(externalObject);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFeatureCommandContextHelper::~RiaFeatureCommandContextHelper()
|
||||
{
|
||||
RiaFeatureCommandContext::instance()->setObject(nullptr);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFeatureCommandContextTextHelper::RiaFeatureCommandContextTextHelper(const QString& title, const QString& text)
|
||||
{
|
||||
m_object = new QObject;
|
||||
|
||||
m_object->setProperty(RiaFeatureCommandContext::titleStringIdentifier().data(), title);
|
||||
m_object->setProperty(RiaFeatureCommandContext::contentStringIdentifier().data(), text);
|
||||
|
||||
RiaFeatureCommandContext::instance()->setObject(m_object);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFeatureCommandContextTextHelper::~RiaFeatureCommandContextTextHelper()
|
||||
{
|
||||
if (m_object)
|
||||
{
|
||||
m_object->deleteLater();
|
||||
m_object = nullptr;
|
||||
}
|
||||
}
|
72
ApplicationCode/Application/RiaFeatureCommandContext.h
Normal file
72
ApplicationCode/Application/RiaFeatureCommandContext.h
Normal file
@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RiaFeatureCommandContext
|
||||
{
|
||||
friend class RiaFeatureCommandContextHelper;
|
||||
|
||||
public:
|
||||
static RiaFeatureCommandContext* instance();
|
||||
|
||||
QObject* object() const;
|
||||
void setObject(QObject* object);
|
||||
|
||||
QString titleString() const;
|
||||
QString contentString() const;
|
||||
|
||||
static std::string titleStringIdentifier();
|
||||
static std::string contentStringIdentifier();
|
||||
|
||||
private:
|
||||
RiaFeatureCommandContext();
|
||||
~RiaFeatureCommandContext();
|
||||
|
||||
private:
|
||||
QPointer<QObject> m_pointerToQObject;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RiaFeatureCommandContextHelper
|
||||
{
|
||||
public:
|
||||
RiaFeatureCommandContextHelper(QObject* externalObject);
|
||||
~RiaFeatureCommandContextHelper();
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RiaFeatureCommandContextTextHelper
|
||||
{
|
||||
public:
|
||||
RiaFeatureCommandContextTextHelper(const QString& title, const QString& text);
|
||||
~RiaFeatureCommandContextTextHelper();
|
||||
|
||||
private:
|
||||
QObject* m_object;
|
||||
};
|
@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafFixedAtlasFont.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
@ -25,7 +26,6 @@
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class FixedAtlasFont;
|
||||
template<typename T> class AppEnum;
|
||||
}
|
||||
|
||||
@ -45,7 +45,8 @@ public:
|
||||
FONT_SIZE_14,
|
||||
FONT_SIZE_16,
|
||||
FONT_SIZE_24,
|
||||
FONT_SIZE_32
|
||||
FONT_SIZE_32,
|
||||
MAX_FONT_SIZE = FONT_SIZE_32
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<FontSize> FontSizeType;
|
||||
|
1832
ApplicationCode/Application/RiaGuiApplication.cpp
Normal file
1832
ApplicationCode/Application/RiaGuiApplication.cpp
Normal file
File diff suppressed because it is too large
Load Diff
180
ApplicationCode/Application/RiaGuiApplication.h
Normal file
180
ApplicationCode/Application/RiaGuiApplication.h
Normal file
@ -0,0 +1,180 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMutex>
|
||||
#include <QPointer>
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
class QAction;
|
||||
|
||||
class Drawable;
|
||||
|
||||
class RIProcess;
|
||||
|
||||
class RiaPreferences;
|
||||
class RiaProjectModifier;
|
||||
class RiaSocketServer;
|
||||
|
||||
class RigEclipseCaseData;
|
||||
|
||||
class RimCommandObject;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimGridView;
|
||||
class RimProject;
|
||||
class RimSummaryPlot;
|
||||
class Rim3dView;
|
||||
class RimViewWindow;
|
||||
class RimWellLogPlot;
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
class RiuMainWindow;
|
||||
class RiuMainWindowBase;
|
||||
class RiuMdiMaximizeWindowGuard;
|
||||
class RiuPlotMainWindow;
|
||||
class RiuRecentFileActionProvider;
|
||||
class RiaArgumentParser;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaGuiApplication : public QApplication, public RiaApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum RINavigationPolicy
|
||||
{
|
||||
NAVIGATION_POLICY_CEETRON,
|
||||
NAVIGATION_POLICY_CAD,
|
||||
NAVIGATION_POLICY_GEOQUEST,
|
||||
NAVIGATION_POLICY_RMS
|
||||
};
|
||||
|
||||
public:
|
||||
static bool isRunning();
|
||||
static RiaGuiApplication* instance();
|
||||
|
||||
RiaGuiApplication(int& argc, char** argv);
|
||||
~RiaGuiApplication() override;
|
||||
|
||||
bool saveProject();
|
||||
bool saveProjectPromptForFileName();
|
||||
bool askUserToSaveModifiedProject();
|
||||
bool saveProjectAs(const QString& fileName);
|
||||
|
||||
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
||||
bool useShaders() const;
|
||||
bool showPerformanceInfo() const;
|
||||
|
||||
RINavigationPolicy navigationPolicy() const;
|
||||
|
||||
RiuMainWindow* getOrCreateAndShowMainWindow();
|
||||
RiuMainWindow* mainWindow();
|
||||
RimViewWindow* activePlotWindow() const;
|
||||
|
||||
RiuPlotMainWindow* getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow();
|
||||
RiuMainWindowBase* mainWindowByID(int mainWindowID);
|
||||
|
||||
static RimViewWindow* activeViewWindow();
|
||||
|
||||
bool isMain3dWindowVisible() const;
|
||||
bool isMainPlotWindowVisible() const;
|
||||
|
||||
void closeMainWindowIfOpenButHidden();
|
||||
void closeMainPlotWindowIfOpenButHidden();
|
||||
|
||||
std::vector<QAction*> recentFileActions() const;
|
||||
|
||||
static void clearAllSelections();
|
||||
void applyGuiPreferences(const RiaPreferences* oldPreferences = nullptr);
|
||||
void updateGrpcServer();
|
||||
|
||||
// Public RiaApplication overrides
|
||||
void initialize() override;
|
||||
ApplicationStatus handleArguments(cvf::ProgramOptions* progOpt) override;
|
||||
int launchUnitTestsWithConsole() override;
|
||||
void addToRecentFiles(const QString& fileName) override;
|
||||
void showFormattedTextInMessageBoxOrConsole(const QString& errMsg) override;
|
||||
void launchGrpcServer() override;
|
||||
#ifdef ENABLE_GRPC
|
||||
RiaGrpcServer* grpcServer() const override;
|
||||
#endif
|
||||
protected:
|
||||
// Protected RiaApplication overrides
|
||||
void invokeProcessEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) override;
|
||||
void onFileSuccessfullyLoaded(const QString& fileName, RiaDefines::ImportFileType fileType) override;
|
||||
void onProjectBeingOpened() override;
|
||||
void onProjectOpeningError(const QString& errMsg);
|
||||
void onProjectOpened() override;
|
||||
void onProjectBeingClosed() override;
|
||||
void onProjectClosed() override;
|
||||
void startMonitoringWorkProgress(caf::UiProcess* uiProcess) override;
|
||||
void stopMonitoringWorkProgress() override;
|
||||
|
||||
private:
|
||||
void setWindowCaptionFromAppState();
|
||||
|
||||
void createMainWindow();
|
||||
void deleteMainWindow();
|
||||
|
||||
void createMainPlotWindow();
|
||||
void deleteMainPlotWindow();
|
||||
|
||||
void loadAndUpdatePlotData();
|
||||
|
||||
void storeTreeViewState();
|
||||
|
||||
bool notify(QObject *, QEvent *) override;
|
||||
|
||||
private slots:
|
||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void runIdleProcessing();
|
||||
void onProgramExit();
|
||||
|
||||
private:
|
||||
RiuMainWindow* m_mainWindow;
|
||||
RiuPlotMainWindow* m_mainPlotWindow;
|
||||
#ifdef ENABLE_GRPC
|
||||
QPointer<QTimer> m_idleTimer;
|
||||
#endif
|
||||
|
||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||
|
||||
std::unique_ptr<RiuMdiMaximizeWindowGuard> m_maximizeWindowGuard;
|
||||
};
|
@ -16,30 +16,96 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaArgumentParser.h"
|
||||
#include "RiaConsoleApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cvfProgramOptions.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
RiaApplication* createApplication(int &argc, char *argv[])
|
||||
{
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (!qstrcmp(argv[i], "--console") || !qstrcmp(argv[i], "--unittest"))
|
||||
{
|
||||
return new RiaConsoleApplication(argc, argv);
|
||||
}
|
||||
}
|
||||
return new RiaGuiApplication(argc, argv);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifndef WIN32
|
||||
// From Qt 5.3 and onwards Qt has a mechanism for checking this automatically
|
||||
// But it only checks user id not group id, so better to do it ourselves.
|
||||
if (getuid() != geteuid() || getgid() != getegid())
|
||||
{
|
||||
std::cerr << "FATAL: The application binary appears to be running setuid or setgid, this is a security hole." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||
|
||||
RiaApplication app(argc, argv);
|
||||
std::unique_ptr<RiaApplication> app (createApplication(argc, argv));
|
||||
|
||||
cvf::ProgramOptions progOpt;
|
||||
bool result = RiaArgumentParser::parseArguments(&progOpt);
|
||||
|
||||
const cvf::String usageText = progOpt.usageText(110, 30);
|
||||
app->initialize();
|
||||
app->setCommandLineHelpText( cvfqt::Utils::toQString(usageText) );
|
||||
|
||||
if (!result)
|
||||
{
|
||||
std::vector<cvf::String> unknownOptions = progOpt.unknownOptions();
|
||||
QString unknownOptionsText;
|
||||
for (cvf::String option : unknownOptions)
|
||||
{
|
||||
unknownOptionsText += QString("\tUnknown option: %1\n").arg(cvfqt::Utils::toQString(option));
|
||||
}
|
||||
|
||||
app->showFormattedTextInMessageBoxOrConsole("ERROR: Unknown command line options detected ! \n"
|
||||
+ unknownOptionsText
|
||||
+ "\n\n"
|
||||
+ "The current command line options in ResInsight are:\n"
|
||||
+ app->commandLineParameterHelp());
|
||||
|
||||
if (dynamic_cast<RiaGuiApplication*>(app.get()) == nullptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
|
||||
int unitTestResult = app.parseArgumentsAndRunUnitTestsIfRequested();
|
||||
if (unitTestResult > -1)
|
||||
RiaApplication::ApplicationStatus status = app->handleArguments(&progOpt);
|
||||
if (status == RiaApplication::EXIT_COMPLETED)
|
||||
{
|
||||
return unitTestResult;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (app.parseArguments())
|
||||
else if (status == RiaApplication::EXIT_WITH_ERROR)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (status == RiaApplication::KEEP_GOING)
|
||||
{
|
||||
int exitCode = 0;
|
||||
try
|
||||
{
|
||||
exitCode = app.exec();
|
||||
if (app->initializeGrpcServer(progOpt))
|
||||
{
|
||||
app->launchGrpcServer();
|
||||
}
|
||||
exitCode = QCoreApplication::instance()->exec();
|
||||
}
|
||||
catch (std::exception& exep )
|
||||
{
|
||||
@ -55,6 +121,7 @@ int main(int argc, char *argv[])
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
return 0;
|
||||
CVF_ASSERT(false && "Unknown ApplicationStatus");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -223,13 +223,13 @@ QList<caf::PdmOptionItemInfo> RiaMemoryCleanup::calculateValueOptions(const caf:
|
||||
std::vector<RimEclipseCase*> eclipseCases = proj->eclipseCases();
|
||||
for (RimEclipseCase* c : eclipseCases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider()));
|
||||
}
|
||||
|
||||
std::vector<RimGeoMechCase*> geoMechCases = proj->geoMechCases();
|
||||
for (RimGeoMechCase* c : geoMechCases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
@ -30,6 +31,14 @@
|
||||
#include "cafPdmUiFieldHandle.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QDir>
|
||||
#include <QLocale>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
#include <QStandardPaths>
|
||||
#endif
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
@ -40,7 +49,16 @@ namespace caf
|
||||
addItem(RiaPreferences::NOT_IMPORT, "NOT_IMPORT", "Skip");
|
||||
setDefault(RiaPreferences::IMPORT);
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
void RiaPreferences::SummaryHistoryCurveStyleModeType::setUp()
|
||||
{
|
||||
addItem(RiaPreferences::SYMBOLS, "SYMBOLS", "Symbols");
|
||||
addItem(RiaPreferences::LINES, "LINES", "Lines");
|
||||
addItem(RiaPreferences::SYMBOLS_AND_LINES, "SYMBOLS_AND_LINES", "Symbols and Lines");
|
||||
setDefault(RiaPreferences::SYMBOLS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
|
||||
@ -49,12 +67,32 @@ CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaPreferences::RiaPreferences(void)
|
||||
{
|
||||
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_RMS), "Navigation Mode", "", "", "");
|
||||
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaGuiApplication::RINavigationPolicy>(RiaGuiApplication::NAVIGATION_POLICY_RMS), "Navigation Mode", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&enableGrpcServer, "enableGrpcServer", true, "Enable Python Script Server", "", "Remote Procedure Call Scripting Engine", "");
|
||||
CAF_PDM_InitField(&defaultGrpcPortNumber, "defaultGrpcPort", 50051, "Default Python Script Server Port", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "");
|
||||
scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", "");
|
||||
// TODO: This only currently works for installed ResInsight.
|
||||
scriptDirectories = QCoreApplication::applicationDirPath() + "/Python/rips/PythonExamples";
|
||||
|
||||
QString defaultTextEditor;
|
||||
#ifdef WIN32
|
||||
defaultTextEditor = QString("notepad.exe");
|
||||
#else
|
||||
defaultTextEditor = QString("kate");
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
defaultTextEditor = QStandardPaths::findExecutable("kate");
|
||||
if (defaultTextEditor.isEmpty())
|
||||
{
|
||||
defaultTextEditor = QStandardPaths::findExecutable("gedit");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", defaultTextEditor, "Script Editor", "", "", "");
|
||||
scriptEditorExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave Executable Location", "", "", "");
|
||||
@ -64,6 +102,10 @@ RiaPreferences::RiaPreferences(void)
|
||||
CAF_PDM_InitField(&octaveShowHeaderInfoWhenExecutingScripts, "octaveShowHeaderInfoWhenExecutingScripts", false, "Show Text Header When Executing Scripts", "", "", "");
|
||||
octaveShowHeaderInfoWhenExecutingScripts.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitField(&pythonExecutable, "pythonExecutable", QString("python"), "Python Executable Location", "", "", "");
|
||||
pythonExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
pythonExecutable.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||
|
||||
CAF_PDM_InitField(&ssihubAddress, "ssihubAddress", QString("http://"), "SSIHUB Address", "", "", "");
|
||||
ssihubAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||
|
||||
@ -76,11 +118,12 @@ RiaPreferences::RiaPreferences(void)
|
||||
|
||||
CAF_PDM_InitField(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&defaultSceneFontSize, "fontSizeInScene", "Viewer Font Size", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&defaultAnnotationFontSize, "defaultAnnotationFontSize", "Annotation Font Size", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&defaultWellLabelFontSize, "wellLabelFontSize", "Well Label Font Size", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&defaultPlotFontSize, "defaultPlotFontSize", "Plot Font Size", "", "", "");
|
||||
defaultPlotFontSize = RiaFontCache::FONT_SIZE_8;
|
||||
caf::AppEnum<RiaFontCache::FontSize> fontSize = RiaFontCache::FONT_SIZE_8;
|
||||
caf::AppEnum<RiaFontCache::FontSize> plotFontSize = RiaFontCache::FONT_SIZE_10;
|
||||
CAF_PDM_InitField(&defaultSceneFontSize, "fontSizeInScene", fontSize, "Viewer Font Size", "", "", "");
|
||||
CAF_PDM_InitField(&defaultAnnotationFontSize, "defaultAnnotationFontSize", fontSize, "Annotation Font Size", "", "", "");
|
||||
CAF_PDM_InitField(&defaultWellLabelFontSize, "wellLabelFontSize", fontSize, "Well Label Font Size", "", "", "");
|
||||
CAF_PDM_InitField(&defaultPlotFontSize, "defaultPlotFontSize", plotFontSize, "Plot Font Size", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", true, "Show LAS Curve Without TVD Warning", "", "", "");
|
||||
showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
@ -113,6 +156,10 @@ RiaPreferences::RiaPreferences(void)
|
||||
CAF_PDM_InitFieldNoDefault(&summaryRestartFilesShowImportDialog, "summaryRestartFilesShowImportDialog", "Show Import Dialog", "", "", "");
|
||||
CAF_PDM_InitField(&summaryImportMode, "summaryImportMode", SummaryRestartFilesImportModeType(RiaPreferences::IMPORT), "Default Summary Import Option", "", "", "");
|
||||
CAF_PDM_InitField(&gridImportMode, "gridImportMode", SummaryRestartFilesImportModeType(RiaPreferences::NOT_IMPORT), "Default Grid Import Option", "", "", "");
|
||||
CAF_PDM_InitField(&summaryEnsembleImportMode, "summaryEnsembleImportMode", SummaryRestartFilesImportModeType(RiaPreferences::IMPORT), "Default Ensemble Summary Import Option", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&defaultSummaryHistoryCurveStyle, "defaultSummaryHistoryCurveStyle", SummaryHistoryCurveStyleModeType(RiaPreferences::SYMBOLS), "Default Curve Style for History Vectors", "", "", "");
|
||||
CAF_PDM_InitField(&defaultSummaryCurvesTextFilter, "defaultSummaryCurvesTextFilter", QString("FOPT"), "Default Summary Curves", "", "Semicolon separated list of filters used to create curves in new summary plots", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_holoLensExportFolder, "holoLensExportFolder", "HoloLens Export Folder", "", "", "");
|
||||
m_holoLensExportFolder.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||
@ -121,19 +168,20 @@ RiaPreferences::RiaPreferences(void)
|
||||
CAF_PDM_InitField(&holoLensDisableCertificateVerification, "holoLensDisableCertificateVerification", false, "Disable SSL Certificate Verification (HoloLens)", "", "", "");
|
||||
holoLensDisableCertificateVerification.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitField(&csvTextExportFieldSeparator, "csvTextExportFieldSeparator", QString(","), "CSV Text Export Field Separator", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_showProjectChangedDialog, "showProjectChangedDialog", true, "Show 'Project has changed' dialog", "", "", "");
|
||||
m_showProjectChangedDialog.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_readerSettings, "readerSettings", "Reader Settings", "", "", "");
|
||||
m_readerSettings = new RifReaderSettings;
|
||||
CAF_PDM_InitFieldNoDefault(&m_dateFormat, "dateFormat", "Date Format", "", "", "");
|
||||
m_dateFormat.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
|
||||
m_dateFormat = RiaQDateTimeTools::supportedDateFormats().front();
|
||||
|
||||
m_tabNames << "General";
|
||||
m_tabNames << "Eclipse";
|
||||
m_tabNames << "Octave";
|
||||
if (RiaApplication::enableDevelopmentFeatures())
|
||||
{
|
||||
m_tabNames << "System";
|
||||
}
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeFormat, "timeFormat", "Time Format", "", "", "");
|
||||
m_timeFormat.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
|
||||
m_timeFormat = RiaQDateTimeTools::supportedTimeFormats().front();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -201,7 +249,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
if (uiConfigName == m_tabNames[0])
|
||||
if (uiConfigName == RiaPreferences::tabNameGeneral())
|
||||
{
|
||||
caf::PdmUiGroup* colorGroup = uiOrdering.addNewGroup("Default Colors");
|
||||
colorGroup->add(&defaultViewerBackgroundColor);
|
||||
@ -228,7 +276,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
otherGroup->add(&showLasCurveWithoutTvdWarning);
|
||||
otherGroup->add(&holoLensDisableCertificateVerification);
|
||||
}
|
||||
else if (uiConfigName == m_tabNames[1])
|
||||
else if (uiConfigName == RiaPreferences::tabNameEclipse())
|
||||
{
|
||||
caf::PdmUiGroup* newCaseBehaviourGroup = uiOrdering.addNewGroup("Behavior When Loading Data");
|
||||
newCaseBehaviourGroup->add(&autocomputeDepthRelatedProperties);
|
||||
@ -238,22 +286,50 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
|
||||
caf::PdmUiGroup* restartBehaviourGroup = uiOrdering.addNewGroup("Origin Files");
|
||||
restartBehaviourGroup->add(&summaryRestartFilesShowImportDialog);
|
||||
caf::PdmUiGroup* summaryImportOptionGroup = restartBehaviourGroup->addNewGroup("Origin Summary Files");
|
||||
summaryImportOptionGroup->add(&summaryImportMode);
|
||||
caf::PdmUiGroup* gridImportOptionGroup = restartBehaviourGroup->addNewGroup("Origin Grid Files");
|
||||
gridImportOptionGroup->add(&gridImportMode);
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = restartBehaviourGroup->addNewGroup("Origin Summary Files");
|
||||
group->add(&summaryImportMode);
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = restartBehaviourGroup->addNewGroup("Origin Grid Files");
|
||||
group->add(&gridImportMode);
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = restartBehaviourGroup->addNewGroup("Origin Ensemble Summary Files");
|
||||
group->add(&summaryEnsembleImportMode);
|
||||
}
|
||||
}
|
||||
else if (uiConfigName == m_tabNames[2])
|
||||
else if (uiConfigName == RiaPreferences::tabNamePlotting())
|
||||
{
|
||||
uiOrdering.add(&defaultSummaryCurvesTextFilter);
|
||||
uiOrdering.add(&defaultSummaryHistoryCurveStyle);
|
||||
uiOrdering.add(&m_dateFormat);
|
||||
uiOrdering.add(&m_timeFormat);
|
||||
}
|
||||
else if (uiConfigName == RiaPreferences::tabNameScripting())
|
||||
{
|
||||
caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup("Octave");
|
||||
octaveGroup->add(&octaveExecutable);
|
||||
octaveGroup->add(&octaveShowHeaderInfoWhenExecutingScripts);
|
||||
|
||||
#ifdef ENABLE_GRPC
|
||||
caf::PdmUiGroup* pythonGroup = uiOrdering.addNewGroup("Python");
|
||||
pythonGroup->add(&enableGrpcServer);
|
||||
pythonGroup->add(&defaultGrpcPortNumber);
|
||||
pythonGroup->add(&pythonExecutable);
|
||||
#endif
|
||||
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Script files");
|
||||
scriptGroup->add(&scriptDirectories);
|
||||
scriptGroup->add(&scriptEditorExecutable);
|
||||
}
|
||||
else if (RiaApplication::enableDevelopmentFeatures() && uiConfigName == m_tabNames[3])
|
||||
else if (uiConfigName == RiaPreferences::tabNameExport())
|
||||
{
|
||||
uiOrdering.add(&csvTextExportFieldSeparator);
|
||||
}
|
||||
else if (RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem())
|
||||
{
|
||||
uiOrdering.add(&m_appendClassNameToUiText);
|
||||
uiOrdering.add(&m_appendFieldKeywordToToolTipText);
|
||||
@ -285,16 +361,123 @@ QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions(const caf::P
|
||||
options.push_back(caf::PdmOptionItemInfo(skip.uiText(), RiaPreferences::NOT_IMPORT));
|
||||
options.push_back(caf::PdmOptionItemInfo(separate.uiText(), RiaPreferences::SEPARATE_CASES));
|
||||
}
|
||||
else if (fieldNeedingOptions == &summaryEnsembleImportMode)
|
||||
{
|
||||
// Manual option handling in order to one only a subset of the enum values
|
||||
SummaryRestartFilesImportModeType skip(RiaPreferences::NOT_IMPORT);
|
||||
SummaryRestartFilesImportModeType allowImport(RiaPreferences::IMPORT);
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(skip.uiText(), RiaPreferences::NOT_IMPORT));
|
||||
options.push_back(caf::PdmOptionItemInfo(allowImport.uiText(), RiaPreferences::IMPORT));
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_dateFormat)
|
||||
{
|
||||
for (auto dateFormat : RiaQDateTimeTools::supportedDateFormats())
|
||||
{
|
||||
QDate exampleDate = QDate(2019, 8, 16);
|
||||
QString fullDateFormat =
|
||||
RiaQDateTimeTools::dateFormatString(dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY);
|
||||
QString uiText = QString("%1 (%2)").arg(fullDateFormat).arg(exampleDate.toString(fullDateFormat));
|
||||
uiText.replace("AP", "AM/PM");
|
||||
options.push_back(caf::PdmOptionItemInfo(uiText, QVariant::fromValue(dateFormat)));
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_timeFormat)
|
||||
{
|
||||
for (auto timeFormat : RiaQDateTimeTools::supportedTimeFormats())
|
||||
{
|
||||
QTime exampleTime = QTime(15, 48, 22);
|
||||
QString timeFormatString =
|
||||
RiaQDateTimeTools::timeFormatString(timeFormat, RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND);
|
||||
QString uiText = QString("%1 (%2)").arg(timeFormatString).arg(exampleTime.toString(timeFormatString));
|
||||
uiText.replace("AP", "AM/PM");
|
||||
options.push_back(caf::PdmOptionItemInfo(uiText, QVariant::fromValue(timeFormat)));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferences::initAfterRead()
|
||||
{
|
||||
// If the stored font size is larger than the maximum enum value, the stored font size is actually point size
|
||||
int defaultSceneFontEnumValue = static_cast<int>(defaultSceneFontSize.v());
|
||||
if (defaultSceneFontEnumValue > (int) RiaFontCache::MAX_FONT_SIZE)
|
||||
{
|
||||
defaultSceneFontSize = RiaFontCache::fontSizeEnumFromPointSize(defaultSceneFontEnumValue);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNameGeneral()
|
||||
{
|
||||
return "General";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNameEclipse()
|
||||
{
|
||||
return "Eclipse";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNamePlotting()
|
||||
{
|
||||
return "Plotting";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNameScripting()
|
||||
{
|
||||
return "Scripting";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNameExport()
|
||||
{
|
||||
return "Export";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNameSystem()
|
||||
{
|
||||
return "System";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaPreferences::tabNames()
|
||||
{
|
||||
return m_tabNames;
|
||||
QStringList names;
|
||||
|
||||
names << tabNameGeneral();
|
||||
names << tabNameEclipse();
|
||||
names << tabNamePlotting();
|
||||
names << tabNameScripting();
|
||||
names << tabNameExport();
|
||||
|
||||
if (RiaApplication::enableDevelopmentFeatures())
|
||||
{
|
||||
names << tabNameSystem();
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -358,6 +541,22 @@ QString RiaPreferences::holoLensExportFolder() const
|
||||
return m_holoLensExportFolder();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RiaPreferences::dateFormat() const
|
||||
{
|
||||
return m_dateFormat();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RiaPreferences::timeFormat() const
|
||||
{
|
||||
return m_timeFormat();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -22,9 +22,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaFontCache.h"
|
||||
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildField.h"
|
||||
@ -47,6 +48,14 @@ public:
|
||||
typedef caf::AppEnum<SummaryRestartFilesImportMode> SummaryRestartFilesImportModeType;
|
||||
typedef RiaFontCache::FontSizeType FontSizeType;
|
||||
|
||||
enum SummaryHistoryCurveStyleMode
|
||||
{
|
||||
SYMBOLS,
|
||||
LINES,
|
||||
SYMBOLS_AND_LINES
|
||||
};
|
||||
typedef caf::AppEnum<SummaryHistoryCurveStyleMode> SummaryHistoryCurveStyleModeType;
|
||||
|
||||
RiaPreferences(void);
|
||||
~RiaPreferences(void) override;
|
||||
|
||||
@ -62,10 +71,16 @@ public:
|
||||
bool showProjectChangedDialog() const;
|
||||
QString holoLensExportFolder() const;
|
||||
|
||||
const QString& dateFormat() const;
|
||||
const QString& timeFormat() const;
|
||||
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
|
||||
|
||||
public: // Pdm Fields
|
||||
caf::PdmField<caf::AppEnum< RiaApplication::RINavigationPolicy > > navigationPolicy;
|
||||
caf::PdmField<caf::AppEnum< RiaGuiApplication::RINavigationPolicy > > navigationPolicy;
|
||||
|
||||
caf::PdmField<bool> enableGrpcServer;
|
||||
caf::PdmField<int> defaultGrpcPortNumber;
|
||||
|
||||
caf::PdmField<QString> scriptDirectories;
|
||||
caf::PdmField<QString> scriptEditorExecutable;
|
||||
@ -73,6 +88,8 @@ public: // Pdm Fields
|
||||
caf::PdmField<QString> octaveExecutable;
|
||||
caf::PdmField<bool> octaveShowHeaderInfoWhenExecutingScripts;
|
||||
|
||||
caf::PdmField<QString> pythonExecutable;
|
||||
|
||||
caf::PdmField<QString> ssihubAddress;
|
||||
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::MeshModeType>> defaultMeshModeType;
|
||||
@ -102,13 +119,26 @@ public: // Pdm Fields
|
||||
caf::PdmField<bool> summaryRestartFilesShowImportDialog;
|
||||
caf::PdmField<SummaryRestartFilesImportModeType> summaryImportMode;
|
||||
caf::PdmField<SummaryRestartFilesImportModeType> gridImportMode;
|
||||
caf::PdmField<SummaryRestartFilesImportModeType> summaryEnsembleImportMode;
|
||||
|
||||
caf::PdmField<QString> defaultSummaryCurvesTextFilter;
|
||||
caf::PdmField<SummaryHistoryCurveStyleModeType> defaultSummaryHistoryCurveStyle;
|
||||
|
||||
caf::PdmField<bool> holoLensDisableCertificateVerification;
|
||||
caf::PdmField<QString> csvTextExportFieldSeparator;
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
void initAfterRead() override;
|
||||
private:
|
||||
static QString tabNameGeneral();
|
||||
static QString tabNameEclipse();
|
||||
static QString tabNamePlotting();
|
||||
static QString tabNameScripting();
|
||||
static QString tabNameExport();
|
||||
static QString tabNameSystem();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RifReaderSettings*> m_readerSettings;
|
||||
@ -120,6 +150,7 @@ private:
|
||||
caf::PdmField<bool> m_showTestToolbar;
|
||||
caf::PdmField<bool> m_includeFractureDebugInfoFile;
|
||||
caf::PdmField<QString> m_holoLensExportFolder;
|
||||
caf::PdmField<QString> m_dateFormat;
|
||||
caf::PdmField<QString> m_timeFormat;
|
||||
QStringList m_tabNames;
|
||||
|
||||
};
|
||||
|
@ -26,8 +26,8 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition()
|
||||
: m_summaryCase(nullptr)
|
||||
, m_ensemble(nullptr)
|
||||
: m_summaryCase(nullptr)
|
||||
, m_ensemble(nullptr)
|
||||
|
||||
{
|
||||
}
|
||||
@ -35,14 +35,13 @@ RiaSummaryCurveDefinition::RiaSummaryCurveDefinition()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition(RimSummaryCase* summaryCase,
|
||||
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition(RimSummaryCase* summaryCase,
|
||||
const RifEclipseSummaryAddress& summaryAddress,
|
||||
RimSummaryCaseCollection* ensemble)
|
||||
RimSummaryCaseCollection* ensemble)
|
||||
: m_summaryCase(summaryCase)
|
||||
, m_ensemble(ensemble)
|
||||
, m_summaryAddress(summaryAddress)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -77,7 +76,6 @@ bool RiaSummaryCurveDefinition::isEnsembleCurve() const
|
||||
return m_ensemble != nullptr;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -116,8 +114,10 @@ const std::vector<time_t>& RiaSummaryCurveDefinition::timeSteps(const RiaSummary
|
||||
QString RiaSummaryCurveDefinition::curveDefinitionText() const
|
||||
{
|
||||
QString caseName;
|
||||
if (summaryCase() ) caseName = summaryCase()->caseName();
|
||||
else if (ensemble()) caseName = ensemble()->name();
|
||||
if (summaryCase())
|
||||
caseName = summaryCase()->caseName();
|
||||
else if (ensemble())
|
||||
caseName = ensemble()->name();
|
||||
|
||||
return RiaSummaryCurveDefinition::curveDefinitionText(caseName, summaryAddress());
|
||||
}
|
||||
@ -142,6 +142,7 @@ QString RiaSummaryCurveDefinition::curveDefinitionText(const QString& caseName,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaSummaryCurveDefinition::operator<(const RiaSummaryCurveDefinition& other) const
|
||||
{
|
||||
if (m_ensemble != other.ensemble())
|
||||
{
|
||||
QString ensembleName;
|
||||
QString otherEnsembleName;
|
||||
@ -156,12 +157,17 @@ bool RiaSummaryCurveDefinition::operator<(const RiaSummaryCurveDefinition& other
|
||||
otherEnsembleName = other.ensemble()->name();
|
||||
}
|
||||
|
||||
// First check if names are different to ensure stable alphabetic sort
|
||||
if (ensembleName != otherEnsembleName)
|
||||
{
|
||||
return ensembleName < otherEnsembleName;
|
||||
}
|
||||
|
||||
// Use pointer address, sorting will be be unstable
|
||||
return m_ensemble < other.ensemble();
|
||||
}
|
||||
|
||||
if (m_summaryCase != other.summaryCase())
|
||||
{
|
||||
QString summaryCaseName;
|
||||
QString otherSummaryCaseName;
|
||||
@ -175,12 +181,15 @@ bool RiaSummaryCurveDefinition::operator<(const RiaSummaryCurveDefinition& other
|
||||
otherSummaryCaseName = other.summaryCase()->caseName();
|
||||
}
|
||||
|
||||
// First check if names are different to ensure stable alphabetic sort
|
||||
if (summaryCaseName != otherSummaryCaseName)
|
||||
{
|
||||
return summaryCaseName < otherSummaryCaseName;
|
||||
}
|
||||
|
||||
// Use pointer address, sorting will be be unstable
|
||||
return m_summaryCase < other.summaryCase();
|
||||
}
|
||||
|
||||
return (m_summaryAddress < other.summaryAddress());
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaArgumentParser.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaBaseDefs.h"
|
||||
#include "RiaEclipseFileNameTools.h"
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
@ -50,489 +48,86 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaArgumentParser::parseArguments()
|
||||
bool RiaArgumentParser::parseArguments(cvf::ProgramOptions* progOpt)
|
||||
{
|
||||
cvf::ProgramOptions progOpt;
|
||||
progOpt.registerOption("last", "", "Open last used project.");
|
||||
progOpt.registerOption("project", "<filename>", "Open project file <filename>.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("case",
|
||||
"<casename>",
|
||||
"Import Eclipse case <casename> (do not include the .GRID/.EGRID extension.)",
|
||||
cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption("startdir", "<folder>", "Set startup directory.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("savesnapshots",
|
||||
"all|views|plots",
|
||||
"Save snapshot of all views or plots to project file location sub folder 'snapshots'. Option 'all' "
|
||||
"will include both views and plots. Application closes after snapshots have been written.",
|
||||
cvf::ProgramOptions::OPTIONAL_MULTI_VALUE);
|
||||
progOpt.registerOption(
|
||||
"size", "<width> <height>", "Set size of the main application window.", cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption(
|
||||
"replaceCase",
|
||||
"[<caseId>] <newGridFile>",
|
||||
"Replace grid in <caseId> or first case with <newgridFile>. Repeat parameter for multiple replace operations.",
|
||||
cvf::ProgramOptions::MULTI_VALUE,
|
||||
cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt.registerOption("replaceSourceCases",
|
||||
"[<caseGroupId>] <gridListFile>",
|
||||
"Replace source cases in <caseGroupId> or first grid case group with the grid files listed in the "
|
||||
"<gridListFile> file. Repeat parameter for multiple replace operations.",
|
||||
cvf::ProgramOptions::MULTI_VALUE,
|
||||
cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt.registerOption("replacePropertiesFolder",
|
||||
"[<caseId>] <newPropertiesFolder>",
|
||||
"Replace the folder containing property files for an eclipse input case.",
|
||||
cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption("multiCaseSnapshots",
|
||||
"<gridListFile>",
|
||||
"For each grid file listed in the <gridListFile> file, replace the first case in the project and save "
|
||||
"snapshot of all views.",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("commandFile", "<commandfile>", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption(
|
||||
"commandFileProject",
|
||||
"<filename>",
|
||||
"Project to use if performing case looping for command file. Used in conjunction with 'commandFileReplaceCases'.",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("commandFileReplaceCases",
|
||||
"[<caseId>] <caseListFile>",
|
||||
"Supply list of cases to replace in project, performing command file for each case.",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("help", "", "Displays help text.");
|
||||
progOpt.registerOption("?", "", "Displays help text.");
|
||||
progOpt.registerOption("regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("unittest", "", "System command");
|
||||
progOpt.registerOption("ignoreArgs", "", "Ignore all arguments. Mostly for testing purposes");
|
||||
CVF_ASSERT(progOpt);
|
||||
progOpt->registerOption("help", "", "Displays help text and exits.");
|
||||
progOpt->registerOption("?", "", "Displays help text and exits.");
|
||||
|
||||
progOpt.setOptionPrefix(cvf::ProgramOptions::DOUBLE_DASH);
|
||||
progOpt->registerOption("project", "<filename>", "Open project file <filename>.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("last", "", "Open last used project.");
|
||||
progOpt->registerOption("case",
|
||||
"<casename|filename> [<casename|filename> ...]",
|
||||
"Imports the Eclipse cases specified by case name with or without extension."
|
||||
"If <casename>, import the corresponding grid file and summary file"
|
||||
"If <filename> has extension .GRRID/.EGRID, import the grid file and corresponding summary file"
|
||||
"If <filename> has extension .SMSPEC, import the summary file (does not open the corresponding grid file)",
|
||||
cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt->registerOption("size", "<width> <height>", "Set size of the main application window.", cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt->registerOption("console", "", "Launch as a console application without graphics");
|
||||
progOpt->registerOption("server", "[<portnumber>]", "Launch as a GRPC server. Default port is 50051", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("startdir", "<folder>", "Set startup directory.\n", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
|
||||
QString helpText = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(RiaApplication::getVersionStringApp(false));
|
||||
helpText += "Copyright Equinor ASA, Ceetron Solution AS, Ceetron AS\n\n";
|
||||
progOpt->registerOption("commandFile", "<commandfile>", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("commandFileReplaceCases",
|
||||
"[<caseId>] <caseListFile>",
|
||||
"Supply list of cases to replace in project, performing command file for each case.",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("commandFileProject",
|
||||
"<filename>",
|
||||
"Project to use if performing case looping for command file. Used in conjunction with 'commandFileReplaceCases'.\n",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
|
||||
const cvf::String usageText = progOpt.usageText(110, 30);
|
||||
helpText += cvfqt::Utils::toQString(usageText);
|
||||
progOpt->registerOption("savesnapshots",
|
||||
"all|views|plots",
|
||||
"Save snapshot of all views or plots to project file location sub folder 'snapshots'. Option 'all' "
|
||||
"will include both views and plots. Application closes after snapshots have been written.",
|
||||
cvf::ProgramOptions::OPTIONAL_MULTI_VALUE);
|
||||
progOpt->registerOption("multiCaseSnapshots",
|
||||
"<gridListFile>",
|
||||
"For each grid file listed in the <gridListFile> file, replace the first case in the project and save "
|
||||
"snapshots of all views.\n",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
|
||||
RiaApplication::instance()->setHelpText(helpText);
|
||||
progOpt->registerOption("replaceCase",
|
||||
"[<caseId>] <newGridFile>",
|
||||
"Replace grid in <caseId> or first case with <newgridFile>. Repeat parameter for multiple replace operations.",
|
||||
cvf::ProgramOptions::MULTI_VALUE,
|
||||
cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt->registerOption("replaceSourceCases",
|
||||
"[<caseGroupId>] <gridListFile>",
|
||||
"Replace source cases in <caseGroupId> or first grid case group with the grid files listed in the "
|
||||
"<gridListFile> file. Repeat parameter for multiple replace operations.",
|
||||
cvf::ProgramOptions::MULTI_VALUE,
|
||||
cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt->registerOption("replacePropertiesFolder",
|
||||
"[<caseId>] <newPropertiesFolder>",
|
||||
"Replace the folder containing property files for an eclipse input case.\n",
|
||||
cvf::ProgramOptions::MULTI_VALUE);
|
||||
|
||||
|
||||
progOpt->registerOption("updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
#ifdef USE_UNIT_TESTS
|
||||
progOpt->registerOption("unittest", "", "System command");
|
||||
#endif
|
||||
progOpt->registerOption("ignoreArgs", "", "System command. Ignore all arguments. Mostly for testing purposes");
|
||||
|
||||
progOpt->setOptionPrefix(cvf::ProgramOptions::DOUBLE_DASH);
|
||||
|
||||
QStringList arguments = QCoreApplication::arguments();
|
||||
|
||||
bool parseOk = progOpt.parse(cvfqt::Utils::toStringVector(arguments));
|
||||
bool parseOk = progOpt->parse(cvfqt::Utils::toStringVector(arguments));
|
||||
|
||||
// If positional parameter functionality is to be supported, the test for existence of positionalParameters must be removed
|
||||
// This is based on a pull request by @andlaus https://github.com/OPM/ResInsight/pull/162
|
||||
if (!parseOk || progOpt.hasOption("help") || progOpt.hasOption("?") || !progOpt.positionalParameters().empty())
|
||||
if (!parseOk || !progOpt->positionalParameters().empty())
|
||||
{
|
||||
#if defined(_MSC_VER) && defined(_WIN32)
|
||||
RiaApplication::instance()->showFormattedTextInMessageBox(helpText);
|
||||
#else
|
||||
fprintf(stdout, "%s\n", helpText.toLatin1().data());
|
||||
fflush(stdout);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handling of the actual command line options
|
||||
// --------------------------------------------------------
|
||||
|
||||
if (cvf::Option o = progOpt.option("ignoreArgs"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("regressiontest"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
QString regressionTestPath = cvfqt::Utils::toQString(o.value(0));
|
||||
|
||||
// Use a logger writing to stdout instead of message panel
|
||||
// This is useful when executing regression tests on a build server, and this is the reason for creating the logger when
|
||||
// parsing the command line options
|
||||
auto stdLogger = new RiaStdOutLogger;
|
||||
stdLogger->setLevel(RI_LL_DEBUG);
|
||||
|
||||
RiaLogging::setLoggerInstance(stdLogger);
|
||||
|
||||
RiaRegressionTestRunner::instance()->executeRegressionTests(regressionTestPath, QStringList());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("updateregressiontestbase"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
QString regressionTestPath = cvfqt::Utils::toQString(o.value(0));
|
||||
RiaRegressionTestRunner::instance()->updateRegressionTest(regressionTestPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("startdir"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
RiaApplication::instance()->setStartDir(cvfqt::Utils::toQString(o.value(0)));
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("size"))
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
int width = o.safeValue(0).toInt(-1);
|
||||
int height = o.safeValue(1).toInt(-1);
|
||||
if (mainWnd && width > 0 && height > 0)
|
||||
{
|
||||
mainWnd->resize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
QString projectFileName;
|
||||
|
||||
if (progOpt.hasOption("last"))
|
||||
{
|
||||
projectFileName = RiaApplication::instance()->preferences()->lastUsedProjectFileName;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("project"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
projectFileName = cvfqt::Utils::toQString(o.value(0));
|
||||
}
|
||||
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
if (cvf::Option o = progOpt.option("multiCaseSnapshots"))
|
||||
{
|
||||
QString gridListFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
std::vector<QString> gridFiles = RiaApplication::readFileListFromTextFile(gridListFile);
|
||||
RiaApplication::instance()->runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
cvf::ref<RiaProjectModifier> projectModifier;
|
||||
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::PLA_NONE;
|
||||
|
||||
if (cvf::Option o = progOpt.option("replaceCase"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplaceCaseFirstOccurrence(gridFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !gridFileName.isEmpty())
|
||||
{
|
||||
projectModifier->setReplaceCase(caseId, gridFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("replaceSourceCases"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
std::vector<QString> gridFileNames =
|
||||
RiaApplication::readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0)));
|
||||
projectModifier->setReplaceSourceCasesFirstOccurrence(gridFileNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int groupId = o.safeValue(optionIdx++).toInt(-1);
|
||||
std::vector<QString> gridFileNames =
|
||||
RiaApplication::readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(optionIdx++)));
|
||||
|
||||
if (groupId != -1 && !gridFileNames.empty())
|
||||
{
|
||||
projectModifier->setReplaceSourceCasesById(groupId, gridFileNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectLoadAction = RiaApplication::PLA_CALCULATE_STATISTICS;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("replacePropertiesFolder"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplacePropertiesFolderFirstOccurrence(propertiesFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !propertiesFolder.isEmpty())
|
||||
{
|
||||
projectModifier->setReplacePropertiesFolder(caseId, propertiesFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(projectFileName, projectLoadAction, projectModifier.p());
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("case"))
|
||||
{
|
||||
QStringList caseNames = cvfqt::Utils::toQStringList(o.values());
|
||||
for (const QString& caseName : caseNames)
|
||||
{
|
||||
openCaseFromCommandLineParameter(caseName);
|
||||
}
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("savesnapshots"))
|
||||
{
|
||||
bool snapshotViews = false;
|
||||
bool snapshotPlots = false;
|
||||
|
||||
QStringList snapshotItemTexts = cvfqt::Utils::toQStringList(o.values());
|
||||
if (snapshotItemTexts.empty())
|
||||
{
|
||||
// No options will keep backwards compatibility before we introduced snapshot of plots
|
||||
snapshotViews = true;
|
||||
}
|
||||
|
||||
for (const QString& s : snapshotItemTexts)
|
||||
{
|
||||
if (s.toLower() == "all")
|
||||
{
|
||||
snapshotViews = true;
|
||||
snapshotPlots = true;
|
||||
}
|
||||
else if (s.toLower() == "views")
|
||||
{
|
||||
snapshotViews = true;
|
||||
}
|
||||
else if (s.toLower() == "plots")
|
||||
{
|
||||
snapshotPlots = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (RiaApplication::instance()->project() != nullptr && !RiaApplication::instance()->project()->fileName().isEmpty())
|
||||
{
|
||||
if (snapshotViews)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
CVF_ASSERT(mainWnd);
|
||||
mainWnd->hideAllDockWindows();
|
||||
|
||||
// 2016-11-09 : Location of snapshot folder was previously located in 'snapshot' folder
|
||||
// relative to current working folder. Now harmonized to behave as RiuMainWindow::slotSnapshotAllViewsToFile()
|
||||
QString absolutePathToSnapshotDir =
|
||||
RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("snapshots");
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir);
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
|
||||
if (snapshotPlots)
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
RiaApplication::instance()->mainPlotWindow()->hideAllDockWindows();
|
||||
|
||||
// Will be saved relative to current directory
|
||||
RicSnapshotAllPlotsToFileFeature::saveAllPlots();
|
||||
|
||||
RiaApplication::instance()->mainPlotWindow()->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returning false will exit the application
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("commandFile"))
|
||||
{
|
||||
QString commandFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
|
||||
cvf::Option projectOption = progOpt.option("commandFileProject");
|
||||
cvf::Option caseOption = progOpt.option("commandFileReplaceCases");
|
||||
if (projectOption && caseOption)
|
||||
{
|
||||
projectFileName = cvfqt::Utils::toQString(projectOption.value(0));
|
||||
|
||||
std::vector<int> caseIds;
|
||||
std::vector<QString> caseListFiles;
|
||||
|
||||
if (caseOption.valueCount() == 1)
|
||||
{
|
||||
caseListFiles.push_back(cvfqt::Utils::toQString(caseOption.safeValue(0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < caseOption.valueCount())
|
||||
{
|
||||
const int caseId = caseOption.safeValue(optionIdx++).toInt(-1);
|
||||
QString caseListFile = cvfqt::Utils::toQString(caseOption.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !caseListFile.isEmpty())
|
||||
{
|
||||
caseIds.push_back(caseId);
|
||||
caseListFiles.push_back(caseListFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caseIds.empty() && !caseListFiles.empty())
|
||||
{
|
||||
QString caseListFile = caseListFiles[0];
|
||||
std::vector<QString> caseFiles = RiaApplication::readFileListFromTextFile(caseListFile);
|
||||
for (const QString& caseFile : caseFiles)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
projectModifier.setReplaceCaseFirstOccurrence(caseFile);
|
||||
RiaApplication::instance()->loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(caseIds.size() == caseListFiles.size());
|
||||
|
||||
std::vector<std::vector<QString>> allCaseFiles;
|
||||
size_t maxFiles = 0;
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
std::vector<QString> caseFiles = RiaApplication::readFileListFromTextFile(caseListFiles[i]);
|
||||
allCaseFiles.push_back(caseFiles);
|
||||
maxFiles = std::max(caseFiles.size(), maxFiles);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
for (size_t j = 0; j < maxFiles; ++j)
|
||||
{
|
||||
if (allCaseFiles[i].size() > j)
|
||||
{
|
||||
projectModifier.setReplaceCase(caseIds[i], allCaseFiles[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaArgumentParser::executeCommandFile(const QString& commandFile)
|
||||
{
|
||||
QFile file(commandFile);
|
||||
RicfMessages messages;
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
// TODO : Error logging?
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream in(&file);
|
||||
RicfCommandFileExecutor::instance()->executeCommands(in);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaArgumentParser::openCaseFromCommandLineParameter(const QString& parameter)
|
||||
{
|
||||
if (RiaEclipseFileNameTools::isProjectFile(parameter))
|
||||
{
|
||||
return RiaApplication::instance()->loadProject(parameter);
|
||||
}
|
||||
|
||||
QStringList gridFileNames;
|
||||
QStringList summarySpecFileNames;
|
||||
|
||||
if (RiaEclipseFileNameTools::isGridFile(parameter))
|
||||
{
|
||||
QFileInfo fi(parameter);
|
||||
|
||||
gridFileNames.push_back(fi.absoluteFilePath());
|
||||
}
|
||||
else if (RiaEclipseFileNameTools::isSummarySpecFile(parameter))
|
||||
{
|
||||
QFileInfo fi(parameter);
|
||||
|
||||
summarySpecFileNames.push_back(fi.absoluteFilePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaEclipseFileNameTools fileNameTools(parameter);
|
||||
|
||||
{
|
||||
QString gridFileName = fileNameTools.findRelatedGridFile();
|
||||
if (!gridFileName.isEmpty())
|
||||
{
|
||||
gridFileNames.push_back(gridFileName);
|
||||
}
|
||||
}
|
||||
|
||||
QString summarySpecFileName = fileNameTools.findRelatedSummarySpecFile();
|
||||
if (!summarySpecFileName.isEmpty())
|
||||
{
|
||||
summarySpecFileNames.push_back(summarySpecFileName);
|
||||
}
|
||||
}
|
||||
|
||||
bool openCaseResult = true;
|
||||
|
||||
// Open summary cases first. Then, the open of grid file will not open an already open summary case file
|
||||
if (!summarySpecFileNames.empty())
|
||||
{
|
||||
openCaseResult &= RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(summarySpecFileNames);
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
}
|
||||
|
||||
for (const auto& f : gridFileNames)
|
||||
{
|
||||
openCaseResult &= RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({f}), nullptr, true);
|
||||
}
|
||||
|
||||
return openCaseResult;
|
||||
}
|
||||
|
@ -20,6 +20,10 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ProgramOptions;
|
||||
}
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@ -28,10 +32,6 @@
|
||||
class RiaArgumentParser
|
||||
{
|
||||
public:
|
||||
static bool parseArguments();
|
||||
|
||||
private:
|
||||
static void executeCommandFile(const QString& commandFile);
|
||||
static bool openCaseFromCommandLineParameter(const QString& parameter);
|
||||
static bool parseArguments(cvf::ProgramOptions* progOpt);
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMath.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -141,6 +142,18 @@ cvf::Color3f RiaColorTools::fromQColorTo3f(QColor color)
|
||||
return cvf::Color3f(color.redF(), color.greenF(), color.blueF());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QColor RiaColorTools::blendQColors(const QColor& color1, const QColor& color2, int weight1 /*= 1*/, int weight2 /*= 1*/)
|
||||
{
|
||||
CVF_ASSERT(weight1 > 0 && weight2 > 0);
|
||||
int weightsum = weight1 + weight2;
|
||||
return QColor((color1.red() * weight1 + color2.red() * weight2) / weightsum,
|
||||
(color1.green() * weight1 + color2.green() * weight2) / weightsum,
|
||||
(color1.blue() * weight1 + color2.blue() * weight2) / weightsum);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -43,6 +43,8 @@ public:
|
||||
static QColor toQColor(cvf::Color4f color);
|
||||
static cvf::Color3f fromQColorTo3f(QColor);
|
||||
|
||||
static QColor blendQColors(const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1);
|
||||
|
||||
private:
|
||||
static float relativeLuminance(cvf::Color3f backgroundColor);
|
||||
static float calculateNonLinearColorValue(float colorFraction);
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaFilePathTools.h"
|
||||
#include <QDir>
|
||||
#include <set>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -112,3 +113,52 @@ std::pair<QString, QString> RiaFilePathTools::toFolderAndFileName(const QString&
|
||||
return std::make_pair("", absFN);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaFilePathTools::removeDuplicatePathSeparators(const QString& path)
|
||||
{
|
||||
QString correctedPath = path;
|
||||
int len;
|
||||
do
|
||||
{
|
||||
len = correctedPath.size();
|
||||
correctedPath.replace(QString("%1%1").arg(SEPARATOR), SEPARATOR);
|
||||
} while (correctedPath.size() != len);
|
||||
|
||||
return correctedPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaFilePathTools::rootSearchPathFromSearchFilter(const QString& searchFilter)
|
||||
{
|
||||
std::set<QChar> globStartCharacters = {'*', '?', '['}; // ']' not needed
|
||||
|
||||
QStringList pathPartList = searchFilter.split(SEPARATOR);
|
||||
|
||||
QStringList::iterator pathPartIt= pathPartList.begin();
|
||||
|
||||
for ( ; pathPartIt != pathPartList.end(); ++pathPartIt)
|
||||
{
|
||||
QString pathPart = *pathPartIt;
|
||||
|
||||
// Remove allowed escaping of wildcards
|
||||
|
||||
pathPart.replace("[[]", "");
|
||||
pathPart.replace("[]]", "");
|
||||
pathPart.replace("[?]", "");
|
||||
pathPart.replace("[*]", "");
|
||||
|
||||
if (pathPart.contains("*")) break;
|
||||
if (pathPart.contains("?")) break;
|
||||
if (pathPart.contains("[")) break;
|
||||
|
||||
}
|
||||
|
||||
pathPartList.erase(pathPartIt, pathPartList.end());
|
||||
|
||||
return pathPartList.join(SEPARATOR);
|
||||
}
|
||||
|
@ -40,4 +40,6 @@ public:
|
||||
static bool equalPaths(const QString& path1, const QString& path2);
|
||||
static QString canonicalPath(const QString& path);
|
||||
static std::pair<QString, QString> toFolderAndFileName(const QString& absFileName);
|
||||
static QString removeDuplicatePathSeparators(const QString& path);
|
||||
static QString rootSearchPathFromSearchFilter(const QString& searchFilter);
|
||||
};
|
||||
|
@ -18,10 +18,14 @@
|
||||
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "ApplicationCommands/RicShowMainWindowFeature.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||
#include "SummaryPlotCommands/RicNewSummaryCurveFeature.h"
|
||||
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
@ -67,7 +71,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& fileNames, QStringList* openedFiles, bool noDialog)
|
||||
bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& fileNames, FileCaseIdMap* openedFilesOut, bool noDialog)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* project = app->project();
|
||||
@ -78,12 +82,15 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& file
|
||||
selector.determineFilesToImportFromGridFiles(fileNames);
|
||||
std::vector<RifSummaryCaseFileResultInfo> summaryFileInfos = selector.summaryFileInfos();
|
||||
|
||||
FileCaseIdMap openedFiles;
|
||||
|
||||
// Import eclipse case files
|
||||
for (const QString& gridCaseFile : selector.gridCaseFiles())
|
||||
{
|
||||
if (RiaImportEclipseCaseTools::openEclipseCaseFromFile(gridCaseFile))
|
||||
int caseId = RiaImportEclipseCaseTools::openEclipseCaseFromFile(gridCaseFile);
|
||||
if (caseId >= 0)
|
||||
{
|
||||
if(openedFiles) openedFiles->push_back(gridCaseFile);
|
||||
openedFiles.insert(std::make_pair(gridCaseFile, caseId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +166,7 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& file
|
||||
{
|
||||
RimSummaryPlotCollection* summaryPlotColl = project->mainPlotCollection()->summaryPlotCollection();
|
||||
|
||||
RicNewSummaryCurveFeature::ensureAtLeastOnePlot(summaryPlotColl, newSumCases.front());
|
||||
RicSummaryPlotFeatureImpl::ensureAtLeastOnePlot(summaryPlotColl, newSumCases.front());
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded(newSumCases.front());
|
||||
}
|
||||
@ -176,15 +183,20 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& file
|
||||
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
|
||||
return true;
|
||||
if (openedFilesOut)
|
||||
{
|
||||
*openedFilesOut = openedFiles;
|
||||
}
|
||||
|
||||
return !openedFiles.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::openEclipseCaseFromFile(const QString& fileName)
|
||||
int RiaImportEclipseCaseTools::openEclipseCaseFromFile(const QString& fileName)
|
||||
{
|
||||
if (!caf::Utils::fileExists(fileName)) return false;
|
||||
if (!caf::Utils::fileExists(fileName)) return -1;
|
||||
|
||||
return RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(fileName, false);
|
||||
}
|
||||
@ -196,7 +208,7 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilter(const QString&
|
||||
{
|
||||
if (!caf::Utils::fileExists(fileName)) return false;
|
||||
|
||||
return RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(fileName, true);
|
||||
return RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(fileName, true) >= 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -257,7 +269,7 @@ bool RiaImportEclipseCaseTools::openMockModel(const QString& name)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QString& fileName, bool showTimeStepFilter)
|
||||
int RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QString& fileName, bool showTimeStepFilter)
|
||||
{
|
||||
QFileInfo gridFileName(fileName);
|
||||
QString caseName = gridFileName.completeBaseName();
|
||||
@ -272,10 +284,13 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr
|
||||
if (analysisModels == nullptr)
|
||||
{
|
||||
delete rimResultReservoir;
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->show();
|
||||
if (RiaGuiApplication::isRunning())
|
||||
{
|
||||
RicShowMainWindowFeature::showMainWindow();
|
||||
}
|
||||
|
||||
analysisModels->cases.push_back(rimResultReservoir);
|
||||
|
||||
@ -285,7 +300,7 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr
|
||||
|
||||
delete rimResultReservoir;
|
||||
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
RimEclipseView* riv = rimResultReservoir->createAndAddReservoirView();
|
||||
@ -299,15 +314,17 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr
|
||||
|
||||
analysisModels->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
|
||||
|
||||
return true;
|
||||
if (RiaGuiApplication::isRunning())
|
||||
{
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
|
||||
}
|
||||
return rimResultReservoir->caseId();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImportEclipseCaseTools::addEclipseCases(const QStringList& fileNames)
|
||||
bool RiaImportEclipseCaseTools::addEclipseCases(const QStringList& fileNames, RimIdenticalGridCaseGroup** resultingCaseGroup/*=nullptr*/)
|
||||
{
|
||||
if (fileNames.size() == 0) return true;
|
||||
|
||||
@ -389,11 +406,16 @@ bool RiaImportEclipseCaseTools::addEclipseCases(const QStringList& fileNames)
|
||||
{
|
||||
// Create placeholder results and propagate results info from main case to all other cases
|
||||
gridCaseGroup->loadMainCaseAndActiveCellInfo();
|
||||
|
||||
if (resultingCaseGroup)
|
||||
{
|
||||
*resultingCaseGroup = gridCaseGroup;
|
||||
}
|
||||
}
|
||||
|
||||
project->activeOilField()->analysisModels()->updateConnectedEditors();
|
||||
|
||||
if (gridCaseGroup->statisticsCaseCollection()->reservoirs.size() > 0)
|
||||
if (RiaGuiApplication::isRunning() && gridCaseGroup && gridCaseGroup->statisticsCaseCollection()->reservoirs.size() > 0)
|
||||
{
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(gridCaseGroup->statisticsCaseCollection()->reservoirs[0]);
|
||||
}
|
||||
|
@ -18,25 +18,31 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
class QString;
|
||||
class QStringList;
|
||||
|
||||
class RimIdenticalGridCaseGroup;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaImportEclipseCaseTools
|
||||
{
|
||||
public:
|
||||
static bool openEclipseCasesFromFile(const QStringList& fileNames, QStringList* openedFiles = nullptr, bool noDialog = false);
|
||||
typedef std::map<QString, int> FileCaseIdMap;
|
||||
|
||||
static bool openEclipseCasesFromFile(const QStringList& fileNames, FileCaseIdMap* openedFilesOut = nullptr, bool noDialog = false);
|
||||
static bool openEclipseCaseShowTimeStepFilter(const QString& fileName);
|
||||
|
||||
static bool openEclipseInputCaseFromFileNames(const QStringList& fileNames, QString* fileContainingGrid = nullptr);
|
||||
static bool openMockModel(const QString& name);
|
||||
|
||||
static bool addEclipseCases(const QStringList& fileNames);
|
||||
static bool addEclipseCases(const QStringList& fileNames, RimIdenticalGridCaseGroup** resultingCaseGroup = nullptr);
|
||||
|
||||
private:
|
||||
static bool openEclipseCaseFromFile(const QString& fileName);
|
||||
static bool openEclipseCaseShowTimeStepFilterImpl(const QString& fileName, bool showTimeStepFilter);
|
||||
static int openEclipseCaseFromFile(const QString& fileName);
|
||||
static int openEclipseCaseShowTimeStepFilterImpl(const QString& fileName, bool showTimeStepFilter);
|
||||
};
|
||||
|
||||
|
@ -43,7 +43,7 @@ void RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName(Rim3dView* vi
|
||||
|
||||
QString displayName = caseName + " : " + view->name();
|
||||
|
||||
QIcon icon = view->uiCapability()->uiIcon();
|
||||
caf::QIconProvider iconProvider = view->uiCapability()->uiIconProvider();
|
||||
|
||||
optionItems->push_back(caf::PdmOptionItemInfo(displayName, view, false, icon));
|
||||
optionItems->push_back(caf::PdmOptionItemInfo(displayName, view, false, iconProvider));
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QLocale>
|
||||
#include <QString>
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include <cvfAssert.h>
|
||||
|
||||
#include <ctime>
|
||||
@ -47,6 +48,30 @@ const QString RiaQDateTimeTools::TIMESPAN_HALFYEAR_NAME = "Half Year";
|
||||
const QString RiaQDateTimeTools::TIMESPAN_YEAR_NAME = "Year";
|
||||
const QString RiaQDateTimeTools::TIMESPAN_DECADE_NAME = "Decade";
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum<RiaQDateTimeTools::DateFormatComponents>::setUp()
|
||||
{
|
||||
addItem(RiaQDateTimeTools::DATE_FORMAT_NONE, "NO_DATE", "No Date");
|
||||
addItem(RiaQDateTimeTools::DATE_FORMAT_YEAR, "YEAR", "Year Only");
|
||||
addItem(RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH, "YEAR_MONTH", "Year and Month");
|
||||
addItem(RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY, "YEAR_MONTH_DAY", "Year, Month and Day");
|
||||
setDefault(RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum<RiaQDateTimeTools::TimeFormatComponents>::setUp()
|
||||
{
|
||||
addItem(RiaQDateTimeTools::TIME_FORMAT_NONE, "NO_TIME", "No Time of Day");
|
||||
addItem(RiaQDateTimeTools::TIME_FORMAT_HOUR, "HOUR", "Hour Only");
|
||||
addItem(RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE, "HOUR_MINUTE", "Hour and Minute");
|
||||
addItem(RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND, "HOUR_MINUTE_SECONDS", "Hour, Minutes and Seconds");
|
||||
setDefault(RiaQDateTimeTools::TIME_FORMAT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -393,3 +418,81 @@ QString RiaQDateTimeTools::dateFormatString()
|
||||
{
|
||||
return "dd.MMM yyyy";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RiaQDateTimeTools::supportedDateFormats()
|
||||
{
|
||||
std::vector<QString> dateFormats;
|
||||
|
||||
// See enum DateFormatComponents in header
|
||||
// The semi-colon separated components are:
|
||||
// DATE_FORMAT_YEAR, ..YEAR_MONTH, ..YEAR_MONTH_DAY
|
||||
dateFormats.push_back("yyyy;yyyy-MM;yyyy-MM-dd");
|
||||
dateFormats.push_back("yyyy;MMM yyyy;dd. MMM yyyy");
|
||||
dateFormats.push_back("yyyy;MMM yyyy;MMM dd. yyyy");
|
||||
dateFormats.push_back("yyyy;MM/yyyy;dd/MM/yyyy");
|
||||
dateFormats.push_back("yyyy;M/yyyy;d/M/yyyy");
|
||||
dateFormats.push_back("yyyy;M/yyyy;M/d/yyyy");
|
||||
dateFormats.push_back("yy;M/yy;d/M/yy");
|
||||
dateFormats.push_back("yy;M/yy;M/d/yy");
|
||||
dateFormats.push_back("yyyy;MM-yyyy;dd-MM-yyyy");
|
||||
dateFormats.push_back("yyyy;MM.yyyy;dd.MM.yyyy");
|
||||
dateFormats.push_back("yyyy;MM-yyyy;MM-dd-yyyy");
|
||||
dateFormats.push_back("yyyy;MM.yyyy;MM.dd.yyyy");
|
||||
dateFormats.push_back("yy;MM-yy;dd-MM-yy");
|
||||
dateFormats.push_back("yy;MM-yy;MM-dd-yy");
|
||||
|
||||
return dateFormats;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RiaQDateTimeTools::supportedTimeFormats()
|
||||
{
|
||||
std::vector<QString> timeFormats;
|
||||
|
||||
// See enum TimeFormatComponents in header
|
||||
// The semi-colon separated components are:
|
||||
// TIME_FORMAT_HOUR, ..HOUR_MINUTE, ..HOUR_MINUTE_SECOND and ..HOUR_MINUTE_MILLISECOND
|
||||
timeFormats.push_back("HH;HH:mm;HH:mm:ss;HH:mm:ss.zzz");
|
||||
timeFormats.push_back("H;H:mm;H:mm:ss;H:mm:ss.zzz");
|
||||
timeFormats.push_back("hh AP;hh:mm AP;hh:mm:ss AP;hh:mm:ss.zzz AP");
|
||||
timeFormats.push_back("h AP;h:mm AP;h:mm:ss AP;h:mm:ss.zzz AP");
|
||||
|
||||
return timeFormats;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaQDateTimeTools::dateFormatString(const QString& fullDateFormat, DateFormatComponents dateComponents)
|
||||
{
|
||||
if (dateComponents == DATE_FORMAT_NONE) return "";
|
||||
|
||||
QStringList allVariants = fullDateFormat.split(";");
|
||||
if (static_cast<int>(dateComponents) < allVariants.size())
|
||||
{
|
||||
return allVariants[dateComponents];
|
||||
}
|
||||
CVF_ASSERT(false && "Date format string is malformed");
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaQDateTimeTools::timeFormatString(const QString& fullTimeFormat, TimeFormatComponents timeComponents)
|
||||
{
|
||||
if (timeComponents == TIME_FORMAT_NONE) return "";
|
||||
|
||||
QStringList allVariants = fullTimeFormat.split(";");
|
||||
if (static_cast<int>(timeComponents) < allVariants.size())
|
||||
{
|
||||
return allVariants[timeComponents];
|
||||
}
|
||||
CVF_ASSERT(false && "Time format string is malformed");
|
||||
return "";
|
||||
}
|
@ -22,7 +22,11 @@
|
||||
#include <qnamespace.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
#include <QVariant>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -60,6 +64,27 @@ class RiaQDateTimeTools
|
||||
static const DateTimeSpan TIMESPAN_DECADE;
|
||||
|
||||
public:
|
||||
enum DateFormatComponents
|
||||
{
|
||||
DATE_FORMAT_UNSPECIFIED = -2,
|
||||
DATE_FORMAT_NONE = -1,
|
||||
DATE_FORMAT_YEAR = 0,
|
||||
DATE_FORMAT_YEAR_MONTH,
|
||||
DATE_FORMAT_YEAR_MONTH_DAY,
|
||||
DATE_FORMAT_SIZE
|
||||
};
|
||||
|
||||
enum TimeFormatComponents
|
||||
{
|
||||
TIME_FORMAT_UNSPECIFIED = -2,
|
||||
TIME_FORMAT_NONE = -1,
|
||||
TIME_FORMAT_HOUR,
|
||||
TIME_FORMAT_HOUR_MINUTE,
|
||||
TIME_FORMAT_HOUR_MINUTE_SECOND,
|
||||
TIME_FORMAT_HOUR_MINUTE_SECOND_MILLISECOND,
|
||||
TIME_FORMAT_SIZE
|
||||
};
|
||||
|
||||
static const QString TIMESPAN_DAY_NAME;
|
||||
static const QString TIMESPAN_WEEK_NAME;
|
||||
static const QString TIMESPAN_MONTH_NAME;
|
||||
@ -104,9 +129,16 @@ public:
|
||||
static QString createTimeFormatStringFromDates(const std::vector<QDateTime>& dates);
|
||||
static QString dateFormatString();
|
||||
|
||||
static std::vector<QString> supportedDateFormats();
|
||||
static std::vector<QString> supportedTimeFormats();
|
||||
|
||||
static QString dateFormatString(const QString& fullDateFormat, DateFormatComponents dateComponents);
|
||||
static QString timeFormatString(const QString& fullTimeFormat, TimeFormatComponents timeComponents);
|
||||
|
||||
private:
|
||||
static quint64 secondsInDay();
|
||||
static quint64 secondsInYear();
|
||||
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include "RiaRegressionTestRunner.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGitDiff.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaImageCompareReporter.h"
|
||||
#include "RiaImageFileCompare.h"
|
||||
#include "RiaLogging.h"
|
||||
@ -199,7 +199,7 @@ void RiaRegressionTestRunner::runRegressionTest()
|
||||
|
||||
regressionTestConfigureProject();
|
||||
|
||||
resizeMaximizedPlotWindows();
|
||||
resizePlotWindows();
|
||||
|
||||
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(fullPathGeneratedFolder);
|
||||
@ -499,12 +499,12 @@ void RiaRegressionTestRunner::regressionTestConfigureProject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTestRunner::resizeMaximizedPlotWindows()
|
||||
void RiaRegressionTestRunner::resizePlotWindows()
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if (!proj) return;
|
||||
|
||||
RiuPlotMainWindow* plotMainWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if (!plotMainWindow) return;
|
||||
|
||||
std::vector<RimViewWindow*> viewWindows;
|
||||
@ -515,20 +515,16 @@ void RiaRegressionTestRunner::resizeMaximizedPlotWindows()
|
||||
{
|
||||
if (viewWindow->isMdiWindow())
|
||||
{
|
||||
RimMdiWindowGeometry wndGeo = viewWindow->mdiWindowGeometry();
|
||||
if (wndGeo.isMaximized)
|
||||
QWidget* viewWidget = viewWindow->viewWidget();
|
||||
|
||||
if (viewWidget)
|
||||
{
|
||||
QWidget* viewWidget = viewWindow->viewWidget();
|
||||
|
||||
if (viewWidget)
|
||||
QMdiSubWindow* mdiWindow = plotMainWindow->findMdiSubWindow(viewWidget);
|
||||
if (mdiWindow)
|
||||
{
|
||||
QMdiSubWindow* mdiWindow = plotMainWindow->findMdiSubWindow(viewWidget);
|
||||
if (mdiWindow)
|
||||
{
|
||||
mdiWindow->showNormal();
|
||||
mdiWindow->showNormal();
|
||||
|
||||
viewWidget->resize(RiaRegressionTestRunner::regressionDefaultImageSize());
|
||||
}
|
||||
viewWidget->resize(RiaRegressionTestRunner::regressionDefaultImageSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -603,7 +599,7 @@ QFileInfoList RiaRegressionTestRunner::subDirectoriesForTestExecution(const QDir
|
||||
for (const auto& s : m_testFilter)
|
||||
{
|
||||
QString trimmed = s.trimmed();
|
||||
if (anyMatchFound || baseName.contains(trimmed, Qt::CaseInsensitive))
|
||||
if ((m_appendAllTestsAfterLastItemInFilter && anyMatchFound) || baseName.contains(trimmed, Qt::CaseInsensitive))
|
||||
{
|
||||
foldersMatchingTestFilter.push_back(fi);
|
||||
anyMatchFound = true;
|
||||
@ -641,7 +637,7 @@ void RiaRegressionTestRunner::executeRegressionTests(const QString& regressionTe
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
if (mainWnd)
|
||||
{
|
||||
mainWnd->hideAllDockWindows();
|
||||
mainWnd->hideAllDockWidgets();
|
||||
mainWnd->statusBar()->close();
|
||||
|
||||
mainWnd->setDefaultWindowSize();
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
const QDir& testDir);
|
||||
|
||||
static void removeDirectoryWithContent(QDir& dirToDelete);
|
||||
static void resizeMaximizedPlotWindows();
|
||||
static void resizePlotWindows();
|
||||
static QSize regressionDefaultImageSize();
|
||||
static QString diff2htmlHeaderText(const QString& testRootPath);
|
||||
QFileInfoList subDirectoriesForTestExecution(const QDir& directory);
|
||||
|
@ -26,8 +26,6 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <set>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -125,6 +123,50 @@ std::set<int> RiaSummaryCurveAnalyzer::regionNumbers() const
|
||||
return m_regionNumbers;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::wellCompletions(const std::string& wellName) const
|
||||
{
|
||||
std::set<std::string> connections;
|
||||
|
||||
for (const auto& conn : m_wellCompletions)
|
||||
{
|
||||
if (conn.first == wellName)
|
||||
{
|
||||
connections.insert(conn.second);
|
||||
}
|
||||
}
|
||||
|
||||
return connections;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<int> RiaSummaryCurveAnalyzer::wellSegmentNumbers(const std::string& wellName) const
|
||||
{
|
||||
std::set<int> segmentNumberForWell;
|
||||
|
||||
for (const auto& wellSegment : m_wellSegmentNumbers)
|
||||
{
|
||||
if (wellName.empty() || std::get<0>(wellSegment) == wellName)
|
||||
{
|
||||
segmentNumberForWell.insert(std::get<1>(wellSegment));
|
||||
}
|
||||
}
|
||||
|
||||
return segmentNumberForWell;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::blocks() const
|
||||
{
|
||||
return m_blocks;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -136,33 +178,57 @@ std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryCurveAnalyzer::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const
|
||||
std::vector<QString> RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category,
|
||||
const std::string& secondaryIdentifier) const
|
||||
{
|
||||
std::vector<QString> stringSet;
|
||||
std::vector<QString> identifierStrings;
|
||||
|
||||
if (category == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||
{
|
||||
for (const auto& regionNumber : m_regionNumbers)
|
||||
{
|
||||
stringSet.push_back(QString::number(regionNumber));
|
||||
identifierStrings.push_back(QString::number(regionNumber));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL)
|
||||
{
|
||||
for (const auto& wellName : m_wellNames)
|
||||
{
|
||||
stringSet.push_back(QString::fromStdString(wellName));
|
||||
identifierStrings.push_back(QString::fromStdString(wellName));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
||||
{
|
||||
for (const auto& wellGroupName : m_wellGroupNames)
|
||||
{
|
||||
stringSet.push_back(QString::fromStdString(wellGroupName));
|
||||
identifierStrings.push_back(QString::fromStdString(wellGroupName));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_BLOCK)
|
||||
{
|
||||
for (const auto& ijkBlock : m_blocks)
|
||||
{
|
||||
identifierStrings.push_back(QString::fromStdString(ijkBlock));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT)
|
||||
{
|
||||
auto segmentNumbers = wellSegmentNumbers(secondaryIdentifier);
|
||||
for (const auto& segment : segmentNumbers)
|
||||
{
|
||||
identifierStrings.push_back(QString::number(segment));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION)
|
||||
{
|
||||
auto connections = wellCompletions(secondaryIdentifier);
|
||||
for (const auto& conn : connections)
|
||||
{
|
||||
identifierStrings.push_back(QString::fromStdString(conn));
|
||||
}
|
||||
}
|
||||
|
||||
return stringSet;
|
||||
return identifierStrings;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -213,6 +279,9 @@ void RiaSummaryCurveAnalyzer::clear()
|
||||
m_wellGroupNames.clear();
|
||||
m_regionNumbers.clear();
|
||||
m_categories.clear();
|
||||
m_wellCompletions.clear();
|
||||
m_wellSegmentNumbers.clear();
|
||||
m_blocks.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -267,9 +336,11 @@ void RiaSummaryCurveAnalyzer::computeQuantityNamesWithHistory() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeSingleAddress(const RifEclipseSummaryAddress& address)
|
||||
{
|
||||
if (!address.wellName().empty())
|
||||
const std::string& wellName = address.wellName();
|
||||
|
||||
if (!wellName.empty())
|
||||
{
|
||||
m_wellNames.insert(address.wellName());
|
||||
m_wellNames.insert(wellName);
|
||||
}
|
||||
|
||||
if (!address.quantityName().empty())
|
||||
@ -287,6 +358,22 @@ void RiaSummaryCurveAnalyzer::analyzeSingleAddress(const RifEclipseSummaryAddres
|
||||
m_regionNumbers.insert(address.regionNumber());
|
||||
}
|
||||
|
||||
if (address.category() == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION)
|
||||
{
|
||||
auto wellNameAndCompletion = std::make_pair(wellName, address.blockAsString());
|
||||
m_wellCompletions.insert(wellNameAndCompletion);
|
||||
}
|
||||
else if (address.category() == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT)
|
||||
{
|
||||
auto wellNameAndSegment = std::make_pair(wellName, address.wellSegmentNumber());
|
||||
m_wellSegmentNumbers.insert(wellNameAndSegment);
|
||||
}
|
||||
else if (address.category() == RifEclipseSummaryAddress::SUMMARY_BLOCK)
|
||||
{
|
||||
auto text = address.blockAsString();
|
||||
m_blocks.insert(text);
|
||||
}
|
||||
|
||||
if (address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID)
|
||||
{
|
||||
m_categories.insert(address.category());
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryCurveCollection;
|
||||
@ -51,11 +52,16 @@ public:
|
||||
std::set<std::string> wellGroupNames() const;
|
||||
std::set<int> regionNumbers() const;
|
||||
|
||||
std::set<std::string> wellCompletions(const std::string& wellName) const;
|
||||
std::set<int> wellSegmentNumbers(const std::string& wellName) const;
|
||||
std::set<std::string> blocks() const;
|
||||
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> categories() const;
|
||||
|
||||
std::vector<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const;
|
||||
std::vector<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category,
|
||||
const std::string& secondaryIdentifier) const;
|
||||
|
||||
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::set<RifEclipseSummaryAddress>& addresses,
|
||||
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::set<RifEclipseSummaryAddress>& addresses,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category);
|
||||
|
||||
static std::string correspondingHistorySummaryCurveName(const std::string& curveName);
|
||||
@ -67,13 +73,16 @@ private:
|
||||
void analyzeSingleAddress(const RifEclipseSummaryAddress& address);
|
||||
|
||||
private:
|
||||
std::set<std::string> m_quantities;
|
||||
std::set<std::string> m_quantities;
|
||||
mutable std::set<std::string> m_quantitiesWithMatchingHistory;
|
||||
mutable std::set<std::string> m_quantitiesNoMatchingHistory;
|
||||
|
||||
std::set<std::string> m_wellNames;
|
||||
std::set<std::string> m_wellGroupNames;
|
||||
std::set<int> m_regionNumbers;
|
||||
std::set<std::string> m_wellNames;
|
||||
std::set<std::string> m_wellGroupNames;
|
||||
std::set<int> m_regionNumbers;
|
||||
std::set<std::pair<std::string, std::string>> m_wellCompletions;
|
||||
std::set<std::pair<std::string, int>> m_wellSegmentNumbers;
|
||||
std::set<std::string> m_blocks;
|
||||
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> m_categories;
|
||||
};
|
||||
|
@ -5,16 +5,19 @@ project (ApplicationCode)
|
||||
# Open GL
|
||||
find_package( OpenGL )
|
||||
|
||||
option(RESINSIGHT_ENABLE_GRPC "Enable the gRPC scripting framework" OFF)
|
||||
option(RESINSIGHT_GRPC_BUNDLE_PYTHON_MODULE "Bundle the gRPC python modules into the install folder" OFF)
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS Core QUIET)
|
||||
find_package(Qt5 COMPONENTS Core QUIET)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Network Script Widgets)
|
||||
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Network Script Widgets)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Script Qt5::Widgets)
|
||||
else()
|
||||
set (QT_COMPONENTS_REQUIRED QtCore QtGui QtMain QtOpenGl QtNetwork QtScript)
|
||||
find_package(Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
|
||||
find_package(Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
endif(Qt5Core_FOUND)
|
||||
|
||||
@ -44,6 +47,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Commands
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Commands/EclipseCommands
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FileInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GrpcInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SocketInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Measurement
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization
|
||||
@ -57,14 +61,13 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Annotations
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Completions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/GridCrossPlots
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/GridCrossPlots
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Measurement
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel/Completions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/OdbReader
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechVisualization
|
||||
@ -97,6 +100,12 @@ list( APPEND CPP_SOURCES
|
||||
${UNIT_TEST_FILES}
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
list( APPEND REFERENCED_CMAKE_FILES
|
||||
GrpcInterface/CMakeLists.cmake
|
||||
)
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
|
||||
list( APPEND REFERENCED_CMAKE_FILES
|
||||
Application/CMakeLists_files.cmake
|
||||
Application/Tools/CMakeLists_files.cmake
|
||||
@ -108,8 +117,8 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
FileInterface/CMakeLists_files.cmake
|
||||
|
||||
ProjectDataModel/CMakeLists_files.cmake
|
||||
ProjectDataModel/GridCrossPlots/CMakeLists_files.cmake
|
||||
ProjectDataModel/GridCrossPlots/CellFilters/CMakeLists_files.cmake
|
||||
ProjectDataModel/GridCrossPlots/CMakeLists_files.cmake
|
||||
ProjectDataModel/GridCrossPlots/CellFilters/CMakeLists_files.cmake
|
||||
ProjectDataModel/Summary/CMakeLists_files.cmake
|
||||
ProjectDataModel/Flow/CMakeLists_files.cmake
|
||||
ProjectDataModel/Annotations/CMakeLists_files.cmake
|
||||
@ -135,7 +144,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
|
||||
Commands/ExportCommands/CMakeLists_files.cmake
|
||||
Commands/FlowCommands/CMakeLists_files.cmake
|
||||
Commands/GridCrossPlotCommands/CMakeLists_files.cmake
|
||||
Commands/GridCrossPlotCommands/CMakeLists_files.cmake
|
||||
Commands/HoloLensCommands/CMakeLists_files.cmake
|
||||
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
|
||||
Commands/IntersectionViewCommands/CMakeLists_files.cmake
|
||||
@ -143,6 +152,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
Commands/OctaveScriptCommands/CMakeLists_files.cmake
|
||||
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
|
||||
Commands/SummaryPlotCommands/CMakeLists_files.cmake
|
||||
Commands/SsiHubImportCommands/CMakeLists_files.cmake
|
||||
Commands/ToggleCommands/CMakeLists_files.cmake
|
||||
Commands/ViewLink/CMakeLists_files.cmake
|
||||
Commands/WellLogCommands/CMakeLists_files.cmake
|
||||
@ -154,6 +164,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
)
|
||||
|
||||
option (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS "Include ApplicationCode Unit Tests" OFF)
|
||||
mark_as_advanced(FORCE RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS)
|
||||
if (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS)
|
||||
add_definitions(-DUSE_UNIT_TESTS)
|
||||
|
||||
@ -181,11 +192,9 @@ list( APPEND CPP_SOURCES
|
||||
# Sub-directory projects
|
||||
#############################################################################
|
||||
|
||||
add_subdirectory(WellPathImportSsihub)
|
||||
add_subdirectory(ResultStatisticsCache)
|
||||
|
||||
set( RI_LIBRARIES
|
||||
WellPathImportSsihub
|
||||
ResultStatisticsCache
|
||||
)
|
||||
|
||||
@ -230,7 +239,6 @@ if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_SOURING)
|
||||
add_definitions(-DENABLE_SOURING)
|
||||
endif()
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Qt specifics: Moc, ui, resources
|
||||
#############################################################################
|
||||
@ -244,13 +252,13 @@ set ( QT_MOC_HEADERS
|
||||
SocketInterface/RiaSocketServer.h
|
||||
)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt5_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
else()
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt4_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
endif()
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
|
||||
# NOTE! Resources in subfolders must append to QRC_FILES using the following statement
|
||||
@ -266,17 +274,15 @@ set( QRC_FILES
|
||||
)
|
||||
|
||||
# Runs RCC on specified files
|
||||
if ( NOT CMAKE_AUTOMOC)
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
else()
|
||||
qt4_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
endif(Qt5Core_FOUND)
|
||||
endif(NOT CMAKE_AUTOMOC)
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
qt5_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
else()
|
||||
qt4_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
# Adding resource (RC) files for Windows
|
||||
if ( MSVC )
|
||||
@ -306,8 +312,14 @@ source_group( "UnitTests" FILES ${UNIT_TEST_FILES} )
|
||||
|
||||
if (MSVC)
|
||||
set( EXE_FILES WIN32)
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
# GRPC generates a lot of harmless warnings on MSVC
|
||||
set_source_files_properties(${GRPC_CPP_SOURCES} ${GRPC_UNIT_TEST_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "/wd4251 /wd4702 /wd4005 /wd4244 /wd4125")
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
elseif (APPLE)
|
||||
set( EXE_FILES MACOSX_BUNDLE)
|
||||
else()
|
||||
set_source_files_properties(${GRPC_CPP_SOURCES} ${GRPC_UNIT_TESTS_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Wno-overloaded-virtual")
|
||||
endif()
|
||||
set( EXE_FILES
|
||||
${EXE_FILES}
|
||||
@ -319,11 +331,26 @@ set( EXE_FILES
|
||||
${HEADER_FILES}
|
||||
${REFERENCED_CMAKE_FILES}
|
||||
../ResInsightVersion.cmake
|
||||
../.clang-format
|
||||
../.clang-tidy
|
||||
.clang-format
|
||||
.clang-tidy
|
||||
Adm/RiaVersionInfo.h.cmake
|
||||
)
|
||||
|
||||
add_executable( ResInsight ${EXE_FILES} )
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
list(APPEND EXE_FILES
|
||||
${GRPC_CPP_SOURCES}
|
||||
${GRPC_HEADER_FILES}
|
||||
${GRPC_PYTHON_SOURCES_FULL_PATH}
|
||||
${GRPC_PROTO_FILES_FULL_PATH}
|
||||
Adm/RiaVersionInfo.py.cmake
|
||||
)
|
||||
if (DEFINED GRPC_LIBRARY_DIRS)
|
||||
message(STATUS "Using GRPC Library Dir: ${GRPC_LIBRARY_DIRS}")
|
||||
link_directories(${GRPC_LIBRARY_DIRS})
|
||||
endif(DEFINED GRPC_LIBRARY_DIRS)
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
|
||||
add_executable( ResInsight ${EXE_FILES})
|
||||
|
||||
if (MSVC)
|
||||
# The following warnings are supposed to be used in ResInsight, but temporarily disabled to avoid too much noise
|
||||
@ -334,9 +361,9 @@ if (MSVC)
|
||||
|
||||
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/W4 /wd4190 /wd4100 /wd4127 /wd4245")
|
||||
if (CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
|
||||
# The following warning is generated over 800 times from a qwt header only using VS2015
|
||||
# Disabling temporarily
|
||||
# warning C4505 'function' : unreferenced local function has been removed
|
||||
# The following warning is generated over 800 times from a qwt header only using VS2015
|
||||
# Disabling temporarily
|
||||
# warning C4505 'function' : unreferenced local function has been removed
|
||||
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/wd4505")
|
||||
endif()
|
||||
|
||||
@ -376,6 +403,16 @@ set( LINK_LIBRARIES
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
if (UNIX)
|
||||
foreach(GRPC_LIBRARY ${GRPC_LIBRARIES})
|
||||
list(APPEND LINK_LIBRARIES "${GRPC_LIBRARY_DIRS}/lib${GRPC_LIBRARY}.a")
|
||||
endforeach()
|
||||
else()
|
||||
list(APPEND LINK_LIBRARIES ${GRPC_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# According to ivarun this is needed on OpenSuse, and Fedora. See: https://github.com/OPM/ResInsight/pull/7
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
list(APPEND EXTERNAL_LINK_LIBRARIES
|
||||
@ -449,19 +486,29 @@ endif()
|
||||
if (MSVC)
|
||||
|
||||
# Qt DLLs
|
||||
if (Qt5Core_FOUND)
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
message(STATUS "Creating post build step for copying Qt DLLs")
|
||||
|
||||
foreach (qtlib ${QT_LIBRARIES})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:ResInsight>
|
||||
)
|
||||
)
|
||||
endforeach(qtlib)
|
||||
else()
|
||||
set (QTLIBLIST QtCore4 QtCored4 QtGui4 QtGuid4 QtOpenGl4 QtOpenGld4 QtNetwork4 QtNetworkd4 QtScript4 QtScriptd4 QtScriptTools4 QtScriptToolsd4)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/${qtlib}.dll)
|
||||
endforeach( qtlib )
|
||||
endif()
|
||||
|
||||
if (_unityTargetName)
|
||||
foreach (qtlib ${QT_LIBRARIES})
|
||||
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:${_unityTargetName}>
|
||||
)
|
||||
endforeach(qtlib)
|
||||
endif(_unityTargetName)
|
||||
|
||||
else()
|
||||
set (QTLIBLIST QtCore QtGui QtGui QtOpenGl QtNetwork QtScript QtScriptTools)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/$<IF:$<CONFIG:Debug>,${qtlib}d4.dll,${qtlib}4.dll>)
|
||||
endforeach( qtlib )
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
# Odb Dlls
|
||||
if (RESINSIGHT_USE_ODB_API)
|
||||
# Find all the dlls
|
||||
@ -502,6 +549,20 @@ foreach (FILE_TO_COPY ${RI_DLL_FILENAMES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Make sure we perform the Python code generation by having a target which ResInsight depends on
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
set(RESINSIGHT_GRPC_PYTHON_EXECUTABLE "" CACHE FILEPATH "gRPC : Path to Python 3 executable, required to build the Python client library")
|
||||
if (RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
if (EXISTS ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE})
|
||||
add_custom_target(GeneratedPythonSources DEPENDS ${GRPC_GENERATED_PYTHON_SOURCES})
|
||||
add_dependencies(ResInsight GeneratedPythonSources)
|
||||
else()
|
||||
message(STATUS "Error installing python code: RESINSIGHT_GRPC_PYTHON_EXECUTABLE set but ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE} not found")
|
||||
endif(EXISTS ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE})
|
||||
else()
|
||||
message(STATUS "RESINSIGHT_GRPC_PYTHON_EXECUTABLE not specified. Will not install GRPC Python code.")
|
||||
endif(RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
endif(RESINSIGHT_ENABLE_GRPC)
|
||||
|
||||
#############################################################################
|
||||
# Install
|
||||
@ -514,7 +575,6 @@ set (RESINSIGHT_LICENSE_FILES
|
||||
|
||||
# bundle libraries together with private installation
|
||||
if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
# tell binary to first attempt to load libraries from its own directory
|
||||
set(RESINSIGHT_INSTALL_RPATH "\$ORIGIN")
|
||||
@ -535,6 +595,23 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
|
||||
set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "${RESINSIGHT_INSTALL_RPATH}")
|
||||
|
||||
# bundle Qt5 libraries
|
||||
option (RESINSIGHT_QT5_BUNDLE_LIBRARIES "Bundle Qt5 libraries" OFF)
|
||||
mark_as_advanced(FORCE RESINSIGHT_QT5_BUNDLE_LIBRARIES)
|
||||
if (RESINSIGHT_QT5_BUNDLE_LIBRARIES)
|
||||
message( STATUS "Bundling of Qt5 libraries is enabled" )
|
||||
|
||||
foreach (qtlib ${QT_LIBRARIES})
|
||||
get_target_property(FILE_NAME_FULL_PATH ${qtlib} LOCATION)
|
||||
message (STATUS "${qtlib} location on disk - ${FILE_NAME_FULL_PATH}")
|
||||
get_filename_component(FILE_NAME_WE ${FILE_NAME_FULL_PATH} NAME_WE)
|
||||
set(FILE_NAME_FOR_INSTALL "${FILE_NAME_WE}.so.5")
|
||||
message (STATUS "${qtlib} filename for install - ${FILE_NAME_FOR_INSTALL}")
|
||||
|
||||
install(FILES ${FILE_NAME_FULL_PATH} DESTINATION ${RESINSIGHT_INSTALL_FOLDER} RENAME ${FILE_NAME_FOR_INSTALL} )
|
||||
endforeach()
|
||||
endif(RESINSIGHT_QT5_BUNDLE_LIBRARIES)
|
||||
|
||||
endif()
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
@ -543,7 +620,7 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
|
||||
set (RESINSIGHT_FILES ${RI_DLL_FILENAMES})
|
||||
|
||||
if(Qt5_FOUND AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
|
||||
if(RESINSIGHT_BUILD_WITH_QT5 AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
|
||||
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
|
||||
|
||||
execute_process(
|
||||
@ -576,12 +653,12 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
COMMAND set PATH=%PATH%$<SEMICOLON>${qt5_install_prefix}/bin
|
||||
COMMAND
|
||||
Qt5::windeployqt
|
||||
--no-compiler-runtime
|
||||
--no-system-d3d-compiler
|
||||
--no-quick-import
|
||||
--no-translations
|
||||
--no-compiler-runtime
|
||||
--no-system-d3d-compiler
|
||||
--no-quick-import
|
||||
--no-translations
|
||||
--verbose 0
|
||||
--dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt"
|
||||
--dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt"
|
||||
"$<TARGET_FILE_DIR:ResInsight>/$<TARGET_FILE_NAME:ResInsight>"
|
||||
)
|
||||
|
||||
@ -593,6 +670,31 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
)
|
||||
endif()
|
||||
|
||||
# install GRPC-related DLLs
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
set (GRPC_DLL_NAMES libprotobuf cares zlib1)
|
||||
foreach (dllname ${GRPC_DLL_NAMES})
|
||||
list(APPEND RESINSIGHT_FILES "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/${dllname}.dll")
|
||||
endforeach(dllname ${GRPC_DLL_NAMES})
|
||||
endif()
|
||||
|
||||
# OpenSSL
|
||||
option(RESINSIGHT_BUNDLE_OPENSSL "Bundle the OpenSSL binary DLLs" OFF)
|
||||
mark_as_advanced(FORCE RESINSIGHT_BUNDLE_OPENSSL)
|
||||
|
||||
if (RESINSIGHT_BUNDLE_OPENSSL)
|
||||
find_package(OpenSSL)
|
||||
if (OPENSSL_FOUND)
|
||||
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
|
||||
SET(OPENSSL_BIN_DIR ${OPENSSL_INCLUDE_DIR})
|
||||
string(REPLACE "include" "bin" OPENSSL_BIN_DIR ${OPENSSL_BIN_DIR})
|
||||
message("OpenSSL binary dir: ${OPENSSL_BIN_DIR}")
|
||||
|
||||
install(FILES ${OPENSSL_BIN_DIR}/libeay32.dll DESTINATION ${RESINSIGHT_INSTALL_FOLDER})
|
||||
install(FILES ${OPENSSL_BIN_DIR}/ssleay32.dll DESTINATION ${RESINSIGHT_INSTALL_FOLDER})
|
||||
endif(OPENSSL_FOUND)
|
||||
endif(RESINSIGHT_BUNDLE_OPENSSL)
|
||||
|
||||
# CRT
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP ON)
|
||||
set(CMAKE_INSTALL_OPENMP_LIBRARIES ON)
|
||||
@ -601,6 +703,23 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
|
||||
endif()
|
||||
|
||||
# install gRPC Python files
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
message(STATUS "GRPC enabled")
|
||||
if (RESINSIGHT_GRPC_PYTHON_EXECUTABLE AND EXISTS ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE})
|
||||
message(STATUS "Python found")
|
||||
if (RESINSIGHT_GRPC_BUNDLE_PYTHON_MODULE)
|
||||
message(STATUS "Bundling Python GRPC modules")
|
||||
add_custom_command(
|
||||
TARGET ResInsight
|
||||
POST_BUILD
|
||||
COMMAND ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE} -m pip install --target=${GRPC_PYTHON_SOURCE_PATH} grpcio
|
||||
)
|
||||
endif()
|
||||
install(DIRECTORY ${GRPC_PYTHON_SOURCE_PATH}/ DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/Python)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (RESINSIGHT_FILES ${RESINSIGHT_FILES} ${RESINSIGHT_LICENSE_FILES})
|
||||
|
||||
|
||||
@ -680,6 +799,10 @@ if(RESINSIGHT_FOUND_HDF5)
|
||||
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_souring")
|
||||
endif()
|
||||
|
||||
if(RESINSIGHT_BUNDLE_OPENSSL AND OPENSSL_FOUND)
|
||||
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_openssl")
|
||||
endif()
|
||||
|
||||
# Append el5 when compiled on RHEL5 and el6 if compiled on RHEL6
|
||||
if (NOT "${RESINSIGHT_RHEL_SYSTEM_NAME}" STREQUAL "")
|
||||
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_${RESINSIGHT_RHEL_SYSTEM_NAME}")
|
||||
|
@ -28,6 +28,11 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfExportLgrForCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateLgrForCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfApplicationTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateSaturationPressurePlots.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportFlowCharacteristics.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateGridCaseGroup.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateStatisticsCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCloneView.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -59,6 +64,11 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfExportLgrForCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateLgrForCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfApplicationTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateSaturationPressurePlots.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportFlowCharacteristics.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateGridCaseGroup.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateStatisticsCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCloneView.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandObject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandResponse.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldCapability.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldHandle.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfObjectCapability.h
|
||||
@ -10,6 +11,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfMessages.h
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCommandResponse.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldCapability.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfFieldHandle.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfObjectCapability.cpp
|
||||
|
@ -20,11 +20,15 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "RicfObjectCapability.h"
|
||||
#include "RicfFieldCapability.h"
|
||||
#include "RicfCommandResponse.h"
|
||||
|
||||
#define RICF_InitField(field, keyword, default, uiName, iconResourceName, toolTip, whatsThis) \
|
||||
CAF_PDM_InitField(field, keyword, default, uiName, iconResourceName, toolTip, whatsThis); \
|
||||
AddRicfCapabilityToField(field)
|
||||
|
||||
#define RICF_InitFieldNoDefault(field, keyword, uiName, iconResourceName, toolTip, whatsThis) \
|
||||
CAF_PDM_InitFieldNoDefault(field, keyword, uiName, iconResourceName, toolTip, whatsThis); \
|
||||
AddRicfCapabilityToField(field)
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -37,7 +41,7 @@ public:
|
||||
RicfCommandObject();
|
||||
~RicfCommandObject() override;
|
||||
|
||||
virtual void execute() = 0;
|
||||
virtual RicfCommandResponse execute() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicfCommandResponse.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse::RicfCommandResponse(Status status, const QString& message)
|
||||
: m_status(COMMAND_OK)
|
||||
{
|
||||
updateStatus(status, message);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse::Status RicfCommandResponse::status() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicfCommandResponse::message() const
|
||||
{
|
||||
return m_messages.join("\n");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RicfCommandResponse::result() const
|
||||
{
|
||||
return m_result.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Takes ownership of the result object
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandResponse::setResult(caf::PdmObject* result)
|
||||
{
|
||||
m_result = result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandResponse::updateStatus(Status status, const QString& message)
|
||||
{
|
||||
m_status = std::max(m_status, status);
|
||||
if (!message.isEmpty())
|
||||
m_messages.push_back(QString("%1:%2").arg(statusLabel(status)).arg(message));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicfCommandResponse::statusLabel(Status status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case COMMAND_WARNING:
|
||||
return "WARNING";
|
||||
case COMMAND_ERROR:
|
||||
return "ERROR";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <memory>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Command response which contains status and possibly a result
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCommandResponse
|
||||
{
|
||||
public:
|
||||
// Status in order of severity from ok to critical
|
||||
enum Status
|
||||
{
|
||||
COMMAND_OK,
|
||||
COMMAND_WARNING,
|
||||
COMMAND_ERROR
|
||||
};
|
||||
public:
|
||||
RicfCommandResponse(Status status = COMMAND_OK, const QString& message="");
|
||||
|
||||
Status status() const;
|
||||
QString message() const;
|
||||
caf::PdmObject* result() const;
|
||||
void setResult(caf::PdmObject* result);
|
||||
void updateStatus(Status status, const QString& message);
|
||||
|
||||
private:
|
||||
static QString statusLabel(Status status);
|
||||
private:
|
||||
Status m_status;
|
||||
QStringList m_messages;
|
||||
caf::PdmPointer<caf::PdmObject> m_result;
|
||||
};
|
||||
|
@ -19,21 +19,33 @@
|
||||
#include "RicfFieldCapability.h"
|
||||
#include "RicfMessages.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
|
||||
#include <QColor>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldReader<QString>::readFieldData(QString& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
void RicfFieldReader<QString>::readFieldData(QString& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted)
|
||||
{
|
||||
fieldValue = "";
|
||||
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QString accumulatedFieldValue;
|
||||
|
||||
QChar currentChar;
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if ( currentChar == QChar('"') )
|
||||
bool validStringStart = !stringsAreQuoted;
|
||||
bool validStringEnd = !stringsAreQuoted;
|
||||
if (stringsAreQuoted)
|
||||
{
|
||||
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
if (currentChar == QChar('"'))
|
||||
{
|
||||
validStringStart = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (validStringStart)
|
||||
{
|
||||
while ( !inputStream.atEnd() )
|
||||
{
|
||||
@ -43,6 +55,7 @@ void RicfFieldReader<QString>::readFieldData(QString& fieldValue, QTextStream& i
|
||||
if ( currentChar == QChar('"') ) // End Quote
|
||||
{
|
||||
// Reached end of string
|
||||
validStringEnd = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -57,7 +70,7 @@ void RicfFieldReader<QString>::readFieldData(QString& fieldValue, QTextStream& i
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!validStringStart)
|
||||
{
|
||||
// Unexpected start of string, Missing '"'
|
||||
// Error message
|
||||
@ -66,6 +79,15 @@ void RicfFieldReader<QString>::readFieldData(QString& fieldValue, QTextStream& i
|
||||
+ errorMessageContainer->currentCommand + "\"" );
|
||||
// Could interpret as unquoted text
|
||||
}
|
||||
else if (!validStringEnd)
|
||||
{
|
||||
// Unexpected end of string, Missing '"'
|
||||
// Error message
|
||||
errorMessageContainer->addError("String argument does not seem to be quoted. Missing the end '\"' in the \"" +
|
||||
errorMessageContainer->currentArgument + "\" argument of the command: \"" +
|
||||
errorMessageContainer->currentCommand + "\"");
|
||||
// Could interpret as unquoted text
|
||||
}
|
||||
|
||||
fieldValue = accumulatedFieldValue;
|
||||
}
|
||||
@ -73,7 +95,7 @@ void RicfFieldReader<QString>::readFieldData(QString& fieldValue, QTextStream& i
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldWriter<QString>::writeFieldData(const QString& fieldValue, QTextStream& outputStream)
|
||||
void RicfFieldWriter<QString>::writeFieldData(const QString& fieldValue, QTextStream& outputStream, bool quoteStrings)
|
||||
{
|
||||
outputStream << "\"";
|
||||
for ( int i = 0; i < fieldValue.size(); ++i )
|
||||
@ -90,7 +112,7 @@ void RicfFieldWriter<QString>::writeFieldData(const QString& fieldValue, QTextSt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldReader<bool>::readFieldData(bool& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
void RicfFieldReader<bool>::readFieldData(bool& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted)
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QString accumulatedFieldValue;
|
||||
@ -125,8 +147,33 @@ void RicfFieldReader<bool>::readFieldData(bool& fieldValue, QTextStream& inputSt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldWriter<bool>::writeFieldData(const bool& fieldValue, QTextStream& outputStream)
|
||||
void RicfFieldWriter<bool>::writeFieldData(const bool& fieldValue, QTextStream& outputStream, bool quoteStrings)
|
||||
{
|
||||
// Lower-case true/false is used in the documentation.
|
||||
outputStream << (fieldValue ? "true" : "false");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldReader<cvf::Color3f>::readFieldData(cvf::Color3f& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted)
|
||||
{
|
||||
QString fieldStringValue;
|
||||
RicfFieldReader<QString>::readFieldData(fieldStringValue, inputStream, errorMessageContainer, stringsAreQuoted);
|
||||
|
||||
QColor qColor(fieldStringValue);
|
||||
if (qColor.isValid())
|
||||
{
|
||||
fieldValue = RiaColorTools::fromQColorTo3f(qColor);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldWriter<cvf::Color3f>::writeFieldData(const cvf::Color3f& fieldValue, QTextStream& outputStream, bool quoteStrings)
|
||||
{
|
||||
QColor qColor = RiaColorTools::toQColor(fieldValue);
|
||||
QString fieldStringValue = qColor.name();
|
||||
RicfFieldWriter<QString>::writeFieldData(fieldStringValue, outputStream, quoteStrings);
|
||||
}
|
@ -22,6 +22,8 @@
|
||||
#include "RicfMessages.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QString>
|
||||
@ -30,7 +32,7 @@
|
||||
template <typename DataType>
|
||||
struct RicfFieldReader
|
||||
{
|
||||
static void readFieldData(DataType & fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
static void readFieldData(DataType & fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted = true)
|
||||
{
|
||||
inputStream >> fieldValue;
|
||||
if (inputStream.status() == QTextStream::ReadCorruptData)
|
||||
@ -47,7 +49,7 @@ struct RicfFieldReader
|
||||
template <typename DataType>
|
||||
struct RicfFieldWriter
|
||||
{
|
||||
static void writeFieldData(const DataType & fieldValue, QTextStream& outputStream)
|
||||
static void writeFieldData(const DataType & fieldValue, QTextStream& outputStream, bool quoteStrings = true)
|
||||
{
|
||||
outputStream << fieldValue;
|
||||
}
|
||||
@ -56,32 +58,43 @@ struct RicfFieldWriter
|
||||
template <>
|
||||
struct RicfFieldReader<QString>
|
||||
{
|
||||
static void readFieldData(QString & fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer);
|
||||
static void readFieldData(QString & fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted = true);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RicfFieldWriter<QString>
|
||||
{
|
||||
static void writeFieldData(const QString & fieldValue, QTextStream& outputStream);
|
||||
static void writeFieldData(const QString & fieldValue, QTextStream& outputStream, bool quoteStrings = true);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RicfFieldReader<bool>
|
||||
{
|
||||
static void readFieldData(bool& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer);
|
||||
static void readFieldData(bool& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted = true);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RicfFieldWriter<bool>
|
||||
{
|
||||
static void writeFieldData(const bool& fieldValue, QTextStream& outputStream);
|
||||
static void writeFieldData(const bool& fieldValue, QTextStream& outputStream, bool quoteStrings = true);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct RicfFieldReader<cvf::Color3f>
|
||||
{
|
||||
static void readFieldData(cvf::Color3f& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted = true);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct RicfFieldWriter<cvf::Color3f>
|
||||
{
|
||||
static void writeFieldData(const cvf::Color3f& fieldValue, QTextStream& outputStream, bool quoteStrings = true);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RicfFieldReader< caf::AppEnum<T> >
|
||||
{
|
||||
static void readFieldData(caf::AppEnum<T>& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
static void readFieldData(caf::AppEnum<T>& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted = true)
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QString accumulatedFieldValue;
|
||||
@ -114,7 +127,7 @@ struct RicfFieldReader< caf::AppEnum<T> >
|
||||
template <typename T>
|
||||
struct RicfFieldWriter< caf::AppEnum<T> >
|
||||
{
|
||||
static void writeFieldData(const caf::AppEnum<T>& fieldValue, QTextStream& outputStream)
|
||||
static void writeFieldData(const caf::AppEnum<T>& fieldValue, QTextStream& outputStream, bool quoteStrings = true)
|
||||
{
|
||||
outputStream << fieldValue;
|
||||
}
|
||||
@ -123,7 +136,7 @@ struct RicfFieldWriter< caf::AppEnum<T> >
|
||||
template <typename T>
|
||||
struct RicfFieldReader< std::vector<T> >
|
||||
{
|
||||
static void readFieldData(std::vector<T>& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
static void readFieldData(std::vector<T>& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer, bool stringsAreQuoted = true)
|
||||
{
|
||||
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
|
||||
QChar chr = errorMessageContainer->readCharWithLineNumberCount(inputStream);
|
||||
@ -144,7 +157,7 @@ struct RicfFieldReader< std::vector<T> >
|
||||
}
|
||||
|
||||
T value;
|
||||
RicfFieldReader<T>::readFieldData(value, inputStream, errorMessageContainer);
|
||||
RicfFieldReader<T>::readFieldData(value, inputStream, errorMessageContainer, true);
|
||||
fieldValue.push_back(value);
|
||||
}
|
||||
}
|
||||
@ -159,7 +172,7 @@ struct RicfFieldReader< std::vector<T> >
|
||||
template <typename T>
|
||||
struct RicfFieldWriter< std::vector<T> >
|
||||
{
|
||||
static void writeFieldData(const std::vector<T>& fieldValue, QTextStream& outputStream)
|
||||
static void writeFieldData(const std::vector<T>& fieldValue, QTextStream& outputStream, bool quoteStrings = true)
|
||||
{
|
||||
outputStream << "[";
|
||||
for (size_t i = 0; i < fieldValue.size(); ++i)
|
||||
@ -189,18 +202,20 @@ public:
|
||||
|
||||
// Xml Serializing
|
||||
public:
|
||||
void readFieldData (QTextStream& inputStream, caf::PdmObjectFactory* objectFactory, RicfMessages* errorMessageContainer) override
|
||||
void readFieldData (QTextStream& inputStream, caf::PdmObjectFactory* objectFactory, RicfMessages* errorMessageContainer, bool stringsAreQuoted = true) override
|
||||
{
|
||||
//m_field->xmlCapability()->assertValid();
|
||||
typename FieldType::FieldDataType value;
|
||||
RicfFieldReader<typename FieldType::FieldDataType>::readFieldData(value, inputStream, errorMessageContainer);
|
||||
m_field->setValue(value);
|
||||
RicfFieldReader<typename FieldType::FieldDataType>::readFieldData(value, inputStream, errorMessageContainer, stringsAreQuoted);
|
||||
|
||||
if (this->isIOWriteable())
|
||||
{
|
||||
m_field->setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
void writeFieldData(QTextStream& outputStream) const override
|
||||
void writeFieldData(QTextStream& outputStream, bool quoteStrings = true) const override
|
||||
{
|
||||
//m_field->xmlCapability()->assertValid();
|
||||
RicfFieldWriter<typename FieldType::FieldDataType>::writeFieldData(m_field->value(), outputStream);
|
||||
RicfFieldWriter<typename FieldType::FieldDataType>::writeFieldData(m_field->value(), outputStream, quoteStrings);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -26,6 +26,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfFieldHandle::RicfFieldHandle(caf::PdmFieldHandle* owner, bool giveOwnership)
|
||||
{
|
||||
m_IOWriteable = true;
|
||||
m_owner = owner;
|
||||
owner->addCapability(this, giveOwnership);
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
#pragma once
|
||||
#include "cafPdmFieldCapability.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectFactory;
|
||||
@ -37,17 +39,28 @@ class QTextStream;
|
||||
class RicfFieldHandle : public caf::PdmFieldCapability
|
||||
{
|
||||
public:
|
||||
RicfFieldHandle(caf::PdmFieldHandle* owner , bool giveOwnership);
|
||||
|
||||
RicfFieldHandle(caf::PdmFieldHandle* owner, bool giveOwnership);
|
||||
~RicfFieldHandle() override;
|
||||
|
||||
bool isIOWriteable() const
|
||||
{
|
||||
return m_IOWriteable;
|
||||
}
|
||||
|
||||
void setIOWriteable(bool writeable)
|
||||
{
|
||||
m_IOWriteable = writeable;
|
||||
}
|
||||
|
||||
virtual void readFieldData (QTextStream& inputStream,
|
||||
caf::PdmObjectFactory* objectFactory,
|
||||
RicfMessages* errorMessageContainer ) = 0;
|
||||
virtual void writeFieldData(QTextStream& outputStream) const = 0;
|
||||
RicfMessages* errorMessageContainer,
|
||||
bool stringsAreQuoted = true) = 0;
|
||||
virtual void writeFieldData(QTextStream& outputStream, bool quoteStrings = true) const = 0;
|
||||
|
||||
private:
|
||||
caf::PdmFieldHandle* m_owner;
|
||||
bool m_IOWriteable;
|
||||
};
|
||||
|
||||
|
||||
|
79
ApplicationCode/CommandFileInterface/RicfCloneView.cpp
Normal file
79
ApplicationCode/CommandFileInterface/RicfCloneView.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
#include "RicfCloneView.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicfCreateView.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCloneView, "cloneView");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCloneView::RicfCloneView()
|
||||
{
|
||||
RICF_InitField(&m_viewId, "viewId", -1, "View Id", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCloneView::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
std::vector<Rim3dView*> allViews;
|
||||
project->descendantsIncludingThisOfType(allViews);
|
||||
|
||||
for (Rim3dView* view : allViews)
|
||||
{
|
||||
if (view->id() == m_viewId())
|
||||
{
|
||||
const RimEclipseView* eclipseView = dynamic_cast<const RimEclipseView*>(view);
|
||||
const RimGeoMechView* geoMechView = dynamic_cast<const RimGeoMechView*>(view);
|
||||
|
||||
int newViewId = -1;
|
||||
if (eclipseView)
|
||||
{
|
||||
RimEclipseCase* eclipseCase = eclipseView->eclipseCase();
|
||||
RimEclipseView* newEclipseView = eclipseCase->createCopyAndAddView(eclipseView);
|
||||
newViewId = newEclipseView->id();
|
||||
newEclipseView->loadDataAndUpdate();
|
||||
eclipseCase->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::setExpanded(newEclipseView);
|
||||
}
|
||||
else if (geoMechView)
|
||||
{
|
||||
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||
RimGeoMechView* newGeoMechView = geoMechCase->createCopyAndAddView(geoMechView);
|
||||
newViewId = newGeoMechView->id();
|
||||
view->loadDataAndUpdate();
|
||||
geoMechCase->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::setExpanded(view);
|
||||
}
|
||||
|
||||
if (newViewId >= 0)
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
response.setResult(new RicfCreateViewResult(newViewId));
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString error = QString("cloneView: Could not clone view with id %1").arg(m_viewId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
41
ApplicationCode/CommandFileInterface/RicfCloneView.h
Normal file
41
ApplicationCode/CommandFileInterface/RicfCloneView.h
Normal file
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCloneView : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCloneView();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_viewId;
|
||||
};
|
@ -32,7 +32,8 @@ RicfCloseProject::RicfCloseProject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCloseProject::execute()
|
||||
RicfCommandResponse RicfCloseProject::execute()
|
||||
{
|
||||
RiaApplication::instance()->closeProject();
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class RicfCloseProject : public RicfCommandObject
|
||||
public:
|
||||
RicfCloseProject();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -37,15 +37,31 @@ CAF_PDM_SOURCE_INIT(RicfComputeCaseGroupStatistics, "computeCaseGroupStatistics"
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfComputeCaseGroupStatistics::RicfComputeCaseGroupStatistics()
|
||||
{
|
||||
RICF_InitField(&m_groupId, "caseGroupId", -1, "Case Group ID", "", "", "");
|
||||
RICF_InitField(&m_caseIds, "caseIds", std::vector<int>(), "Case IDs", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfComputeCaseGroupStatistics::execute()
|
||||
RicfCommandResponse RicfComputeCaseGroupStatistics::execute()
|
||||
{
|
||||
for (int caseId : m_caseIds())
|
||||
RicfCommandResponse response;
|
||||
|
||||
std::vector<int> caseIds = m_caseIds.v();
|
||||
|
||||
if (m_groupId() >= 0)
|
||||
{
|
||||
for (RimIdenticalGridCaseGroup* group : RiaApplication::instance()->project()->activeOilField()->analysisModels()->caseGroups)
|
||||
{
|
||||
for (RimEclipseCase* c : group->statisticsCaseCollection->reservoirs)
|
||||
{
|
||||
caseIds.push_back(c->caseId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int caseId : caseIds)
|
||||
{
|
||||
bool foundCase = false;
|
||||
for (RimIdenticalGridCaseGroup* group : RiaApplication::instance()->project()->activeOilField()->analysisModels()->caseGroups)
|
||||
@ -61,7 +77,9 @@ void RicfComputeCaseGroupStatistics::execute()
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning(QString("computeCaseGroupStatistics: Found case with ID %1, but it is not a statistics case, cannot compute statistics.").arg(caseId));
|
||||
QString warning = QString("computeCaseGroupStatistics: Found case with ID %1, but it is not a statistics case, cannot compute statistics.").arg(caseId);
|
||||
RiaLogging::warning(warning);
|
||||
response.updateStatus(RicfCommandResponse::COMMAND_WARNING, warning);
|
||||
}
|
||||
foundCase = true;
|
||||
break;
|
||||
@ -73,7 +91,11 @@ void RicfComputeCaseGroupStatistics::execute()
|
||||
|
||||
if (!foundCase)
|
||||
{
|
||||
RiaLogging::warning(QString("computeCaseGroupStatistics: Could not find statistics case with ID %1.").arg(caseId));
|
||||
QString warning = QString("computeCaseGroupStatistics: Could not find statistics case with ID %1.").arg(caseId);
|
||||
|
||||
RiaLogging::warning(warning);
|
||||
response.updateStatus(RicfCommandResponse::COMMAND_WARNING, warning);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
@ -34,8 +34,9 @@ class RicfComputeCaseGroupStatistics : public RicfCommandObject
|
||||
public:
|
||||
RicfComputeCaseGroupStatistics();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField< int > m_groupId;
|
||||
caf::PdmField< std::vector<int> > m_caseIds;
|
||||
};
|
||||
|
@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfCreateGridCaseGroup.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCreateGridCaseGroupResult, "createGridCaseGroupResult");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateGridCaseGroupResult::RicfCreateGridCaseGroupResult(int caseGroupId /*= -1*/, const QString& caseGroupName /*= ""*/)
|
||||
{
|
||||
CAF_PDM_InitObject("case_group_result", "", "", "");
|
||||
CAF_PDM_InitField(&this->caseGroupId, "groupId", caseGroupId, "", "", "", "");
|
||||
CAF_PDM_InitField(&this->caseGroupName, "groupName", caseGroupName, "", "", "", "");
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCreateGridCaseGroup, "createGridCaseGroup");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateGridCaseGroup::RicfCreateGridCaseGroup()
|
||||
{
|
||||
RICF_InitFieldNoDefault(&m_casePaths, "casePaths", "List of Paths to Case Files", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateGridCaseGroup::execute()
|
||||
{
|
||||
QStringList casePaths;
|
||||
for (QString casePath : m_casePaths())
|
||||
{
|
||||
QFileInfo casePathInfo(casePath);
|
||||
if (!casePathInfo.exists())
|
||||
{
|
||||
QDir startDir(RiaApplication::instance()->startDir());
|
||||
casePath = startDir.absoluteFilePath(casePath);
|
||||
}
|
||||
casePaths.push_back(casePath);
|
||||
}
|
||||
|
||||
RimIdenticalGridCaseGroup* caseGroup = nullptr;
|
||||
|
||||
if (RiaImportEclipseCaseTools::addEclipseCases(casePaths, &caseGroup) && caseGroup)
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
response.setResult(new RicfCreateGridCaseGroupResult(caseGroup->groupId(), caseGroup->name()));
|
||||
return response;
|
||||
}
|
||||
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, "Could not load grid case group");
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RicfCreateGridCaseGroupResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateGridCaseGroupResult(int caseGroupId = -1, const QString& caseGroupName = "");
|
||||
|
||||
public:
|
||||
caf::PdmField<int> caseGroupId;
|
||||
caf::PdmField<QString> caseGroupName;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCreateGridCaseGroup : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateGridCaseGroup();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<QString>> m_casePaths;
|
||||
};
|
@ -59,7 +59,7 @@ RicfCreateLgrForCompletions::RicfCreateLgrForCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCreateLgrForCompletions::execute()
|
||||
RicfCommandResponse RicfCreateLgrForCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@ -71,54 +71,65 @@ void RicfCreateLgrForCompletions::execute()
|
||||
wellPaths = TOOLS::wellPathsFromNames(TOOLS::toQStringList(m_wellPathNames), &wellsNotFound);
|
||||
if (!wellsNotFound.empty())
|
||||
{
|
||||
RiaLogging::error(QString("createLgrForCompletions: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
QString error = QString("createLgrForCompletions: These well paths were not found: ") + wellsNotFound.join(", ");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!wellPaths.empty())
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicCreateTemporaryLgrFeature*>(commandManager->getCommandFeature("RicCreateTemporaryLgrFeature"));
|
||||
QString error("No well paths found");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicCreateTemporaryLgrFeature*>(commandManager->getCommandFeature("RicCreateTemporaryLgrFeature"));
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
{
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
if (c->caseId() == m_caseId())
|
||||
{
|
||||
if (c->caseId() == m_caseId())
|
||||
{
|
||||
eclipseCase = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("createLgrForCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
eclipseCase = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RicDeleteTemporaryLgrsFeature::deleteAllTemporaryLgrs(eclipseCase);
|
||||
|
||||
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
|
||||
QStringList wellsIntersectingOtherLgrs;
|
||||
|
||||
feature->createLgrsForWellPaths(
|
||||
wellPaths,
|
||||
eclipseCase,
|
||||
m_timeStep,
|
||||
lgrCellCounts,
|
||||
m_splitType(),
|
||||
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES},
|
||||
&wellsIntersectingOtherLgrs);
|
||||
|
||||
feature->updateViews(eclipseCase);
|
||||
|
||||
if (!wellsIntersectingOtherLgrs.empty())
|
||||
if (!eclipseCase)
|
||||
{
|
||||
auto wellsList = wellsIntersectingOtherLgrs.join(", ");
|
||||
RiaLogging::error(
|
||||
"createLgrForCompletions: No LGRs created for some wells due to existing intersecting LGR(s).Affected wells : " +
|
||||
wellsList);
|
||||
QString error(QString("createLgrForCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
}
|
||||
|
||||
RicDeleteTemporaryLgrsFeature::deleteAllTemporaryLgrs(eclipseCase);
|
||||
|
||||
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
|
||||
QStringList wellsIntersectingOtherLgrs;
|
||||
|
||||
feature->createLgrsForWellPaths(
|
||||
wellPaths,
|
||||
eclipseCase,
|
||||
m_timeStep,
|
||||
lgrCellCounts,
|
||||
m_splitType(),
|
||||
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES},
|
||||
&wellsIntersectingOtherLgrs);
|
||||
|
||||
feature->updateViews(eclipseCase);
|
||||
|
||||
RicfCommandResponse response;
|
||||
if (!wellsIntersectingOtherLgrs.empty())
|
||||
{
|
||||
auto wellsList = wellsIntersectingOtherLgrs.join(", ");
|
||||
QString warning(
|
||||
"createLgrForCompletions: No LGRs created for some wells due to existing intersecting LGR(s).Affected wells : " +
|
||||
wellsList);
|
||||
RiaLogging::warning(warning);
|
||||
response.updateStatus(RicfCommandResponse::COMMAND_WARNING, warning);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class RicfCreateLgrForCompletions : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateLgrForCompletions();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -74,7 +74,7 @@ RicfCreateMultipleFractures::RicfCreateMultipleFractures()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCreateMultipleFractures::execute()
|
||||
RicfCommandResponse RicfCreateMultipleFractures::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@ -92,54 +92,71 @@ void RicfCreateMultipleFractures::execute()
|
||||
wellPaths = TOOLS::wellPathsFromNames(TOOLS::toQStringList(m_wellPathNames), &wellsNotFound);
|
||||
if (!wellsNotFound.empty())
|
||||
{
|
||||
RiaLogging::error(QString("createMultipleFractures: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
QString error = QString("createMultipleFractures: These well paths were not found: %1").arg(wellsNotFound.join(", "));
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gridCase)
|
||||
{
|
||||
RiaLogging::error(QString("createMultipleFractures: Could not find case with ID %1").arg(m_caseId));
|
||||
QString error = QString("createMultipleFractures: Could not find case with ID %1").arg(m_caseId);
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
if (!fractureTemplate)
|
||||
{
|
||||
RiaLogging::error(QString("createMultipleFractures: Could not find fracture template with ID %1").arg(m_templateId));
|
||||
QString error = QString("createMultipleFractures: Could not find fracture template with ID %1").arg(m_templateId);
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
if (gridCase && fractureTemplate && !wellPaths.empty() && validateArguments())
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
RicCreateMultipleFracturesOptionItemUi* options = new RicCreateMultipleFracturesOptionItemUi();
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicCreateMultipleFracturesFeature*>(commandManager->getCommandFeature("RicCreateMultipleFracturesFeature"));
|
||||
|
||||
// Default layers
|
||||
int topLayer = m_topLayer;
|
||||
int baseLayer = m_baseLayer;
|
||||
if (feature && (topLayer < 0 || baseLayer < 0))
|
||||
{
|
||||
auto ijkRange = feature->ijkRangeForGrid(gridCase);
|
||||
if (topLayer < 0) topLayer = static_cast<int>(ijkRange.first.z());
|
||||
if (baseLayer < 0) baseLayer = static_cast<int>(ijkRange.second.z());
|
||||
}
|
||||
options->setValues(topLayer, baseLayer, fractureTemplate, m_spacing);
|
||||
|
||||
settings->clearWellPaths();
|
||||
for (auto wellPath : wellPaths)
|
||||
{
|
||||
settings->addWellPath(wellPath);
|
||||
}
|
||||
|
||||
settings->setValues(gridCase, m_minDistFromWellTd, m_maxFracturesPerWell);
|
||||
settings->clearOptions();
|
||||
settings->insertOptionItem(nullptr, options);
|
||||
|
||||
|
||||
if (feature)
|
||||
{
|
||||
if (m_action == MultipleFractures::APPEND_FRACTURES) feature->appendFractures();
|
||||
if (m_action == MultipleFractures::REPLACE_FRACTURES) feature->replaceFractures();
|
||||
}
|
||||
QString error("createMultipleFractures: No wellpaths found");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
if (!validateArguments())
|
||||
{
|
||||
QString error("createMultipleFractures: Mandatory argument(s) missing");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
RicCreateMultipleFracturesOptionItemUi* options = new RicCreateMultipleFracturesOptionItemUi();
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicCreateMultipleFracturesFeature*>(commandManager->getCommandFeature("RicCreateMultipleFracturesFeature"));
|
||||
|
||||
// Default layers
|
||||
int topLayer = m_topLayer;
|
||||
int baseLayer = m_baseLayer;
|
||||
if (feature && (topLayer < 0 || baseLayer < 0))
|
||||
{
|
||||
auto ijkRange = feature->ijkRangeForGrid(gridCase);
|
||||
if (topLayer < 0) topLayer = static_cast<int>(ijkRange.first.z());
|
||||
if (baseLayer < 0) baseLayer = static_cast<int>(ijkRange.second.z());
|
||||
}
|
||||
options->setValues(topLayer, baseLayer, fractureTemplate, m_spacing);
|
||||
|
||||
settings->clearWellPaths();
|
||||
for (auto wellPath : wellPaths)
|
||||
{
|
||||
settings->addWellPath(wellPath);
|
||||
}
|
||||
|
||||
settings->setValues(gridCase, m_minDistFromWellTd, m_maxFracturesPerWell);
|
||||
settings->clearOptions();
|
||||
settings->insertOptionItem(nullptr, options);
|
||||
|
||||
if (feature)
|
||||
{
|
||||
if (m_action == MultipleFractures::APPEND_FRACTURES) feature->appendFractures();
|
||||
if (m_action == MultipleFractures::REPLACE_FRACTURES) feature->replaceFractures();
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
||||
|
||||
@ -154,7 +171,6 @@ bool RicfCreateMultipleFractures::validateArguments() const
|
||||
|
||||
if (valid) return true;
|
||||
|
||||
RiaLogging::error(QString("createMultipleFractures: Mandatory argument(s) missing"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ class RicfCreateMultipleFractures : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateMultipleFractures();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
bool validateArguments() const;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "GridCrossPlotCommands/RicCreateSaturationPressurePlotsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
@ -42,7 +42,7 @@ RicfCreateSaturationPressurePlots::RicfCreateSaturationPressurePlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCreateSaturationPressurePlots::execute()
|
||||
RicfCommandResponse RicfCreateSaturationPressurePlots::execute()
|
||||
{
|
||||
std::vector<int> caseIds = m_caseIds();
|
||||
if (caseIds.empty())
|
||||
@ -58,26 +58,39 @@ void RicfCreateSaturationPressurePlots::execute()
|
||||
}
|
||||
}
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
if (project)
|
||||
if (caseIds.empty())
|
||||
{
|
||||
auto eclipeCases = project->eclipseCases();
|
||||
for (auto c : eclipeCases)
|
||||
{
|
||||
auto eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(c);
|
||||
if (!eclipseResultCase) continue;
|
||||
QString error("createSaturationPressurePlots: No cases found");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
for (auto caseId : caseIds)
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
if (!project)
|
||||
{
|
||||
QString error("No project loaded");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
auto eclipeCases = project->eclipseCases();
|
||||
for (auto c : eclipeCases)
|
||||
{
|
||||
auto eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(c);
|
||||
if (!eclipseResultCase) continue;
|
||||
|
||||
for (auto caseId : caseIds)
|
||||
{
|
||||
if (c->caseId == caseId)
|
||||
{
|
||||
if (c->caseId == caseId)
|
||||
{
|
||||
RicCreateSaturationPressurePlotsFeature::createPlots(eclipseResultCase);
|
||||
}
|
||||
RicCreateSaturationPressurePlotsFeature::createPlots(eclipseResultCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection();
|
||||
collection->updateAllRequiredEditors();
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class RicfCreateSaturationPressurePlots : public RicfCommandObject
|
||||
public:
|
||||
RicfCreateSaturationPressurePlots();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField< std::vector<int> > m_caseIds;
|
||||
|
@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfCreateStatisticsCase.h"
|
||||
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimEclipseStatisticsCase.h"
|
||||
#include "RimEclipseStatisticsCaseCollection.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCreateStatisticsCaseResult, "createStatisticsCaseResult");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateStatisticsCaseResult::RicfCreateStatisticsCaseResult(int caseId /*= -1*/)
|
||||
{
|
||||
CAF_PDM_InitObject("statistics_case_result", "", "", "");
|
||||
CAF_PDM_InitField(&this->caseId, "caseId", caseId, "", "", "", "");
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCreateStatisticsCase, "createStatisticsCase");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateStatisticsCase::RicfCreateStatisticsCase()
|
||||
{
|
||||
RICF_InitField(&m_caseGroupId, "caseGroupId", -1, "Case Group Id", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateStatisticsCase::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
|
||||
std::vector<RimIdenticalGridCaseGroup*> gridCaseGroups;
|
||||
project->descendantsIncludingThisOfType(gridCaseGroups);
|
||||
for (auto gridCaseGroup : gridCaseGroups)
|
||||
{
|
||||
if (gridCaseGroup->groupId() == m_caseGroupId())
|
||||
{
|
||||
RimEclipseStatisticsCase* createdObject = gridCaseGroup->createAndAppendStatisticsCase();
|
||||
project->assignCaseIdToCase(createdObject);
|
||||
gridCaseGroup->updateConnectedEditors();
|
||||
RicfCommandResponse response;
|
||||
response.setResult(new RicfCreateStatisticsCaseResult(createdObject->caseId()));
|
||||
return response;
|
||||
}
|
||||
}
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, "Could not find grid case group");
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RicfCreateStatisticsCaseResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateStatisticsCaseResult(int caseId = -1);
|
||||
|
||||
public:
|
||||
caf::PdmField<int> caseId;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCreateStatisticsCase : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateStatisticsCase();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseGroupId;
|
||||
};
|
85
ApplicationCode/CommandFileInterface/RicfCreateView.cpp
Normal file
85
ApplicationCode/CommandFileInterface/RicfCreateView.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
#include "RicfCreateView.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCreateViewResult, "createViewResult");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateViewResult::RicfCreateViewResult(int viewId /*= -1*/)
|
||||
{
|
||||
CAF_PDM_InitObject("view_result", "", "", "");
|
||||
CAF_PDM_InitField(&this->viewId, "viewId", viewId, "", "", "", "");
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCreateView, "createView");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateView::RicfCreateView()
|
||||
{
|
||||
RICF_InitField(&m_caseId, "caseId", -1, "Case Id", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateView::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
std::vector<RimCase*> allCases;
|
||||
project->allCases(allCases);
|
||||
|
||||
for (RimCase* rimCase : allCases)
|
||||
{
|
||||
if (rimCase->caseId == m_caseId())
|
||||
{
|
||||
int viewId = -1;
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(rimCase);
|
||||
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(rimCase);
|
||||
if (eclipseCase)
|
||||
{
|
||||
RimEclipseView* view = eclipseCase->createAndAddReservoirView();
|
||||
viewId = view->id();
|
||||
view->loadDataAndUpdate();
|
||||
eclipseCase->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::setExpanded(view);
|
||||
}
|
||||
else if (geoMechCase)
|
||||
{
|
||||
RimGeoMechView* view = geoMechCase->createAndAddReservoirView();
|
||||
viewId = view->id();
|
||||
view->loadDataAndUpdate();
|
||||
geoMechCase->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::setExpanded(view);
|
||||
}
|
||||
|
||||
if (viewId >= 0)
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
response.setResult(new RicfCreateViewResult(viewId));
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString error = QString("createView: Could not create view for case id %1").arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
52
ApplicationCode/CommandFileInterface/RicfCreateView.h
Normal file
52
ApplicationCode/CommandFileInterface/RicfCreateView.h
Normal file
@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RicfCreateViewResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateViewResult(int viewId = -1);
|
||||
|
||||
public:
|
||||
caf::PdmField<int> viewId;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCreateView : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateView();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
};
|
@ -0,0 +1,119 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfExportFlowCharacteristics.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportFlowCharacteristics, "exportFlowCharacteristics");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportFlowCharacteristics::RicfExportFlowCharacteristics()
|
||||
{
|
||||
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
|
||||
RICF_InitField(&m_selectedTimeSteps, "timeSteps", std::vector<int>(), "Selected Time Steps", "", "", "");
|
||||
RICF_InitField(&m_injectors, "injectors", std::vector<QString>(), "Injectors", "", "", "");
|
||||
RICF_InitField(&m_producers, "producers", std::vector<QString>(), "Producers", "", "", "");
|
||||
RICF_InitField(&m_fileName, "fileName", QString(), "Export File Name", "", "", "");
|
||||
RICF_InitField(&m_minCommunication, "minimumCommunication", 0.0, "Minimum Communication", "", "", "");
|
||||
RICF_InitField(&m_maxPvFraction, "aquiferCellThreshold", 0.1, "Aquifer Cell Threshold", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportFlowCharacteristics::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
auto eclipseCase = dynamic_cast<RimEclipseResultCase*>(TOOLS::caseFromId(m_caseId()));
|
||||
if (!eclipseCase)
|
||||
{
|
||||
QString error = QString("exportFlowCharacteristics: Could not find case with ID %1.").arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
{
|
||||
QString exportFileName = m_fileName();
|
||||
QFileInfo fi(exportFileName);
|
||||
if (!fi.isAbsolute())
|
||||
{
|
||||
QString relativePath = fi.path();
|
||||
|
||||
QString exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath(relativePath);
|
||||
|
||||
QDir exportDir(exportFolder);
|
||||
if (!exportDir.exists())
|
||||
{
|
||||
if (!exportDir.mkpath("."))
|
||||
{
|
||||
QString msg = QString("Failed to create folder - %1").arg(exportFolder);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, msg);
|
||||
}
|
||||
}
|
||||
|
||||
exportFileName = exportFolder + "/" + fi.fileName();
|
||||
}
|
||||
|
||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||
if (flowPlotColl)
|
||||
{
|
||||
RimFlowCharacteristicsPlot* plot = flowPlotColl->defaultFlowCharacteristicsPlot();
|
||||
plot->setFromFlowSolution(eclipseCase->defaultFlowDiagSolution());
|
||||
plot->setTimeSteps(m_selectedTimeSteps);
|
||||
plot->setInjectorsAndProducers(m_injectors, m_producers);
|
||||
plot->setAquiferCellThreshold(m_maxPvFraction);
|
||||
plot->setMinimumCommunication(m_minCommunication);
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
{
|
||||
QString content = plot->curveDataAsText();
|
||||
|
||||
QFile file(exportFileName);
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
QTextStream textstream(&file);
|
||||
textstream << content;
|
||||
}
|
||||
else
|
||||
{
|
||||
QString msg = QString("Failed to export file - %1").arg(exportFileName);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportFlowCharacteristics : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfExportFlowCharacteristics();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
caf::PdmField<std::vector<int>> m_selectedTimeSteps;
|
||||
caf::PdmField<std::vector<QString>> m_injectors;
|
||||
caf::PdmField<std::vector<QString>> m_producers;
|
||||
caf::PdmField<QString> m_fileName;
|
||||
caf::PdmField<double> m_minCommunication;
|
||||
caf::PdmField<double> m_maxPvFraction;
|
||||
};
|
@ -59,7 +59,7 @@ RicfExportLgrForCompletions::RicfExportLgrForCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportLgrForCompletions::execute()
|
||||
RicfCommandResponse RicfExportLgrForCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@ -71,38 +71,49 @@ void RicfExportLgrForCompletions::execute()
|
||||
wellPaths = TOOLS::wellPathsFromNames(TOOLS::toQStringList(m_wellPathNames), &wellsNotFound);
|
||||
if (!wellsNotFound.empty())
|
||||
{
|
||||
RiaLogging::error(QString("exportLgrForCompletions: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
QString error(QString("exportLgrForCompletions: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!wellPaths.empty())
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::LGRS);
|
||||
if (exportFolder.isNull())
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("LGR");
|
||||
}
|
||||
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicExportLgrFeature*>(commandManager->getCommandFeature("RicExportLgrFeature"));
|
||||
|
||||
RimEclipseCase* eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportLgrForCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
|
||||
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
|
||||
QStringList wellsIntersectingOtherLgrs;
|
||||
|
||||
feature->exportLgrsForWellPaths(exportFolder, wellPaths, eclipseCase, m_timeStep, lgrCellCounts, m_splitType(),
|
||||
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES}, &wellsIntersectingOtherLgrs);
|
||||
|
||||
if (!wellsIntersectingOtherLgrs.empty())
|
||||
{
|
||||
auto wellsList = wellsIntersectingOtherLgrs.join(", ");
|
||||
RiaLogging::error("exportLgrForCompletions: No export for some wells due to existing intersecting LGR(s).Affected wells : " + wellsList);
|
||||
}
|
||||
QString error("exportLgrForCompletions: Could not find any well paths");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::LGRS);
|
||||
if (exportFolder.isNull())
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("LGR");
|
||||
}
|
||||
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicExportLgrFeature*>(commandManager->getCommandFeature("RicExportLgrFeature"));
|
||||
|
||||
RimEclipseCase* eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
QString error(QString("exportLgrForCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
|
||||
QStringList wellsIntersectingOtherLgrs;
|
||||
|
||||
feature->exportLgrsForWellPaths(exportFolder, wellPaths, eclipseCase, m_timeStep, lgrCellCounts, m_splitType(),
|
||||
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES}, &wellsIntersectingOtherLgrs);
|
||||
|
||||
RicfCommandResponse response;
|
||||
if (!wellsIntersectingOtherLgrs.empty())
|
||||
{
|
||||
auto wellsList = wellsIntersectingOtherLgrs.join(", ");
|
||||
QString warning("exportLgrForCompletions: No export for some wells due to existing intersecting LGR(s).Affected wells : " + wellsList);
|
||||
RiaLogging::warning(warning);
|
||||
response.updateStatus(RicfCommandResponse::COMMAND_WARNING, warning);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class RicfExportLgrForCompletions : public RicfCommandObject
|
||||
public:
|
||||
RicfExportLgrForCompletions();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -55,7 +55,7 @@ RicfExportMsw::RicfExportMsw()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportMsw::execute()
|
||||
RicfCommandResponse RicfExportMsw::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@ -64,8 +64,9 @@ void RicfExportMsw::execute()
|
||||
auto eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportMsw: Could not find case with ID %1.").arg(m_caseId()));
|
||||
return;
|
||||
QString error = QString("exportMsw: Could not find case with ID %1.").arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
||||
@ -83,9 +84,12 @@ void RicfExportMsw::execute()
|
||||
RimWellPath* wellPath = RiaApplication::instance()->project()->wellPathByName(m_wellPathName);
|
||||
if (!wellPath)
|
||||
{
|
||||
RiaLogging::error(QString("exportMsw: Could not find well path with name %1").arg(m_wellPathName()));
|
||||
return;
|
||||
QString error = QString("exportMsw: Could not find well path with name %1").arg(m_wellPathName());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(exportSettings, { wellPath });
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class RicfExportMsw : public RicfCommandObject
|
||||
public:
|
||||
RicfExportMsw();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
|
||||
@ -37,21 +37,32 @@ RicfExportMultiCaseSnapshots::RicfExportMultiCaseSnapshots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportMultiCaseSnapshots::execute()
|
||||
RicfCommandResponse RicfExportMultiCaseSnapshots::execute()
|
||||
{
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
if (!app)
|
||||
{
|
||||
QString error("exportMultiCaseSnapshots: Requires GUI Application");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
if (m_gridListFile().isNull())
|
||||
{
|
||||
RiaLogging::error("exportMultiCaseSnapshots: Required parameter gridListFile.");
|
||||
return;
|
||||
QString error("exportMultiCaseSnapshots: Required parameter gridListFile.");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if (lastProjectPath.isNull())
|
||||
{
|
||||
RiaLogging::error("exportMultiCaseSnapshots: 'openProject' must be called before 'exportMultiCaseSnapshots' to specify project file to replace cases in.");
|
||||
return;
|
||||
QString error("exportMultiCaseSnapshots: 'openProject' must be called before 'exportMultiCaseSnapshots' to specify project file to replace cases in.");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
std::vector<QString> listFileNames = RiaApplication::readFileListFromTextFile(m_gridListFile());
|
||||
RiaApplication::instance()->runMultiCaseSnapshots(lastProjectPath, listFileNames, RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS));
|
||||
app->runMultiCaseSnapshots(lastProjectPath, listFileNames, RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS));
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class RicfExportMultiCaseSnapshots : public RicfCommandObject
|
||||
public:
|
||||
RicfExportMultiCaseSnapshots();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_gridListFile;
|
||||
|
@ -59,7 +59,7 @@ RicfExportProperty::RicfExportProperty()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportProperty::execute()
|
||||
RicfCommandResponse RicfExportProperty::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@ -67,16 +67,18 @@ void RicfExportProperty::execute()
|
||||
{
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
QString error = QString("exportProperty: Could not find case with ID %1").arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
if (!eclipseCase->eclipseCaseData())
|
||||
{
|
||||
if (!eclipseCase->openReserviorCase())
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find eclipseCaseData with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
QString error = QString("exportProperty: Could not find eclipseCaseData with ID %1").arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,8 +89,9 @@ void RicfExportProperty::execute()
|
||||
|
||||
if (!cellResultsData->ensureKnownResultLoaded(RigEclipseResultAddress(m_propertyName)))
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find result property : %1").arg(m_propertyName()));
|
||||
return;
|
||||
QString error = QString("exportProperty: Could not find result property : %1").arg(m_propertyName());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
QString filePath = m_exportFileName;
|
||||
@ -106,6 +109,13 @@ void RicfExportProperty::execute()
|
||||
eclipseKeyword = m_propertyName;
|
||||
}
|
||||
|
||||
RicEclipseCellResultToFileImpl::writePropertyToTextFile(
|
||||
filePath, eclipseCase->eclipseCaseData(), m_timeStepIndex, m_propertyName, eclipseKeyword, m_undefinedValue);
|
||||
QString errMsg;
|
||||
if (!RicEclipseCellResultToFileImpl::writePropertyToTextFile(
|
||||
filePath, eclipseCase->eclipseCaseData(), m_timeStepIndex, m_propertyName, eclipseKeyword, m_undefinedValue,
|
||||
&errMsg))
|
||||
{
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, errMsg);
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class RicfExportProperty : public RicfCommandObject
|
||||
public:
|
||||
RicfExportProperty();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -55,15 +55,16 @@ RicfExportPropertyInViews::RicfExportPropertyInViews()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportPropertyInViews::execute()
|
||||
RicfCommandResponse RicfExportPropertyInViews::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
RimEclipseCase* eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
QString error(QString("exportProperty: Could not find case with ID %1").arg(m_caseId()));
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
std::vector<RimEclipseView*> viewsForExport;
|
||||
@ -95,6 +96,8 @@ void RicfExportPropertyInViews::execute()
|
||||
}
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
|
||||
for (const auto& view : viewsForExport)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = nullptr;
|
||||
@ -109,11 +112,12 @@ void RicfExportPropertyInViews::execute()
|
||||
|
||||
if (resultAccessor.isNull())
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find property. Case ID %1, time step %2, property '%3'")
|
||||
QString warning = QString("exportProperty: Could not find property. Case ID %1, time step %2, property '%3'")
|
||||
.arg(m_caseId)
|
||||
.arg(view->currentTimeStep())
|
||||
.arg(propertyName));
|
||||
|
||||
.arg(propertyName);
|
||||
RiaLogging::warning(warning);
|
||||
response.updateStatus(RicfCommandResponse::COMMAND_WARNING, warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -128,11 +132,19 @@ void RicfExportPropertyInViews::execute()
|
||||
fileName = caf::Utils::makeValidFileBasename(fileName);
|
||||
const QString filePath = propertiesDir.filePath(fileName);
|
||||
|
||||
RicEclipseCellResultToFileImpl::writeResultToTextFile(filePath,
|
||||
eclipseCase->eclipseCaseData(),
|
||||
resultAccessor.p(),
|
||||
propertyName,
|
||||
m_undefinedValue,
|
||||
"exportPropertiesInViews");
|
||||
QString errorMsg;
|
||||
|
||||
bool worked = RicEclipseCellResultToFileImpl::writeResultToTextFile(filePath,
|
||||
eclipseCase->eclipseCaseData(),
|
||||
resultAccessor.p(),
|
||||
propertyName,
|
||||
m_undefinedValue,
|
||||
"exportPropertiesInViews",
|
||||
&errorMsg);
|
||||
if (!worked)
|
||||
{
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, errorMsg);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class RicfExportPropertyInViews : public RicfCommandObject
|
||||
public:
|
||||
RicfExportPropertyInViews();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -56,7 +56,7 @@ RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportSimWellFractureCompletions::execute()
|
||||
RicfCommandResponse RicfExportSimWellFractureCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@ -71,8 +71,9 @@ void RicfExportSimWellFractureCompletions::execute()
|
||||
auto eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportSimWellCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
QString error = QString("exportSimWellCompletions: Could not find case with ID %1").arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
}
|
||||
@ -95,10 +96,13 @@ void RicfExportSimWellFractureCompletions::execute()
|
||||
}
|
||||
if (views.empty())
|
||||
{
|
||||
RiaLogging::error(QString("exportSimWellCompletions: Could not find any views named \"%1\" in the case with ID %2").arg(m_viewName).arg(m_caseId()));
|
||||
return;
|
||||
QString error = QString("exportSimWellCompletions: Could not find any views named \"%1\" in the case with ID %2").arg(m_viewName).arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
if (m_simWellNames().empty())
|
||||
{
|
||||
@ -126,7 +130,9 @@ void RicfExportSimWellFractureCompletions::execute()
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning(QString("exportSimWellCompletions: Could not find well with name %1 in view \"%2\" on case with ID %2").arg(wellPathName).arg(m_viewName).arg(m_caseId()));
|
||||
QString warning = QString("exportSimWellCompletions: Could not find well with name %1 in view \"%2\" on case with ID %2").arg(wellPathName).arg(m_viewName).arg(m_caseId());
|
||||
RiaLogging::warning(warning);
|
||||
response.updateStatus(RicfCommandResponse::COMMAND_WARNING, warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,4 +141,6 @@ void RicfExportSimWellFractureCompletions::execute()
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class RicfExportSimWellFractureCompletions : public RicfCommandObject
|
||||
public:
|
||||
RicfExportSimWellFractureCompletions();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -23,7 +23,8 @@
|
||||
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@ -50,17 +51,25 @@ RicfExportSnapshots::RicfExportSnapshots()
|
||||
{
|
||||
RICF_InitField(&m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "");
|
||||
RICF_InitField(&m_prefix, "prefix", QString(), "Prefix", "", "", "");
|
||||
RICF_InitField(&m_caseId, "caseId", -1, "Case Id", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportSnapshots::execute()
|
||||
RicfCommandResponse RicfExportSnapshots::execute()
|
||||
{
|
||||
if (!RiaGuiApplication::isRunning())
|
||||
{
|
||||
QString error("RicfExportSnapshot: Command cannot run without a GUI");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
CVF_ASSERT(mainWnd);
|
||||
mainWnd->hideAllDockWindows();
|
||||
RiaApplication::instance()->processEvents();
|
||||
mainWnd->hideAllDockWidgets();
|
||||
RiaGuiApplication::instance()->processEvents();
|
||||
|
||||
QString absolutePathToSnapshotDir = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS);
|
||||
if (absolutePathToSnapshotDir.isNull())
|
||||
@ -69,7 +78,7 @@ void RicfExportSnapshots::execute()
|
||||
}
|
||||
if (m_type == RicfExportSnapshots::VIEWS || m_type == RicfExportSnapshots::ALL)
|
||||
{
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir, m_prefix);
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir, m_prefix, m_caseId());
|
||||
}
|
||||
if (m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL)
|
||||
{
|
||||
@ -77,5 +86,7 @@ void RicfExportSnapshots::execute()
|
||||
}
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
RiaApplication::instance()->processEvents();
|
||||
RiaGuiApplication::instance()->processEvents();
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ class RicfExportSnapshots : public RicfCommandObject
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
// Values are exposed in gRPC .proto. Do not change without also changing .proto
|
||||
enum SnapshotsType
|
||||
{
|
||||
VIEWS,
|
||||
@ -44,9 +45,10 @@ public:
|
||||
public:
|
||||
RicfExportSnapshots();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<SnapshotsTypeEnum> m_type;
|
||||
caf::PdmField<QString> m_prefix;
|
||||
caf::PdmField<int> m_caseId;
|
||||
};
|
||||
|
@ -75,19 +75,21 @@ RicfExportVisibleCells::RicfExportVisibleCells()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportVisibleCells::execute()
|
||||
RicfCommandResponse RicfExportVisibleCells::execute()
|
||||
{
|
||||
if (m_caseId < 0 || m_viewName().isEmpty())
|
||||
{
|
||||
RiaLogging::error("exportVisibleCells: CaseId or view name not specified");
|
||||
return;
|
||||
QString error("exportVisibleCells: CaseId or view name not specified");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
auto eclipseView = RicfApplicationTools::viewFromCaseIdAndViewName(m_caseId, m_viewName);
|
||||
if (!eclipseView)
|
||||
{
|
||||
RiaLogging::error(QString("exportVisibleCells: Could not find view '%1' in case ID %2").arg(m_viewName).arg(m_caseId));
|
||||
return;
|
||||
QString error(QString("exportVisibleCells: Could not find view '%1' in case ID %2").arg(m_viewName).arg(m_caseId));
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::CELLS);
|
||||
@ -101,6 +103,8 @@ void RicfExportVisibleCells::execute()
|
||||
RicSaveEclipseInputVisibleCellsUi exportSettings;
|
||||
buildExportSettings(exportFolder, &exportSettings);
|
||||
RicSaveEclipseInputVisibleCellsFeature::executeCommand(eclipseView, exportSettings, "exportVisibleCells");
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -45,7 +45,7 @@ class RicfExportVisibleCells : public RicfCommandObject
|
||||
public:
|
||||
RicfExportVisibleCells();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
void buildExportSettings(const QString& exportFolder, RicSaveEclipseInputVisibleCellsUi* exportSettings);
|
||||
|
@ -65,7 +65,7 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportWellPathCompletions::execute()
|
||||
RicfCommandResponse RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@ -101,8 +101,9 @@ void RicfExportWellPathCompletions::execute()
|
||||
auto eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportWellPathCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
QString error = QString("exportWellPathCompletions: Could not find case with ID %1").arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
}
|
||||
@ -114,6 +115,8 @@ void RicfExportWellPathCompletions::execute()
|
||||
}
|
||||
exportSettings->folder = exportFolder;
|
||||
|
||||
RicfCommandResponse response;
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
if (m_wellPathNames().empty())
|
||||
{
|
||||
@ -136,7 +139,9 @@ void RicfExportWellPathCompletions::execute()
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning(QString("exportWellPathCompletions: Could not find well path with name %1").arg(wellPathName));
|
||||
QString warning = QString("exportWellPathCompletions: Could not find well path with name %1").arg(wellPathName);
|
||||
RiaLogging::warning(warning);
|
||||
response.updateStatus(RicfCommandResponse::COMMAND_WARNING, warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -144,4 +149,6 @@ void RicfExportWellPathCompletions::execute()
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class RicfExportWellPathCompletions : public RicfCommandObject
|
||||
public:
|
||||
RicfExportWellPathCompletions();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -52,7 +52,7 @@ RicfExportWellPaths::RicfExportWellPaths()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportWellPaths::execute()
|
||||
RicfCommandResponse RicfExportWellPaths::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
@ -64,27 +64,34 @@ void RicfExportWellPaths::execute()
|
||||
wellPaths = TOOLS::wellPathsFromNames(TOOLS::toQStringList(m_wellPathNames), &wellsNotFound);
|
||||
if (!wellsNotFound.empty())
|
||||
{
|
||||
RiaLogging::error(QString("exportWellPaths: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
QString error(QString("exportWellPaths: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!wellPaths.empty())
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::WELLPATHS);
|
||||
if (exportFolder.isNull())
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("wellpaths");
|
||||
}
|
||||
QString error("No well paths found");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicExportSelectedWellPathsFeature*>(commandManager->getCommandFeature("RicExportSelectedWellPathsFeature"));
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::WELLPATHS);
|
||||
if (exportFolder.isNull())
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("wellpaths");
|
||||
}
|
||||
|
||||
for (const auto wellPath : wellPaths)
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicExportSelectedWellPathsFeature*>(commandManager->getCommandFeature("RicExportSelectedWellPathsFeature"));
|
||||
|
||||
for (const auto wellPath : wellPaths)
|
||||
{
|
||||
if (wellPath)
|
||||
{
|
||||
if (wellPath)
|
||||
{
|
||||
feature->exportWellPath(wellPath, m_mdStepSize, exportFolder, false);
|
||||
}
|
||||
feature->exportWellPath(wellPath, m_mdStepSize, exportFolder, false);
|
||||
}
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class RicfExportWellPaths : public RicfCommandObject
|
||||
public:
|
||||
RicfExportWellPaths();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<QString>> m_wellPathNames;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
// Copyright (C) 2017-2019 Statoil ASA
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -18,12 +19,25 @@
|
||||
|
||||
#include "RicfLoadCase.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfLoadCaseResult, "loadCaseResult");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfLoadCaseResult::RicfLoadCaseResult(int caseId)
|
||||
{
|
||||
CAF_PDM_InitObject("case_result", "", "", "");
|
||||
CAF_PDM_InitField(&this->caseId, "id", caseId, "", "", "", "");
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfLoadCase, "loadCase");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -37,11 +51,26 @@ RicfLoadCase::RicfLoadCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfLoadCase::execute()
|
||||
RicfCommandResponse RicfLoadCase::execute()
|
||||
{
|
||||
bool ok = RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({m_path()}), nullptr, true);
|
||||
QString absolutePath = m_path;
|
||||
QFileInfo projectPathInfo(absolutePath);
|
||||
if (!projectPathInfo.exists())
|
||||
{
|
||||
QDir startDir(RiaApplication::instance()->startDir());
|
||||
absolutePath = startDir.absoluteFilePath(m_path);
|
||||
}
|
||||
|
||||
RiaImportEclipseCaseTools::FileCaseIdMap fileCaseIdMap;
|
||||
bool ok = RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({absolutePath}), &fileCaseIdMap, true);
|
||||
if (!ok)
|
||||
{
|
||||
RiaLogging::error(QString("loadCase: Unable to load case from %1").arg(m_path()));
|
||||
QString error = QString("loadCase: Unable to load case from %1").arg(absolutePath);
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
CAF_ASSERT(fileCaseIdMap.size() == 1u);
|
||||
RicfCommandResponse response;
|
||||
response.setResult(new RicfLoadCaseResult(fileCaseIdMap.begin()->second));
|
||||
return response;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
// Copyright (C) 2017-2019 Statoil ASA
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -22,6 +23,15 @@
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RicfLoadCaseResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RicfLoadCaseResult(int caseId = -1);
|
||||
public:
|
||||
caf::PdmField<int> caseId;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@ -34,7 +44,7 @@ class RicfLoadCase : public RicfCommandObject
|
||||
public:
|
||||
RicfLoadCase();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_path;
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaRegressionTestRunner.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfOpenProject, "openProject");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -37,13 +40,21 @@ RicfOpenProject::RicfOpenProject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfOpenProject::execute()
|
||||
RicfCommandResponse RicfOpenProject::execute()
|
||||
{
|
||||
bool ok = RiaApplication::instance()->loadProject(m_path);
|
||||
QString projectPath = m_path;
|
||||
QFileInfo projectPathInfo(projectPath);
|
||||
if (!projectPathInfo.exists())
|
||||
{
|
||||
QDir startDir(RiaApplication::instance()->startDir());
|
||||
projectPath = startDir.absoluteFilePath(m_path);
|
||||
}
|
||||
bool ok = RiaApplication::instance()->loadProject(projectPath);
|
||||
if (!ok)
|
||||
{
|
||||
RiaLogging::error(QString("openProject: Unable to open project at %1").arg(m_path()));
|
||||
return;
|
||||
QString errMsg = QString("openProject: Unable to open project at %1").arg(m_path());
|
||||
RiaLogging::error(errMsg);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, errMsg);
|
||||
}
|
||||
|
||||
if (RiaRegressionTestRunner::instance()->isRunningRegressionTests())
|
||||
@ -51,5 +62,7 @@ void RicfOpenProject::execute()
|
||||
RiaRegressionTestRunner::regressionTestConfigureProject();
|
||||
}
|
||||
|
||||
RicfCommandFileExecutor::instance()->setLastProjectPath(m_path);
|
||||
RicfCommandFileExecutor::instance()->setLastProjectPath(projectPath);
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class RicfOpenProject : public RicfCommandObject
|
||||
public:
|
||||
RicfOpenProject();
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_path;
|
||||
|
@ -26,6 +26,9 @@
|
||||
|
||||
#include "RimProject.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfSingleCaseReplace, "replaceCase");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -56,16 +59,47 @@ QString RicfSingleCaseReplace::filePath() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfSingleCaseReplace::execute()
|
||||
RicfCommandResponse RicfSingleCaseReplace::execute()
|
||||
{
|
||||
// Never call execute on this object, information is aggregated into RicfMultiCaseReplace
|
||||
CAF_ASSERT(false);
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if (lastProjectPath.isNull())
|
||||
{
|
||||
QString errMsg(
|
||||
"replaceCase: 'openProject' must be called before 'replaceCase' to specify project file to replace case in.");
|
||||
RiaLogging::error(errMsg);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, errMsg);
|
||||
}
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
|
||||
QString filePath = m_newGridFile();
|
||||
QFileInfo casePathInfo(filePath);
|
||||
if (!casePathInfo.exists())
|
||||
{
|
||||
QDir startDir(RiaApplication::instance()->startDir());
|
||||
filePath = startDir.absoluteFilePath(m_newGridFile());
|
||||
}
|
||||
|
||||
if (m_caseId() < 0)
|
||||
{
|
||||
projectModifier->setReplaceCaseFirstOccurrence(filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectModifier->setReplaceCase(m_caseId(), filePath);
|
||||
}
|
||||
|
||||
if (!RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_NONE, projectModifier.p()))
|
||||
{
|
||||
QString errMsg("Could not reload project");
|
||||
RiaLogging::error(errMsg);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, errMsg);
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfMultiCaseReplace, "replaceCaseImpl_no_support_for_command_file_text_parsing");
|
||||
CAF_PDM_SOURCE_INIT(RicfMultiCaseReplace, "replaceMultipleCases");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -85,26 +119,35 @@ void RicfMultiCaseReplace::setCaseReplacePairs(const std::map<int, QString>& cas
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfMultiCaseReplace::execute()
|
||||
RicfCommandResponse RicfMultiCaseReplace::execute()
|
||||
{
|
||||
if (m_caseIdToGridFileNameMap.empty())
|
||||
{
|
||||
RiaLogging::error("replaceCaseImpl: No replacements available.");
|
||||
return;
|
||||
QString errMsg("replaceCaseImpl: No replacements available.");
|
||||
RiaLogging::error(errMsg);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, errMsg);
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if (lastProjectPath.isNull())
|
||||
{
|
||||
RiaLogging::error("replaceCase: 'openProject' must be called before 'replaceCase' to specify project file to replace case in.");
|
||||
return;
|
||||
QString errMsg("replaceCase: 'openProject' must be called before 'replaceCase' to specify project file to replace case in.");
|
||||
RiaLogging::error(errMsg);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, errMsg);
|
||||
}
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
for (const auto& a : m_caseIdToGridFileNameMap)
|
||||
{
|
||||
const auto caseId = a.first;
|
||||
const auto filePath = a.second;
|
||||
const int caseId = a.first;
|
||||
QString filePath = a.second;
|
||||
QFileInfo casePathInfo(filePath);
|
||||
if (!casePathInfo.exists())
|
||||
{
|
||||
QDir startDir(RiaApplication::instance()->startDir());
|
||||
filePath = startDir.absoluteFilePath(filePath);
|
||||
}
|
||||
|
||||
if (caseId < 0)
|
||||
{
|
||||
projectModifier->setReplaceCaseFirstOccurrence(filePath);
|
||||
@ -115,5 +158,12 @@ void RicfMultiCaseReplace::execute()
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_NONE, projectModifier.p());
|
||||
if (!RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_NONE, projectModifier.p()))
|
||||
{
|
||||
QString errMsg("Could not reload project");
|
||||
RiaLogging::error(errMsg);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, errMsg);
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
int caseId() const;
|
||||
QString filePath() const;
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_newGridFile;
|
||||
@ -51,7 +51,7 @@ private:
|
||||
// RicfMultipleReplaceCase represents multiple caseId-gridFileName pairs
|
||||
//
|
||||
// NB! This object has no support for parsing a text command. This object is created by aggregating
|
||||
// multiple RicfSingleCaseReplace objects
|
||||
// multiple RicfSingleCaseReplace objects, or through gRPC interface.
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfMultiCaseReplace : public RicfCommandObject
|
||||
@ -63,7 +63,7 @@ public:
|
||||
|
||||
void setCaseReplacePairs(const std::map<int, QString>& caseIdToGridFileNameMap);
|
||||
|
||||
void execute() override;
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
std::map<int, QString> m_caseIdToGridFileNameMap;
|
||||
|
@ -38,19 +38,21 @@ RicfReplaceSourceCases::RicfReplaceSourceCases()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfReplaceSourceCases::execute()
|
||||
RicfCommandResponse RicfReplaceSourceCases::execute()
|
||||
{
|
||||
if (m_gridListFile().isNull())
|
||||
{
|
||||
RiaLogging::error("replaceSourceCases: Required parameter gridListFile.");
|
||||
return;
|
||||
QString error("replaceSourceCases: Required parameter gridListFile.");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if (lastProjectPath.isNull())
|
||||
{
|
||||
RiaLogging::error("replaceSourceCases: 'openProject' must be called before 'replaceSourceCases' to specify project file to replace cases in.");
|
||||
return;
|
||||
QString error("replaceSourceCases: 'openProject' must be called before 'replaceSourceCases' to specify project file to replace cases in.");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
@ -65,5 +67,11 @@ void RicfReplaceSourceCases::execute()
|
||||
projectModifier->setReplaceSourceCasesById(m_caseGroupId(), listFileNames);
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_CALCULATE_STATISTICS, projectModifier.p());
|
||||
if (!RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_CALCULATE_STATISTICS, projectModifier.p()))
|
||||
{
|
||||
QString error("Could not reload project");
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user