#2139, #2126 Add available times convenience access in RftReader, Rename enum in RifEclipseRftAddress

This commit is contained in:
Jacob Støren 2017-11-13 15:17:49 +01:00
parent 8bea278d20
commit c670878b33
6 changed files with 60 additions and 34 deletions

View File

@ -21,8 +21,8 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime timeStep, RftWellLogChannelName wellLogChannelName) :
m_wellName(wellName), m_wellLogChannelName(wellLogChannelName)
RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime timeStep, RftWellLogChannelType wellLogChannelName) :
m_wellName(wellName), m_wellLogChannel(wellLogChannelName)
{
timeStep.setTimeSpec(Qt::TimeSpec::UTC);
@ -37,7 +37,7 @@ bool operator==(const RifEclipseRftAddress& first, const RifEclipseRftAddress& s
{
if (first.wellName() != second.wellName()) return false;
if (first.timeStep() != second.timeStep()) return false;
if (first.wellLogChannelName() != second.wellLogChannelName()) return false;
if (first.wellLogChannel() != second.wellLogChannel()) return false;
return true;
}
@ -49,7 +49,7 @@ bool operator<(const RifEclipseRftAddress& first, const RifEclipseRftAddress& se
{
if (first.wellName() != second.wellName()) return (first.wellName() < second.wellName());
if (first.timeStep() != second.timeStep()) return (first.timeStep() < second.timeStep());
if (first.wellLogChannelName() != second.wellLogChannelName()) return (first.wellLogChannelName() < second.wellLogChannelName());
if (first.wellLogChannel() != second.wellLogChannel()) return (first.wellLogChannel() < second.wellLogChannel());
return false;
}

View File

@ -32,7 +32,7 @@ class RifEclipseRftAddress
{
public:
enum RftWellLogChannelName
enum RftWellLogChannelType
{
NONE,
DEPTH,
@ -46,16 +46,16 @@ public:
};
public:
RifEclipseRftAddress(QString wellName, QDateTime timeStep, RftWellLogChannelName wellLogChannelName);
RifEclipseRftAddress(QString wellName, QDateTime timeStep, RftWellLogChannelType wellLogChannel);
const QString& wellName() const { return m_wellName; }
QDateTime timeStep() const { return m_timeStep; }
const RftWellLogChannelName& wellLogChannelName() const { return m_wellLogChannelName; }
const RftWellLogChannelType& wellLogChannel() const { return m_wellLogChannel; }
private:
QString m_wellName;
QDateTime m_timeStep;
RftWellLogChannelName m_wellLogChannelName;
RftWellLogChannelType m_wellLogChannel;
};
bool operator==(const RifEclipseRftAddress& first, const RifEclipseRftAddress& second);

View File

@ -140,7 +140,7 @@ void RifReaderEclipseRft::values(const RifEclipseRftAddress& rftAddress, std::ve
ecl_rft_node_type* node = ecl_rft_file_iget_node(m_ecl_rft_file, index);
RifEclipseRftAddress::RftWellLogChannelName wellLogChannelName = rftAddress.wellLogChannelName();
RifEclipseRftAddress::RftWellLogChannelType wellLogChannelName = rftAddress.wellLogChannel();
switch (wellLogChannelName)
{
@ -245,7 +245,7 @@ void RifReaderEclipseRft::cellIndices(const RifEclipseRftAddress& rftAddress, st
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QDateTime> RifReaderEclipseRft::availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelName& wellLogChannelName)
std::vector<QDateTime> RifReaderEclipseRft::availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName)
{
if (!m_ecl_rft_file)
{
@ -258,7 +258,7 @@ std::vector<QDateTime> RifReaderEclipseRft::availableTimeSteps(const QString& we
for (const RifEclipseRftAddress& address : m_eclipseRftAddresses)
{
if (address.wellName() == wellName && address.wellLogChannelName() == wellLogChannelName)
if (address.wellName() == wellName && address.wellLogChannel() == wellLogChannelName)
{
timeSteps.push_back(address.timeStep());
}
@ -269,14 +269,38 @@ std::vector<QDateTime> RifReaderEclipseRft::availableTimeSteps(const QString& we
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RifEclipseRftAddress::RftWellLogChannelName> RifReaderEclipseRft::availableWellLogChannels(const QString& wellName)
std::set<QDateTime> RifReaderEclipseRft::availableTimeSteps(const QString& wellName, const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels)
{
if (!m_ecl_rft_file)
{
open();
}
std::vector<RifEclipseRftAddress::RftWellLogChannelName> wellLogChannelNames;
std::set<QDateTime> timeSteps;
if (wellName == "") return timeSteps;
for (const RifEclipseRftAddress& address : m_eclipseRftAddresses)
{
if (address.wellName() == wellName && relevantChannels.count( address.wellLogChannel()) )
{
timeSteps.insert(address.timeStep());
}
}
return timeSteps;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RifEclipseRftAddress::RftWellLogChannelType> RifReaderEclipseRft::availableWellLogChannels(const QString& wellName)
{
if (!m_ecl_rft_file)
{
open();
}
std::vector<RifEclipseRftAddress::RftWellLogChannelType> wellLogChannelNames;
if (wellName == "") return wellLogChannelNames;
@ -288,7 +312,7 @@ std::vector<RifEclipseRftAddress::RftWellLogChannelName> RifReaderEclipseRft::av
{
if (address.wellName() == wellName)
{
RifEclipseRftAddress::RftWellLogChannelName name = address.wellLogChannelName();
RifEclipseRftAddress::RftWellLogChannelType name = address.wellLogChannel();
if (!pressureFound)
{
@ -301,7 +325,7 @@ std::vector<RifEclipseRftAddress::RftWellLogChannelName> RifReaderEclipseRft::av
if (!rftFound)
{
if ( name == RifEclipseRftAddress::RftWellLogChannelName::SWAT )
if ( name == RifEclipseRftAddress::RftWellLogChannelType::SWAT )
{
rftFound = true;
if (pltFound && pressureFound) break;
@ -311,7 +335,7 @@ std::vector<RifEclipseRftAddress::RftWellLogChannelName> RifReaderEclipseRft::av
if (!pltFound)
{
if ( name == RifEclipseRftAddress::RftWellLogChannelName::WRAT )
if ( name == RifEclipseRftAddress::RftWellLogChannelType::WRAT )
{
pltFound = true;
if (rftFound && pressureFound) break;
@ -326,15 +350,15 @@ std::vector<RifEclipseRftAddress::RftWellLogChannelName> RifReaderEclipseRft::av
}
if (rftFound)
{
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelName::SWAT);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelName::SOIL);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelName::SGAS);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelType::SWAT);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelType::SOIL);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelType::SGAS);
}
if (pltFound)
{
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelName::WRAT);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelName::ORAT);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelName::GRAT);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelType::WRAT);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelType::ORAT);
wellLogChannelNames.push_back(RifEclipseRftAddress::RftWellLogChannelType::GRAT);
}
return wellLogChannelNames;

View File

@ -48,8 +48,10 @@ public:
void values(const RifEclipseRftAddress& rftAddress, std::vector<double>* values);
void cellIndices(const RifEclipseRftAddress& rftAddress, std::vector<caf::VecIjk>* indices);
std::vector<QDateTime> availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelName& wellLogChannelName);
std::vector<RifEclipseRftAddress::RftWellLogChannelName> availableWellLogChannels(const QString& wellName);
std::set<QDateTime> availableTimeSteps(const QString& wellName, const std::set<RifEclipseRftAddress::RftWellLogChannelType> relevantChannels);
std::vector<QDateTime> availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName);
std::vector<RifEclipseRftAddress::RftWellLogChannelType> availableWellLogChannels(const QString& wellName);
const std::set<QString>& wellNames();
bool wellHasRftData(QString wellName);

View File

@ -59,7 +59,7 @@
namespace caf
{
template<>
void caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelName >::setUp()
void caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelType >::setUp()
{
addItem(RifEclipseRftAddress::NONE, "NONE", "None");
addItem(RifEclipseRftAddress::DEPTH, "DEPTH", "Depth");
@ -141,7 +141,7 @@ void RimWellLogRftCurve::setRftAddress(RifEclipseRftAddress address)
{
m_timeStep = address.timeStep();
m_wellName = address.wellName();
m_wellLogChannelName = address.wellLogChannelName();
m_wellLogChannelName = address.wellLogChannel();
}
//--------------------------------------------------------------------------------------------------
@ -206,7 +206,7 @@ void RimWellLogRftCurve::updateWellChannelNameAndTimeStep()
RifReaderEclipseRft* reader = rftReader();
if (!reader) return;
std::vector<RifEclipseRftAddress::RftWellLogChannelName> channelNames = reader->availableWellLogChannels(m_wellName);
std::vector<RifEclipseRftAddress::RftWellLogChannelType> channelNames = reader->availableWellLogChannels(m_wellName);
if (channelNames.empty())
{
@ -247,10 +247,10 @@ QString RimWellLogRftCurve::createCurveAutoName()
{
name.push_back(m_eclipseResultCase->caseName());
}
if (wellLogChannelName() != caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::text(RifEclipseRftAddress::NONE))
if (wellLogChannelName() != caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::text(RifEclipseRftAddress::NONE))
{
RifEclipseRftAddress::RftWellLogChannelName channelNameEnum = caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::fromText(wellLogChannelName());
name.push_back(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::uiText(channelNameEnum));
RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::fromText(wellLogChannelName());
name.push_back(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(channelNameEnum));
}
if ( !m_timeStep().isNull())
{
@ -386,14 +386,14 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const ca
RifReaderEclipseRft* reader = rftReader();
if (reader)
{
for (const RifEclipseRftAddress::RftWellLogChannelName& channelName : reader->availableWellLogChannels(m_wellName))
for (const RifEclipseRftAddress::RftWellLogChannelType& channelName : reader->availableWellLogChannels(m_wellName))
{
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::uiText(channelName), channelName));
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(channelName), channelName));
}
}
if (options.empty())
{
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE));
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE));
}
}
else if (fieldNeedingOptions == &m_timeStep)

View File

@ -89,7 +89,7 @@ private:
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField< caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelName > > m_wellLogChannelName;
caf::PdmField< caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelType > > m_wellLogChannelName;
bool m_isUsingPseudoLength;
};