Merge branch 'dev' into feature-ensemble-rft

This commit is contained in:
Gaute Lindkvist
2019-08-28 12:56:27 +02:00
committed by GitHub
46 changed files with 4450 additions and 306 deletions

View File

@@ -27,8 +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_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@"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,289 @@
// ResInsight version string : 2019.08.0-dev.01
// Report generated : Tue Aug 27 11:38:53 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
cloneView
closeProject
computeCaseGroupStatistics
createGridCaseGroup
createGridCaseGroupResult
createLgrForCompletions
createMultipleFractures
createSaturationPressurePlots
createStatisticsCase
createStatisticsCaseResult
createView
createViewResult
exportFlowCharacteristics
exportLgrForCompletions
exportMsw
exportMultiCaseSnapshots
exportProperty
exportPropertyInViews
exportSimWellFractureCompletions
exportSnapshots
exportVisibleCells
exportWellPathCompletions
exportWellPaths
loadCase
loadCaseResult
openProject
replaceCase
replaceMultipleCases
replaceSourceCases
runOctaveScript
scaleFractureTemplate
setExportFolder
setFractureContainment
setMainWindowSize
setStartDir
setTimeStep

View File

@@ -289,7 +289,7 @@ bool RiaApplication::openFile(const QString& fileName)
}
else if (fileType & RiaDefines::ANY_ECLIPSE_FILE)
{
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames(QStringList{fileName});
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames(QStringList{fileName}, true);
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel(fileType);
}

View File

@@ -259,7 +259,7 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments(cvf::Pr
{
QStringList fileNames = RicImportGeneralDataFeature::fileNamesFromCaseNames(cvfqt::Utils::toQStringList(o.values()));
RicImportGeneralDataFeature::OpenCaseResults results =
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(fileNames);
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(fileNames, true);
}
if (cvf::Option o = progOpt->option("commandFile"))

View File

@@ -133,6 +133,7 @@
#ifdef USE_UNIT_TESTS
#include "gtest/gtest.h"
#endif // USE_UNIT_TESTS
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
namespace caf
{
@@ -657,6 +658,11 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
}
}
if (cvf::Option o = progOpt->option("summaryplot"))
{
RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( cvfqt::Utils::toQStringList(o.values()));
}
QString projectFileName;
if (progOpt->hasOption("last"))
@@ -777,7 +783,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra
QStringList fileNames = RicImportGeneralDataFeature::fileNamesFromCaseNames(cvfqt::Utils::toQStringList(o.values()));
RicImportGeneralDataFeature::OpenCaseResults results =
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(fileNames);
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(fileNames, true);
if (results && !results.eclipseSummaryFiles.empty())
{
getOrCreateAndShowMainPlotWindow();

View File

@@ -32,6 +32,7 @@
#include "cafPdmUiFilePathEditor.h"
#include <QDate>
#include <QDir>
#include <QLocale>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
@@ -74,7 +75,10 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "");
scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
QString defaultTextEditor;
// TODO: This only currently works for installed ResInsight.
scriptDirectories = QCoreApplication::applicationDirPath() + "/Python/rips/PythonExamples";
QString defaultTextEditor;
#ifdef WIN32
defaultTextEditor = QString("notepad.exe");
#else
@@ -101,6 +105,7 @@ RiaPreferences::RiaPreferences(void)
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(&showPythonDebugInfo, "pythonDebugInfo", false, "Show Python Debug Info", "", "", "");
CAF_PDM_InitField(&ssihubAddress, "ssihubAddress", QString("http://"), "SSIHUB Address", "", "", "");
ssihubAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
@@ -268,8 +273,6 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
viewsGroup->add(&showHud);
caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup("Other");
otherGroup->add(&m_dateFormat);
otherGroup->add(&m_timeFormat);
otherGroup->add(&ssihubAddress);
otherGroup->add(&showLasCurveWithoutTvdWarning);
otherGroup->add(&holoLensDisableCertificateVerification);
@@ -300,10 +303,12 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
group->add(&summaryEnsembleImportMode);
}
}
else if (uiConfigName == RiaPreferences::tabNameEclipseSummary())
else if (uiConfigName == RiaPreferences::tabNamePlotting())
{
uiOrdering.add(&defaultSummaryCurvesTextFilter);
uiOrdering.add(&defaultSummaryHistoryCurveStyle);
uiOrdering.add(&m_dateFormat);
uiOrdering.add(&m_timeFormat);
}
else if (uiConfigName == RiaPreferences::tabNameScripting())
{
@@ -314,8 +319,9 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
#ifdef ENABLE_GRPC
caf::PdmUiGroup* pythonGroup = uiOrdering.addNewGroup("Python");
pythonGroup->add(&enableGrpcServer);
pythonGroup->add(&showPythonDebugInfo);
pythonGroup->add(&defaultGrpcPortNumber);
pythonGroup->add(&pythonExecutable);
pythonGroup->add(&pythonExecutable);
#endif
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Script files");
scriptGroup->add(&scriptDirectories);
@@ -426,9 +432,9 @@ QString RiaPreferences::tabNameEclipse()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::tabNameEclipseSummary()
QString RiaPreferences::tabNamePlotting()
{
return "Summary";
return "Plotting";
}
//--------------------------------------------------------------------------------------------------
@@ -464,7 +470,7 @@ QStringList RiaPreferences::tabNames()
names << tabNameGeneral();
names << tabNameEclipse();
names << tabNameEclipseSummary();
names << tabNamePlotting();
names << tabNameScripting();
names << tabNameExport();

View File

@@ -89,6 +89,7 @@ public: // Pdm Fields
caf::PdmField<bool> octaveShowHeaderInfoWhenExecutingScripts;
caf::PdmField<QString> pythonExecutable;
caf::PdmField<bool> showPythonDebugInfo;
caf::PdmField<QString> ssihubAddress;
@@ -135,7 +136,7 @@ protected:
private:
static QString tabNameGeneral();
static QString tabNameEclipse();
static QString tabNameEclipseSummary();
static QString tabNamePlotting();
static QString tabNameScripting();
static QString tabNameExport();
static QString tabNameSystem();

View File

@@ -72,6 +72,13 @@ bool RiaArgumentParser::parseArguments(cvf::ProgramOptions* progOpt)
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);
progOpt->registerOption("summaryplot",
"[<plotOptions>] <eclipsesummaryvectors> [<eclipsedatafiles>]",
"Creates a summary plot using all the <eclipsedatafiles>,"
"and all the summary vectors defined in <eclipsesummaryvectors>."
"Use --summaryplot -help to show a more detailed help text.\n",
cvf::ProgramOptions::OPTIONAL_MULTI_VALUE);
progOpt->registerOption("commandFile", "<commandfile>", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE);
progOpt->registerOption("commandFileReplaceCases",
"[<caseId>] <caseListFile>",

View File

@@ -438,7 +438,9 @@ std::vector<QString> RiaQDateTimeTools::supportedDateFormats()
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");

View File

@@ -18,8 +18,8 @@
#include "RiaRegressionTestRunner.h"
#include "RiaGuiApplication.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,7 +499,7 @@ void RiaRegressionTestRunner::regressionTestConfigureProject()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::resizeMaximizedPlotWindows()
void RiaRegressionTestRunner::resizePlotWindows()
{
RimProject* proj = RiaApplication::instance()->project();
if (!proj) return;
@@ -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,8 +599,7 @@ QFileInfoList RiaRegressionTestRunner::subDirectoriesForTestExecution(const QDir
for (const auto& s : m_testFilter)
{
QString trimmed = s.trimmed();
if ((m_appendAllTestsAfterLastItemInFilter && anyMatchFound) ||
baseName.contains(trimmed, Qt::CaseInsensitive))
if ((m_appendAllTestsAfterLastItemInFilter && anyMatchFound) || baseName.contains(trimmed, Qt::CaseInsensitive))
{
foldersMatchingTestFilter.push_back(fi);
anyMatchFound = true;

View File

@@ -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);

View File

@@ -713,7 +713,7 @@ if (RESINSIGHT_PRIVATE_INSTALL)
add_custom_command(
TARGET ResInsight
POST_BUILD
COMMAND ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE} -m pip install --target=${GRPC_PYTHON_SOURCE_PATH} grpcio
COMMAND ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE} -m pip install --target=${GRPC_PYTHON_SOURCE_PATH} grpcio-tools
)
endif()
install(DIRECTORY ${GRPC_PYTHON_SOURCE_PATH}/ DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/Python)

View File

@@ -21,9 +21,12 @@
#include "RicScriptFeatureImpl.h"
#include "RimCalcScript.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RimCalcScript.h"
#include "RiuMainWindow.h"
#include "RiuProcessMonitor.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
@@ -31,6 +34,8 @@
#include <QAction>
#include <QFileInfo>
#include <iostream>
CAF_CMD_SOURCE_INIT(RicExecuteScriptFeature, "RicExecuteScriptFeature");
//--------------------------------------------------------------------------------------------------
@@ -71,7 +76,35 @@ void RicExecuteScriptFeature::onActionTriggered(bool isChecked)
if (!pythonPath.isEmpty())
{
QStringList arguments = RimCalcScript::createCommandLineArguments(calcScript->absoluteFileName());
RiaApplication::instance()->launchProcess(pythonPath, arguments, app->pythonProcessEnvironment());
QProcessEnvironment penv = app->pythonProcessEnvironment();
RiuProcessMonitor* processMonitor = RiuMainWindow::instance()->processMonitor();
if (RiaApplication::instance()->preferences()->showPythonDebugInfo() && processMonitor)
{
QStringList debugInfo;
debugInfo << "----- Launching Python interpreter -----";
debugInfo << "Python interpreter path: " + pythonPath;
debugInfo << "Using arguments: ";
for (QString argument : arguments)
{
debugInfo << "* " + argument;
}
QStringList envList = penv.toStringList();
debugInfo << "Using environment: ";
for (QString envVariable : envList)
{
debugInfo << "* " + envVariable;
}
debugInfo << "------------------------------------";
for (QString debugString : debugInfo)
{
std::cout << debugString.toStdString() << std::endl;
processMonitor->addStringToLog(debugString + "\n");
}
}
RiaApplication::instance()->launchProcess(pythonPath, arguments, penv);
}
}
}

