From dc93767683b8445ed2ffe73218adcaa9fc6bc9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Thu, 2 Nov 2017 11:05:39 +0100 Subject: [PATCH] #2076 RFT Plot. Support PRES_FORM las channel name --- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 46 +++++++++++++------ .../ProjectDataModel/Flow/RimWellRftPlot.h | 6 ++- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index e5f7c336b4..5bd594ea99 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -53,7 +53,7 @@ CAF_PDM_SOURCE_INIT(RimWellRftPlot, "WellRftPlot"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const char RimWellRftPlot::PRESSURE_DATA_NAME[] = "PRESSURE"; +const std::set RimWellRftPlot::PRESSURE_DATA_NAMES = { "PRESSURE", "PRES_FORM" }; const char RimWellRftPlot::PLOT_NAME_QFORMAT_STRING[] = "RFT: %1"; //-------------------------------------------------------------------------------------------------- @@ -557,14 +557,12 @@ std::map> RimWellRftPlot::timeStepsFromRf std::map> RimWellRftPlot::timeStepsFromGridCase(RimEclipseCase* gridCase) const { const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData(); - size_t resultIndex = eclipseCaseData != nullptr ? - eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, PRESSURE_DATA_NAME) : - cvf::UNDEFINED_SIZE_T; + std::pair resultDataInfo = pressureResultDataInfo(eclipseCaseData); std::map> timeStepsMap; - if (resultIndex != cvf::UNDEFINED_SIZE_T) + if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T) { - for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates(resultIndex)) + for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates(resultDataInfo.first)) { if (timeStepsMap.count(timeStep) == 0) { @@ -802,12 +800,14 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set resultDataInfo = pressureResultDataInfo(gridCase->eclipseCaseData()); + // Case curve->setCase(gridCase); // Result definition RimEclipseResultDefinition* resultDef = new RimEclipseResultDefinition(); - resultDef->setResultVariable(PRESSURE_DATA_NAME); + resultDef->setResultVariable(resultDataInfo.second); curve->setEclipseResultDefinition(resultDef); // Time step @@ -957,13 +957,36 @@ bool RimWellRftPlot::hasPressureData(RimWellPath* wellPath) return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RimWellRftPlot::pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData) +{ + if (eclipseCaseData != nullptr) + { + for (const auto& pressureDataName : PRESSURE_DATA_NAMES) + { + size_t index = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)-> + findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, pressureDataName); + if (index != cvf::UNDEFINED_SIZE_T) + { + return std::make_pair(index, pressureDataName); + } + } + } + return std::make_pair(cvf::UNDEFINED_SIZE_T, ""); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RimWellRftPlot::isPressureChannel(RimWellLogFileChannel* channel) { - // Todo: read pressure channel names from config/defines - return QString::compare(channel->name(), PRESSURE_DATA_NAME) == 0; + for (const auto& pressureDataName : PRESSURE_DATA_NAMES) + { + if (QString::compare(channel->name(), pressureDataName, Qt::CaseInsensitive) == 0) return true; + } + return false; } //-------------------------------------------------------------------------------------------------- @@ -971,10 +994,7 @@ bool RimWellRftPlot::isPressureChannel(RimWellLogFileChannel* channel) //-------------------------------------------------------------------------------------------------- bool RimWellRftPlot::hasPressureData(RimEclipseResultCase* gridCase) { - const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData(); - size_t resultIndex = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)-> - findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, PRESSURE_DATA_NAME); - return resultIndex != cvf::UNDEFINED_SIZE_T; + return pressureResultDataInfo(gridCase->eclipseCaseData()).first != cvf::UNDEFINED_SIZE_T; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h index 3b5951dbd1..33bbfdf7fa 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h @@ -34,7 +34,7 @@ #include #include #include - +#include class RimEclipseCase; class RimEclipseResultCase; @@ -43,6 +43,7 @@ class RimWellLogFileChannel; class RimWellLogPlot; class RimWellPath; class RiuWellRftPlot; +class RigEclipseCaseData; namespace cvf { class Color3f; @@ -61,7 +62,7 @@ class RimWellRftPlot : public RimViewWindow { CAF_PDM_HEADER_INIT; - static const char PRESSURE_DATA_NAME[]; + static const std::set PRESSURE_DATA_NAMES; static const char PLOT_NAME_QFORMAT_STRING[]; public: @@ -83,6 +84,7 @@ public: static bool isPressureChannel(RimWellLogFileChannel* channel); static bool hasPressureData(RimEclipseResultCase* gridCase); static bool hasPressureData(RimWellPath* wellPath); + static std::pair pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData); static const char* plotNameFormatString(); void applyInitialSelections();