From 014dd9497a59e9faf02a87417eae0f0b2a87640c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 8 Nov 2017 11:22:16 +0100 Subject: [PATCH] #2035 Add color and legend text to the PLT curves --- .../Flow/RimWellFlowRateCurve.cpp | 6 +- .../Flow/RimWellFlowRateCurve.h | 4 +- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 61 +++++++++++++------ .../ProjectDataModel/Flow/RimWellPltPlot.h | 1 + .../ProjectDataModel/RimWellLogFile.h | 3 +- .../RigAccWellFlowCalculator.cpp | 2 +- 6 files changed, 53 insertions(+), 24 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index 61b569b9db..1fa9d2a730 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -126,7 +126,7 @@ bool RimWellFlowRateCurve::doFillCurve() const //-------------------------------------------------------------------------------------------------- QString RimWellFlowRateCurve::createCurveAutoName() { - return m_tracerName; + return m_curveAutoName; } //-------------------------------------------------------------------------------------------------- @@ -315,12 +315,12 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& tracerName, const std::vector& depthValues, const std::vector& flowRates) +void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& curveName, const std::vector& depthValues, const std::vector& flowRates) { m_curveData = new RigWellLogCurveData; m_curveData->setValuesAndMD(flowRates, depthValues, RiaDefines::UNIT_NONE, false); - m_tracerName = tracerName; + m_curveAutoName = curveName; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h index 4d1d9ba386..ef8898f25a 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h @@ -38,7 +38,7 @@ public: RimWellFlowRateCurve(); virtual ~RimWellFlowRateCurve(); - void setFlowValuesPrDepthValue(const QString& tracerName , const std::vector& depthValues, const std::vector& flowRates); + void setFlowValuesPrDepthValue(const QString& curveName , const std::vector& depthValues, const std::vector& flowRates); void updateStackedPlotData(); virtual QString wellName() const override; @@ -61,7 +61,7 @@ private: bool isUsingConnectionNumberDepthType() const; RimWellAllocationPlot* wellAllocationPlot() const; - QString m_tracerName; + QString m_curveAutoName; int m_groupId; bool m_doFillCurve; diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index ce4ff05beb..e5fc2674f0 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -1059,22 +1059,30 @@ void RimWellPltPlot::syncCurvesFromUiSelection() std::set selectedPhases = m_phaseSelectionMode == FLOW_TYPE_PHASE_SPLIT ? std::set(m_phases().begin(), m_phases().end()) : std::set({ PHASE_TOTAL }); + + RifWellRftAddress sourceDef = curveDefToAdd.first; + QDateTime timeStep = curveDefToAdd.second; std::unique_ptr resultPointCalc; + QString curveName; + curveName += sourceDef.eclCase() ? sourceDef.eclCase()->caseUserDescription() : ""; + curveName += sourceDef.wellLogFile() ? sourceDef.wellLogFile()->name() : ""; + if (sourceDef.sourceType() == RifWellRftAddress::RFT) curveName += ", RFT"; + curveName += ", " + timeStep.toString(); - if ( curveDefToAdd.first.sourceType() == RifWellRftAddress::RFT ) + if ( sourceDef.sourceType() == RifWellRftAddress::RFT ) { resultPointCalc.reset(new RigRftResultPointCalculator(m_wellName(), m_branchIndex(), - dynamic_cast(curveDefToAdd.first.eclCase()), - curveDefToAdd.second)); + dynamic_cast(sourceDef.eclCase()), + timeStep)); } - else if (curveDefToAdd.first.sourceType() == RifWellRftAddress::GRID) + else if (sourceDef.sourceType() == RifWellRftAddress::GRID) { resultPointCalc.reset(new RigSimWellResultPointCalculator(m_wellName(), m_branchIndex(), - dynamic_cast(curveDefToAdd.first.eclCase()), - curveDefToAdd.second)); + dynamic_cast(sourceDef.eclCase()), + timeStep)); } @@ -1092,14 +1100,30 @@ void RimWellPltPlot::syncCurvesFromUiSelection() std::vector tracerNames = wfAccumulator.tracerNames(); for ( const QString& tracerName: tracerNames ) { - const std::vector accFlow = wfAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0); - addStackedCurve(tracerName, depthValues, accFlow, plotTrack, curveGroupId, false); + auto color = tracerName == RIG_FLOW_OIL_NAME ? cvf::Color3f::DARK_GREEN : + tracerName == RIG_FLOW_GAS_NAME ? cvf::Color3f::DARK_RED : + tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE : + cvf::Color3f::DARK_GRAY; + + if ( tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count(PHASE_OIL) + || tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count(PHASE_GAS) + || tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(PHASE_WATER) ) + { + const std::vector accFlow = wfAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0); + addStackedCurve(curveName + ", " + tracerName, + depthValues, + accFlow, + plotTrack, + color, + curveGroupId, + false); + } } } } - else if ( curveDefToAdd.first.sourceType() == RifWellRftAddress::OBSERVED ) + else if ( sourceDef.sourceType() == RifWellRftAddress::OBSERVED ) { - RimWellLogFile* const wellLogFile = curveDefToAdd.first.wellLogFile(); + RimWellLogFile* const wellLogFile = sourceDef.wellLogFile(); if(wellLogFile!= nullptr) { RigWellLogFile* rigWellLogFile = wellLogFile->wellLogFile(); @@ -1111,10 +1135,16 @@ void RimWellPltPlot::syncCurvesFromUiSelection() const auto& channelName = channel->name(); if (selectedPhases.count(flowPhaseFromChannelName(channelName)) > 0) { - addStackedCurve(channelName, + auto color = channelName == OIL_CHANNEL_NAME ? cvf::Color3f::DARK_GREEN : + channelName == GAS_CHANNEL_NAME ? cvf::Color3f::DARK_RED : + channelName == WATER_CHANNEL_NAME ? cvf::Color3f::BLUE : + cvf::Color3f::DARK_GRAY; + + addStackedCurve(curveName + ", " + channelName, rigWellLogFile->depthValues(), rigWellLogFile->values(channelName), plotTrack, + color, curveGroupId, true); } @@ -1129,20 +1159,17 @@ void RimWellPltPlot::syncCurvesFromUiSelection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::addStackedCurve(const QString& channelName, +void RimWellPltPlot::addStackedCurve(const QString& curveName, const std::vector& depthValues, const std::vector& accFlow, RimWellLogTrack* plotTrack, + cvf::Color3f color, int curveGroupId, bool doFillCurve) { RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; - curve->setFlowValuesPrDepthValue(channelName, depthValues, accFlow); + curve->setFlowValuesPrDepthValue(curveName, depthValues, accFlow); - auto color = channelName == OIL_CHANNEL_NAME ? cvf::Color3f::DARK_GREEN : - channelName == GAS_CHANNEL_NAME ? cvf::Color3f::DARK_RED : - channelName == WATER_CHANNEL_NAME ? cvf::Color3f::BLUE : - cvf::Color3f::DARK_GRAY; curve->setColor(color); curve->setGroupId(curveGroupId); curve->setDoFillCurve(doFillCurve); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.h index 6b90cdea8c..044c822009 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.h @@ -151,6 +151,7 @@ private: const std::vector& depthValues, const std::vector& accFlow, RimWellLogTrack* plotTrack, + cvf::Color3f color, int curveGroupId, bool doFillCurve); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFile.h b/ApplicationCode/ProjectDataModel/RimWellLogFile.h index a7cf42a1a3..c2a555acc7 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFile.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogFile.h @@ -58,7 +58,8 @@ public: void setFileName(const QString& fileName); QString fileName() const { return m_fileName; } - + QString name() const { return m_name; } + bool readFile(QString* errorMessage); QString wellName() const; diff --git a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp index e6375abae1..76cccb0905 100644 --- a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp @@ -50,7 +50,7 @@ size_t RigEclCellIndexCalculator::resultCellIndex(size_t gridIndex, size_t gridC //-------------------------------------------------------------------------------------------------- /// -/// The pipeBranchesCellIds are describing the lines between the points, starting with the first line +/// The pipeBranchesWellResultPoints are describing the lines between the points, starting with the first line // and is thus expected to be one less than the number of centerline points //-------------------------------------------------------------------------------------------------- RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector >& pipeBranchesCLCoords,