#1947 RFT/PLT Plot: Use AppEnum for wellLogChannel and remove qwtPlot field in rftCurve

This commit is contained in:
Rebecca Cox
2017-10-06 13:35:49 +02:00
parent a01dd00d62
commit aeb854b895
6 changed files with 138 additions and 91 deletions

View File

@@ -18,20 +18,10 @@
#include "RifEclipseRftAddress.h" #include "RifEclipseRftAddress.h"
const QString RifEclipseRftAddress::DEPTH = "Depth";
const QString RifEclipseRftAddress::PRESSURE = "Pressure";
const QString RifEclipseRftAddress::SWAT = "Water Saturation";
const QString RifEclipseRftAddress::SOIL = "Oil Saturation";
const QString RifEclipseRftAddress::SGAS = "Gas Saturation";
const QString RifEclipseRftAddress::WRAT = "Water Flow";
const QString RifEclipseRftAddress::ORAT = "Oil Flow";
const QString RifEclipseRftAddress::GRAT = "Gas Flow";
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime timeStep, QString wellLogChannelName) : RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime timeStep, RftWellLogChannelName wellLogChannelName) :
m_wellName(wellName), m_wellLogChannelName(wellLogChannelName) m_wellName(wellName), m_wellLogChannelName(wellLogChannelName)
{ {
timeStep.setTimeSpec(Qt::TimeSpec::UTC); timeStep.setTimeSpec(Qt::TimeSpec::UTC);
@@ -40,23 +30,6 @@ RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime timeStep,
m_timeStep = timeStep; m_timeStep = timeStep;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RifEclipseRftAddress::allWellLogChannelNamesExDepth()
{
std::vector<QString> channelNames;
channelNames.push_back(RifEclipseRftAddress::PRESSURE);
channelNames.push_back(RifEclipseRftAddress::SWAT);
channelNames.push_back(RifEclipseRftAddress::SOIL);
channelNames.push_back(RifEclipseRftAddress::SGAS);
channelNames.push_back(RifEclipseRftAddress::WRAT);
channelNames.push_back(RifEclipseRftAddress::ORAT);
channelNames.push_back(RifEclipseRftAddress::GRAT);
return channelNames;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -31,27 +31,31 @@
class RifEclipseRftAddress class RifEclipseRftAddress
{ {
public: public:
static const QString DEPTH;
static const QString PRESSURE; enum RftWellLogChannelName
static const QString SWAT; {
static const QString SOIL; NONE,
static const QString SGAS; DEPTH,
static const QString WRAT; PRESSURE,
static const QString ORAT; SWAT,
static const QString GRAT; SOIL,
SGAS,
WRAT,
ORAT,
GRAT
};
public: public:
RifEclipseRftAddress(QString wellName, QDateTime timeStep, QString wellLogChannelName); RifEclipseRftAddress(QString wellName, QDateTime timeStep, RftWellLogChannelName wellLogChannelName);
static std::vector<QString> allWellLogChannelNamesExDepth(); const QString& wellName() const { return m_wellName; }
QDateTime timeStep() const { return m_timeStep; }
const QString& wellName() const { return m_wellName; } const RftWellLogChannelName& wellLogChannelName() const { return m_wellLogChannelName; }
QDateTime timeStep() const { return m_timeStep; }
const QString& wellLogChannelName() const { return m_wellLogChannelName; }
private: private:
QString m_wellName; QString m_wellName;
QDateTime m_timeStep; QDateTime m_timeStep;
QString m_wellLogChannelName; RftWellLogChannelName m_wellLogChannelName;
}; };
bool operator==(const RifEclipseRftAddress& first, const RifEclipseRftAddress& second); bool operator==(const RifEclipseRftAddress& first, const RifEclipseRftAddress& second);

View File

@@ -18,8 +18,6 @@
#include "RifReaderEclipseRft.h" #include "RifReaderEclipseRft.h"
#include "RifEclipseRftAddress.h"
#include "ert/ecl/ecl_rft_file.h" #include "ert/ecl/ecl_rft_file.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -91,13 +89,13 @@ void RifReaderEclipseRft::open()
m_eclipseRftAddresses.push_back(addressWrat); m_eclipseRftAddresses.push_back(addressWrat);
m_rftAddressToLibeclNodeIdx[addressWrat] = i; m_rftAddressToLibeclNodeIdx[addressWrat] = i;
RifEclipseRftAddress addressGrat(wellName, timeStep, RifEclipseRftAddress::GRAT);
m_eclipseRftAddresses.push_back(addressGrat);
m_rftAddressToLibeclNodeIdx[addressGrat] = i;
RifEclipseRftAddress addressOrat(wellName, timeStep, RifEclipseRftAddress::ORAT); RifEclipseRftAddress addressOrat(wellName, timeStep, RifEclipseRftAddress::ORAT);
m_eclipseRftAddresses.push_back(addressOrat); m_eclipseRftAddresses.push_back(addressOrat);
m_rftAddressToLibeclNodeIdx[addressOrat] = i; m_rftAddressToLibeclNodeIdx[addressOrat] = i;
RifEclipseRftAddress addressGrat(wellName, timeStep, RifEclipseRftAddress::GRAT);
m_eclipseRftAddresses.push_back(addressGrat);
m_rftAddressToLibeclNodeIdx[addressGrat] = i;
} }
} }
@@ -122,84 +120,106 @@ const std::vector<RifEclipseRftAddress>& RifReaderEclipseRft::eclipseRftAddresse
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RifReaderEclipseRft::values(const RifEclipseRftAddress& rftAddress, std::vector<double>* values) void RifReaderEclipseRft::values(const RifEclipseRftAddress& rftAddress, std::vector<double>* values)
{ {
CVF_ASSERT(values);
if (!m_ecl_rft_file) if (!m_ecl_rft_file)
{ {
open(); open();
} }
values->clear();
int index = indexFromAddress(rftAddress); int index = indexFromAddress(rftAddress);
if (index < 0) return; if (index < 0) return;
ecl_rft_node_type* node = ecl_rft_file_iget_node(m_ecl_rft_file, index); ecl_rft_node_type* node = ecl_rft_file_iget_node(m_ecl_rft_file, index);
QString wellLogChannelName = rftAddress.wellLogChannelName(); RifEclipseRftAddress::RftWellLogChannelName wellLogChannelName = rftAddress.wellLogChannelName();
if (wellLogChannelName == RifEclipseRftAddress::DEPTH) switch (wellLogChannelName)
{
case RifEclipseRftAddress::DEPTH:
{ {
for (int i = 0; i < ecl_rft_node_get_size(node); i++) for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{ {
values->push_back(ecl_rft_node_iget_depth(node, i)); values->push_back(ecl_rft_node_iget_depth(node, i));
} }
break;
} }
else if (wellLogChannelName == RifEclipseRftAddress::PRESSURE) case RifEclipseRftAddress::PRESSURE:
{ {
for (int i = 0; i < ecl_rft_node_get_size(node); i++) for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{ {
values->push_back(ecl_rft_node_iget_pressure(node, i)); values->push_back(ecl_rft_node_iget_pressure(node, i));
} }
break;
} }
else if (wellLogChannelName == RifEclipseRftAddress::SWAT) case RifEclipseRftAddress::SWAT:
{ {
for (int i = 0; i < ecl_rft_node_get_size(node); i++) for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{ {
values->push_back(ecl_rft_node_iget_swat(node, i)); values->push_back(ecl_rft_node_iget_swat(node, i));
} }
break;
} }
else if (wellLogChannelName == RifEclipseRftAddress::SOIL) case RifEclipseRftAddress::SOIL:
{ {
for (int i = 0; i < ecl_rft_node_get_size(node); i++) for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{ {
values->push_back(ecl_rft_node_iget_soil(node, i)); values->push_back(ecl_rft_node_iget_soil(node, i));
} }
break;
} }
else if (wellLogChannelName == RifEclipseRftAddress::SGAS) case RifEclipseRftAddress::SGAS:
{ {
for (int i = 0; i < ecl_rft_node_get_size(node); i++) for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{ {
values->push_back(ecl_rft_node_iget_sgas(node, i)); values->push_back(ecl_rft_node_iget_sgas(node, i));
} }
break;
} }
else if (wellLogChannelName == RifEclipseRftAddress::WRAT) case RifEclipseRftAddress::WRAT:
{ {
for (int i = 0; i < ecl_rft_node_get_size(node); i++) for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{ {
values->push_back(ecl_rft_node_iget_wrat(node, i)); values->push_back(ecl_rft_node_iget_wrat(node, i));
} }
break;
} }
else if (wellLogChannelName == RifEclipseRftAddress::GRAT) case RifEclipseRftAddress::ORAT:
{
for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{
values->push_back(ecl_rft_node_iget_grat(node, i));
}
}
else if (wellLogChannelName == RifEclipseRftAddress::ORAT)
{ {
for (int i = 0; i < ecl_rft_node_get_size(node); i++) for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{ {
values->push_back(ecl_rft_node_iget_orat(node, i)); values->push_back(ecl_rft_node_iget_orat(node, i));
} }
break;
}
case RifEclipseRftAddress::GRAT:
{
for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{
values->push_back(ecl_rft_node_iget_grat(node, i));
}
break;
}
default:
break;
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<QDateTime> RifReaderEclipseRft::availableTimeSteps(const QString& wellName, const QString& wellLogChannelName) const std::vector<QDateTime> RifReaderEclipseRft::availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelName& wellLogChannelName)
{ {
if (!m_ecl_rft_file)
{
open();
}
std::vector<QDateTime> timeSteps; std::vector<QDateTime> timeSteps;
if (wellName == "" || wellLogChannelName == "") return timeSteps; if (wellName == "") return timeSteps;
for (const RifEclipseRftAddress& address : m_eclipseRftAddresses) for (const RifEclipseRftAddress& address : m_eclipseRftAddresses)
{ {
@@ -214,8 +234,41 @@ std::vector<QDateTime> RifReaderEclipseRft::availableTimeSteps(const QString& we
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::set<QString>& RifReaderEclipseRft::wellNames() const std::vector<RifEclipseRftAddress::RftWellLogChannelName> RifReaderEclipseRft::availableWellLogChannels(const QString& wellName)
{ {
if (!m_ecl_rft_file)
{
open();
}
std::vector<RifEclipseRftAddress::RftWellLogChannelName> wellLogChannelNames;
if (wellName == "") return wellLogChannelNames;
for (const RifEclipseRftAddress& address : m_eclipseRftAddresses)
{
if (address.wellName() == wellName)
{
RifEclipseRftAddress::RftWellLogChannelName name = address.wellLogChannelName();
if (name != RifEclipseRftAddress::RftWellLogChannelName::DEPTH)
{
wellLogChannelNames.push_back(address.wellLogChannelName());
}
}
}
return wellLogChannelNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::set<QString>& RifReaderEclipseRft::wellNames()
{
if (!m_ecl_rft_file)
{
open();
}
return m_wellNames; return m_wellNames;
} }

View File

@@ -18,6 +18,8 @@
#pragma once #pragma once
#include "RifEclipseRftAddress.h"
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
@@ -27,8 +29,6 @@
#include <QDateTime> #include <QDateTime>
class RifEclipseRftAddress;
//================================================================================================== //==================================================================================================
// //
// //
@@ -42,8 +42,9 @@ public:
const std::vector<RifEclipseRftAddress>& eclipseRftAddresses(); const std::vector<RifEclipseRftAddress>& eclipseRftAddresses();
void values(const RifEclipseRftAddress& rftAddress, std::vector<double>* values); void values(const RifEclipseRftAddress& rftAddress, std::vector<double>* values);
std::vector<QDateTime> availableTimeSteps(const QString& wellName, const QString& wellLogChannelName) const; std::vector<QDateTime> availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelName& wellLogChannelName);
const std::set<QString>& wellNames() const; std::vector<RifEclipseRftAddress::RftWellLogChannelName> availableWellLogChannels(const QString& wellName);
const std::set<QString>& wellNames();
private: private:
void open(); void open();
@@ -58,6 +59,5 @@ private:
std::vector<RifEclipseRftAddress> m_eclipseRftAddresses; std::vector<RifEclipseRftAddress> m_eclipseRftAddresses;
std::set<QString> m_wellNames; std::set<QString> m_wellNames;
std::map<RifEclipseRftAddress, int> m_rftAddressToLibeclNodeIdx; std::map<RifEclipseRftAddress, int> m_rftAddressToLibeclNodeIdx;
}; };

View File

@@ -21,10 +21,8 @@
#include "RiaEclipseUnitTools.h" #include "RiaEclipseUnitTools.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RimTools.h" #include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
@@ -33,6 +31,7 @@
#include "RiuLineSegmentQwtPlotCurve.h" #include "RiuLineSegmentQwtPlotCurve.h"
#include "RifReaderEclipseRft.h" #include "RifReaderEclipseRft.h"
#include "RifEclipseRftAddress.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cvfAssert.h" #include "cvfAssert.h"
@@ -41,6 +40,23 @@
#include <QString> #include <QString>
namespace caf
{
template<>
void caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelName >::setUp()
{
addItem(RifEclipseRftAddress::NONE, "NONE", "None");
addItem(RifEclipseRftAddress::DEPTH, "DEPTH", "Depth");
addItem(RifEclipseRftAddress::PRESSURE, "PRESSURE", "Pressure");
addItem(RifEclipseRftAddress::SWAT, "SWAT", "Water Saturation");
addItem(RifEclipseRftAddress::SOIL, "SOIL", "Oil Saturation");
addItem(RifEclipseRftAddress::SGAS, "SGAS", "Gas Saturation");
addItem(RifEclipseRftAddress::WRAT, "WRAT", "Water Flow");
addItem(RifEclipseRftAddress::ORAT, "ORAT", "Oil Flow");
addItem(RifEclipseRftAddress::GRAT, "GRAT", "Gas flow");
setDefault(RifEclipseRftAddress::NONE);
}
}
CAF_PDM_SOURCE_INIT(RimWellLogRftCurve, "WellLogRftCurve"); CAF_PDM_SOURCE_INIT(RimWellLogRftCurve, "WellLogRftCurve");
@@ -57,7 +73,7 @@ RimWellLogRftCurve::RimWellLogRftCurve()
CAF_PDM_InitFieldNoDefault(&m_timeStep, "TimeStep", "Time Step", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_timeStep, "TimeStep", "Time Step", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "WellLogChannelName", "Well Property", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "WellLogChannelName", "Well Property", "", "", "");
} }
@@ -81,7 +97,7 @@ QString RimWellLogRftCurve::wellName() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellLogRftCurve::wellLogChannelName() const QString RimWellLogRftCurve::wellLogChannelName() const
{ {
return m_wellLogChannelName; return m_wellLogChannelName().text();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -151,7 +167,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
displayUnit = wellLogPlot->depthUnit(); displayUnit = wellLogPlot->depthUnit();
} }
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->trueDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size())); m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
updateZoomInParentPlot(); updateZoomInParentPlot();
@@ -212,11 +228,14 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const ca
} }
else if (fieldNeedingOptions == &m_wellLogChannelName) else if (fieldNeedingOptions == &m_wellLogChannelName)
{ {
options.push_back(caf::PdmOptionItemInfo("None", "")); options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE));
RifReaderEclipseRft* reader = rftReader();
for (const QString& channelName : RifEclipseRftAddress::allWellLogChannelNamesExDepth()) if (reader)
{ {
options.push_back(caf::PdmOptionItemInfo(channelName, channelName)); for (const RifEclipseRftAddress::RftWellLogChannelName& channelName : reader->availableWellLogChannels(m_wellName))
{
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::uiText(channelName), channelName));
}
} }
} }
else if (fieldNeedingOptions == &m_timeStep) else if (fieldNeedingOptions == &m_timeStep)
@@ -224,7 +243,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const ca
RifReaderEclipseRft* reader = rftReader(); RifReaderEclipseRft* reader = rftReader();
if (reader) if (reader)
{ {
std::vector<QDateTime> timeStamps = reader->availableTimeSteps(m_wellName, m_wellLogChannelName); std::vector<QDateTime> timeStamps = reader->availableTimeSteps(m_wellName, m_wellLogChannelName());
for (const QDateTime& dt : timeStamps) for (const QDateTime& dt : timeStamps)
{ {
options.push_back(caf::PdmOptionItemInfo(dt.toString(), dt)); options.push_back(caf::PdmOptionItemInfo(dt.toString(), dt));

View File

@@ -26,10 +26,10 @@
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmPtrField.h" #include "cafPdmPtrField.h"
#include "cvfObject.h" #include "cvfObject.h"
#include "cafAppEnum.h"
class RifReaderEclipseRft; class RifReaderEclipseRft;
class RimEclipseResultCase; class RimEclipseResultCase;
class RiuLineSegmentQwtPlotCurve;
//================================================================================================== //==================================================================================================
/// ///
@@ -68,12 +68,10 @@ private:
std::vector<double> depthValues() const; std::vector<double> depthValues() const;
private: private:
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve; caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase; caf::PdmField<QString> m_wellName;
caf::PdmField<QDateTime> m_timeStep; caf::PdmField< caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelName > > m_wellLogChannelName;
caf::PdmField<QString> m_wellName;
caf::PdmField<QString> m_wellLogChannelName;
}; };