This commit is contained in:
Magne Sjaastad 2018-05-11 14:20:16 +02:00
parent bf2f524d34
commit b02bf07568

View File

@ -1,17 +1,17 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017 Statoil ASA // Copyright (C) 2017 Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -39,24 +39,23 @@
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimWellPathCollection.h" #include "RimWellPathCollection.h"
#include <regex>
#include "RimTools.h" #include "RimTools.h"
#include <regex>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::set<QString> RimWellPlotTools::PRESSURE_DATA_NAMES = { "PRESSURE", "PRES_FORM" }; const std::set<QString> RimWellPlotTools::PRESSURE_DATA_NAMES = {"PRESSURE", "PRES_FORM"};
const std::set<QString> RimWellPlotTools::OIL_CHANNEL_NAMES = { "QOZT", "QOIL", "^.*\\D_QOIL" }; const std::set<QString> RimWellPlotTools::OIL_CHANNEL_NAMES = {"QOZT", "QOIL", "^.*\\D_QOIL"};
const std::set<QString> RimWellPlotTools::GAS_CHANNEL_NAMES = { "QGZT", "QGAS", "^.*\\D_QGAS" }; const std::set<QString> RimWellPlotTools::GAS_CHANNEL_NAMES = {"QGZT", "QGAS", "^.*\\D_QGAS"};
const std::set<QString> RimWellPlotTools::WATER_CHANNEL_NAMES = { "QWZT", "QWAT", "^.*\\D_QWAT" }; const std::set<QString> RimWellPlotTools::WATER_CHANNEL_NAMES = {"QWZT", "QWAT", "^.*\\D_QWAT"};
const std::set<QString> RimWellPlotTools::TOTAL_CHANNEL_NAMES = { "QTZT", "QTOT", "^.*\\D_QTOT" }; const std::set<QString> RimWellPlotTools::TOTAL_CHANNEL_NAMES = {"QTZT", "QTOT", "^.*\\D_QTOT"};
std::set<QString> RimWellPlotTools::FLOW_DATA_NAMES = {}; std::set<QString> RimWellPlotTools::FLOW_DATA_NAMES = {};
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
class StaticFieldsInitializer class StaticFieldsInitializer
{ {
@ -64,15 +63,19 @@ public:
StaticFieldsInitializer() StaticFieldsInitializer()
{ {
// Init static list // Init static list
RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::OIL_CHANNEL_NAMES.begin(), RimWellPlotTools::OIL_CHANNEL_NAMES.end()); RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::OIL_CHANNEL_NAMES.begin(),
RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::GAS_CHANNEL_NAMES.begin(), RimWellPlotTools::GAS_CHANNEL_NAMES.end()); RimWellPlotTools::OIL_CHANNEL_NAMES.end());
RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::WATER_CHANNEL_NAMES.begin(), RimWellPlotTools::WATER_CHANNEL_NAMES.end()); RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::GAS_CHANNEL_NAMES.begin(),
RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::TOTAL_CHANNEL_NAMES.begin(), RimWellPlotTools::TOTAL_CHANNEL_NAMES.end()); RimWellPlotTools::GAS_CHANNEL_NAMES.end());
RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::WATER_CHANNEL_NAMES.begin(),
RimWellPlotTools::WATER_CHANNEL_NAMES.end());
RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::TOTAL_CHANNEL_NAMES.begin(),
RimWellPlotTools::TOTAL_CHANNEL_NAMES.end());
} }
} staticFieldsInitializer; } staticFieldsInitializer;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::hasPressureData(const RimWellLogFile* wellLogFile) bool RimWellPlotTools::hasPressureData(const RimWellLogFile* wellLogFile)
{ {
@ -84,7 +87,7 @@ bool RimWellPlotTools::hasPressureData(const RimWellLogFile* wellLogFile)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::hasPressureData(RimWellPath* wellPath) bool RimWellPlotTools::hasPressureData(RimWellPath* wellPath)
{ {
@ -99,7 +102,7 @@ bool RimWellPlotTools::hasPressureData(RimWellPath* wellPath)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::pair<size_t, QString> RimWellPlotTools::pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData) std::pair<size_t, QString> RimWellPlotTools::pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData)
{ {
@ -107,8 +110,8 @@ std::pair<size_t, QString> RimWellPlotTools::pressureResultDataInfo(const RigEcl
{ {
for (const auto& pressureDataName : PRESSURE_DATA_NAMES) for (const auto& pressureDataName : PRESSURE_DATA_NAMES)
{ {
size_t index = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)-> size_t index = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)
findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, pressureDataName); ->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, pressureDataName);
if (index != cvf::UNDEFINED_SIZE_T) if (index != cvf::UNDEFINED_SIZE_T)
{ {
return std::make_pair(index, pressureDataName); return std::make_pair(index, pressureDataName);
@ -119,7 +122,7 @@ std::pair<size_t, QString> RimWellPlotTools::pressureResultDataInfo(const RigEcl
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::isPressureChannel(RimWellLogFileChannel* channel) bool RimWellPlotTools::isPressureChannel(RimWellLogFileChannel* channel)
{ {
@ -131,14 +134,14 @@ bool RimWellPlotTools::isPressureChannel(RimWellLogFileChannel* channel)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::hasPressureData(RimEclipseResultCase* gridCase) bool RimWellPlotTools::hasPressureData(RimEclipseResultCase* gridCase)
{ {
return pressureResultDataInfo(gridCase->eclipseCaseData()).first != cvf::UNDEFINED_SIZE_T; return pressureResultDataInfo(gridCase->eclipseCaseData()).first != cvf::UNDEFINED_SIZE_T;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::hasFlowData(const RimWellLogFile* wellLogFile) bool RimWellPlotTools::hasFlowData(const RimWellLogFile* wellLogFile)
{ {
@ -150,7 +153,7 @@ bool RimWellPlotTools::hasFlowData(const RimWellLogFile* wellLogFile)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::hasFlowData(const RimWellPath* wellPath) bool RimWellPlotTools::hasFlowData(const RimWellPath* wellPath)
{ {
@ -165,7 +168,7 @@ bool RimWellPlotTools::hasFlowData(const RimWellPath* wellPath)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::hasAssociatedWellPath(const QString& wellName) bool RimWellPlotTools::hasAssociatedWellPath(const QString& wellName)
{ {
@ -176,7 +179,7 @@ bool RimWellPlotTools::hasAssociatedWellPath(const QString& wellName)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::isFlowChannel(RimWellLogFileChannel* channel) bool RimWellPlotTools::isFlowChannel(RimWellLogFileChannel* channel)
{ {
@ -184,7 +187,7 @@ bool RimWellPlotTools::isFlowChannel(RimWellLogFileChannel* channel)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::isOilFlowChannel(const QString& channelName) bool RimWellPlotTools::isOilFlowChannel(const QString& channelName)
{ {
@ -192,7 +195,7 @@ bool RimWellPlotTools::isOilFlowChannel(const QString& channelName)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::isGasFlowChannel(const QString& channelName) bool RimWellPlotTools::isGasFlowChannel(const QString& channelName)
{ {
@ -200,7 +203,7 @@ bool RimWellPlotTools::isGasFlowChannel(const QString& channelName)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::isWaterFlowChannel(const QString& channelName) bool RimWellPlotTools::isWaterFlowChannel(const QString& channelName)
{ {
@ -208,7 +211,7 @@ bool RimWellPlotTools::isWaterFlowChannel(const QString& channelName)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::isTotalFlowChannel(const QString& channelName) bool RimWellPlotTools::isTotalFlowChannel(const QString& channelName)
{ {
@ -216,7 +219,7 @@ bool RimWellPlotTools::isTotalFlowChannel(const QString& channelName)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::hasFlowData(RimEclipseResultCase* gridCase) bool RimWellPlotTools::hasFlowData(RimEclipseResultCase* gridCase)
{ {
@ -224,8 +227,8 @@ bool RimWellPlotTools::hasFlowData(RimEclipseResultCase* gridCase)
for (const QString& channelName : FLOW_DATA_NAMES) for (const QString& channelName : FLOW_DATA_NAMES)
{ {
size_t resultIndex = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)-> size_t resultIndex =
findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, channelName); eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, channelName);
if (resultIndex != cvf::UNDEFINED_SIZE_T) return true; if (resultIndex != cvf::UNDEFINED_SIZE_T) return true;
} }
@ -233,7 +236,7 @@ bool RimWellPlotTools::hasFlowData(RimEclipseResultCase* gridCase)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
FlowPhase RimWellPlotTools::flowPhaseFromChannelName(const QString& channelName) FlowPhase RimWellPlotTools::flowPhaseFromChannelName(const QString& channelName)
{ {
@ -244,12 +247,11 @@ FlowPhase RimWellPlotTools::flowPhaseFromChannelName(const QString& channelName)
return FLOW_PHASE_NONE; return FLOW_PHASE_NONE;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPlotTools::addTimeStepsToMap(std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& destMap, void RimWellPlotTools::addTimeStepsToMap(std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& destMap,
const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsToAdd) const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsToAdd)
{ {
for (const auto& timeStepPair : timeStepsToAdd) for (const auto& timeStepPair : timeStepsToAdd)
{ {
@ -262,19 +264,18 @@ void RimWellPlotTools::addTimeStepsToMap(std::map<QDateTime, std::set<RifDataSou
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure(const QString& wellPathNameOrSimWellName) std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure(const QString& wellPathNameOrSimWellName)
{ {
std::vector<RimWellLogFile*> wellLogFiles; std::vector<RimWellLogFile*> wellLogFiles;
const RimProject* const project = RiaApplication::instance()->project(); const RimProject* const project = RiaApplication::instance()->project();
std::vector<RimWellPath*> wellPaths = project->allWellPaths(); std::vector<RimWellPath*> wellPaths = project->allWellPaths();
for (auto wellPath : wellPaths) for (auto wellPath : wellPaths)
{ {
if (!wellPathNameOrSimWellName.isEmpty() && if (!wellPathNameOrSimWellName.isEmpty() && (wellPathNameOrSimWellName == wellPath->associatedSimulationWellName() ||
(wellPathNameOrSimWellName == wellPath->associatedSimulationWellName() || wellPathNameOrSimWellName == wellPath->name()))
wellPathNameOrSimWellName == wellPath->name()))
{ {
const std::vector<RimWellLogFile*> files = wellPath->wellLogFiles(); const std::vector<RimWellLogFile*> files = wellPath->wellLogFiles();
@ -283,7 +284,7 @@ std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure(co
if (hasPressureData(file)) if (hasPressureData(file))
{ {
wellLogFiles.push_back(file); wellLogFiles.push_back(file);
} }
} }
} }
} }
@ -292,7 +293,7 @@ std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure(co
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogFileChannel* RimWellPlotTools::getPressureChannelFromWellFile(const RimWellLogFile* wellLogFile) RimWellLogFileChannel* RimWellPlotTools::getPressureChannelFromWellFile(const RimWellLogFile* wellLogFile)
{ {
@ -310,23 +311,23 @@ RimWellLogFileChannel* RimWellPlotTools::getPressureChannelFromWellFile(const Ri
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingFlow(const QString& wellPathName) std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingFlow(const QString& wellPathName)
{ {
std::vector<RimWellLogFile*> wellLogFiles; std::vector<RimWellLogFile*> wellLogFiles;
const RimProject* const project = RiaApplication::instance()->project(); const RimProject* const project = RiaApplication::instance()->project();
std::vector<RimWellPath*> wellPaths = project->allWellPaths(); std::vector<RimWellPath*> wellPaths = project->allWellPaths();
for ( auto wellPath : wellPaths ) for (auto wellPath : wellPaths)
{ {
if ( wellPath->name() == wellPathName ) if (wellPath->name() == wellPathName)
{ {
std::vector<RimWellLogFile*> files = wellPath->wellLogFiles(); std::vector<RimWellLogFile*> files = wellPath->wellLogFiles();
for ( RimWellLogFile* file : files ) for (RimWellLogFile* file : files)
{ {
if ( hasFlowData(file) ) if (hasFlowData(file))
{ {
wellLogFiles.push_back(file); wellLogFiles.push_back(file);
} }
@ -337,14 +338,15 @@ std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingFlow(const
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellPath* RimWellPlotTools::wellPathFromWellLogFile(const RimWellLogFile* wellLogFile) RimWellPath* RimWellPlotTools::wellPathFromWellLogFile(const RimWellLogFile* wellLogFile)
{ {
RimProject* const project = RiaApplication::instance()->project(); RimProject* const project = RiaApplication::instance()->project();
for (const auto& oilField : project->oilFields) for (const auto& oilField : project->oilFields)
{ {
auto wellPaths = std::vector<RimWellPath*>(oilField->wellPathCollection()->wellPaths.begin(), oilField->wellPathCollection()->wellPaths.end()); auto wellPaths = std::vector<RimWellPath*>(oilField->wellPathCollection()->wellPaths.begin(),
oilField->wellPathCollection()->wellPaths.end());
for (const auto& wellPath : wellPaths) for (const auto& wellPath : wellPaths)
{ {
@ -362,19 +364,19 @@ RimWellPath* RimWellPlotTools::wellPathFromWellLogFile(const RimWellLogFile* wel
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RimEclipseResultCase*> RimWellPlotTools::gridCasesForWell(const QString& simWellName) std::vector<RimEclipseResultCase*> RimWellPlotTools::gridCasesForWell(const QString& simWellName)
{ {
std::vector<RimEclipseResultCase*> cases; std::vector<RimEclipseResultCase*> cases;
const RimProject* project = RiaApplication::instance()->project(); const RimProject* project = RiaApplication::instance()->project();
for (RimEclipseCase* eclCase : project->eclipseCases()) for (RimEclipseCase* eclCase : project->eclipseCases())
{ {
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclCase); RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclCase);
if (resultCase != nullptr) if (resultCase != nullptr)
{ {
if ( eclCase->eclipseCaseData()->findSimWellData(simWellName) ) if (eclCase->eclipseCaseData()->findSimWellData(simWellName))
{ {
cases.push_back(resultCase); cases.push_back(resultCase);
break; break;
@ -385,20 +387,18 @@ std::vector<RimEclipseResultCase*> RimWellPlotTools::gridCasesForWell(const QStr
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RimEclipseResultCase*> RimWellPlotTools::rftCasesForWell(const QString& simWellName) std::vector<RimEclipseResultCase*> RimWellPlotTools::rftCasesForWell(const QString& simWellName)
{ {
std::vector<RimEclipseResultCase*> cases; std::vector<RimEclipseResultCase*> cases;
const RimProject* project = RiaApplication::instance()->project(); const RimProject* project = RiaApplication::instance()->project();
for (RimEclipseCase* eclCase : project->eclipseCases()) for (RimEclipseCase* eclCase : project->eclipseCases())
{ {
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclCase); RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclCase);
if (resultCase if (resultCase && resultCase->rftReader() && resultCase->rftReader()->wellNames().count(simWellName))
&& resultCase->rftReader()
&& resultCase->rftReader()->wellNames().count(simWellName))
{ {
cases.push_back(resultCase); cases.push_back(resultCase);
} }
@ -407,12 +407,11 @@ std::vector<RimEclipseResultCase*> RimWellPlotTools::rftCasesForWell(const QStri
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::set<QDateTime> RimWellPlotTools::timeStepsFromRftCase(RimEclipseResultCase* rftCase, std::set<QDateTime> RimWellPlotTools::timeStepsFromRftCase(RimEclipseResultCase* rftCase, const QString& simWellName)
const QString& simWellName)
{ {
std::set<QDateTime> timeSteps; std::set<QDateTime> timeSteps;
RifReaderEclipseRft* const reader = rftCase->rftReader(); RifReaderEclipseRft* const reader = rftCase->rftReader();
if (reader != nullptr) if (reader != nullptr)
{ {
@ -425,12 +424,12 @@ std::set<QDateTime> RimWellPlotTools::timeStepsFromRftCase(RimEclipseResultCase*
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::set<QDateTime> RimWellPlotTools::timeStepsFromGridCase(RimEclipseCase* gridCase) std::set<QDateTime> RimWellPlotTools::timeStepsFromGridCase(RimEclipseCase* gridCase)
{ {
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData(); const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData();
std::pair<size_t, QString> resultDataInfo = pressureResultDataInfo(eclipseCaseData); std::pair<size_t, QString> resultDataInfo = pressureResultDataInfo(eclipseCaseData);
std::set<QDateTime> timeSteps; std::set<QDateTime> timeSteps;
if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T) if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T)
@ -444,7 +443,7 @@ std::set<QDateTime> RimWellPlotTools::timeStepsFromGridCase(RimEclipseCase* grid
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QDateTime RimWellPlotTools::timeStepFromWellLogFile(RimWellLogFile* wellLogFile) QDateTime RimWellPlotTools::timeStepFromWellLogFile(RimWellLogFile* wellLogFile)
{ {
@ -453,12 +452,12 @@ QDateTime RimWellPlotTools::timeStepFromWellLogFile(RimWellLogFile* wellLogFile)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> RimWellPlotTools::timeStepsMapFromGridCase(RimEclipseCase* gridCase) std::map<QDateTime, std::set<RifDataSourceForRftPlt>> RimWellPlotTools::timeStepsMapFromGridCase(RimEclipseCase* gridCase)
{ {
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData(); const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData();
std::pair<size_t, QString> resultDataInfo = pressureResultDataInfo(eclipseCaseData); std::pair<size_t, QString> resultDataInfo = pressureResultDataInfo(eclipseCaseData);
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMap; std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMap;
if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T) if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T)
@ -476,32 +475,31 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>> RimWellPlotTools::timeStep
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::set<QDateTime> RimWellPlotTools::findMatchingOrAdjacentTimeSteps(const std::set<QDateTime>& baseTimeLine, std::set<QDateTime> RimWellPlotTools::findMatchingOrAdjacentTimeSteps(const std::set<QDateTime>& baseTimeLine,
const std::set<QDateTime>& availableTimeSteps) const std::set<QDateTime>& availableTimeSteps)
{ {
std::set<QDateTime> resultTimeSteps; std::set<QDateTime> resultTimeSteps;
for (const QDateTime& baseTimeStep: baseTimeLine ) for (const QDateTime& baseTimeStep : baseTimeLine)
{ {
auto itToEqualOrLargerTime = availableTimeSteps.lower_bound(baseTimeStep); auto itToEqualOrLargerTime = availableTimeSteps.lower_bound(baseTimeStep);
if (itToEqualOrLargerTime != availableTimeSteps.end()) if (itToEqualOrLargerTime != availableTimeSteps.end())
{ {
resultTimeSteps.insert(*itToEqualOrLargerTime); resultTimeSteps.insert(*itToEqualOrLargerTime);
if ( *itToEqualOrLargerTime != baseTimeStep if (*itToEqualOrLargerTime != baseTimeStep && itToEqualOrLargerTime != availableTimeSteps.begin())
&& itToEqualOrLargerTime != availableTimeSteps.begin() )
{ {
// Found a larger time, then add the timestep before it as the adjacent timestep before the base timestep // Found a larger time, then add the timestep before it as the adjacent timestep before the base timestep
itToEqualOrLargerTime--; itToEqualOrLargerTime--;
resultTimeSteps.insert(*itToEqualOrLargerTime); resultTimeSteps.insert(*itToEqualOrLargerTime);
} }
} }
} }
// The above will only work if there are at least one available timestep equal or after any of the basetimeline times. // The above will only work if there are at least one available timestep equal or after any of the basetimeline times.
// If no timesteps matched but we have some, add the last available because the above code missed it. // If no timesteps matched but we have some, add the last available because the above code missed it.
if (!resultTimeSteps.size() && baseTimeLine.size() && availableTimeSteps.size()) if (!resultTimeSteps.size() && baseTimeLine.size() && availableTimeSteps.size())
{ {
resultTimeSteps.insert(*availableTimeSteps.rbegin()); resultTimeSteps.insert(*availableTimeSteps.rbegin());
} }
@ -510,20 +508,19 @@ std::set<QDateTime> RimWellPlotTools::findMatchingOrAdjacentTimeSteps(const std:
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::set<QDateTime> RimWellPlotTools::availableSimWellTimesteps(RimEclipseCase * eclCase, std::set<QDateTime>
const QString& simWellName, RimWellPlotTools::availableSimWellTimesteps(RimEclipseCase* eclCase, const QString& simWellName, bool addFirstReportTimestep)
bool addFirstReportTimestep)
{ {
std::set<QDateTime> availebleTimeSteps; std::set<QDateTime> availebleTimeSteps;
std::vector<QDateTime> allTimeSteps = eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates(); std::vector<QDateTime> allTimeSteps = eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates();
const RigSimWellData* simWell = eclCase->eclipseCaseData()->findSimWellData(simWellName); const RigSimWellData* simWell = eclCase->eclipseCaseData()->findSimWellData(simWellName);
for ( size_t tsIdx = 0; tsIdx < allTimeSteps.size(); ++tsIdx ) for (size_t tsIdx = 0; tsIdx < allTimeSteps.size(); ++tsIdx)
{ {
if ( simWell->hasWellResult(tsIdx) || (addFirstReportTimestep && tsIdx == 0) ) if (simWell->hasWellResult(tsIdx) || (addFirstReportTimestep && tsIdx == 0))
{ {
availebleTimeSteps.insert(allTimeSteps[tsIdx]); availebleTimeSteps.insert(allTimeSteps[tsIdx]);
} }
@ -533,13 +530,13 @@ std::set<QDateTime> RimWellPlotTools::availableSimWellTimesteps(RimEclipseCase *
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve(const RimWellLogCurve* curve) RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve(const RimWellLogCurve* curve)
{ {
const RimWellLogRftCurve* rftCurve = dynamic_cast<const RimWellLogRftCurve*>(curve); const RimWellLogRftCurve* rftCurve = dynamic_cast<const RimWellLogRftCurve*>(curve);
const RimWellLogExtractionCurve* gridCurve = dynamic_cast<const RimWellLogExtractionCurve*>(curve); const RimWellLogExtractionCurve* gridCurve = dynamic_cast<const RimWellLogExtractionCurve*>(curve);
const RimWellLogFileCurve* wellLogFileCurve = dynamic_cast<const RimWellLogFileCurve*>(curve); const RimWellLogFileCurve* wellLogFileCurve = dynamic_cast<const RimWellLogFileCurve*>(curve);
if (rftCurve != nullptr) if (rftCurve != nullptr)
{ {
@ -547,7 +544,7 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve(const RimWellLogCur
if (rftCase != nullptr) if (rftCase != nullptr)
{ {
const RifEclipseRftAddress rftAddress = rftCurve->rftAddress(); const RifEclipseRftAddress rftAddress = rftCurve->rftAddress();
const QDateTime timeStep = rftAddress.timeStep(); const QDateTime timeStep = rftAddress.timeStep();
return RiaRftPltCurveDefinition(RifDataSourceForRftPlt(RifDataSourceForRftPlt::RFT, rftCase), timeStep); return RiaRftPltCurveDefinition(RifDataSourceForRftPlt(RifDataSourceForRftPlt::RFT, rftCase), timeStep);
} }
} }
@ -556,21 +553,21 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve(const RimWellLogCur
RimEclipseResultCase* gridCase = dynamic_cast<RimEclipseResultCase*>(gridCurve->rimCase()); RimEclipseResultCase* gridCase = dynamic_cast<RimEclipseResultCase*>(gridCurve->rimCase());
if (gridCase != nullptr) if (gridCase != nullptr)
{ {
size_t timeStepIndex = gridCurve->currentTimeStep(); size_t timeStepIndex = gridCurve->currentTimeStep();
const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsMap = timeStepsMapFromGridCase(gridCase); const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsMap = timeStepsMapFromGridCase(gridCase);
auto timeStepsVector = std::vector<std::pair<QDateTime, std::set<RifDataSourceForRftPlt>>>( auto timeStepsVector =
timeStepsMap.begin(), timeStepsMap.end()); std::vector<std::pair<QDateTime, std::set<RifDataSourceForRftPlt>>>(timeStepsMap.begin(), timeStepsMap.end());
if (timeStepIndex < timeStepsMap.size()) if (timeStepIndex < timeStepsMap.size())
{ {
return RiaRftPltCurveDefinition(RifDataSourceForRftPlt(RifDataSourceForRftPlt::GRID, gridCase), return RiaRftPltCurveDefinition(RifDataSourceForRftPlt(RifDataSourceForRftPlt::GRID, gridCase),
timeStepsVector[timeStepIndex].first); timeStepsVector[timeStepIndex].first);
} }
} }
} }
else if (wellLogFileCurve != nullptr) else if (wellLogFileCurve != nullptr)
{ {
const RimWellPath* const wellPath = wellLogFileCurve->wellPath(); const RimWellPath* const wellPath = wellLogFileCurve->wellPath();
RimWellLogFile* const wellLogFile = wellLogFileCurve->wellLogFile(); RimWellLogFile* const wellLogFile = wellLogFileCurve->wellLogFile();
if (wellLogFile != nullptr) if (wellLogFile != nullptr)
{ {
@ -590,7 +587,7 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve(const RimWellLogCur
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellPath* RimWellPlotTools::wellPathByWellPathNameOrSimWellName(const QString& wellPathNameOrSimwellName) RimWellPath* RimWellPlotTools::wellPathByWellPathNameOrSimWellName(const QString& wellPathNameOrSimwellName)
{ {
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
RimWellPath* wellPath = proj->wellPathByName(wellPathNameOrSimwellName); RimWellPath* wellPath = proj->wellPathByName(wellPathNameOrSimwellName);
return wellPath != nullptr ? wellPath : proj->wellPathFromSimWellName(wellPathNameOrSimwellName); return wellPath != nullptr ? wellPath : proj->wellPathFromSimWellName(wellPathNameOrSimwellName);
@ -610,8 +607,7 @@ QString RimWellPlotTools::simWellName(const QString& wellPathNameOrSimWellName)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::tryMatchChannelName(const std::set<QString>& channelNames, const QString& channelNameToMatch) bool RimWellPlotTools::tryMatchChannelName(const std::set<QString>& channelNames, const QString& channelNameToMatch)
{ {
auto itr = std::find_if(channelNames.begin(), channelNames.end(), [&](const QString& channelName) auto itr = std::find_if(channelNames.begin(), channelNames.end(), [&](const QString& channelName) {
{
if (channelName.startsWith('^')) if (channelName.startsWith('^'))
{ {
std::regex pattern(channelName.toStdString()); std::regex pattern(channelName.toStdString());
@ -625,51 +621,51 @@ bool RimWellPlotTools::tryMatchChannelName(const std::set<QString>& channelNames
return itr != channelNames.end(); return itr != channelNames.end();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::set < RiaRftPltCurveDefinition > RimWellPlotTools::curveDefsFromTimesteps(const QString& simWellName, std::set<RiaRftPltCurveDefinition>
const std::vector<QDateTime>& selectedTimeSteps, RimWellPlotTools::curveDefsFromTimesteps(const QString& simWellName,
bool firstSimWellTimeStepIsValid, const std::vector<QDateTime>& selectedTimeSteps,
const std::vector<RifDataSourceForRftPlt>& selectedSourcesExpanded) bool firstSimWellTimeStepIsValid,
const std::vector<RifDataSourceForRftPlt>& selectedSourcesExpanded)
{ {
std::set<RiaRftPltCurveDefinition> curveDefs; std::set<RiaRftPltCurveDefinition> curveDefs;
std::set<QDateTime> selectedTimeStepSet(selectedTimeSteps.begin(), selectedTimeSteps.end()); std::set<QDateTime> selectedTimeStepSet(selectedTimeSteps.begin(), selectedTimeSteps.end());
for ( const RifDataSourceForRftPlt& addr : selectedSourcesExpanded ) for (const RifDataSourceForRftPlt& addr : selectedSourcesExpanded)
{ {
if ( addr.rftReader() ) if (addr.rftReader())
{ {
std::set<QDateTime> rftTimes = addr.rftReader()->availableTimeSteps(simWellName, { RifEclipseRftAddress::ORAT, std::set<QDateTime> rftTimes = addr.rftReader()->availableTimeSteps(
RifEclipseRftAddress::WRAT, simWellName, {RifEclipseRftAddress::ORAT, RifEclipseRftAddress::WRAT, RifEclipseRftAddress::GRAT});
RifEclipseRftAddress::GRAT }); for (const QDateTime& time : rftTimes)
for ( const QDateTime& time : rftTimes )
{ {
if ( selectedTimeStepSet.count(time) ) if (selectedTimeStepSet.count(time))
{ {
curveDefs.insert(RiaRftPltCurveDefinition(addr, time)); curveDefs.insert(RiaRftPltCurveDefinition(addr, time));
} }
} }
} }
else if ( addr.sourceType() == RifDataSourceForRftPlt::GRID && addr.eclCase() ) else if (addr.sourceType() == RifDataSourceForRftPlt::GRID && addr.eclCase())
{ {
std::set<QDateTime> timeSteps = RimWellPlotTools::availableSimWellTimesteps(addr.eclCase(), simWellName, firstSimWellTimeStepIsValid); std::set<QDateTime> timeSteps =
RimWellPlotTools::availableSimWellTimesteps(addr.eclCase(), simWellName, firstSimWellTimeStepIsValid);
for ( const QDateTime& time : timeSteps ) for (const QDateTime& time : timeSteps)
{ {
if ( selectedTimeStepSet.count(time) ) if (selectedTimeStepSet.count(time))
{ {
curveDefs.insert(RiaRftPltCurveDefinition(addr, time)); curveDefs.insert(RiaRftPltCurveDefinition(addr, time));
} }
} }
} }
else if ( addr.sourceType() == RifDataSourceForRftPlt::OBSERVED ) else if (addr.sourceType() == RifDataSourceForRftPlt::OBSERVED)
{ {
if ( addr.wellLogFile() ) if (addr.wellLogFile())
{ {
if ( selectedTimeStepSet.count(addr.wellLogFile()->date()) ) if (selectedTimeStepSet.count(addr.wellLogFile()->date()))
{ {
curveDefs.insert(RiaRftPltCurveDefinition(addr, addr.wellLogFile()->date())); curveDefs.insert(RiaRftPltCurveDefinition(addr, addr.wellLogFile()->date()));
} }
@ -680,12 +676,11 @@ std::set < RiaRftPltCurveDefinition > RimWellPlotTools::curveDefsFromTimesteps(c
return curveDefs; return curveDefs;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WellFlowCondition condition, QString RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem) RiaEclipseUnitTools::UnitSystem unitSystem)
{ {
QString axisTitle; QString axisTitle;
@ -706,7 +701,7 @@ QString RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WellFlowCondition co
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString flowConditionReservoirUnitText(RiaEclipseUnitTools::UnitSystem unitSystem) QString flowConditionReservoirUnitText(RiaEclipseUnitTools::UnitSystem unitSystem)
{ {
@ -714,17 +709,24 @@ QString flowConditionReservoirUnitText(RiaEclipseUnitTools::UnitSystem unitSyste
switch (unitSystem) switch (unitSystem)
{ {
case RiaEclipseUnitTools::UNITS_METRIC: unitText = "[m<sup>3</sup>/day]"; break; case RiaEclipseUnitTools::UNITS_METRIC:
case RiaEclipseUnitTools::UNITS_FIELD: unitText = "[Brl/day]"; break; unitText = "[m<sup>3</sup>/day]";
case RiaEclipseUnitTools::UNITS_LAB: unitText = "[cm<sup>3</sup>/hr]"; break; break;
default: break; case RiaEclipseUnitTools::UNITS_FIELD:
unitText = "[Brl/day]";
break;
case RiaEclipseUnitTools::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
} }
return unitText; return unitText;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellPlotTools::flowUnitText(RimWellLogFile::WellFlowCondition condition, RiaEclipseUnitTools::UnitSystem unitSystem) QString RimWellPlotTools::flowUnitText(RimWellLogFile::WellFlowCondition condition, RiaEclipseUnitTools::UnitSystem unitSystem)
{ {
@ -738,21 +740,29 @@ QString RimWellPlotTools::flowUnitText(RimWellLogFile::WellFlowCondition conditi
{ {
switch (unitSystem) switch (unitSystem)
{ {
case RiaEclipseUnitTools::UNITS_METRIC: unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]"; break; case RiaEclipseUnitTools::UNITS_METRIC:
case RiaEclipseUnitTools::UNITS_FIELD: unitText = "[Liquid BBL/day], [Gas BOE/day]"; break; unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]";
case RiaEclipseUnitTools::UNITS_LAB: unitText = "[cm<sup>3</sup>/hr]"; break; break;
default: break; case RiaEclipseUnitTools::UNITS_FIELD:
unitText = "[Liquid BBL/day], [Gas BOE/day]";
break;
case RiaEclipseUnitTools::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
} }
} }
return unitText; return unitText;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellPlotTools::curveUnitText(RimWellLogFile::WellFlowCondition condition, RiaEclipseUnitTools::UnitSystem unitSystem, FlowPhase flowPhase) QString RimWellPlotTools::curveUnitText(RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem,
FlowPhase flowPhase)
{ {
QString unitText; QString unitText;
@ -767,24 +777,39 @@ QString RimWellPlotTools::curveUnitText(RimWellLogFile::WellFlowCondition condit
case RiaEclipseUnitTools::UNITS_METRIC: case RiaEclipseUnitTools::UNITS_METRIC:
switch (flowPhase) switch (flowPhase)
{ {
case FLOW_PHASE_GAS: unitText = "[kSm<sup>3</sup>/day]"; break; case FLOW_PHASE_GAS:
unitText = "[kSm<sup>3</sup>/day]";
break;
case FLOW_PHASE_WATER: // Intentionally fall through, water and oil have same unit case FLOW_PHASE_WATER: // Intentionally fall through, water and oil have same unit
case FLOW_PHASE_OIL: unitText = "[Sm<sup>3</sup>/day]"; break; case FLOW_PHASE_OIL:
default: unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]"; break; unitText = "[Sm<sup>3</sup>/day]";
break;
default:
unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]";
break;
} }
break; break;
case RiaEclipseUnitTools::UNITS_FIELD: case RiaEclipseUnitTools::UNITS_FIELD:
switch (flowPhase) switch (flowPhase)
{ {
case FLOW_PHASE_GAS: unitText = "[BOE/day]"; break; case FLOW_PHASE_GAS:
unitText = "[BOE/day]";
break;
case FLOW_PHASE_WATER: // Intentionally fall through, water and oil have same unit case FLOW_PHASE_WATER: // Intentionally fall through, water and oil have same unit
case FLOW_PHASE_OIL: unitText = "[BBL/day]"; break; case FLOW_PHASE_OIL:
default: unitText = "[Liquid BBL/day], [Gas BOE/day]"; break; unitText = "[BBL/day]";
break;
default:
unitText = "[Liquid BBL/day], [Gas BOE/day]";
break;
} }
break; break;
case RiaEclipseUnitTools::UNITS_LAB: unitText = "[cm<sup>3</sup>/hr]"; break; case RiaEclipseUnitTools::UNITS_LAB:
default: break; unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
} }
} }
@ -938,20 +963,22 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>> RimWellPlotTools::calculat
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPlotTools::calculateValueOptionsForTimeSteps(const QString& wellPathNameOrSimWellName, void RimWellPlotTools::calculateValueOptionsForTimeSteps(
const std::vector<RifDataSourceForRftPlt>& selSources, const QString& wellPathNameOrSimWellName,
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults, const std::vector<RifDataSourceForRftPlt>& selSources,
QList<caf::PdmOptionItemInfo>& options) const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults,
QList<caf::PdmOptionItemInfo>& options)
{ {
auto timestepsToShowWithSources = calculateRelevantTimeStepsFromCases(wellPathNameOrSimWellName, selSources, interestingRFTResults); auto timestepsToShowWithSources =
calculateRelevantTimeStepsFromCases(wellPathNameOrSimWellName, selSources, interestingRFTResults);
// Create formatted options of all the time steps // Create formatted options of all the time steps
QString dateFormatString; QString dateFormatString;
{ {
std::vector<QDateTime> allTimeSteps; std::vector<QDateTime> allTimeSteps;
for ( const std::pair<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepPair : timestepsToShowWithSources ) for (const std::pair<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepPair : timestepsToShowWithSources)
{ {
allTimeSteps.push_back(timeStepPair.first); allTimeSteps.push_back(timeStepPair.first);
} }
@ -960,17 +987,24 @@ void RimWellPlotTools::calculateValueOptionsForTimeSteps(const QString& wellPath
for (const std::pair<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepPair : timestepsToShowWithSources) for (const std::pair<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepPair : timestepsToShowWithSources)
{ {
QString optionText = timeStepPair.first.toString(dateFormatString); QString optionText = timeStepPair.first.toString(dateFormatString);
bool hasObs = false; bool hasObs = false;
bool hasRft = false; bool hasRft = false;
bool hasGrid = false; bool hasGrid = false;
for (const auto& source : timeStepPair.second) for (const auto& source : timeStepPair.second)
{ {
switch (source.sourceType()){ switch (source.sourceType())
case RifDataSourceForRftPlt::OBSERVED: hasObs = true; break; {
case RifDataSourceForRftPlt::RFT : hasRft = true; break; case RifDataSourceForRftPlt::OBSERVED:
case RifDataSourceForRftPlt::GRID : hasGrid = true; break; hasObs = true;
break;
case RifDataSourceForRftPlt::RFT:
hasRft = true;
break;
case RifDataSourceForRftPlt::GRID:
hasGrid = true;
break;
} }
} }