diff --git a/ApplicationCode/FileInterface/RifEclipseRftAddress.cpp b/ApplicationCode/FileInterface/RifEclipseRftAddress.cpp index 71eaf1c63a..633c887b17 100644 --- a/ApplicationCode/FileInterface/RifEclipseRftAddress.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRftAddress.cpp @@ -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; } diff --git a/ApplicationCode/FileInterface/RifEclipseRftAddress.h b/ApplicationCode/FileInterface/RifEclipseRftAddress.h index 450a8bd35f..12e2157438 100644 --- a/ApplicationCode/FileInterface/RifEclipseRftAddress.h +++ b/ApplicationCode/FileInterface/RifEclipseRftAddress.h @@ -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); diff --git a/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp b/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp index b34649275b..5ca0e10966 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseRft.cpp @@ -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 RifReaderEclipseRft::availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelName& wellLogChannelName) +std::vector RifReaderEclipseRft::availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName) { if (!m_ecl_rft_file) { @@ -258,7 +258,7 @@ std::vector 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 RifReaderEclipseRft::availableTimeSteps(const QString& we //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RifReaderEclipseRft::availableWellLogChannels(const QString& wellName) +std::set RifReaderEclipseRft::availableTimeSteps(const QString& wellName, const std::set relevantChannels) { if (!m_ecl_rft_file) { open(); } - std::vector wellLogChannelNames; + std::set 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 RifReaderEclipseRft::availableWellLogChannels(const QString& wellName) +{ + if (!m_ecl_rft_file) + { + open(); + } + + std::vector wellLogChannelNames; if (wellName == "") return wellLogChannelNames; @@ -288,7 +312,7 @@ std::vector RifReaderEclipseRft::av { if (address.wellName() == wellName) { - RifEclipseRftAddress::RftWellLogChannelName name = address.wellLogChannelName(); + RifEclipseRftAddress::RftWellLogChannelType name = address.wellLogChannel(); if (!pressureFound) { @@ -301,7 +325,7 @@ std::vector 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 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 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; diff --git a/ApplicationCode/FileInterface/RifReaderEclipseRft.h b/ApplicationCode/FileInterface/RifReaderEclipseRft.h index 8b8c415dc2..ecd055d370 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseRft.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseRft.h @@ -48,8 +48,10 @@ public: void values(const RifEclipseRftAddress& rftAddress, std::vector* values); void cellIndices(const RifEclipseRftAddress& rftAddress, std::vector* indices); - std::vector availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelName& wellLogChannelName); - std::vector availableWellLogChannels(const QString& wellName); + std::set availableTimeSteps(const QString& wellName, const std::set relevantChannels); + + std::vector availableTimeSteps(const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName); + std::vector availableWellLogChannels(const QString& wellName); const std::set& wellNames(); bool wellHasRftData(QString wellName); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp index 6b8535da1f..baf05b3728 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.cpp @@ -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 channelNames = reader->availableWellLogChannels(m_wellName); + std::vector 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::text(RifEclipseRftAddress::NONE)) + if (wellLogChannelName() != caf::AppEnum::text(RifEclipseRftAddress::NONE)) { - RifEclipseRftAddress::RftWellLogChannelName channelNameEnum = caf::AppEnum::fromText(wellLogChannelName()); - name.push_back(caf::AppEnum::uiText(channelNameEnum)); + RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = caf::AppEnum::fromText(wellLogChannelName()); + name.push_back(caf::AppEnum::uiText(channelNameEnum)); } if ( !m_timeStep().isNull()) { @@ -386,14 +386,14 @@ QList 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::uiText(channelName), channelName)); + options.push_back(caf::PdmOptionItemInfo(caf::AppEnum::uiText(channelName), channelName)); } } if (options.empty()) { - options.push_back(caf::PdmOptionItemInfo(caf::AppEnum::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE)); + options.push_back(caf::PdmOptionItemInfo(caf::AppEnum::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE)); } } else if (fieldNeedingOptions == &m_timeStep) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.h index 6d130e6a74..4096379f0e 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogRftCurve.h @@ -89,7 +89,7 @@ private: caf::PdmPtrField m_eclipseResultCase; caf::PdmField m_timeStep; caf::PdmField m_wellName; - caf::PdmField< caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelName > > m_wellLogChannelName; + caf::PdmField< caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelType > > m_wellLogChannelName; bool m_isUsingPseudoLength; };