mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2100 PLT plot. Refactoring. Use RimWellPlotTools methods
This commit is contained in:
parent
89e5c04aef
commit
d3d5a89979
@ -66,12 +66,12 @@ bool RicNewPltPlotFeature::isCommandEnabled()
|
||||
RimEclipseResultCase* eclCase = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseResultCase*>();
|
||||
if (simWell != nullptr)
|
||||
{
|
||||
enable &= RimWellPltPlot::hasFlowData(eclCase);
|
||||
enable &= RimWellPlotTools::hasFlowData(eclCase);
|
||||
}
|
||||
}
|
||||
else if (rimWellPath)
|
||||
{
|
||||
enable &= RimWellPltPlot::hasFlowData(rimWellPath);
|
||||
enable &= RimWellPlotTools::hasFlowData(rimWellPath);
|
||||
}
|
||||
return enable;
|
||||
}
|
||||
|
@ -19,11 +19,13 @@
|
||||
#include "RimWellPlotTools.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
#include "RifReaderEclipseRft.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigSimWellData.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
@ -38,11 +40,35 @@
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class StaticFieldsInitializer
|
||||
{
|
||||
public:
|
||||
StaticFieldsInitializer()
|
||||
{
|
||||
// Init static list
|
||||
RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::OIL_CHANNEL_NAMES.begin(), RimWellPlotTools::OIL_CHANNEL_NAMES.end());
|
||||
RimWellPlotTools::FLOW_DATA_NAMES.insert(RimWellPlotTools::GAS_CHANNEL_NAMES.begin(), 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());
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::set<QString> RimWellPlotTools::PRESSURE_DATA_NAMES = { "PRESSURE", "PRES_FORM" };
|
||||
|
||||
const std::set<QString> RimWellPlotTools::OIL_CHANNEL_NAMES = { "QOZT", "QOIL" };
|
||||
const std::set<QString> RimWellPlotTools::GAS_CHANNEL_NAMES = { "QGZT", "QGAS" };
|
||||
const std::set<QString> RimWellPlotTools::WATER_CHANNEL_NAMES = { "QWZT", "QWAT" };
|
||||
const std::set<QString> RimWellPlotTools::TOTAL_CHANNEL_NAMES = { "QTZT", "QTOT" };
|
||||
|
||||
std::set<QString> RimWellPlotTools::FLOW_DATA_NAMES = {};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -109,6 +135,93 @@ bool RimWellPlotTools::hasPressureData(RimEclipseResultCase* gridCase)
|
||||
{
|
||||
return pressureResultDataInfo(gridCase->eclipseCaseData()).first != cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::hasFlowData(const RimWellLogFile* wellLogFile)
|
||||
{
|
||||
for (RimWellLogFileChannel* const wellLogChannel : wellLogFile->wellLogChannels())
|
||||
{
|
||||
if (isFlowChannel(wellLogChannel)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::hasFlowData(RimWellPath* wellPath)
|
||||
{
|
||||
for (RimWellLogFile* const wellLogFile : wellPath->wellLogFiles())
|
||||
{
|
||||
if (hasFlowData(wellLogFile))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::isFlowChannel(RimWellLogFileChannel* channel)
|
||||
{
|
||||
return FLOW_DATA_NAMES.count(channel->name()) > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::isOilFlowChannel(const QString& channelName)
|
||||
{
|
||||
return OIL_CHANNEL_NAMES.count(channelName) > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::isGasFlowChannel(const QString& channelName)
|
||||
{
|
||||
return GAS_CHANNEL_NAMES.count(channelName) > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::isWaterFlowChannel(const QString& channelName)
|
||||
{
|
||||
return WATER_CHANNEL_NAMES.count(channelName) > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::hasFlowData(RimEclipseResultCase* gridCase)
|
||||
{
|
||||
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData();
|
||||
|
||||
for (const QString& channelName : FLOW_DATA_NAMES)
|
||||
{
|
||||
size_t resultIndex = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->
|
||||
findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, channelName);
|
||||
|
||||
if (resultIndex != cvf::UNDEFINED_SIZE_T) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
FlowPhase RimWellPlotTools::flowPhaseFromChannelName(const QString& channelName)
|
||||
{
|
||||
if (tryMatchChannelName(OIL_CHANNEL_NAMES, channelName)) return FLOW_PHASE_OIL;
|
||||
if (tryMatchChannelName(GAS_CHANNEL_NAMES, channelName)) return FLOW_PHASE_GAS;
|
||||
if (tryMatchChannelName(WATER_CHANNEL_NAMES, channelName)) return FLOW_PHASE_WATER;
|
||||
if (tryMatchChannelName(TOTAL_CHANNEL_NAMES, channelName)) return FLOW_PHASE_TOTAL;
|
||||
return FLOW_PHASE_NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -143,7 +256,7 @@ void RimWellPlotTools::addTimeStepsToMap(std::map<QDateTime, std::set<RifWellRft
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure(const QString& wellName)
|
||||
std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure(const QString& wellPathName)
|
||||
{
|
||||
std::vector<RimWellLogFile*> wellLogFiles;
|
||||
const RimProject* const project = RiaApplication::instance()->project();
|
||||
@ -159,10 +272,10 @@ std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure(co
|
||||
|
||||
for (RimWellLogFile* const file : files)
|
||||
{
|
||||
size_t timeStepCount = timeStepsMapFromWellLogFile(file).size();
|
||||
size_t timeStepCount = timeStepsMapFromWellLogFile(file).size(); // todo: only one timestep
|
||||
|
||||
if (timeStepCount == 0) continue;
|
||||
if (QString::compare(file->wellName(), wellName) != 0) continue;
|
||||
if (RiaWellNameComparer::tryFindMatchingWellPath(wellPathName).isEmpty()) continue;
|
||||
|
||||
if (hasPressureData(file))
|
||||
{
|
||||
@ -192,6 +305,54 @@ RimWellLogFileChannel* RimWellPlotTools::getPressureChannelFromWellFile(const Ri
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingFlow(const QString& wellPathName)
|
||||
{
|
||||
std::vector<RimWellLogFile*> wellLogFiles;
|
||||
const RimProject* const project = RiaApplication::instance()->project();
|
||||
|
||||
for (const auto& wellPath : project->allWellPaths())
|
||||
{
|
||||
bool hasPressure = false;
|
||||
const std::vector<RimWellLogFile*> files = wellPath->wellLogFiles();
|
||||
|
||||
for (RimWellLogFile* const file : files)
|
||||
{
|
||||
size_t timeStepCount = timeStepsMapFromWellLogFile(file).size(); // todo: only one timestep
|
||||
|
||||
if (timeStepCount == 0) continue;
|
||||
if (RiaWellNameComparer::tryFindMatchingWellPath(wellPathName).isEmpty()) continue;
|
||||
|
||||
if (hasFlowData(file))
|
||||
{
|
||||
wellLogFiles.push_back(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
return wellLogFiles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFileChannel*> RimWellPlotTools::getFlowChannelsFromWellFile(const RimWellLogFile* wellLogFile)
|
||||
{
|
||||
std::vector<RimWellLogFileChannel*> channels;
|
||||
if (wellLogFile != nullptr)
|
||||
{
|
||||
for (RimWellLogFileChannel* const channel : wellLogFile->wellLogChannels())
|
||||
{
|
||||
if (isFlowChannel(channel))
|
||||
{
|
||||
channels.push_back(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -220,7 +381,7 @@ RimWellPath* RimWellPlotTools::wellPathFromWellLogFile(const RimWellLogFile* wel
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseResultCase*> RimWellPlotTools::gridCasesForWell(const QString& wellName)
|
||||
std::vector<RimEclipseResultCase*> RimWellPlotTools::gridCasesForWell(const QString& simWellName)
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
const RimProject* const project = RiaApplication::instance()->project();
|
||||
@ -230,7 +391,15 @@ std::vector<RimEclipseResultCase*> RimWellPlotTools::gridCasesForWell(const QStr
|
||||
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclCase);
|
||||
if (resultCase != nullptr)
|
||||
{
|
||||
cases.push_back(resultCase);
|
||||
RigEclipseCaseData* const eclipseCaseData = eclCase->eclipseCaseData();
|
||||
for (const cvf::ref<RigSimWellData>& wellResult : eclipseCaseData->wellResults())
|
||||
{
|
||||
if (wellResult->m_wellName == simWellName)
|
||||
{
|
||||
cases.push_back(resultCase);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cases;
|
||||
@ -239,7 +408,7 @@ std::vector<RimEclipseResultCase*> RimWellPlotTools::gridCasesForWell(const QStr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseResultCase*> RimWellPlotTools::rftCasesForWell(const QString& wellName)
|
||||
std::vector<RimEclipseResultCase*> RimWellPlotTools::rftCasesForWell(const QString& simWellName)
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
const RimProject* const project = RiaApplication::instance()->project();
|
||||
@ -249,7 +418,15 @@ std::vector<RimEclipseResultCase*> RimWellPlotTools::rftCasesForWell(const QStri
|
||||
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclCase);
|
||||
if (resultCase != nullptr && resultCase->rftReader() != nullptr)
|
||||
{
|
||||
cases.push_back(resultCase);
|
||||
RigEclipseCaseData* const eclipseCaseData = eclCase->eclipseCaseData();
|
||||
for (const cvf::ref<RigSimWellData>& wellResult : eclipseCaseData->wellResults())
|
||||
{
|
||||
if (wellResult->m_wellName == simWellName)
|
||||
{
|
||||
cases.push_back(resultCase);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cases;
|
||||
@ -258,13 +435,14 @@ std::vector<RimEclipseResultCase*> RimWellPlotTools::rftCasesForWell(const QStri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QDateTime> RimWellPlotTools::timeStepsFromRftCase(RimEclipseResultCase* rftCase, const QString& wellName)
|
||||
std::set<QDateTime> RimWellPlotTools::timeStepsFromRftCase(RimEclipseResultCase* rftCase,
|
||||
const QString& simWellName)
|
||||
{
|
||||
std::set<QDateTime> timeSteps;
|
||||
RifReaderEclipseRft* const reader = rftCase->rftReader();
|
||||
if (reader != nullptr)
|
||||
{
|
||||
for (const QDateTime& timeStep : reader->availableTimeSteps(wellName, RifEclipseRftAddress::PRESSURE))
|
||||
for (const QDateTime& timeStep : reader->availableTimeSteps(simWellName, RifEclipseRftAddress::PRESSURE))
|
||||
{
|
||||
timeSteps.insert(timeStep);
|
||||
}
|
||||
@ -303,13 +481,13 @@ QDateTime RimWellPlotTools::timeStepFromWellLogFile(RimWellLogFile* wellLogFile)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> RimWellPlotTools::timeStepsMapFromRftCase(RimEclipseResultCase* rftCase, const QString& wellName)
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> RimWellPlotTools::timeStepsMapFromRftCase(RimEclipseResultCase* rftCase, const QString& simWellName)
|
||||
{
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMap;
|
||||
RifReaderEclipseRft* const reader = rftCase->rftReader();
|
||||
if (reader != nullptr)
|
||||
{
|
||||
for (const QDateTime& timeStep : reader->availableTimeSteps(wellName, RifEclipseRftAddress::PRESSURE))
|
||||
for (const QDateTime& timeStep : reader->availableTimeSteps(simWellName, RifEclipseRftAddress::PRESSURE))
|
||||
{
|
||||
if (timeStepsMap.count(timeStep) == 0)
|
||||
{
|
||||
@ -456,3 +634,35 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve(const RimWellLogCur
|
||||
}
|
||||
return RiaRftPltCurveDefinition(RifWellRftAddress(), QDateTime());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RimWellPlotTools::wellPathByWellPathNameOrSimWellName(const QString& wellPathNameOrSimwellName)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimWellPath* wellPath = proj->wellPathByName(wellPathNameOrSimwellName);
|
||||
|
||||
return wellPath != nullptr ? wellPath : proj->wellPathFromSimulationWell(wellPathNameOrSimwellName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPlotTools::simWellName(const QString& wellPathNameOrSimWellName)
|
||||
{
|
||||
RimWellPath* wellPath = wellPathByWellPathNameOrSimWellName(wellPathNameOrSimWellName);
|
||||
return wellPath != nullptr ? wellPath->associatedSimulationWell() : wellPathNameOrSimWellName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::tryMatchChannelName(const std::set<QString>& channelNames, const QString& channelNameToMatch)
|
||||
{
|
||||
auto itr = std::find_if(channelNames.begin(), channelNames.end(), [&](const QString& channelName)
|
||||
{
|
||||
return channelName.contains(channelNameToMatch, Qt::CaseInsensitive);
|
||||
});
|
||||
return itr != channelNames.end();
|
||||
}
|
||||
|
@ -39,12 +39,24 @@ class RigEclipseCaseData;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
enum FlowType { FLOW_TYPE_TOTAL, FLOW_TYPE_PHASE_SPLIT };
|
||||
enum FlowPhase { FLOW_PHASE_NONE, FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER, FLOW_PHASE_TOTAL };
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellPlotTools
|
||||
{
|
||||
static const std::set<QString> PRESSURE_DATA_NAMES;
|
||||
|
||||
static const std::set<QString> OIL_CHANNEL_NAMES;
|
||||
static const std::set<QString> GAS_CHANNEL_NAMES;
|
||||
static const std::set<QString> WATER_CHANNEL_NAMES;
|
||||
static const std::set<QString> TOTAL_CHANNEL_NAMES;
|
||||
|
||||
static std::set<QString> FLOW_DATA_NAMES;
|
||||
|
||||
public:
|
||||
static bool hasPressureData(const RimWellLogFile* wellLogFile);
|
||||
static bool isPressureChannel(RimWellLogFileChannel* channel);
|
||||
@ -52,24 +64,36 @@ public:
|
||||
static bool hasPressureData(RimWellPath* wellPath);
|
||||
static std::pair<size_t, QString> pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData);
|
||||
|
||||
static bool hasFlowData(const RimWellLogFile* wellLogFile);
|
||||
static bool isFlowChannel(RimWellLogFileChannel* channel);
|
||||
static bool isOilFlowChannel(const QString& channelName);
|
||||
static bool isGasFlowChannel(const QString& channelName);
|
||||
static bool isWaterFlowChannel(const QString& channelName);
|
||||
static bool hasFlowData(RimEclipseResultCase* gridCase);
|
||||
static bool hasFlowData(RimWellPath* wellPath);
|
||||
static FlowPhase flowPhaseFromChannelName(const QString& channelName);
|
||||
|
||||
static void addTimeStepToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
||||
const std::pair<QDateTime, std::set<RifWellRftAddress>>& timeStepToAdd);
|
||||
static void addTimeStepsToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeStepsToAdd);
|
||||
|
||||
static std::vector<RimWellLogFile*> wellLogFilesContainingPressure(const QString& wellName);
|
||||
static std::vector<RimWellLogFile*> wellLogFilesContainingPressure(const QString& simWellName);
|
||||
static RimWellLogFileChannel* getPressureChannelFromWellFile(const RimWellLogFile* wellLogFile);
|
||||
|
||||
static std::vector<RimWellLogFile*> wellLogFilesContainingFlow(const QString& wellName);
|
||||
static std::vector<RimWellLogFileChannel*> getFlowChannelsFromWellFile(const RimWellLogFile* wellLogFile);
|
||||
|
||||
static RimWellPath* wellPathFromWellLogFile(const RimWellLogFile* wellLogFile);
|
||||
|
||||
static std::vector<RimEclipseResultCase*> gridCasesForWell(const QString& wellName);
|
||||
static std::vector<RimEclipseResultCase*> rftCasesForWell(const QString& wellName);
|
||||
static std::vector<RimEclipseResultCase*> gridCasesForWell(const QString& simWellName);
|
||||
static std::vector<RimEclipseResultCase*> rftCasesForWell(const QString& simWellName);
|
||||
|
||||
static std::set<QDateTime> timeStepsFromRftCase(RimEclipseResultCase* rftCase, const QString& wellName);
|
||||
static std::set<QDateTime> timeStepsFromRftCase(RimEclipseResultCase* rftCase, const QString& simWellName);
|
||||
static std::set<QDateTime> timeStepsFromGridCase(RimEclipseCase* gridCase);
|
||||
static QDateTime timeStepFromWellLogFile(RimWellLogFile* wellLogFile);
|
||||
|
||||
static std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMapFromRftCase(RimEclipseResultCase* rftCase, const QString& wellName);
|
||||
static std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMapFromRftCase(RimEclipseResultCase* rftCase, const QString& simWellName);
|
||||
static std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMapFromGridCase(RimEclipseCase* gridCase);
|
||||
static std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMapFromWellLogFile(RimWellLogFile* wellLogFile);
|
||||
static std::map<QDateTime, std::set<RifWellRftAddress>> adjacentTimeSteps(const std::vector<std::pair<QDateTime, std::set<RifWellRftAddress>>>& allTimeSteps,
|
||||
@ -78,8 +102,17 @@ public:
|
||||
|
||||
static RiaRftPltCurveDefinition curveDefFromCurve(const RimWellLogCurve* curve);
|
||||
|
||||
static RimWellPath* wellPathByWellPathNameOrSimWellName(const QString& wellPathNameOrSimwellName);
|
||||
static QString simWellName(const QString& wellPathNameOrSimWellName);
|
||||
static bool tryMatchChannelName(const std::set<QString>& channelNames, const QString& channelNameToMatch);
|
||||
|
||||
template<typename T>
|
||||
static void appendSet(std::set<T>& destSet, const std::set<T>& setToAppend);
|
||||
|
||||
private:
|
||||
friend class StaticFieldsInitializer;
|
||||
|
||||
static StaticFieldsInitializer ms_staticFieldInitializer;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
#include "RimWellFlowRateCurve.h"
|
||||
#include "RiuWellPltPlot.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
@ -59,70 +60,29 @@
|
||||
#include "RimSummaryCurveAppearanceCalculator.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Move to tools class
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* wellPathByWellPathNameOrSimWellName(const QString& wellPathNameOrSimwellName)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimWellPath* wellPath = proj->wellPathByName(wellPathNameOrSimwellName);
|
||||
|
||||
return wellPath != nullptr ? wellPath : proj->wellPathFromSimulationWell(wellPathNameOrSimwellName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Move to tools class
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString simWellName(const QString& wellPathNameOrSimWellName)
|
||||
{
|
||||
RimWellPath* wellPath = wellPathByWellPathNameOrSimWellName(wellPathNameOrSimWellName);
|
||||
return wellPath != nullptr ? wellPath->associatedSimulationWell() : wellPathNameOrSimWellName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Move to tools class
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool tryMatchChannelName(const std::set<QString>& channelNames, const QString& channelNameToMatch)
|
||||
{
|
||||
auto itr = std::find_if(channelNames.begin(), channelNames.end(), [&](const QString& channelName)
|
||||
{
|
||||
return channelName.contains(channelNameToMatch, Qt::CaseInsensitive);
|
||||
});
|
||||
return itr != channelNames.end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellPltPlot, "WellPltPlot");
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum< RimWellPltPlot::FlowType>::setUp()
|
||||
void caf::AppEnum< FlowType>::setUp()
|
||||
{
|
||||
addItem(RimWellPltPlot::FLOW_TYPE_TOTAL, "TOTAL", "Total Flow");
|
||||
addItem(RimWellPltPlot::FLOW_TYPE_PHASE_SPLIT, "PHASE_SPLIT", "Phase Split");
|
||||
addItem(FLOW_TYPE_TOTAL, "TOTAL", "Total Flow");
|
||||
addItem(FLOW_TYPE_PHASE_SPLIT, "PHASE_SPLIT", "Phase Split");
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RimWellPltPlot::FlowPhase>::setUp()
|
||||
void caf::AppEnum< FlowPhase>::setUp()
|
||||
{
|
||||
addItem(RimWellPltPlot::PHASE_OIL, "PHASE_OIL", "Oil");
|
||||
addItem(RimWellPltPlot::PHASE_GAS, "PHASE_GAS", "Gas");
|
||||
addItem(RimWellPltPlot::PHASE_WATER, "PHASE_WATER", "Water");
|
||||
addItem(FLOW_PHASE_OIL, "PHASE_OIL", "Oil");
|
||||
addItem(FLOW_PHASE_GAS, "PHASE_GAS", "Gas");
|
||||
addItem(FLOW_PHASE_WATER, "PHASE_WATER", "Water");
|
||||
}
|
||||
}
|
||||
|
||||
const std::set<QString> RimWellPltPlot::OIL_CHANNEL_NAMES = { "QOZT", "QOIL" };
|
||||
const std::set<QString> RimWellPltPlot::GAS_CHANNEL_NAMES = { "QGZT", "QGAS" };
|
||||
const std::set<QString> RimWellPltPlot::WATER_CHANNEL_NAMES = { "QWZT", "QWAT" };
|
||||
const std::set<QString> RimWellPltPlot::TOTAL_CHANNEL_NAMES = { "QTZT", "QTOT" };
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QString> RimWellPltPlot::FLOW_DATA_NAMES = { };
|
||||
const char RimWellPltPlot::PLOT_NAME_QFORMAT_STRING[] = "PLT: %1";
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -130,12 +90,6 @@ const char RimWellPltPlot::PLOT_NAME_QFORMAT_STRING[] = "PLT: %1";
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPltPlot::RimWellPltPlot()
|
||||
{
|
||||
// Init static list
|
||||
FLOW_DATA_NAMES.insert(OIL_CHANNEL_NAMES.begin(), OIL_CHANNEL_NAMES.end());
|
||||
FLOW_DATA_NAMES.insert(GAS_CHANNEL_NAMES.begin(), GAS_CHANNEL_NAMES.end());
|
||||
FLOW_DATA_NAMES.insert(WATER_CHANNEL_NAMES.begin(), WATER_CHANNEL_NAMES.end());
|
||||
FLOW_DATA_NAMES.insert(TOTAL_CHANNEL_NAMES.begin(), TOTAL_CHANNEL_NAMES.end());
|
||||
|
||||
CAF_PDM_InitObject("Well Allocation Plot", ":/WellAllocPlot16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("PLT Plot"), "Name", "", "", "");
|
||||
@ -171,7 +125,7 @@ RimWellPltPlot::RimWellPltPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_phases, "Phases", "Phases", "", "", "");
|
||||
m_phases.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
||||
m_phases = std::vector<caf::AppEnum<FlowPhase>>({ FlowPhase::PHASE_OIL, FlowPhase::PHASE_GAS, FlowPhase::PHASE_WATER });
|
||||
m_phases = std::vector<caf::AppEnum<FlowPhase>>({ FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER });
|
||||
|
||||
this->setAsPlotMdiWindow();
|
||||
m_doInitAfterLoad = false;
|
||||
@ -328,18 +282,6 @@ void RimWellPltPlot::updateSelectedTimeStepsFromSelectedSources()
|
||||
m_selectedTimeSteps = newTimeStepsSelections;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPltPlot::FlowPhase RimWellPltPlot::flowPhaseFromChannelName(const QString& channelName)
|
||||
{
|
||||
if (tryMatchChannelName(OIL_CHANNEL_NAMES, channelName)) return PHASE_OIL;
|
||||
if (tryMatchChannelName(GAS_CHANNEL_NAMES, channelName)) return PHASE_GAS;
|
||||
if (tryMatchChannelName(WATER_CHANNEL_NAMES, channelName)) return PHASE_WATER;
|
||||
if (tryMatchChannelName(TOTAL_CHANNEL_NAMES, channelName)) return PHASE_TOTAL;
|
||||
return PHASE_NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -429,7 +371,7 @@ void RimWellPltPlot::updateFormationsOnPlot() const
|
||||
|
||||
if (m_wellLogPlot->trackCount() > 0)
|
||||
{
|
||||
m_wellLogPlot->trackByIndex(0)->updateFormationNamesData(rimCase, trajectoryType, wellPath, simWellName(m_wellPathName), m_branchIndex);
|
||||
m_wellLogPlot->trackByIndex(0)->updateFormationNamesData(rimCase, trajectoryType, wellPath, RimWellPlotTools::simWellName(m_wellPathName), m_branchIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,261 +448,15 @@ void RimWellPltPlot::updateWidgetTitleWindowTitle()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFile*> RimWellPltPlot::wellLogFilesContainingFlow(const QString& wellPathName) const
|
||||
{
|
||||
std::vector<RimWellLogFile*> wellLogFiles;
|
||||
const RimProject* const project = RiaApplication::instance()->project();
|
||||
|
||||
for (const auto& wellPath : project->allWellPaths())
|
||||
{
|
||||
bool hasPressure = false;
|
||||
const std::vector<RimWellLogFile*> files = wellPath->wellLogFiles();
|
||||
|
||||
for (RimWellLogFile* const file : files)
|
||||
{
|
||||
size_t timeStepCount = timeStepsFromWellLogFile(file).size();
|
||||
|
||||
if (timeStepCount == 0) continue;
|
||||
if(RiaWellNameComparer::tryFindMatchingWellPath(wellPathName).isEmpty()) continue;
|
||||
|
||||
if (hasFlowData(file))
|
||||
{
|
||||
wellLogFiles.push_back(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
return wellLogFiles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFileChannel*> RimWellPltPlot::getFlowChannelsFromWellFile(const RimWellLogFile* wellLogFile) const
|
||||
{
|
||||
std::vector<RimWellLogFileChannel*> channels;
|
||||
if(wellLogFile != nullptr)
|
||||
{
|
||||
for (RimWellLogFileChannel* const channel : wellLogFile->wellLogChannels())
|
||||
{
|
||||
if (isFlowChannel(channel))
|
||||
{
|
||||
channels.push_back(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RimWellPltPlot::wellPathFromWellLogFile(const RimWellLogFile* wellLogFile) const
|
||||
{
|
||||
RimProject* const project = RiaApplication::instance()->project();
|
||||
for (const auto& oilField : project->oilFields)
|
||||
{
|
||||
auto wellPaths = std::vector<RimWellPath*>(oilField->wellPathCollection()->wellPaths.begin(), oilField->wellPathCollection()->wellPaths.end());
|
||||
|
||||
for (const auto& wellPath : wellPaths)
|
||||
{
|
||||
for (RimWellLogFile* const file : wellPath->wellLogFiles())
|
||||
{
|
||||
if (file == wellLogFile)
|
||||
{
|
||||
return wellPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::tuple<RimEclipseResultCase*, bool/*hasPressure*/, bool /*hasRftData*/>>
|
||||
RimWellPltPlot::eclipseCasesForWell(const QString& wellName) const
|
||||
{
|
||||
std::vector<std::tuple<RimEclipseResultCase*, bool, bool>> cases;
|
||||
const RimProject* const project = RiaApplication::instance()->project();
|
||||
|
||||
for (const auto& oilField : project->oilFields)
|
||||
{
|
||||
const RimEclipseCaseCollection* const eclCaseColl = oilField->analysisModels();
|
||||
for (RimEclipseCase* eCase : eclCaseColl->cases())
|
||||
{
|
||||
auto eclCase = dynamic_cast<RimEclipseResultCase*>(eCase);
|
||||
if (eclCase != nullptr)
|
||||
{
|
||||
RigEclipseCaseData* const eclipseCaseData = eclCase->eclipseCaseData();
|
||||
for (const cvf::ref<RigSimWellData>& wellResult : eclipseCaseData->wellResults())
|
||||
{
|
||||
if (QString::compare(wellResult->m_wellName, wellName) == 0)
|
||||
{
|
||||
bool hasRftData = eclCase->rftReader() != nullptr;
|
||||
cases.push_back(std::make_tuple(eclCase, true, hasRftData));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseResultCase*>
|
||||
RimWellPltPlot::gridCasesFromEclipseCases(const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCasesTuple) const
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
for (const std::tuple<RimEclipseResultCase*, bool, bool>& eclCaseTuple : eclipseCasesTuple)
|
||||
{
|
||||
bool hasPressureData = std::get<1>(eclCaseTuple);
|
||||
size_t timeStepCount = timeStepsFromGridCase(std::get<0>(eclCaseTuple)).size();
|
||||
if (hasPressureData && timeStepCount > 0)
|
||||
{
|
||||
cases.push_back(std::get<0>(eclCaseTuple));
|
||||
}
|
||||
}
|
||||
return cases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseResultCase*>
|
||||
RimWellPltPlot::rftCasesFromEclipseCases(const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCasesTuple) const
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
for (const std::tuple<RimEclipseResultCase*, bool, bool>& eclCaseTuple : eclipseCasesTuple)
|
||||
{
|
||||
bool hasRftData = std::get<2>(eclCaseTuple);
|
||||
size_t timeStepCount = timeStepsFromRftCase(std::get<0>(eclCaseTuple)).size();
|
||||
if (hasRftData && timeStepCount > 0)
|
||||
{
|
||||
cases.push_back(std::get<0>(eclCaseTuple));
|
||||
}
|
||||
}
|
||||
return cases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> RimWellPltPlot::timeStepsFromRftCase(RimEclipseResultCase* rftCase) const
|
||||
{
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMap;
|
||||
RifReaderEclipseRft* const reader = rftCase->rftReader();
|
||||
if (reader != nullptr)
|
||||
{
|
||||
for (const QDateTime& timeStep : reader->availableTimeSteps(simWellName(m_wellPathName), RifEclipseRftAddress::PRESSURE))
|
||||
{
|
||||
if (timeStepsMap.count(timeStep) == 0)
|
||||
{
|
||||
timeStepsMap.insert(std::make_pair(timeStep, std::set<RifWellRftAddress>()));
|
||||
}
|
||||
timeStepsMap[timeStep].insert(RifWellRftAddress(RifWellRftAddress::RFT, rftCase));
|
||||
}
|
||||
}
|
||||
return timeStepsMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> RimWellPltPlot::timeStepsFromGridCase(RimEclipseCase* gridCase) const
|
||||
{
|
||||
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData();
|
||||
|
||||
std::map<QDateTime, std::set<RifWellRftAddress> > timeStepsMap;
|
||||
{
|
||||
for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates())
|
||||
{
|
||||
if (timeStepsMap.count(timeStep) == 0)
|
||||
{
|
||||
timeStepsMap.insert(std::make_pair(timeStep, std::set<RifWellRftAddress>()));
|
||||
}
|
||||
timeStepsMap[timeStep].insert(RifWellRftAddress(RifWellRftAddress::GRID, gridCase));
|
||||
}
|
||||
}
|
||||
return timeStepsMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QDateTime, std::set<RifWellRftAddress> > RimWellPltPlot::timeStepsFromWellLogFile(RimWellLogFile* wellLogFile) const
|
||||
{
|
||||
std::map<QDateTime, std::set<RifWellRftAddress> > timeStepsMap;
|
||||
|
||||
QDateTime timeStep = wellLogFile->date();
|
||||
|
||||
if (timeStepsMap.count(timeStep) == 0)
|
||||
{
|
||||
timeStepsMap.insert(std::make_pair(timeStep, std::set<RifWellRftAddress>()));
|
||||
}
|
||||
timeStepsMap[timeStep].insert(RifWellRftAddress(RifWellRftAddress::OBSERVED, wellLogFile));
|
||||
|
||||
return timeStepsMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>>
|
||||
RimWellPltPlot::adjacentTimeSteps(const std::vector<std::pair<QDateTime, std::set<RifWellRftAddress>>>& allTimeSteps,
|
||||
const std::pair<QDateTime, std::set<RifWellRftAddress>>& searchTimeStepPair)
|
||||
{
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMap;
|
||||
|
||||
if (allTimeSteps.size() > 0)
|
||||
{
|
||||
auto itr = std::find_if(allTimeSteps.begin(), allTimeSteps.end(),
|
||||
[searchTimeStepPair](const std::pair<QDateTime, std::set<RifWellRftAddress>>& dt)
|
||||
{
|
||||
return dt.first > searchTimeStepPair.first;
|
||||
});
|
||||
|
||||
auto itrEnd = itr != allTimeSteps.end() ? itr + 1 : itr;
|
||||
|
||||
for (itr = itrEnd - 1; itr != allTimeSteps.begin() && (*itr).first >= searchTimeStepPair.first; itr--);
|
||||
auto itrFirst = itr;
|
||||
|
||||
timeStepsMap.insert(itrFirst, itrEnd);
|
||||
}
|
||||
|
||||
// Add searched time step in case it is not included
|
||||
addTimeStepToMap(timeStepsMap, searchTimeStepPair);
|
||||
|
||||
return timeStepsMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPltPlot::mapContainsTimeStep(const std::map<QDateTime, std::set<RifWellRftAddress>>& map, const QDateTime& timeStep)
|
||||
{
|
||||
return std::find_if(map.begin(), map.end(), [timeStep](const std::pair<QDateTime, std::set<RifWellRftAddress>>& pair)
|
||||
{
|
||||
return pair.first == timeStep;
|
||||
}) != map.end();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set < std::pair<RifWellRftAddress, QDateTime>> RimWellPltPlot::selectedCurveDefs() const
|
||||
{
|
||||
std::set<std::pair<RifWellRftAddress, QDateTime>> curveDefs;
|
||||
const std::vector<std::tuple<RimEclipseResultCase*,bool,bool>>& eclipseCases = eclipseCasesForWell(simWellName(m_wellPathName));
|
||||
const std::vector<RimEclipseResultCase*> rftCases = rftCasesFromEclipseCases(eclipseCases);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = gridCasesFromEclipseCases(eclipseCases);
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(RimWellPlotTools::simWellName(m_wellPathName));
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(RimWellPlotTools::simWellName(m_wellPathName));
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathName);
|
||||
|
||||
for (const QDateTime& timeStep : m_selectedTimeSteps())
|
||||
{
|
||||
@ -770,8 +466,8 @@ std::set < std::pair<RifWellRftAddress, QDateTime>> RimWellPltPlot::selectedCurv
|
||||
{
|
||||
for (RimEclipseResultCase* const rftCase : rftCases)
|
||||
{
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeStepsMap = timeStepsFromRftCase(rftCase);
|
||||
if (mapContainsTimeStep(timeStepsMap , timeStep))
|
||||
const std::set<QDateTime>& timeSteps = RimWellPlotTools::timeStepsFromRftCase(rftCase, simWellName);
|
||||
if (timeSteps.count(timeStep) > 0)
|
||||
{
|
||||
curveDefs.insert(std::make_pair(addr, timeStep));
|
||||
}
|
||||
@ -781,8 +477,8 @@ std::set < std::pair<RifWellRftAddress, QDateTime>> RimWellPltPlot::selectedCurv
|
||||
{
|
||||
for (RimEclipseResultCase* const gridCase : gridCases)
|
||||
{
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeStepsMap = timeStepsFromGridCase(gridCase);
|
||||
if (mapContainsTimeStep(timeStepsMap, timeStep))
|
||||
const std::set<QDateTime>& timeSteps = RimWellPlotTools::timeStepsFromGridCase(gridCase);
|
||||
if (timeSteps.count(timeStep) > 0)
|
||||
{
|
||||
curveDefs.insert(std::make_pair(addr, timeStep));
|
||||
}
|
||||
@ -793,8 +489,8 @@ std::set < std::pair<RifWellRftAddress, QDateTime>> RimWellPltPlot::selectedCurv
|
||||
{
|
||||
if (addr.wellLogFile() != nullptr)
|
||||
{
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeStepsMap = timeStepsFromWellLogFile(addr.wellLogFile());
|
||||
if (mapContainsTimeStep(timeStepsMap, timeStep))
|
||||
const QDateTime& wellLogFileTimeStep = RimWellPlotTools::timeStepFromWellLogFile(addr.wellLogFile());
|
||||
if (wellLogFileTimeStep == timeStep)
|
||||
{
|
||||
curveDefs.insert(std::make_pair(RifWellRftAddress(RifWellRftAddress::OBSERVED, addr.wellLogFile()), timeStep));
|
||||
}
|
||||
@ -919,9 +615,9 @@ public:
|
||||
QDateTime m_timeStep)
|
||||
{
|
||||
|
||||
RifEclipseRftAddress gasRateAddress(simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::GRAT);
|
||||
RifEclipseRftAddress oilRateAddress(simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::ORAT);
|
||||
RifEclipseRftAddress watRateAddress(simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::WRAT);
|
||||
RifEclipseRftAddress gasRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::GRAT);
|
||||
RifEclipseRftAddress oilRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::ORAT);
|
||||
RifEclipseRftAddress watRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::WRAT);
|
||||
|
||||
std::vector<caf::VecIjk> rftIndices;
|
||||
eclCase->rftReader()->cellIndices(gasRateAddress, &rftIndices);
|
||||
@ -1014,7 +710,7 @@ public:
|
||||
|
||||
std::map<size_t, std::pair<size_t, size_t> > globCellIdxToIdxInSimWellBranch;
|
||||
|
||||
const RimWellPath* wellPath = wellPathByWellPathNameOrSimWellName(wellPathName);
|
||||
const RimWellPath* wellPath = RimWellPlotTools::wellPathByWellPathNameOrSimWellName(wellPathName);
|
||||
const RigSimWellData* simWell = wellPath != nullptr ? eclCase->eclipseCaseData()->findSimWellData(wellPath->associatedSimulationWell()) : nullptr;
|
||||
|
||||
if (!simWell) return;
|
||||
@ -1095,7 +791,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
int curveGroupId = 0;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimWellPath* wellPath = wellPathByWellPathNameOrSimWellName(m_wellPathName);
|
||||
RimWellPath* wellPath = RimWellPlotTools::wellPathByWellPathNameOrSimWellName(m_wellPathName);
|
||||
RimWellLogPlotCollection* wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection();
|
||||
|
||||
|
||||
@ -1104,7 +800,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
{
|
||||
std::set<FlowPhase> selectedPhases = m_phaseSelectionMode == FLOW_TYPE_PHASE_SPLIT ?
|
||||
std::set<FlowPhase>(m_phases().begin(), m_phases().end()) :
|
||||
std::set<FlowPhase>({ PHASE_TOTAL });
|
||||
std::set<FlowPhase>({ FLOW_PHASE_TOTAL });
|
||||
|
||||
RifWellRftAddress sourceDef = curveDefToAdd.first;
|
||||
QDateTime timeStep = curveDefToAdd.second;
|
||||
@ -1149,9 +845,9 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
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) )
|
||||
if ( tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count(FLOW_PHASE_OIL)
|
||||
|| tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count(FLOW_PHASE_GAS)
|
||||
|| tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(FLOW_PHASE_WATER) )
|
||||
{
|
||||
const std::vector<double> accFlow = wfAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0);
|
||||
addStackedCurve(curveName + ", " + tracerName,
|
||||
@ -1174,14 +870,14 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
|
||||
if (rigWellLogFile != nullptr)
|
||||
{
|
||||
for (RimWellLogFileChannel* channel : getFlowChannelsFromWellFile(wellLogFile))
|
||||
for (RimWellLogFileChannel* channel : RimWellPlotTools::getFlowChannelsFromWellFile(wellLogFile))
|
||||
{
|
||||
const auto& channelName = channel->name();
|
||||
if (selectedPhases.count(flowPhaseFromChannelName(channelName)) > 0)
|
||||
if (selectedPhases.count(RimWellPlotTools::flowPhaseFromChannelName(channelName)) > 0)
|
||||
{
|
||||
auto color = OIL_CHANNEL_NAMES.count(channelName) > 0 ? cvf::Color3f::DARK_GREEN :
|
||||
GAS_CHANNEL_NAMES.count(channelName) > 0 ? cvf::Color3f::DARK_RED :
|
||||
WATER_CHANNEL_NAMES.count(channelName) > 0 ? cvf::Color3f::BLUE :
|
||||
auto color = RimWellPlotTools::isOilFlowChannel(channelName) ? cvf::Color3f::DARK_GREEN :
|
||||
RimWellPlotTools::isGasFlowChannel(channelName) ? cvf::Color3f::DARK_RED :
|
||||
RimWellPlotTools::isWaterFlowChannel(channelName) ? cvf::Color3f::BLUE :
|
||||
cvf::Color3f::DARK_GRAY;
|
||||
|
||||
addStackedCurve(curveName + ", " + channelName,
|
||||
@ -1260,7 +956,7 @@ std::vector<RifWellRftAddress> RimWellPltPlot::selectedSources() const
|
||||
{
|
||||
if (addr.sourceType() == RifWellRftAddress::OBSERVED)
|
||||
{
|
||||
for (RimWellLogFile* const wellLogFile : wellLogFilesContainingFlow(m_wellPathName))
|
||||
for (RimWellLogFile* const wellLogFile : RimWellPlotTools::wellLogFilesContainingFlow(m_wellPathName))
|
||||
{
|
||||
sources.push_back(RifWellRftAddress(RifWellRftAddress::OBSERVED, wellLogFile));
|
||||
}
|
||||
@ -1343,58 +1039,6 @@ int RimWellPltPlot::branchIndex() const
|
||||
return m_branchIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPltPlot::hasFlowData(const RimWellLogFile* wellLogFile)
|
||||
{
|
||||
for (RimWellLogFileChannel* const wellLogChannel : wellLogFile->wellLogChannels())
|
||||
{
|
||||
if (isFlowChannel(wellLogChannel)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPltPlot::hasFlowData(RimWellPath* wellPath)
|
||||
{
|
||||
for (RimWellLogFile* const wellLogFile : wellPath->wellLogFiles())
|
||||
{
|
||||
if (hasFlowData(wellLogFile))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPltPlot::isFlowChannel(RimWellLogFileChannel* channel)
|
||||
{
|
||||
return FLOW_DATA_NAMES.count(channel->name()) > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPltPlot::hasFlowData(RimEclipseResultCase* gridCase)
|
||||
{
|
||||
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData();
|
||||
|
||||
for (const QString& channelName : FLOW_DATA_NAMES)
|
||||
{
|
||||
size_t resultIndex = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->
|
||||
findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, channelName);
|
||||
|
||||
if (resultIndex != cvf::UNDEFINED_SIZE_T) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1409,6 +1053,7 @@ const char* RimWellPltPlot::plotNameFormatString()
|
||||
QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathName);
|
||||
|
||||
if (fieldNeedingOptions == &m_wellPathName)
|
||||
{
|
||||
@ -1418,9 +1063,7 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
|
||||
{
|
||||
std::set<RifWellRftAddress> optionAddresses;
|
||||
|
||||
const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCases = eclipseCasesForWell(simWellName(m_wellPathName));
|
||||
|
||||
const std::vector<RimEclipseResultCase*> rftCases = rftCasesFromEclipseCases(eclipseCases);
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(simWellName);
|
||||
if (rftCases.size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifWellRftAddress::sourceTypeUiText(RifWellRftAddress::RFT), true));
|
||||
@ -1434,7 +1077,7 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
|
||||
options.push_back(item);
|
||||
}
|
||||
|
||||
const std::vector<RimEclipseResultCase*> gridCases = gridCasesFromEclipseCases(eclipseCases);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(simWellName);
|
||||
if (gridCases.size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifWellRftAddress::sourceTypeUiText(RifWellRftAddress::GRID), true));
|
||||
@ -1448,7 +1091,7 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
|
||||
options.push_back(item);
|
||||
}
|
||||
|
||||
if (wellLogFilesContainingFlow(m_wellPathName).size() > 0)
|
||||
if (RimWellPlotTools::wellLogFilesContainingFlow(m_wellPathName).size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifWellRftAddress::sourceTypeUiText(RifWellRftAddress::OBSERVED), true));
|
||||
|
||||
@ -1467,7 +1110,7 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
size_t branchCount = proj->simulationWellBranches(simWellName(m_wellPathName)).size();
|
||||
size_t branchCount = proj->simulationWellBranches(simWellName).size();
|
||||
|
||||
for (int bIdx = 0; bIdx < static_cast<int>(branchCount); ++bIdx)
|
||||
{
|
||||
@ -1485,9 +1128,9 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_phases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("Oil", PHASE_OIL));
|
||||
options.push_back(caf::PdmOptionItemInfo("Gas", PHASE_GAS));
|
||||
options.push_back(caf::PdmOptionItemInfo("Water", PHASE_WATER));
|
||||
options.push_back(caf::PdmOptionItemInfo("Oil", FLOW_PHASE_OIL));
|
||||
options.push_back(caf::PdmOptionItemInfo("Gas", FLOW_PHASE_GAS));
|
||||
options.push_back(caf::PdmOptionItemInfo("Water", FLOW_PHASE_WATER));
|
||||
}
|
||||
|
||||
return options;
|
||||
@ -1559,11 +1202,13 @@ QImage RimWellPltPlot::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathName);
|
||||
|
||||
uiOrdering.add(&m_userName);
|
||||
uiOrdering.add(&m_wellPathName);
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if (proj->simulationWellBranches(simWellName(m_wellPathName)).size() > 1)
|
||||
if (proj->simulationWellBranches(simWellName).size() > 1)
|
||||
{
|
||||
uiOrdering.add(&m_branchIndex);
|
||||
}
|
||||
@ -1667,37 +1312,6 @@ void RimWellPltPlot::syncSourcesIoFieldFromGuiField()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::addTimeStepToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
||||
const std::pair<QDateTime, std::set<RifWellRftAddress>>& timeStepToAdd)
|
||||
{
|
||||
auto timeStepMapToAdd = std::map<QDateTime, std::set<RifWellRftAddress>> { timeStepToAdd };
|
||||
addTimeStepsToMap(destMap, timeStepMapToAdd);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::addTimeStepsToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeStepsToAdd)
|
||||
{
|
||||
for (const auto& timeStepPair : timeStepsToAdd)
|
||||
{
|
||||
if (timeStepPair.first.isValid())
|
||||
{
|
||||
if (destMap.count(timeStepPair.first) == 0)
|
||||
{
|
||||
destMap.insert(std::make_pair(timeStepPair.first, std::set<RifWellRftAddress>()));
|
||||
}
|
||||
auto addresses = timeStepPair.second;
|
||||
destMap[timeStepPair.first].insert(addresses.begin(), addresses.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1754,10 +1368,10 @@ void RimWellPltPlot::calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::calculateValueOptionsForTimeSteps(const QString& wellPathNameOrSimWellName, QList<caf::PdmOptionItemInfo>& options)
|
||||
{
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathName);
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> displayTimeStepsMap, obsAndRftTimeStepsMap, gridTimeStepsMap;
|
||||
const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCases = eclipseCasesForWell(simWellName(wellPathNameOrSimWellName));
|
||||
const std::vector<RimEclipseResultCase*> rftCases = rftCasesFromEclipseCases(eclipseCases);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = gridCasesFromEclipseCases(eclipseCases);
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(simWellName);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(simWellName);
|
||||
|
||||
// First update timeSteps to Address 'cache'
|
||||
std::vector<RifWellRftAddress> selSources = selectedSources();
|
||||
@ -1769,22 +1383,21 @@ void RimWellPltPlot::calculateValueOptionsForTimeSteps(const QString& wellPathNa
|
||||
{
|
||||
for (RimEclipseResultCase* const rftCase : rftCases)
|
||||
{
|
||||
addTimeStepsToMap(obsAndRftTimeStepsMap, timeStepsFromRftCase(rftCase));
|
||||
RimWellPlotTools::addTimeStepsToMap(obsAndRftTimeStepsMap, RimWellPlotTools::timeStepsMapFromRftCase(rftCase, simWellName));
|
||||
}
|
||||
}
|
||||
else if (selection.sourceType() == RifWellRftAddress::GRID)
|
||||
{
|
||||
for (RimEclipseResultCase* const gridCase : gridCases)
|
||||
{
|
||||
addTimeStepsToMap(gridTimeStepsMap, timeStepsFromGridCase(gridCase));
|
||||
RimWellPlotTools::addTimeStepsToMap(gridTimeStepsMap, RimWellPlotTools::timeStepsMapFromGridCase(gridCase));
|
||||
}
|
||||
}
|
||||
else
|
||||
if (selection.sourceType() == RifWellRftAddress::OBSERVED)
|
||||
else if (selection.sourceType() == RifWellRftAddress::OBSERVED)
|
||||
{
|
||||
if (selection.wellLogFile() != nullptr)
|
||||
{
|
||||
addTimeStepsToMap(obsAndRftTimeStepsMap, timeStepsFromWellLogFile(selection.wellLogFile()));
|
||||
RimWellPlotTools::addTimeStepsToMap(obsAndRftTimeStepsMap, RimWellPlotTools::timeStepsMapFromWellLogFile(selection.wellLogFile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1799,14 +1412,14 @@ void RimWellPltPlot::calculateValueOptionsForTimeSteps(const QString& wellPathNa
|
||||
|
||||
for (const std::pair<QDateTime, std::set<RifWellRftAddress>>& timeStepPair : obsAndRftTimeStepsMap)
|
||||
{
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& adjTimeSteps = adjacentTimeSteps(gridTimeStepsVector, timeStepPair);
|
||||
addTimeStepsToMap(displayTimeStepsMap, adjTimeSteps);
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& adjTimeSteps = RimWellPlotTools::adjacentTimeSteps(gridTimeStepsVector, timeStepPair);
|
||||
RimWellPlotTools::addTimeStepsToMap(displayTimeStepsMap, adjTimeSteps);
|
||||
}
|
||||
|
||||
// Add the first grid time step (from the total grid time steps list)
|
||||
if (gridTimeStepsVector.size() > 0)
|
||||
{
|
||||
addTimeStepToMap(displayTimeStepsMap, gridTimeStepsVector.front());
|
||||
RimWellPlotTools::addTimeStepToMap(displayTimeStepsMap, gridTimeStepsVector.front());
|
||||
}
|
||||
|
||||
// Add already selected time steps
|
||||
@ -1817,13 +1430,13 @@ void RimWellPltPlot::calculateValueOptionsForTimeSteps(const QString& wellPathNa
|
||||
const std::set<RifWellRftAddress> sourceAddresses = m_timeStepsToAddresses[timeStep];
|
||||
if (isAnySourceAddressSelected(sourceAddresses))
|
||||
{
|
||||
addTimeStepToMap(displayTimeStepsMap, std::make_pair(timeStep, m_timeStepsToAddresses[timeStep]));
|
||||
RimWellPlotTools::addTimeStepToMap(displayTimeStepsMap, std::make_pair(timeStep, m_timeStepsToAddresses[timeStep]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addTimeStepsToMap(m_timeStepsToAddresses, displayTimeStepsMap);
|
||||
RimWellPlotTools::addTimeStepsToMap(m_timeStepsToAddresses, displayTimeStepsMap);
|
||||
|
||||
// Create vector of all time steps
|
||||
std::vector<QDateTime> allTimeSteps;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RimRftAddress.h"
|
||||
#include "RifWellRftAddressQMetaType.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@ -62,15 +63,6 @@ class RimWellPltPlot : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
enum FlowType { FLOW_TYPE_TOTAL, FLOW_TYPE_PHASE_SPLIT };
|
||||
enum FlowPhase { PHASE_NONE, PHASE_OIL, PHASE_GAS, PHASE_WATER, PHASE_TOTAL };
|
||||
|
||||
static const std::set<QString> OIL_CHANNEL_NAMES;
|
||||
static const std::set<QString> GAS_CHANNEL_NAMES;
|
||||
static const std::set<QString> WATER_CHANNEL_NAMES;
|
||||
static const std::set<QString> TOTAL_CHANNEL_NAMES;
|
||||
|
||||
static std::set<QString> FLOW_DATA_NAMES;
|
||||
static const char PLOT_NAME_QFORMAT_STRING[];
|
||||
|
||||
public:
|
||||
@ -89,10 +81,6 @@ public:
|
||||
QString currentWellName() const;
|
||||
int branchIndex() const;
|
||||
|
||||
static bool hasFlowData(const RimWellLogFile* wellLogFile);
|
||||
static bool isFlowChannel(RimWellLogFileChannel* channel);
|
||||
static bool hasFlowData(RimEclipseResultCase* gridCase);
|
||||
static bool hasFlowData(RimWellPath* wellPath);
|
||||
static const char* plotNameFormatString();
|
||||
|
||||
//void applyInitialSelections();
|
||||
@ -117,10 +105,6 @@ protected:
|
||||
void syncSourcesIoFieldFromGuiField();
|
||||
|
||||
private:
|
||||
static void addTimeStepToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
||||
const std::pair<QDateTime, std::set<RifWellRftAddress>>& timeStepToAdd);
|
||||
static void addTimeStepsToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeStepsToAdd);
|
||||
void updateTimeStepsToAddresses(const std::vector<RifWellRftAddress>& addressesToKeep);
|
||||
void calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options);
|
||||
void calculateValueOptionsForTimeSteps(const QString& wellPathNameOrSimWellName, QList<caf::PdmOptionItemInfo>& options);
|
||||
@ -129,21 +113,6 @@ private:
|
||||
|
||||
void syncCurvesFromUiSelection();
|
||||
|
||||
std::vector<RimWellLogFile*> wellLogFilesContainingFlow(const QString& wellName) const;
|
||||
std::vector<RimWellLogFileChannel*> getFlowChannelsFromWellFile(const RimWellLogFile* wellLogFile) const;
|
||||
|
||||
RimWellPath* wellPathFromWellLogFile(const RimWellLogFile* wellLogFile) const;
|
||||
|
||||
std::vector<std::tuple<RimEclipseResultCase*, bool, bool>> eclipseCasesForWell(const QString& wellName) const;
|
||||
std::vector<RimEclipseResultCase*> gridCasesFromEclipseCases(const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCasesTuple) const;
|
||||
std::vector<RimEclipseResultCase*> rftCasesFromEclipseCases(const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCasesTuple) const;
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsFromRftCase(RimEclipseResultCase* gridCase) const;
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsFromGridCase(RimEclipseCase* gridCase) const;
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsFromWellLogFile(RimWellLogFile* wellLogFile) const;
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> adjacentTimeSteps(const std::vector<std::pair<QDateTime, std::set<RifWellRftAddress>>>& allTimeSteps,
|
||||
const std::pair<QDateTime, std::set<RifWellRftAddress>>& searchTimeStepPair);
|
||||
static bool mapContainsTimeStep(const std::map<QDateTime, std::set<RifWellRftAddress>>& map, const QDateTime& timeStep);
|
||||
|
||||
std::set<std::pair<RifWellRftAddress, QDateTime>> selectedCurveDefs() const;
|
||||
std::set<std::pair<RifWellRftAddress, QDateTime>> curveDefsFromCurves() const;
|
||||
std::pair<RifWellRftAddress, QDateTime> curveDefFromCurve(const RimWellLogCurve* curve) const;
|
||||
@ -167,7 +136,6 @@ private:
|
||||
|
||||
//void applyCurveAppearance(RimWellLogCurve* newCurve);
|
||||
void updateSelectedTimeStepsFromSelectedSources();
|
||||
static FlowPhase flowPhaseFromChannelName(const QString& channelName);
|
||||
void setPlotXAxisTitles(RimWellLogTrack* plotTrack);
|
||||
std::vector<RimEclipseCase*> eclipseCases() const;
|
||||
|
||||
|
@ -81,7 +81,7 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
m_wellLogPlot.uiCapability()->setUiTreeHidden(true);
|
||||
m_wellLogPlot.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "WellName", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellPathNameOrSimWellName, "WellName", "WellName", "", "", "");
|
||||
CAF_PDM_InitField(&m_branchIndex, "BranchIndex", 0, "BranchIndex", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedSources, "Sources", "Sources", "", "", "");
|
||||
@ -269,7 +269,7 @@ void RimWellRftPlot::updateFormationsOnPlot() const
|
||||
RimOilField* oilField = proj->activeOilField();
|
||||
|
||||
RimWellPathCollection* wellPathCollection = oilField->wellPathCollection();
|
||||
RimWellPath* wellPath = wellPathCollection->wellPathByName(m_wellName);
|
||||
RimWellPath* wellPath = wellPathCollection->wellPathByName(m_wellPathNameOrSimWellName);
|
||||
|
||||
RimWellLogTrack::TrajectoryType trajectoryType;
|
||||
|
||||
@ -292,7 +292,7 @@ void RimWellRftPlot::updateFormationsOnPlot() const
|
||||
|
||||
if (m_wellLogPlot->trackCount() > 0)
|
||||
{
|
||||
m_wellLogPlot->trackByIndex(0)->updateFormationNamesData(rimCase, trajectoryType, wellPath, m_wellName, m_branchIndex);
|
||||
m_wellLogPlot->trackByIndex(0)->updateFormationNamesData(rimCase, trajectoryType, wellPath, m_wellPathNameOrSimWellName, m_branchIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,20 +305,21 @@ void RimWellRftPlot::applyInitialSelections()
|
||||
std::set<QDateTime> rftTimeSteps;
|
||||
std::set<QDateTime> observedTimeSteps;
|
||||
std::set<QDateTime> gridTimeSteps;
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathNameOrSimWellName);
|
||||
|
||||
for(RimEclipseResultCase* const rftCase : RimWellPlotTools::rftCasesForWell(m_wellName))
|
||||
for(RimEclipseResultCase* const rftCase : RimWellPlotTools::rftCasesForWell(m_wellPathNameOrSimWellName))
|
||||
{
|
||||
sourcesToSelect.push_back(RifWellRftAddress(RifWellRftAddress::RFT, rftCase));
|
||||
RimWellPlotTools::appendSet(rftTimeSteps, RimWellPlotTools::timeStepsFromRftCase(rftCase, m_wellName));
|
||||
RimWellPlotTools::appendSet(rftTimeSteps, RimWellPlotTools::timeStepsFromRftCase(rftCase, simWellName));
|
||||
}
|
||||
|
||||
for (RimEclipseResultCase* const gridCase : RimWellPlotTools::gridCasesForWell(m_wellName))
|
||||
for (RimEclipseResultCase* const gridCase : RimWellPlotTools::gridCasesForWell(m_wellPathNameOrSimWellName))
|
||||
{
|
||||
sourcesToSelect.push_back(RifWellRftAddress(RifWellRftAddress::GRID, gridCase));
|
||||
RimWellPlotTools::appendSet(gridTimeSteps, RimWellPlotTools::timeStepsFromGridCase(gridCase));
|
||||
}
|
||||
|
||||
std::vector<RimWellLogFile*> wellLogFiles = RimWellPlotTools::wellLogFilesContainingPressure(m_wellName);
|
||||
std::vector<RimWellLogFile*> wellLogFiles = RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName);
|
||||
if(wellLogFiles.size() > 0)
|
||||
{
|
||||
sourcesToSelect.push_back(RifWellRftAddress(RifWellRftAddress::OBSERVED));
|
||||
@ -438,8 +439,9 @@ void RimWellRftPlot::syncCurvesFromUiSelection()
|
||||
std::set < RiaRftPltCurveDefinition> RimWellRftPlot::selectedCurveDefs() const
|
||||
{
|
||||
std::set<RiaRftPltCurveDefinition> curveDefs;
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(m_wellName);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(m_wellName);
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(m_wellPathNameOrSimWellName);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(m_wellPathNameOrSimWellName);
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathNameOrSimWellName);
|
||||
|
||||
for (const QDateTime& timeStep : m_selectedTimeSteps())
|
||||
{
|
||||
@ -449,7 +451,7 @@ std::set < RiaRftPltCurveDefinition> RimWellRftPlot::selectedCurveDefs() const
|
||||
{
|
||||
for (RimEclipseResultCase* const rftCase : rftCases)
|
||||
{
|
||||
const std::set<QDateTime>& timeSteps = RimWellPlotTools::timeStepsFromRftCase(rftCase, m_wellName);
|
||||
const std::set<QDateTime>& timeSteps = RimWellPlotTools::timeStepsFromRftCase(rftCase, simWellName);
|
||||
if (timeSteps.count(timeStep) > 0)
|
||||
{
|
||||
curveDefs.insert(RiaRftPltCurveDefinition(addr, timeStep));
|
||||
@ -471,8 +473,8 @@ std::set < RiaRftPltCurveDefinition> RimWellRftPlot::selectedCurveDefs() const
|
||||
{
|
||||
if (addr.wellLogFile() != nullptr)
|
||||
{
|
||||
const QDateTime wlfTimeStep = RimWellPlotTools::timeStepFromWellLogFile(addr.wellLogFile());
|
||||
if (wlfTimeStep == timeStep)
|
||||
const QDateTime wellLogFileTimeStep = RimWellPlotTools::timeStepFromWellLogFile(addr.wellLogFile());
|
||||
if (wellLogFileTimeStep == timeStep)
|
||||
{
|
||||
curveDefs.insert(RiaRftPltCurveDefinition(RifWellRftAddress(RifWellRftAddress::OBSERVED, addr.wellLogFile()), timeStep));
|
||||
}
|
||||
@ -524,7 +526,7 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
|
||||
auto rftCase = curveDefToAdd.address().eclCase();
|
||||
curve->setEclipseResultCase(dynamic_cast<RimEclipseResultCase*>(rftCase));
|
||||
|
||||
RifEclipseRftAddress address(m_wellName, curveDefToAdd.timeStep(), RifEclipseRftAddress::PRESSURE);
|
||||
RifEclipseRftAddress address(m_wellPathNameOrSimWellName, curveDefToAdd.timeStep(), RifEclipseRftAddress::PRESSURE);
|
||||
curve->setRftAddress(address);
|
||||
curve->setZOrder(1);
|
||||
|
||||
@ -538,7 +540,7 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
|
||||
|
||||
cvf::Color3f curveColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(plotTrack->curveCount());
|
||||
curve->setColor(curveColor);
|
||||
curve->setFromSimulationWellName(m_wellName, m_branchIndex);
|
||||
curve->setFromSimulationWellName(m_wellPathNameOrSimWellName, m_branchIndex);
|
||||
|
||||
// Fetch cases and time steps
|
||||
auto gridCase = curveDefToAdd.address().eclCase();
|
||||
@ -555,9 +557,9 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
|
||||
curve->setEclipseResultDefinition(resultDef);
|
||||
|
||||
// Time step
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeSteps = RimWellPlotTools::timeStepsMapFromGridCase(gridCase);
|
||||
const std::set<QDateTime>& timeSteps = RimWellPlotTools::timeStepsFromGridCase(gridCase);
|
||||
auto currentTimeStepItr = std::find_if(timeSteps.begin(), timeSteps.end(),
|
||||
[curveDefToAdd](std::pair<QDateTime, std::set<RifWellRftAddress>> pair) {return pair.first == curveDefToAdd.timeStep(); });
|
||||
[curveDefToAdd](const QDateTime& timeStep) {return timeStep == curveDefToAdd.timeStep(); });
|
||||
auto currentTimeStepIndex = std::distance(timeSteps.begin(), currentTimeStepItr);
|
||||
curve->setCurrentTimeStep(currentTimeStepIndex);
|
||||
curve->setZOrder(0);
|
||||
@ -623,7 +625,7 @@ std::vector<RifWellRftAddress> RimWellRftPlot::selectedSources() const
|
||||
{
|
||||
if (addr.sourceType() == RifWellRftAddress::OBSERVED)
|
||||
{
|
||||
for (RimWellLogFile* const wellLogFile : RimWellPlotTools::wellLogFilesContainingPressure(m_wellName))
|
||||
for (RimWellLogFile* const wellLogFile : RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName))
|
||||
{
|
||||
sources.push_back(RifWellRftAddress(RifWellRftAddress::OBSERVED, wellLogFile));
|
||||
}
|
||||
@ -663,7 +665,7 @@ RimWellLogPlot* RimWellRftPlot::wellLogPlot() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::setCurrentWellName(const QString& currWellName)
|
||||
{
|
||||
m_wellName = currWellName;
|
||||
m_wellPathNameOrSimWellName = currWellName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -671,7 +673,7 @@ void RimWellRftPlot::setCurrentWellName(const QString& currWellName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellRftPlot::currentWellName() const
|
||||
{
|
||||
return m_wellName;
|
||||
return m_wellPathNameOrSimWellName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -695,15 +697,16 @@ const char* RimWellRftPlot::plotNameFormatString()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathNameOrSimWellName);
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (fieldNeedingOptions == &m_wellName)
|
||||
if (fieldNeedingOptions == &m_wellPathNameOrSimWellName)
|
||||
{
|
||||
calculateValueOptionsForWells(options);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_selectedSources)
|
||||
{
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(m_wellName);
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(simWellName);
|
||||
if (rftCases.size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifWellRftAddress::sourceTypeUiText(RifWellRftAddress::RFT), true));
|
||||
@ -716,7 +719,7 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::P
|
||||
options.push_back(item);
|
||||
}
|
||||
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(m_wellName);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(simWellName);
|
||||
if (gridCases.size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifWellRftAddress::sourceTypeUiText(RifWellRftAddress::GRID), true));
|
||||
@ -729,7 +732,7 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::P
|
||||
options.push_back(item);
|
||||
}
|
||||
|
||||
if (RimWellPlotTools::wellLogFilesContainingPressure(m_wellName).size() > 0)
|
||||
if (RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName).size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifWellRftAddress::sourceTypeUiText(RifWellRftAddress::OBSERVED), true));
|
||||
|
||||
@ -747,7 +750,7 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::P
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
size_t branchCount = proj->simulationWellBranches(m_wellName).size();
|
||||
size_t branchCount = proj->simulationWellBranches(m_wellPathNameOrSimWellName).size();
|
||||
|
||||
for (int bIdx = 0; bIdx < static_cast<int>(branchCount); ++bIdx)
|
||||
{
|
||||
@ -770,12 +773,12 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
|
||||
if (changedField == &m_wellName)
|
||||
if (changedField == &m_wellPathNameOrSimWellName)
|
||||
{
|
||||
setDescription(QString(plotNameFormatString()).arg(m_wellName));
|
||||
setDescription(QString(plotNameFormatString()).arg(m_wellPathNameOrSimWellName));
|
||||
}
|
||||
|
||||
if (changedField == &m_wellName || changedField == &m_branchIndex)
|
||||
if (changedField == &m_wellPathNameOrSimWellName || changedField == &m_branchIndex)
|
||||
{
|
||||
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
|
||||
for (RimWellLogCurve* const curve : plotTrack->curvesVector())
|
||||
@ -833,10 +836,10 @@ void RimWellRftPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
m_selectedSourcesOrTimeStepsFieldsChanged = false;
|
||||
|
||||
uiOrdering.add(&m_userName);
|
||||
uiOrdering.add(&m_wellName);
|
||||
uiOrdering.add(&m_wellPathNameOrSimWellName);
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if (proj->simulationWellBranches(m_wellName).size() > 1)
|
||||
if (proj->simulationWellBranches(m_wellPathNameOrSimWellName).size() > 1)
|
||||
{
|
||||
uiOrdering.add(&m_branchIndex);
|
||||
}
|
||||
@ -918,9 +921,10 @@ void RimWellRftPlot::calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::calculateValueOptionsForTimeSteps(QList<caf::PdmOptionItemInfo>& options)
|
||||
{
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathNameOrSimWellName);
|
||||
std::map<QDateTime, std::set<RifWellRftAddress>> displayTimeStepsMap, obsAndRftTimeStepsMap, gridTimeStepsMap;
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(m_wellName);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(m_wellName);
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(simWellName);
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(simWellName);
|
||||
|
||||
for (const RifWellRftAddress& selection : selectedSources())
|
||||
{
|
||||
@ -928,7 +932,7 @@ void RimWellRftPlot::calculateValueOptionsForTimeSteps(QList<caf::PdmOptionItemI
|
||||
{
|
||||
for (RimEclipseResultCase* const rftCase : rftCases)
|
||||
{
|
||||
RimWellPlotTools::addTimeStepsToMap(obsAndRftTimeStepsMap, RimWellPlotTools::timeStepsMapFromRftCase(rftCase, m_wellName));
|
||||
RimWellPlotTools::addTimeStepsToMap(obsAndRftTimeStepsMap, RimWellPlotTools::timeStepsMapFromRftCase(rftCase, simWellName));
|
||||
}
|
||||
}
|
||||
else if (selection.sourceType() == RifWellRftAddress::GRID)
|
||||
|
@ -134,7 +134,7 @@ private:
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<QString> m_userName;
|
||||
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<QString> m_wellPathNameOrSimWellName;
|
||||
caf::PdmField<int> m_branchIndex;
|
||||
caf::PdmField<std::vector<RifWellRftAddress>> m_selectedSources;
|
||||
|
||||
|
@ -22,7 +22,9 @@
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
//#include "RimWellPltPlot.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
|
||||
#include "RiaDateStringParser.h"
|
||||
|
||||
#include "RigWellLogFile.h"
|
||||
@ -238,7 +240,7 @@ std::vector<RimWellLogFileChannel*> RimWellLogFile::wellLogChannels() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogFile::hasFlowData() const
|
||||
{
|
||||
return RimWellPltPlot::hasFlowData(this);
|
||||
return RimWellPlotTools::hasFlowData(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user