View File

@@ -42,7 +42,8 @@ CAF_CMD_SOURCE_INIT(RicImportGeneralDataFeature, "RicImportGeneralDataFeature");
///
//--------------------------------------------------------------------------------------------------
RicImportGeneralDataFeature::OpenCaseResults
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(const QStringList& fileNames)
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(const QStringList& fileNames,
bool doCreateDefaultPlot)
{
CVF_ASSERT(!fileNames.empty());
@@ -89,7 +90,7 @@ RicImportGeneralDataFeature::OpenCaseResults
}
if (!eclipseSummaryFiles.empty())
{
if (!openSummaryCaseFromFileNames(eclipseSummaryFiles))
if (!openSummaryCaseFromFileNames(eclipseSummaryFiles, doCreateDefaultPlot))
{
return OpenCaseResults();
}
@@ -200,7 +201,7 @@ void RicImportGeneralDataFeature::openFileDialog(ImportFileType fileTypes)
RiaApplication::instance()->setLastUsedDialogDirectory(defaultDirectoryLabel(ANY_ECLIPSE_FILE), fileNames.front());
}
if (!openEclipseFilesFromFileNames(fileNames))
if (!openEclipseFilesFromFileNames(fileNames, true))
{
RiaLogging::error(QString("Failed to open file names: %1").arg(fileNames.join(", ")));
}
@@ -240,10 +241,11 @@ bool RicImportGeneralDataFeature::openInputEclipseCaseFromFileNames(const QStrin
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportGeneralDataFeature::openSummaryCaseFromFileNames(const QStringList& fileNames)
bool RicImportGeneralDataFeature::openSummaryCaseFromFileNames(const QStringList& fileNames,
bool doCreateDefaultPlot)
{
std::vector<RimSummaryCase*> newCases;
if (RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(fileNames, &newCases))
if (RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(fileNames, doCreateDefaultPlot, &newCases))
{
RicImportSummaryCasesFeature::addCasesToGroupIfRelevant(newCases);
for (const RimSummaryCase* newCase : newCases)

View File

@@ -46,7 +46,8 @@ public:
}
};
static OpenCaseResults openEclipseFilesFromFileNames(const QStringList& fileNames);
static OpenCaseResults openEclipseFilesFromFileNames(const QStringList& fileNames,
bool doCreateDefaultPlot);
static QStringList fileNamesFromCaseNames(const QStringList& caseNames);
protected:
@@ -60,6 +61,7 @@ protected:
static bool openEclipseCaseFromFileNames(const QStringList& fileNames);
static bool openInputEclipseCaseFromFileNames(const QStringList& fileNames);
static bool openSummaryCaseFromFileNames(const QStringList& fileNames);
static bool openSummaryCaseFromFileNames(const QStringList& fileNames,
bool doCreateDefaultPlot = true);
};

View File

