#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"
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)
{
timeStep.setTimeSpec(Qt::TimeSpec::UTC);
@ -40,23 +30,6 @@ RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime 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
{
public:
static const QString DEPTH;
static const QString PRESSURE;
static const QString SWAT;
static const QString SOIL;
static const QString SGAS;
static const QString WRAT;
static const QString ORAT;
static const QString GRAT;
enum RftWellLogChannelName
{
NONE,
DEPTH,
PRESSURE,
SWAT,
SOIL,
SGAS,
WRAT,
ORAT,
GRAT
};
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& wellLogChannelName() const { return m_wellLogChannelName; }
const QString& wellName() const { return m_wellName; }
QDateTime timeStep() const { return m_timeStep; }
const RftWellLogChannelName& wellLogChannelName() const { return m_wellLogChannelName; }
private:
QString m_wellName;
QDateTime m_timeStep;
QString m_wellLogChannelName;
QString m_wellName;
QDateTime m_timeStep;
RftWellLogChannelName m_wellLogChannelName;
};
bool operator==(const RifEclipseRftAddress& first, const RifEclipseRftAddress& second);

View File

@ -18,8 +18,6 @@
#include "RifReaderEclipseRft.h"
#include "RifEclipseRftAddress.h"
#include "ert/ecl/ecl_rft_file.h"
//--------------------------------------------------------------------------------------------------
@ -91,13 +89,13 @@ void RifReaderEclipseRft::open()
m_eclipseRftAddresses.push_back(addressWrat);
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);
m_eclipseRftAddresses.push_back(addressOrat);
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)
{
CVF_ASSERT(values);
if (!m_ecl_rft_file)
{
open();
}
values->clear();
int index = indexFromAddress(rftAddress);
if (index < 0) return;
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++)
{
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++)
{
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++)
{
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++)
{
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++)
{
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++)
{
values->push_back(ecl_rft_node_iget_wrat(node, i));
}
break;
}
else if (wellLogChannelName == RifEclipseRftAddress::GRAT)
{
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)
case RifEclipseRftAddress::ORAT:
{
for (int i = 0; i < ecl_rft_node_get_size(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;
if (wellName == "" || wellLogChannelName == "") return timeSteps;
if (wellName == "") return timeSteps;
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;
}

View File

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

View File

@ -21,10 +21,8 @@
#include "RiaEclipseUnitTools.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultCase.h"
#include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlot.h"
#include "RigEclipseCaseData.h"
@ -33,6 +31,7 @@
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RifReaderEclipseRft.h"
#include "RifEclipseRftAddress.h"
#include "cafPdmObject.h"
#include "cvfAssert.h"
@ -41,6 +40,23 @@
#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");
@ -57,7 +73,7 @@ RimWellLogRftCurve::RimWellLogRftCurve()
CAF_PDM_InitFieldNoDefault(&m_timeStep, "TimeStep", "Time Step", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "WellLogChannelName", "Well Property", "", "", "");
}
@ -81,7 +97,7 @@ QString RimWellLogRftCurve::wellName() const
//--------------------------------------------------------------------------------------------------
QString RimWellLogRftCurve::wellLogChannelName() const
{
return m_wellLogChannelName;
return m_wellLogChannelName().text();
}
//--------------------------------------------------------------------------------------------------
@ -151,7 +167,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
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());
updateZoomInParentPlot();
@ -212,11 +228,14 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const ca
}
else if (fieldNeedingOptions == &m_wellLogChannelName)
{
options.push_back(caf::PdmOptionItemInfo("None", ""));
for (const QString& channelName : RifEclipseRftAddress::allWellLogChannelNamesExDepth())
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE));
RifReaderEclipseRft* reader = rftReader();
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)
@ -224,7 +243,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const ca
RifReaderEclipseRft* reader = rftReader();
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)
{
options.push_back(caf::PdmOptionItemInfo(dt.toString(), dt));

View File

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