@@ -122,6 +122,7 @@ void RicImportSummaryCasesFeature::setupActionLook(QAction* actionToSetup)
///
//--------------------------------------------------------------------------------------------------
bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(const QStringList& fileNames,
bool doCreateDefaultPlot,
std::vector<RimSummaryCase*>* newCases)
{
RiaGuiApplication* app = RiaGuiApplication::instance();
@@ -131,7 +132,7 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(const QStri
if (createSummaryCasesFromFiles(fileNames, cases))
{
addSummaryCases(*cases);
if (!cases->empty())
if (!cases->empty() && doCreateDefaultPlot)
{
RicSummaryPlotFeatureImpl::createDefaultSummaryPlot(cases->back());
}

View File

@@ -38,7 +38,9 @@ class RicImportSummaryCasesFeature : public caf::CmdFeature
public:
RicImportSummaryCasesFeature() { }
static bool createAndAddSummaryCasesFromFiles(const QStringList& fileName, std::vector<RimSummaryCase*>* newCases = nullptr);
static bool createAndAddSummaryCasesFromFiles(const QStringList& fileName,
bool doCreateDefaultPlot,
std::vector<RimSummaryCase*>* newCases = nullptr);
static bool createSummaryCasesFromFiles(const QStringList& fileName, std::vector<RimSummaryCase*>* newCases, bool ensembleOrGroup = false);
static void addSummaryCases(const std::vector<RimSummaryCase*> cases);
static void addCasesToGroupIfRelevant(const std::vector<RimSummaryCase*> cases);

View File

@@ -23,15 +23,39 @@
#include "RimSummaryPlotCollection.h"
#include "RimProject.h"
#include "RimMainPlotCollection.h"
#include "RimSummaryCase.h"
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuMainWindow.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaEclipseFileNameTools.h"
#include "RiaDefines.h"
#include "RifSummaryReaderInterface.h"
#include "RimSummaryCase.h"
#include "RicImportGeneralDataFeature.h"
#include "RicCreateSummaryCaseCollectionFeature.h"
#include "RicImportSummaryCasesFeature.h"
#include <QStringList>
#include <QFileInfo>
#include <QRegularExpression>
#include "RiaImportEclipseCaseTools.h"
#include "RimEclipseCase.h"
#include "RimGridTimeHistoryCurve.h"
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
#include "RimEclipseResultCase.h"
#include "RimOilField.h"
#include "RimEclipseCaseCollection.h"
#include "RigEclipseResultAddress.h"
#include "RigEclipseCaseData.h"
#include "RigCaseCellResultsData.h"
//--------------------------------------------------------------------------------------------------
///
@@ -92,33 +116,7 @@ std::vector<RimSummaryCurve*> RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot(
QString curvesTextFilter = RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter;
QStringList curveFilters = curvesTextFilter.split(";", QString::SkipEmptyParts);
const std::set<RifEclipseSummaryAddress>& addrs = summaryCase->summaryReader()->allResultAddresses();
std::vector<RifEclipseSummaryAddress> curveAddressesToUse;
for (const auto & addr : addrs)
{
for (const QString& filter: curveFilters)
{
if ( addr.isUiTextMatchingFilterText(filter) )
{
curveAddressesToUse.push_back(addr);
}
}
}
for (const auto & addr : curveAddressesToUse)
{
RimSummaryCurve* newCurve = new RimSummaryCurve();
plot->addCurveNoUpdate(newCurve);
if (summaryCase)
{
newCurve->setSummaryCaseY(summaryCase);
}
newCurve->setSummaryAddressYAndApplyInterpolation(addr);
defaultCurves.push_back(newCurve);
}
return defaultCurves;
return addCurvesFromAddressFiltersToPlot(curveFilters, plot, summaryCase, false);
}
//--------------------------------------------------------------------------------------------------
@@ -142,7 +140,7 @@ void RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( RimSummaryCase* summar
{
RimSummaryPlotCollection* summaryPlotCollection = RiaApplication::instance()->project()->mainPlotCollection->summaryPlotCollection();
if (summaryPlotCollection && summaryCase)
if (summaryPlotCollection && summaryCase && !RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter().isEmpty())
{
auto plot = summaryPlotCollection->createSummaryPlotWithAutoTitle();
@@ -161,4 +159,652 @@ void RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( RimSummaryCase* summar
}
}
RimSummaryCurve* createHistoryCurve(const RifEclipseSummaryAddress& addr, RimSummaryCase* summaryCasesToUse)
{
RifEclipseSummaryAddress historyAddr = addr;
historyAddr.setQuantityName(historyAddr.quantityName() + "H");
if ( summaryCasesToUse->summaryReader()->allResultAddresses().count(historyAddr) )
{
RimSummaryCurve* historyCurve = new RimSummaryCurve();
historyCurve->setSummaryCaseY(summaryCasesToUse);
historyCurve->setSummaryAddressYAndApplyInterpolation(historyAddr);
return historyCurve;
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RigGridCellResultAddress
{
public:
RigGridCellResultAddress()
: gridIndex(-1)
, i(-1)
, j(-1)
, k(-1)
{}
RigGridCellResultAddress(size_t gridIndex,
size_t i,
size_t j,
size_t k,
const RigEclipseResultAddress & eclipseResultAddress)
: gridIndex(gridIndex)
, i(i)
, j(j)
, k(k)
, eclipseResultAddress(eclipseResultAddress)
{}
// Using zero based ijk
size_t gridIndex;
size_t i;
size_t j;
size_t k;
RigEclipseResultAddress eclipseResultAddress;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigGridCellResultAddress> createGridCellAddressesFromFilter(const QString& text)
{
std::vector<RigGridCellResultAddress> addresses;
QStringList addressParts = text.split(":");
if (addressParts.size() > 1)
{
QString resultVarName = addressParts[0];
size_t gridIdx = 0;
if (addressParts.size() > 2)
{
gridIdx = addressParts[1].toULong();
}
QString ijkText = addressParts.back();
QStringList ijkTextParts = ijkText.split(",");
if (ijkTextParts.size() == 3)
{
bool isOk = true;
bool allOk = true;
size_t i = ijkTextParts[0].toULong(&isOk);
allOk &= isOk;
size_t j = ijkTextParts[1].toULong(&isOk);
allOk &= isOk;
size_t k = ijkTextParts[2].toULong(&isOk);
allOk &= isOk;
if (allOk)
{
addresses.emplace_back(RigGridCellResultAddress(gridIdx, i-1, j-1, k-1, RigEclipseResultAddress(resultVarName )));
}
}
}
return addresses;
}
std::vector<RimEclipseCase*> openEclipseCasesForCellPlotting(QStringList gridFileNames)
{
std::vector<RimEclipseCase*> openedCases;
RiaApplication* app = RiaApplication::instance();
RimProject* project = app->project();
RimEclipseCaseCollection* analysisModels = project->activeOilField()->analysisModels();
for ( const QString& fileName: gridFileNames )
{
QFileInfo gridFileInfo(fileName);
if (!gridFileInfo.exists()) continue;
QString caseName = gridFileInfo.completeBaseName();
RimEclipseResultCase* rimResultReservoir = new RimEclipseResultCase();
rimResultReservoir->setCaseInfo(caseName, fileName);
analysisModels->cases.push_back(rimResultReservoir);
if ( !rimResultReservoir->openReserviorCase() )
{
analysisModels->removeCaseFromAllGroups(rimResultReservoir);
delete rimResultReservoir;
continue;
}
else
{
openedCases.push_back(rimResultReservoir);
}
}
analysisModels->updateConnectedEditors();
return openedCases;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine(const QStringList & arguments)
{
// Split arguments in options, vectors and filenames
QStringList options;
QStringList allCurveAddressFilters;
QStringList summaryFileNames;
QStringList gridFileNames;
QString ensembleColoringParameter;
std::set<QString> validOptions = {"-help", "-h", "-nl", "-s", "-n", "-e", "-c", "-cl"};
for (int optionIdx = 0; optionIdx < arguments.size(); ++optionIdx)
{
if (arguments[optionIdx].startsWith("-"))
{
if (arguments[optionIdx] == "-help")
{
RiaApplication::instance()->showFormattedTextInMessageBoxOrConsole(
"The --summaryplot option has the following syntax:\n"
"\n"
"[<plotOptions>] <eclipsesummaryvectorfilters> [<eclipsedatafiles>]\n"
"\n"
"It Creates one summary plot for each of the the summary vectors matched by the <eclipsesummaryvectorfilters> using all the <eclipsedatafiles> in each plot.\n"
"The <eclipsesummaryvectorfilters> has the syntax <vectorname>[:<item>[:<subitem>[:i,j,k]]] and can be repeated.\n"
"Wildcards can also be used, eg. \"WOPT:*\" to select the total oil production from all the wells.\n"
"The <eclipsedatafiles> can be written with or without extension. Only the corresponding SMSPEC file will be opened for each case.\n"
"\n"
"The summary plot options are: \n"
" -help\t Show this help text and ignore the rest of the options.\n"
" -h\t Include history vectors. Will be read from the summary file if the vectors exist.\n"
" \t Only history vectors from the first summary case in the project will be included.\n"
" -nl\t Omit legend in plot.\n"
" -s\t Create only one plot including all the defined vectors and cases.\n"
" -n\t Scale all curves into the range 0.0-1.0. Useful when using -s.\n"
" -e\t Import all the cases as an ensemble, and create ensemble curves sets instead of single curves.\n"
" -c <parametername>\t Same as -e, but colors the curves by the ensemble parameter <parametername> . \n"
" -cl <parametername>\t Same as -c, but uses logarithmic legend.\n"
);
return;
}
if ( validOptions.count(arguments[optionIdx]) )
{
options.push_back(arguments[optionIdx]);
if ( arguments[optionIdx] == "-c" || arguments[optionIdx] == "-cl" )
{
optionIdx++;
if ( optionIdx < arguments.size() ) ensembleColoringParameter = arguments[optionIdx];
}
}
else
{
RiaLogging::error("The summaryplot option: \"" + arguments[optionIdx] + "\" is unknown.");
}
}
else
{
RiaEclipseFileNameTools nameTool(arguments[optionIdx]);
QString smSpecFileName = nameTool.findRelatedSummarySpecFile();
QString gridFileName = nameTool.findRelatedGridFile();
if (smSpecFileName != "" || gridFileName != "")
{
if (smSpecFileName != "") summaryFileNames.push_back(smSpecFileName);
if (gridFileName != "") gridFileNames.push_back(gridFileName);
}
else
{
allCurveAddressFilters.push_back(arguments[optionIdx]);
}
}
}
if ( allCurveAddressFilters.empty() )
{
RiaLogging::error("Needs at least one vector to create a plot.");
}
bool hideLegend = options.contains("-nl");
bool addHistoryCurves = options.contains("-h");
bool isNormalizedY = options.contains("-n");
bool isSinglePlot = options.contains("-s");
enum EnsembleColoringType { SINGLE_COLOR, PARAMETER, LOG_PARAMETER, NONE };
EnsembleColoringType ensembleColoringStyle = NONE;
{
int e_pos = options.lastIndexOf("-e");
int c_pos = options.lastIndexOf("-c");
int cl_pos = options.lastIndexOf("-cl");
int lastEnsembleOptionPos = -1;
if ( e_pos > lastEnsembleOptionPos ) { lastEnsembleOptionPos = e_pos ; ensembleColoringStyle = SINGLE_COLOR; }
if ( c_pos > lastEnsembleOptionPos ) { lastEnsembleOptionPos = c_pos ; ensembleColoringStyle = PARAMETER; }
if ( cl_pos > lastEnsembleOptionPos ) { lastEnsembleOptionPos = cl_pos ; ensembleColoringStyle = LOG_PARAMETER; }
}
bool isEnsembleMode = ensembleColoringStyle != NONE;
std::vector<RimSummaryCase*> summaryCasesToUse;
if ( summaryFileNames.size() )
{
RicImportSummaryCasesFeature::createSummaryCasesFromFiles(summaryFileNames, &summaryCasesToUse, isEnsembleMode);
RicImportSummaryCasesFeature::addSummaryCases(summaryCasesToUse);
RiaApplication::instance()->setLastUsedDialogDirectory(RiaDefines::defaultDirectoryLabel(RiaDefines::ECLIPSE_SUMMARY_FILE),
QFileInfo(summaryFileNames[0]).absolutePath());
}
// Sort in summary and grid curve addresses
QStringList gridResultAddressFilters;
QStringList summaryAddressFilters;
if ( summaryCasesToUse.size() )
{
const std::set<RifEclipseSummaryAddress>& addrs = summaryCasesToUse[0]->summaryReader()->allResultAddresses();
std::vector<bool> usedFilters;
std::set<RifEclipseSummaryAddress> setToInsertFilteredAddressesIn;
filteredSummaryAdressesFromCase(allCurveAddressFilters, addrs, &setToInsertFilteredAddressesIn, &usedFilters);
QRegularExpression gridAddressPattern("^[A-Z]+:[0-9]+,[0-9]+,[0-9]+$");
for ( int filterIdx = 0; filterIdx < allCurveAddressFilters.size(); ++filterIdx )
{
const QString& address = allCurveAddressFilters[filterIdx];
if ( usedFilters[filterIdx] )
{
summaryAddressFilters.push_back(address);
}
else
{
if ( gridAddressPattern.match(address).hasMatch() )
{
gridResultAddressFilters.push_back(address);
}
else
{
RiaLogging::warning("No summary or restart vectors matched \"" + address + "\"");
}
}
}
}
if ( summaryCasesToUse.size() )
{
if ( summaryAddressFilters.size() )
{
RimSummaryPlotCollection* sumPlotColl = RiaApplication::instance()->project()->mainPlotCollection()->summaryPlotCollection();
RimSummaryPlot* lastPlotCreated = nullptr;
RimSummaryCaseCollection* ensemble = nullptr;
if ( isEnsembleMode ) ensemble = RicCreateSummaryCaseCollectionFeature::groupSummaryCases(summaryCasesToUse, "Ensemble", true);
if ( isSinglePlot )
{
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
if ( isEnsembleMode )
{
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases = applySummaryAddressFiltersToCases(summaryCasesToUse,
summaryAddressFilters);
for ( const auto & addr : filteredAdressesFromCases )
{
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
curveSet->setSummaryCaseCollection(ensemble);
curveSet->setSummaryAddress(addr);
if ( ensembleColoringStyle == PARAMETER || ensembleColoringStyle == LOG_PARAMETER )
{
curveSet->setColorMode(RimEnsembleCurveSet::BY_ENSEMBLE_PARAM);
curveSet->setEnsembleParameter(ensembleColoringParameter);
if ( ensembleColoringStyle == LOG_PARAMETER )
{
curveSet->legendConfig()->setMappingMode(RimRegularLegendConfig::LOG10_CONTINUOUS);
}
}
newPlot->ensembleCurveSetCollection()->addCurveSet(curveSet);
if ( addHistoryCurves )
{
RimSummaryCurve* historyCurve = createHistoryCurve(addr, summaryCasesToUse[0]);
if ( historyCurve ) newPlot->addCurveNoUpdate(historyCurve);
}
}
}
else
{
for ( RimSummaryCase* sumCase : summaryCasesToUse )
{
RicSummaryPlotFeatureImpl::addCurvesFromAddressFiltersToPlot(summaryAddressFilters, newPlot, sumCase, addHistoryCurves);
addHistoryCurves = false;
}
}
lastPlotCreated = newPlot;
newPlot->showLegend(!hideLegend);
newPlot->setNormalizationEnabled(isNormalizedY);
newPlot->applyDefaultCurveAppearances();
newPlot->loadDataAndUpdate();
sumPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::setExpanded(newPlot);
RiuPlotMainWindowTools::selectAsCurrentItem(newPlot);
}
else // Multiplot, one for each separate summary address
{
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases = applySummaryAddressFiltersToCases(summaryCasesToUse,
summaryAddressFilters);
for ( const auto & addr : filteredAdressesFromCases )
{
std::vector<RimSummaryCurve*> createdCurves;
std::vector<RimEnsembleCurveSet*> createdEnsembleCurveSets;
if ( isEnsembleMode )
{
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
curveSet->setSummaryCaseCollection(ensemble);
curveSet->setSummaryAddress(addr);
if ( ensembleColoringStyle == PARAMETER || ensembleColoringStyle == LOG_PARAMETER )
{
curveSet->setColorMode(RimEnsembleCurveSet::BY_ENSEMBLE_PARAM);
curveSet->setEnsembleParameter(ensembleColoringParameter);
if ( ensembleColoringStyle == LOG_PARAMETER )
{
curveSet->legendConfig()->setMappingMode(RimRegularLegendConfig::LOG10_CONTINUOUS);
}
}
createdEnsembleCurveSets.push_back(curveSet);
}
else
{
for ( RimSummaryCase* sumCase : summaryCasesToUse )
{
const std::set<RifEclipseSummaryAddress>& allAddrsInCase = sumCase->summaryReader()->allResultAddresses();
if ( allAddrsInCase.count(addr) )
{
RimSummaryCurve* newCurve = new RimSummaryCurve();
newCurve->setSummaryCaseY(sumCase);
newCurve->setSummaryAddressYAndApplyInterpolation(addr);
createdCurves.push_back(newCurve);
}
}
}
if ( addHistoryCurves )
{
RimSummaryCurve* historyCurve = createHistoryCurve(addr, summaryCasesToUse[0]);
if ( historyCurve ) createdCurves.push_back(historyCurve);
}
if ( createdCurves.size() || createdEnsembleCurveSets.size() )
{
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
for ( auto curve : createdCurves )
{
newPlot->addCurveNoUpdate(curve);
}
for ( auto curveSet: createdEnsembleCurveSets )
{
newPlot->ensembleCurveSetCollection()->addCurveSet(curveSet);
}
newPlot->showLegend(!hideLegend);
newPlot->setNormalizationEnabled(isNormalizedY);
newPlot->applyDefaultCurveAppearances();
newPlot->loadDataAndUpdate();
lastPlotCreated = newPlot;
}
}
}
sumPlotColl->updateConnectedEditors();
if ( lastPlotCreated )
{
RiuPlotMainWindowTools::setExpanded(lastPlotCreated);
RiuPlotMainWindowTools::selectAsCurrentItem(lastPlotCreated);
RiuPlotMainWindowTools::showPlotMainWindow();
RiuMainWindow::instance()->close();
}
}
// Grid Cell Result vectors
if ( gridResultAddressFilters.size() )
{
// Todo: Use identical grid case import if -e -c or -cl
std::vector<RimEclipseCase*> gridCasesToPlotFrom = openEclipseCasesForCellPlotting(gridFileNames);
RimSummaryPlotCollection* sumPlotColl = RiaApplication::instance()->project()->mainPlotCollection()->summaryPlotCollection();
if ( isSinglePlot )
{
std::vector<RimGridTimeHistoryCurve*> createdCurves;
int curveColorIndex = 0;
for ( const QString& gridAddressFilter : gridResultAddressFilters )
{
std::vector<RigGridCellResultAddress> cellResAddrs = createGridCellAddressesFromFilter(gridAddressFilter);
for ( RigGridCellResultAddress cellResAddr : cellResAddrs )
{
for ( RimEclipseCase* eclCase: gridCasesToPlotFrom )
{
if (!(eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL) &&
eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->resultInfo(cellResAddr.eclipseResultAddress)) )
{
RiaLogging::warning("Could not find a restart result property with name: \"" + cellResAddr.eclipseResultAddress.m_resultName + "\"");
continue;
}
RimGridTimeHistoryCurve* newCurve = new RimGridTimeHistoryCurve();
newCurve->setFromEclipseCellAndResult(eclCase,
cellResAddr.gridIndex,
cellResAddr.i,
cellResAddr.j,
cellResAddr.k,
cellResAddr.eclipseResultAddress);
newCurve->setLineThickness(2);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(curveColorIndex);
newCurve->setColor(curveColor);
if (!isEnsembleMode) ++curveColorIndex;
createdCurves.push_back(newCurve);
}
if (isEnsembleMode) ++curveColorIndex;
}
}
if ( createdCurves.size() )
{
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
for ( auto curve: createdCurves )
{
newPlot->addGridTimeHistoryCurve(curve);
}
newPlot->showLegend(!hideLegend);
newPlot->setNormalizationEnabled(isNormalizedY);
newPlot->loadDataAndUpdate();
}
}
else // Multiplot
{
int curveColorIndex = 0;
for ( const QString& gridAddressFilter : gridResultAddressFilters )
{
std::vector<RigGridCellResultAddress> cellResAddrs = createGridCellAddressesFromFilter(gridAddressFilter);
for ( RigGridCellResultAddress cellResAddr : cellResAddrs )
{
std::vector<RimGridTimeHistoryCurve*> createdCurves;
for ( RimEclipseCase* eclCase: gridCasesToPlotFrom )
{
if (!(eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL) &&
eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->resultInfo(cellResAddr.eclipseResultAddress)) )
{
RiaLogging::warning("Could not find a restart result property with name: \"" + cellResAddr.eclipseResultAddress.m_resultName + "\"");
continue;
}
RimGridTimeHistoryCurve* newCurve = new RimGridTimeHistoryCurve();
newCurve->setFromEclipseCellAndResult(eclCase,
cellResAddr.gridIndex,
cellResAddr.i,
cellResAddr.j,
cellResAddr.k,
cellResAddr.eclipseResultAddress);
newCurve->setLineThickness(2);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(curveColorIndex);
newCurve->setColor(curveColor);
if (!isEnsembleMode) ++curveColorIndex;
createdCurves.push_back(newCurve);
}
if (isEnsembleMode) ++curveColorIndex;
if ( createdCurves.size() )
{
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
for (auto newCurve : createdCurves)
{
newPlot->addGridTimeHistoryCurve(newCurve);
}
newPlot->showLegend(!hideLegend);
newPlot->setNormalizationEnabled(isNormalizedY);
newPlot->loadDataAndUpdate();
}
}
}
}
sumPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuMainWindow::instance()->close();
}
}
else
{
RiaLogging::error("Needs at least one summary case to create a plot.");
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<RifEclipseSummaryAddress> RicSummaryPlotFeatureImpl::applySummaryAddressFiltersToCases(const std::vector<RimSummaryCase *>& summaryCasesToUse,
const QStringList& summaryAddressFilters)
{
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases;
for ( RimSummaryCase* sumCase : summaryCasesToUse )
{
const std::set<RifEclipseSummaryAddress>& addrs = sumCase->summaryReader()->allResultAddresses();
std::vector<bool> usedFilters;
filteredSummaryAdressesFromCase(summaryAddressFilters, addrs, &filteredAdressesFromCases, &usedFilters);
for ( int cfIdx = 0 ; cfIdx < usedFilters.size() ; ++cfIdx )
{
if ( !usedFilters[cfIdx] )
{
RiaLogging::warning("Vector filter \"" + summaryAddressFilters[cfIdx] + "\" did not match anything in case: \"" + sumCase->caseName() + "\"");
}
}
}
return filteredAdressesFromCases;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryCurve*> RicSummaryPlotFeatureImpl::addCurvesFromAddressFiltersToPlot(const QStringList& curveFilters,
RimSummaryPlot* plot,
RimSummaryCase* summaryCase,
bool addHistoryCurves)
{
std::vector<RimSummaryCurve*> createdCurves;
std::set<RifEclipseSummaryAddress> curveAddressesToUse;
const std::set<RifEclipseSummaryAddress>& addrs = summaryCase->summaryReader()->allResultAddresses();
std::vector<bool> usedFilters;
filteredSummaryAdressesFromCase(curveFilters, addrs, &curveAddressesToUse, &usedFilters);
for (int cfIdx = 0 ; cfIdx < usedFilters.size() ; ++cfIdx)
{
if (!usedFilters[cfIdx])
{
RiaLogging::warning("Vector filter \"" + curveFilters[cfIdx] + "\" did not match anything in case: \"" + summaryCase->caseName() + "\"");
}
}
if (addHistoryCurves)
{
std::vector<RifEclipseSummaryAddress> historyAddressesToUse;
for (RifEclipseSummaryAddress historyAddr : curveAddressesToUse)
{
historyAddr.setQuantityName(historyAddr.quantityName() + "H");
if (addrs.count(historyAddr))
{
historyAddressesToUse.push_back(historyAddr);
}
}
curveAddressesToUse.insert( historyAddressesToUse.begin(), historyAddressesToUse.end() );
}
for (const auto & addr : curveAddressesToUse)
{
RimSummaryCurve* newCurve = new RimSummaryCurve();
plot->addCurveNoUpdate(newCurve);
if (summaryCase)
{
newCurve->setSummaryCaseY(summaryCase);
}
newCurve->setSummaryAddressYAndApplyInterpolation(addr);
createdCurves.push_back(newCurve);
}
return createdCurves;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryPlotFeatureImpl::filteredSummaryAdressesFromCase(const QStringList& curveFilters,
const std::set<RifEclipseSummaryAddress>& allAddressesInCase,
std::set<RifEclipseSummaryAddress>* setToInsertFilteredAddressesIn,
std::vector<bool>* usedFilters)
{
int curveFilterCount = curveFilters.size();
usedFilters->clear();
usedFilters->resize(curveFilterCount, false);
for (const auto & addr : allAddressesInCase)
{
for (int cfIdx = 0 ; cfIdx < curveFilterCount ; ++cfIdx)
{
if ( addr.isUiTextMatchingFilterText( curveFilters[cfIdx]) )
{
setToInsertFilteredAddressesIn->insert(addr);
(*usedFilters)[cfIdx] = true;
}
}
}
}

View File

@@ -23,6 +23,11 @@ class RimSummaryCase;
class RimSummaryPlotCollection;
#include <vector>
#include <set>
#include "RifEclipseSummaryAddress.h"
class QStringList;
class RicSummaryPlotFeatureImpl
{
@@ -31,7 +36,20 @@ public:
static std::vector<RimSummaryCurve*> addDefaultCurvesToPlot(RimSummaryPlot* plot, RimSummaryCase* summaryCase);
static void ensureAtLeastOnePlot(RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase);
static void createDefaultSummaryPlot(RimSummaryCase* summaryCase);
static void createSummaryPlotsFromArgumentLine(const QStringList & arguments);
private:
static std::vector<RimSummaryCurve*> addCurvesFromAddressFiltersToPlot(const QStringList& curveFilters,
RimSummaryPlot* plot,
RimSummaryCase* summaryCase,
bool addHistoryCurves);
static std::set<RifEclipseSummaryAddress> applySummaryAddressFiltersToCases(const std::vector<RimSummaryCase *>& summaryCasesToUse,
const QStringList& summaryAddressFilters);
static void filteredSummaryAdressesFromCase(const QStringList& curveFilters,
const std::set<RifEclipseSummaryAddress>& allAddressesInCase,
std::set<RifEclipseSummaryAddress>* setToInsertFilteredAddressesIn,
std::vector<bool>* usedFilters);
};

View File

@@ -7,4 +7,12 @@ rips.egg-info
setup.py
grpc
grpcio*
six*
six*
easy_install*
bin*
grpc_tools
pkg_resources
google
protobuf*
setuptools*
extern*

View File

@@ -2,5 +2,5 @@ import rips
resInsight = rips.Instance.find()
if resInsight is not None:
print(resInsight.app.versionString())
print("Is this a console run?", resInsight.app.isConsole())
print(resInsight.versionString())
print("Is this a console run?", resInsight.isConsole())

View File

@@ -27,9 +27,9 @@
//--------------------------------------------------------------------------------------------------
grpc::Status RiaGrpcAppService::GetVersion(grpc::ServerContext* context, const rips::Empty* request, rips::Version* reply)
{
reply->set_major_version(RESINSIGHT_MAJOR_VERSION);
reply->set_minor_version(RESINSIGHT_MINOR_VERSION);
reply->set_patch_version(RESINSIGHT_PATCH_VERSION);
reply->set_major_version(QString(RESINSIGHT_MAJOR_VERSION).toInt());
reply->set_minor_version(QString(RESINSIGHT_MINOR_VERSION).toInt());
reply->set_patch_version(QString(RESINSIGHT_PATCH_VERSION).toInt());
return grpc::Status::OK;
}

View File

@@ -19,6 +19,8 @@
#include "RimEclipseGeometrySelectionItem.h"
#include "RigTimeHistoryResultAccessor.h"
#include "RigEclipseCaseData.h"
#include "RigGridBase.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
@@ -61,6 +63,24 @@ void RimEclipseGeometrySelectionItem::setFromSelectionItem(const RiuEclipseSelec
m_eclipseCase = selectionItem->m_view->eclipseCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseGeometrySelectionItem::setFromCaseGridAndIJK(RimEclipseCase* eclipseCase,
size_t gridIndex,
size_t i,
size_t j,
size_t k)
{
m_eclipseCase = eclipseCase;
m_gridIndex = gridIndex;
size_t lgrCellIndex = eclipseCase->eclipseCaseData()->grid(gridIndex)->cellIndexFromIJK(i, j, k);
size_t reservoirCellIndex = eclipseCase->eclipseCaseData()->grid(gridIndex)->reservoirCellIndex(lgrCellIndex);
m_cellIndex = reservoirCellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -39,7 +39,11 @@ public:
~RimEclipseGeometrySelectionItem() override;
void setFromSelectionItem(const RiuEclipseSelectionItem* selectionItem);
void setFromCaseGridAndIJK(RimEclipseCase* eclipseCase,
size_t gridIndex,
size_t i,
size_t j,
size_t k);
QString geometrySelectionText() const override;
RimEclipseCase* eclipseCase() const;

View File

@@ -31,6 +31,7 @@
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResultAddress.h"
#include "RigFlowDiagResults.h"
#include "RigEclipseResultInfo.h"
#include "Rim3dView.h"
#include "Rim3dWellLogCurve.h"
@@ -763,21 +764,32 @@ RigEclipseResultAddress RimEclipseResultDefinition::eclipseResultAddress() const
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::setFromEclipseResultAddress(const RigEclipseResultAddress& address)
{
m_resultType = address.m_resultCatType;
m_resultVariable = address.m_resultName;
m_timeLapseBaseTimestep = address.m_timeLapseBaseFrameIdx;
RigEclipseResultAddress canonizedAddress = address;
if (address.hasDifferenceCase())
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if (gridCellResults)
{
auto rinfo = gridCellResults->resultInfo(address);
if (rinfo) canonizedAddress = rinfo->eclipseResultAddress();
}
m_resultType = canonizedAddress.m_resultCatType;
m_resultVariable = canonizedAddress.m_resultName;
m_timeLapseBaseTimestep = canonizedAddress.m_timeLapseBaseFrameIdx;
if (canonizedAddress.hasDifferenceCase())
{
auto eclipseCases = RiaApplication::instance()->project()->eclipseCases();
for (RimEclipseCase* c : eclipseCases)
{
if (c && c->caseId() == address.m_differenceCaseId)
if (c && c->caseId() == canonizedAddress.m_differenceCaseId)
{
m_differenceCase = c;
}
}
}
this->updateUiFieldsFromActiveResult();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -135,6 +135,30 @@ void RimGridTimeHistoryCurve::setFromSelectionItem(const RiuSelectionItem* selec
updateResultDefinitionFromCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::setFromEclipseCellAndResult(RimEclipseCase* eclCase,
size_t gridIdx,
size_t i,
size_t j,
size_t k,
const RigEclipseResultAddress& resAddr)
{
delete m_geometrySelectionItem();
delete m_eclipseResultDefinition();
delete m_geoMechResultDefinition();
m_eclipseResultDefinition = new RimEclipseResultDefinition;
m_eclipseResultDefinition->setEclipseCase(eclCase);
m_eclipseResultDefinition->setFromEclipseResultAddress(resAddr);
RimEclipseGeometrySelectionItem* geomSelectionItem = new RimEclipseGeometrySelectionItem;
m_geometrySelectionItem = geomSelectionItem;
geomSelectionItem->setFromCaseGridAndIJK(eclCase, gridIdx, i, j, k);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -190,6 +214,22 @@ std::vector<double> RimGridTimeHistoryCurve::yValues() const
}
}
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
bool isNormalized = plot->isNormalizationEnabled();
if (isNormalized)
{
auto minMaxPair = std::minmax_element(values.begin(), values.end());
double min = *minMaxPair.first;
double max = *minMaxPair.second;
double range = max - min;
for (double & v: values)
{
v = (v - min)/range;
}
}
return values;
}

View File

@@ -36,6 +36,7 @@ class RimGeoMechGeometrySelectionItem;
class RimGeometrySelectionItem;
class RiuFemTimeHistoryResultAccessor;
class RiuSelectionItem;
class RigEclipseResultAddress;
//==================================================================================================
///
@@ -51,6 +52,12 @@ public:
~RimGridTimeHistoryCurve() override;
void setFromSelectionItem(const RiuSelectionItem* selectionItem);
void setFromEclipseCellAndResult(RimEclipseCase* eclCase,
size_t gridIdx,
size_t i,
size_t j,
size_t k,
const RigEclipseResultAddress& resAddr);
RiaDefines::PlotAxis yAxis() const;
void setYAxis(RiaDefines::PlotAxis plotAxis);

View File

@@ -426,6 +426,22 @@ RimEnsembleCurveSet::ColorMode RimEnsembleCurveSet::colorMode() const
return m_colorMode();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::setColorMode(ColorMode mode)
{
m_colorMode = mode;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::setEnsembleParameter(const QString& parameterName)
{
m_ensembleParameter = parameterName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -97,6 +97,8 @@ public:
RimEnsembleCurveFilterCollection* filterCollection() const;
ColorMode colorMode() const;
void setColorMode(ColorMode mode);
void setEnsembleParameter(const QString& parameterName);
void updateEnsembleLegendItem();
EnsembleParameter::Type currentEnsembleParameterType() const;
static QString ensembleParameterUiName(const NameParameterPair& paramPair);

View File

@@ -22,6 +22,8 @@
#include "RiaDefines.h"
#include "RiaGuiApplication.h"
#include "RiaPreferences.h"
#include "RiaStatisticsTools.h"
#include "RiaTimeHistoryCurveMerger.h"
#include "RifReaderEclipseSummary.h"
@@ -55,6 +57,7 @@
#include "qwt_plot.h"
#include <QMessageBox>
#include "cafPdmUiLineEditor.h"
CAF_PDM_SOURCE_INIT(RimSummaryCurve, "SummaryCurve");
@@ -72,31 +75,21 @@ RimSummaryCurve::RimSummaryCurve()
m_yValuesSummaryCase.uiCapability()->setUiTreeChildrenHidden(true);
m_yValuesSummaryCase.uiCapability()->setAutoAddingOptionFromValue(false);
CAF_PDM_InitFieldNoDefault(&m_yValuesSelectedVariableDisplayField, "SelectedVariableDisplayVar", "Vector", "", "", "");
m_yValuesSelectedVariableDisplayField.xmlCapability()->disableIO();
m_yValuesSelectedVariableDisplayField.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitFieldNoDefault(&m_yValuesSummaryAddressUiField, "SelectedVariableDisplayVar", "Vector", "", "", "");
m_yValuesSummaryAddressUiField.xmlCapability()->disableIO();
m_yValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_yValuesSummaryFilter, "VarListFilter", "Filter", "", "", "");
m_yValuesSummaryFilter.uiCapability()->setUiTreeChildrenHidden(true);
m_yValuesSummaryFilter.uiCapability()->setUiHidden(true);
m_yValuesSummaryFilter = new RimSummaryFilter;
CAF_PDM_InitFieldNoDefault(&m_yValuesUiFilterResultSelection, "FilterResultSelection", "Filter Result", "", "", "");
m_yValuesUiFilterResultSelection.xmlCapability()->disableIO();
m_yValuesUiFilterResultSelection.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
m_yValuesUiFilterResultSelection.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_yValuesUiFilterResultSelection.uiCapability()->setAutoAddingOptionFromValue(false);
CAF_PDM_InitFieldNoDefault(&m_yValuesCurveVariable, "SummaryAddress", "Summary Address", "", "", "");
m_yValuesCurveVariable.uiCapability()->setUiHidden(true);
m_yValuesCurveVariable.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_yValuesSummaryAddress, "SummaryAddress", "Summary Address", "", "", "");
m_yValuesSummaryAddress.uiCapability()->setUiHidden(true);
m_yValuesSummaryAddress.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_yPushButtonSelectSummaryAddress, "SelectAddress", "", "", "", "");
caf::PdmUiPushButtonEditor::configureEditorForField(&m_yPushButtonSelectSummaryAddress);
m_yPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_yPushButtonSelectSummaryAddress = false;
m_yValuesCurveVariable = new RimSummaryAddress;
m_yValuesSummaryAddress = new RimSummaryAddress;
// X Values
@@ -105,31 +98,23 @@ RimSummaryCurve::RimSummaryCurve()
m_xValuesSummaryCase.uiCapability()->setUiTreeChildrenHidden(true);
m_xValuesSummaryCase.uiCapability()->setAutoAddingOptionFromValue(false);
CAF_PDM_InitFieldNoDefault(&m_xValuesSelectedVariableDisplayField, "SelectedVariableDisplayVarX", "Vector", "", "", "");
m_xValuesSelectedVariableDisplayField.xmlCapability()->disableIO();
m_xValuesSelectedVariableDisplayField.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitFieldNoDefault(&m_xValuesSummaryAddressUiField, "SelectedVariableDisplayVarX", "Vector", "", "", "");
m_xValuesSummaryAddressUiField.xmlCapability()->disableIO();
m_xValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_xValuesSummaryFilter, "VarListFilterX", "Filter", "", "", "");
m_xValuesSummaryFilter.uiCapability()->setUiTreeChildrenHidden(true);
m_xValuesSummaryFilter.uiCapability()->setUiHidden(true);
m_xValuesSummaryFilter = new RimSummaryFilter;
CAF_PDM_InitFieldNoDefault(&m_xValuesUiFilterResultSelection, "FilterResultSelectionX", "Filter Result", "", "", "");
m_xValuesUiFilterResultSelection.xmlCapability()->disableIO();
m_xValuesUiFilterResultSelection.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
m_xValuesUiFilterResultSelection.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_xValuesUiFilterResultSelection.uiCapability()->setAutoAddingOptionFromValue(false);
CAF_PDM_InitFieldNoDefault(&m_xValuesCurveVariable, "SummaryAddressX", "Summary Address", "", "", "");
m_xValuesCurveVariable.uiCapability()->setUiHidden(true);
m_xValuesCurveVariable.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_xValuesSummaryAddress, "SummaryAddressX", "Summary Address", "", "", "");
m_xValuesSummaryAddress.uiCapability()->setUiHidden(true);
m_xValuesSummaryAddress.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_xPushButtonSelectSummaryAddress, "SelectAddressX", "", "", "", "");
caf::PdmUiPushButtonEditor::configureEditorForField(&m_xPushButtonSelectSummaryAddress);
m_xPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_xPushButtonSelectSummaryAddress = false;
m_xValuesCurveVariable = new RimSummaryAddress;
m_xValuesSummaryAddress = new RimSummaryAddress;
// Other members
@@ -147,6 +132,19 @@ RimSummaryCurve::RimSummaryCurve()
m_symbolSkipPixelDistance = 10.0f;
m_curveThickness = 2;
CAF_PDM_InitFieldNoDefault(&m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter", "", "", "");
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden(true);
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiHidden(true);
m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable(false);
m_yValuesSummaryFilter_OBSOLETE = new RimSummaryFilter;
CAF_PDM_InitFieldNoDefault(&m_xValuesSummaryFilter_OBSOLETE, "VarListFilterX", "Filter", "", "", "");
m_xValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden(true);
m_xValuesSummaryFilter_OBSOLETE.uiCapability()->setUiHidden(true);
m_xValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable(false);
m_xValuesSummaryFilter_OBSOLETE = new RimSummaryFilter;
}
//--------------------------------------------------------------------------------------------------
@@ -182,7 +180,7 @@ RimSummaryCase* RimSummaryCurve::summaryCaseY() const
//--------------------------------------------------------------------------------------------------
RifEclipseSummaryAddress RimSummaryCurve::summaryAddressX() const
{
return m_xValuesCurveVariable->address();
return m_xValuesSummaryAddress->address();
}
//--------------------------------------------------------------------------------------------------
@@ -190,7 +188,7 @@ RifEclipseSummaryAddress RimSummaryCurve::summaryAddressX() const
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::setSummaryAddressX(const RifEclipseSummaryAddress& address)
{
m_xValuesCurveVariable->setAddress(address);
m_xValuesSummaryAddress->setAddress(address);
// TODO: Should interpolation be computed similar to RimSummaryCurve::setSummaryAddressY
}
@@ -200,7 +198,7 @@ void RimSummaryCurve::setSummaryAddressX(const RifEclipseSummaryAddress& address
//--------------------------------------------------------------------------------------------------
RifEclipseSummaryAddress RimSummaryCurve::summaryAddressY() const
{
return m_yValuesCurveVariable->address();
return m_yValuesSummaryAddress->address();
}
//--------------------------------------------------------------------------------------------------
@@ -218,14 +216,12 @@ void RimSummaryCurve::setSummaryAddressYAndApplyInterpolation(const RifEclipseSu
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::setSummaryAddressY(const RifEclipseSummaryAddress& address)
{
if (m_yValuesCurveVariable->address() != address)
if (m_yValuesSummaryAddress->address() != address)
{
m_qwtPlotCurve->clearErrorBars();
}
m_yValuesCurveVariable->setAddress(address);
m_yValuesSummaryFilter->updateFromAddress(address);
m_yValuesSummaryAddress->setAddress(address);
}
//--------------------------------------------------------------------------------------------------
@@ -261,9 +257,25 @@ std::vector<double> RimSummaryCurve::valuesY() const
if ( !reader ) return values;
RifEclipseSummaryAddress addr = m_yValuesCurveVariable()->address();
RifEclipseSummaryAddress addr = m_yValuesSummaryAddress()->address();
reader->values(addr, &values);
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
bool isNormalized = plot->isNormalizationEnabled();
if (isNormalized)
{
auto minMaxPair = std::minmax_element(values.begin(), values.end());
double min = *minMaxPair.first;
double max = *minMaxPair.second;
double range = max - min;
for (double & v: values)
{
v = (v - min)/range;
}
}
return values;
}
@@ -308,7 +320,7 @@ std::vector<double> RimSummaryCurve::valuesX() const
{
RifSummaryReaderInterface* reader = m_xValuesSummaryCase()->summaryReader();
RifEclipseSummaryAddress addr = m_xValuesCurveVariable()->address();
RifEclipseSummaryAddress addr = m_xValuesSummaryAddress()->address();
reader->values(addr, &values);
}
@@ -325,7 +337,7 @@ const std::vector<time_t>& RimSummaryCurve::timeStepsY() const
if ( !reader ) return emptyVector;
RifEclipseSummaryAddress addr = m_yValuesCurveVariable()->address();
RifEclipseSummaryAddress addr = m_yValuesSummaryAddress()->address();
return reader->timeSteps(addr);
}
@@ -389,15 +401,14 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
}
else if(fieldNeedingOptions == &m_yValuesUiFilterResultSelection)
else if (&m_yValuesSummaryAddressUiField == fieldNeedingOptions)
{
appendOptionItemsForSummaryAddresses(&options, m_yValuesSummaryCase(), m_yValuesSummaryFilter());
appendOptionItemsForSummaryAddresses(&options, m_yValuesSummaryCase(), nullptr);
}
else if (fieldNeedingOptions == &m_xValuesUiFilterResultSelection)
else if (&m_xValuesSummaryAddressUiField == fieldNeedingOptions)
{
appendOptionItemsForSummaryAddresses(&options, m_xValuesSummaryCase(), m_xValuesSummaryFilter());
appendOptionItemsForSummaryAddresses(&options, m_xValuesSummaryCase(), nullptr);
}
return options;
}
@@ -410,18 +421,18 @@ QString RimSummaryCurve::createCurveAutoName()
firstAncestorOrThisOfTypeAsserted(plot);
const RimSummaryPlotNameHelper* nameHelper = plot->activePlotTitleHelperAllCurves();
QString curveName = m_curveNameConfig->curveNameY(m_yValuesCurveVariable->address(), nameHelper);
QString curveName = m_curveNameConfig->curveNameY(m_yValuesSummaryAddress->address(), nameHelper);
if (curveName.isEmpty())
{
curveName = m_curveNameConfig->curveNameY(m_yValuesCurveVariable->address(), nullptr);
curveName = m_curveNameConfig->curveNameY(m_yValuesSummaryAddress->address(), nullptr);
}
if (isCrossPlotCurve())
{
QString curveNameX = m_curveNameConfig->curveNameX(m_xValuesCurveVariable->address(), nameHelper);
QString curveNameX = m_curveNameConfig->curveNameX(m_xValuesSummaryAddress->address(), nameHelper);
if (curveNameX.isEmpty())
{
curveNameX = m_curveNameConfig->curveNameX(m_xValuesCurveVariable->address(), nullptr);
curveNameX = m_curveNameConfig->curveNameX(m_xValuesSummaryAddress->address(), nullptr);
}
if (!curveName.isEmpty() || !curveNameX.isEmpty())
@@ -456,11 +467,8 @@ void RimSummaryCurve::onLoadDataAndUpdate(bool updateParentPlot)
{
this->RimPlotCurve::updateCurvePresentation(updateParentPlot);
m_yValuesSelectedVariableDisplayField = QString::fromStdString(m_yValuesCurveVariable->address().uiText());
m_yValuesUiFilterResultSelection = m_yValuesCurveVariable->address();
m_xValuesSelectedVariableDisplayField = QString::fromStdString(m_xValuesCurveVariable->address().uiText());
m_xValuesUiFilterResultSelection = m_xValuesCurveVariable->address();
m_yValuesSummaryAddressUiField = m_yValuesSummaryAddress->address();
m_xValuesSummaryAddressUiField = m_xValuesSummaryAddress->address();
updateConnectedEditors();
@@ -615,7 +623,7 @@ void RimSummaryCurve::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (attrib)
{
attrib->m_buttonText = "Vector Selection Dialog";
attrib->m_buttonText = "...";
}
}
}
@@ -629,18 +637,12 @@ void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
{
QString curveDataGroupName = "Summary Vector";
if (isCrossPlotCurve()) curveDataGroupName += " Y";
if ( isCrossPlotCurve() ) curveDataGroupName += " Y";
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword(curveDataGroupName, "Summary Vector Y");
curveDataGroup->add(&m_yValuesSummaryCase);
curveDataGroup->add(&m_yValuesSelectedVariableDisplayField);
curveDataGroup->add(&m_plotAxis);
curveDataGroup->add(&m_yPushButtonSelectSummaryAddress);
QString curveVarSelectionGroupName = "Vector Selection Filter Y";
caf::PdmUiGroup* curveVarSelectionGroup = curveDataGroup->addNewGroupWithKeyword("Vector Selection Filter", curveVarSelectionGroupName);
curveVarSelectionGroup->setCollapsedByDefault(true);
m_yValuesSummaryFilter->uiOrdering(uiConfigName, *curveVarSelectionGroup);
curveVarSelectionGroup->add(&m_yValuesUiFilterResultSelection);
curveDataGroup->add(&m_yValuesSummaryCase, { true, 3, 1 });
curveDataGroup->add(&m_yValuesSummaryAddressUiField, { true, 2, 1 });
curveDataGroup->add(&m_yPushButtonSelectSummaryAddress, { false, 1, 0 });
curveDataGroup->add(&m_plotAxis, { true, 3, 1 });
if (isCrossPlotCurve()) m_showErrorBars = false;
else curveDataGroup->add(&m_showErrorBars);
@@ -649,14 +651,9 @@ void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
if (isCrossPlotCurve())
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Summary Vector X");
curveDataGroup->add(&m_xValuesSummaryCase);
curveDataGroup->add(&m_xValuesSelectedVariableDisplayField);
curveDataGroup->add(&m_xPushButtonSelectSummaryAddress);
caf::PdmUiGroup* curveVarSelectionGroup = curveDataGroup->addNewGroupWithKeyword("Vector Selection Filter", "Vector Selection Filter X");
curveVarSelectionGroup->setCollapsedByDefault(true);
m_xValuesSummaryFilter->uiOrdering(uiConfigName, *curveVarSelectionGroup);
curveVarSelectionGroup->add(&m_xValuesUiFilterResultSelection);
curveDataGroup->add(&m_xValuesSummaryCase, { true, 3, 1 });
curveDataGroup->add(&m_xValuesSummaryAddressUiField, { true, 2, 1 });
curveDataGroup->add(&m_xPushButtonSelectSummaryAddress, { false, 1, 0});
}
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
@@ -773,7 +770,7 @@ void RimSummaryCurve::applyCurveAutoNameSettings(const RimSummaryCurveAutoName&
//--------------------------------------------------------------------------------------------------
QString RimSummaryCurve::curveExportDescription(const RifEclipseSummaryAddress& address) const
{
auto addr = address.isValid() ? address : m_yValuesCurveVariable->address();
auto addr = address.isValid() ? address : m_yValuesSummaryAddress->address();
RimEnsembleCurveSetCollection* coll;
firstAncestorOrThisOfType(coll);
@@ -781,17 +778,24 @@ QString RimSummaryCurve::curveExportDescription(const RifEclipseSummaryAddress&
auto curveSet = coll ? coll->findRimCurveSetFromQwtCurve(m_qwtPlotCurve) : nullptr;
auto group = curveSet ? curveSet->summaryCaseCollection() : nullptr;
auto addressUiText = addr.uiText();
if (addr.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS)
{
addressUiText = RiaStatisticsTools::replacePercentileByPValueText(QString::fromStdString(addressUiText)).toStdString();
}
if (group && group->isEnsemble())
{
return QString("%1.%2.%3")
.arg(QString::fromStdString(addr.uiText()))
.arg(QString::fromStdString(addressUiText))
.arg(m_yValuesSummaryCase->caseName())
.arg(group->name());
}
else
{
return QString("%1.%2")
.arg(QString::fromStdString(addr.uiText()))
.arg(QString::fromStdString(addressUiText))
.arg(m_yValuesSummaryCase->caseName());
}
}
@@ -812,7 +816,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType()
}
}
if (m_yValuesCurveVariable && m_yValuesCurveVariable->address().isHistoryQuantity())
if (m_yValuesSummaryAddress && m_yValuesSummaryAddress->address().isHistoryQuantity())
{
RiaPreferences* prefs = RiaApplication::instance()->preferences();
@@ -842,7 +846,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType()
void RimSummaryCurve::markCachedDataForPurge()
{
auto reader = valuesSummaryReaderY();
if(reader) reader->markForCachePurge(m_yValuesCurveVariable->address());
if(reader) reader->markForCachePurge(m_yValuesSummaryAddress->address());
}
//--------------------------------------------------------------------------------------------------
@@ -867,22 +871,22 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
bool loadAndUpdate = false;
bool crossPlotTestForMatchingTimeSteps = false;
if(changedField == &m_yValuesUiFilterResultSelection)
if(changedField == &m_yValuesSummaryAddressUiField)
{
m_yValuesCurveVariable->setAddress(m_yValuesUiFilterResultSelection());
m_yValuesSummaryAddress->setAddress(m_yValuesSummaryAddressUiField());
this->calculateCurveInterpolationFromAddress();
loadAndUpdate = true;
}
else if (changedField == &m_xValuesUiFilterResultSelection)
else if(changedField == &m_xValuesSummaryAddressUiField)
{
m_xValuesCurveVariable->setAddress(m_xValuesUiFilterResultSelection());
m_xValuesSummaryAddress->setAddress(m_xValuesSummaryAddressUiField());
this->calculateCurveInterpolationFromAddress();
loadAndUpdate = true;
}
}
else if (&m_showCurve == changedField)
{
plot->updateAxes();
@@ -919,7 +923,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{
RiuSummaryCurveDefSelectionDialog dlg(nullptr);
RimSummaryCase* candidateCase = m_yValuesSummaryCase();
RifEclipseSummaryAddress candicateAddress = m_yValuesCurveVariable->address();
RifEclipseSummaryAddress candicateAddress = m_yValuesSummaryAddress->address();
if (candidateCase == nullptr)
{
@@ -928,7 +932,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
if (!candicateAddress.isValid())
{
candicateAddress = m_xValuesCurveVariable->address();
candicateAddress = m_xValuesSummaryAddress->address();
}
dlg.hideEnsembles();
@@ -940,7 +944,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
if (curveSelection.size() > 0)
{
m_yValuesSummaryCase = curveSelection[0].summaryCase();
m_yValuesCurveVariable->setAddress(curveSelection[0].summaryAddress());
m_yValuesSummaryAddress->setAddress(curveSelection[0].summaryAddress());
crossPlotTestForMatchingTimeSteps = true;
loadAndUpdate = true;
@@ -953,7 +957,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{
RiuSummaryCurveDefSelectionDialog dlg(nullptr);
RimSummaryCase* candidateCase = m_xValuesSummaryCase();
RifEclipseSummaryAddress candicateAddress = m_xValuesCurveVariable->address();
RifEclipseSummaryAddress candicateAddress = m_xValuesSummaryAddress->address();
if (candidateCase == nullptr)
{
@@ -962,7 +966,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
if (!candicateAddress.isValid())
{
candicateAddress = m_yValuesCurveVariable->address();
candicateAddress = m_yValuesSummaryAddress->address();
}
dlg.hideEnsembles();
@@ -974,7 +978,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
if (curveSelection.size() > 0)
{
m_xValuesSummaryCase = curveSelection[0].summaryCase();
m_xValuesCurveVariable->setAddress(curveSelection[0].summaryAddress());
m_xValuesSummaryAddress->setAddress(curveSelection[0].summaryAddress());
crossPlotTestForMatchingTimeSteps = true;
loadAndUpdate = true;
@@ -1100,7 +1104,7 @@ const std::vector<time_t>& RimSummaryCurve::timeStepsX() const
if (!reader) return emptyVector;
RifEclipseSummaryAddress addr = m_xValuesCurveVariable()->address();
RifEclipseSummaryAddress addr = m_xValuesSummaryAddress()->address();
return reader->timeSteps(addr);
}
@@ -1110,9 +1114,9 @@ const std::vector<time_t>& RimSummaryCurve::timeStepsX() const
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::calculateCurveInterpolationFromAddress()
{
if (m_yValuesCurveVariable())
if (m_yValuesSummaryAddress())
{
auto address = m_yValuesCurveVariable()->address();
auto address = m_yValuesSummaryAddress()->address();
if (address.hasAccumulatedData())
{
m_curveInterpolation = RiuQwtPlotCurve::INTERPOLATION_POINT_TO_POINT;

View File

@@ -118,21 +118,22 @@ private:
private:
// Y values
caf::PdmPtrField<RimSummaryCase*> m_yValuesSummaryCase;
caf::PdmChildField<RimSummaryAddress*> m_yValuesCurveVariable;
caf::PdmField<QString> m_yValuesSelectedVariableDisplayField;
caf::PdmChildField<RimSummaryFilter*> m_yValuesSummaryFilter;
caf::PdmField<RifEclipseSummaryAddress> m_yValuesUiFilterResultSelection;
caf::PdmChildField<RimSummaryAddress*> m_yValuesSummaryAddress;
caf::PdmField<RifEclipseSummaryAddress> m_yValuesSummaryAddressUiField;
caf::PdmField<bool> m_yPushButtonSelectSummaryAddress;
// X values
caf::PdmPtrField<RimSummaryCase*> m_xValuesSummaryCase;
caf::PdmChildField<RimSummaryAddress*> m_xValuesCurveVariable;
caf::PdmField<QString> m_xValuesSelectedVariableDisplayField;
caf::PdmChildField<RimSummaryFilter*> m_xValuesSummaryFilter;
caf::PdmField<RifEclipseSummaryAddress> m_xValuesUiFilterResultSelection;
caf::PdmChildField<RimSummaryAddress*> m_xValuesSummaryAddress;
caf::PdmField<RifEclipseSummaryAddress> m_xValuesSummaryAddressUiField;
caf::PdmField<bool> m_xPushButtonSelectSummaryAddress;
caf::PdmChildField<RimSummaryCurveAutoName*> m_curveNameConfig;
caf::PdmField<caf::AppEnum< RiaDefines::PlotAxis>> m_plotAxis;
caf::PdmField<bool> m_isTopZWithinCategory;
// Obsolete fields
caf::PdmChildField<RimSummaryFilter*> m_yValuesSummaryFilter_OBSOLETE;
caf::PdmChildField<RimSummaryFilter*> m_xValuesSummaryFilter_OBSOLETE;
};

View File

@@ -140,6 +140,9 @@ RimSummaryPlot::RimSummaryPlot()
CAF_PDM_InitField(&m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto Name", "", "", "");
m_useAutoPlotTitle.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "");
m_normalizeCurveYValues.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitFieldNoDefault(&m_curveFilters_OBSOLETE, "SummaryCurveFilters", "", "", "", "");
m_curveFilters_OBSOLETE.uiCapability()->setUiTreeHidden(true);
@@ -635,6 +638,22 @@ bool RimSummaryPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType,
return anyChange;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::setNormalizationEnabled(bool enable)
{
m_normalizeCurveYValues = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryPlot::isNormalizationEnabled()
{
return m_normalizeCurveYValues();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1227,6 +1246,11 @@ void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
c->updateCurveNameNoLegendUpdate();
}
}
if (changedField == &m_normalizeCurveYValues)
{
this->loadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
@@ -1510,6 +1534,8 @@ void RimSummaryPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add(&m_legendFontSize);
}
uiOrdering.add(&m_normalizeCurveYValues);
m_userDefinedPlotTitle.uiCapability()->setUiReadOnly(m_useAutoPlotTitle);
uiOrdering.skipRemainingFields(true);
@@ -1794,6 +1820,14 @@ caf::PdmObject* RimSummaryPlot::findRimPlotObjectFromQwtCurve(const QwtPlotCurve
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::showLegend(bool enable)
{
m_showLegend = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1809,7 +1843,8 @@ void RimSummaryPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
{
if (field == &m_showLegend ||
field == &m_showPlotTitle ||
field == &m_useAutoPlotTitle)
field == &m_useAutoPlotTitle ||
field == &m_normalizeCurveYValues)
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr)

View File

@@ -140,6 +140,9 @@ public:
bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const override;
bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) override;
void setNormalizationEnabled(bool enable);
bool isNormalizationEnabled();
void showLegend(bool enable);
public:
// Rim2dPlotInterface overrides
void updateAxisScaling() override;
@@ -194,6 +197,8 @@ private:
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_showLegend;
caf::PdmField<bool> m_normalizeCurveYValues;
caf::PdmField<int> m_legendFontSize;
caf::PdmField<bool> m_useAutoPlotTitle;

View File

@@ -301,8 +301,7 @@ bool RimSummaryTimeAxisProperties::isActive() const
//--------------------------------------------------------------------------------------------------
QDateTime RimSummaryTimeAxisProperties::visibleDateTimeMin() const
{
QDateTime fullMin(m_visibleDateRangeMin(), m_visibleTimeRangeMin());
return fullMin;
return RiaQDateTimeTools::createUtcDateTime(m_visibleDateRangeMin(), m_visibleTimeRangeMin());
}
//--------------------------------------------------------------------------------------------------
@@ -310,8 +309,7 @@ QDateTime RimSummaryTimeAxisProperties::visibleDateTimeMin() const
//--------------------------------------------------------------------------------------------------
QDateTime RimSummaryTimeAxisProperties::visibleDateTimeMax() const
{
QDateTime fullMax(m_visibleDateRangeMax(), m_visibleTimeRangeMax());
return fullMax;
return RiaQDateTimeTools::createUtcDateTime(m_visibleDateRangeMax(), m_visibleTimeRangeMax());
}
//--------------------------------------------------------------------------------------------------

View File

@@ -991,7 +991,13 @@ std::vector<RigEclipseResultAddress> RigCaseCellResultsData::existingResults() c
//--------------------------------------------------------------------------------------------------
const RigEclipseResultInfo* RigCaseCellResultsData::resultInfo(const RigEclipseResultAddress& resVarAddr) const
{
return &(m_resultInfos[findScalarResultIndexFromAddress(resVarAddr)]);
size_t index = findScalarResultIndexFromAddress(resVarAddr);
if (index < m_resultInfos.size())
{
return &(m_resultInfos[index]);
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------