#1947 RFT/PLT Plot: Add reader access in curve

This commit is contained in:
Unknown 2017-10-05 09:29:19 +02:00
parent 24d59d7f84
commit fd785044eb
7 changed files with 300 additions and 2 deletions

View File

@ -62,6 +62,11 @@ void RifReaderEclipseRft::open()
m_eclipseRftAddresses.push_back(addressPressure);
m_rftAddressToLibeclNodeIdx[addressPressure] = i;
wellLogChannelName = "DEPTH";
RifEclipseRftAddress addressDepth(wellName, timeStep, wellLogChannelName);
m_eclipseRftAddresses.push_back(addressDepth);
m_rftAddressToLibeclNodeIdx[addressDepth] = i;
if (ecl_rft_node_is_RFT(node))
{
wellLogChannelName = "SWAT";
@ -131,7 +136,14 @@ void RifReaderEclipseRft::values(const RifEclipseRftAddress& rftAddress, std::ve
std::string wellLogChannelName = rftAddress.wellLogChannelName();
if (wellLogChannelName == "PRESSURE")
if (wellLogChannelName == "DEPTH")
{
for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{
values->push_back(ecl_rft_node_iget_depth(node, i));
}
}
else if (wellLogChannelName == "PRESSURE")
{
for (int i = 0; i < ecl_rft_node_get_size(node); i++)
{

View File

@ -22,13 +22,16 @@
#include <string>
#include <vector>
#include "cvfBase.h"
#include "cvfObject.h"
class RifEclipseRftAddress;
//==================================================================================================
//
//
//==================================================================================================
class RifReaderEclipseRft
class RifReaderEclipseRft : public cvf::Object
{
public:
RifReaderEclipseRft(const std::string& fileName);

View File

@ -75,6 +75,7 @@ ${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.h
${CEE_CURRENT_LIST_DIR}RimWellLogFile.h
${CEE_CURRENT_LIST_DIR}RimWellLogFileChannel.h
${CEE_CURRENT_LIST_DIR}RimWellLogFileCurve.h
${CEE_CURRENT_LIST_DIR}RimWellLogRftCurve.h
${CEE_CURRENT_LIST_DIR}RimIntersection.h
${CEE_CURRENT_LIST_DIR}RimIntersectionCollection.h
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.h
@ -171,6 +172,7 @@ ${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogFile.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogFileChannel.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogFileCurve.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogRftCurve.cpp
${CEE_CURRENT_LIST_DIR}RimIntersection.cpp
${CEE_CURRENT_LIST_DIR}RimIntersectionCollection.cpp
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.cpp

View File

@ -24,6 +24,7 @@
#include "RifEclipseOutputFileTools.h"
#include "RifReaderEclipseOutput.h"
#include "RifReaderEclipseRft.h"
#include "RifReaderMockModel.h"
#include "RifReaderSettings.h"
@ -50,6 +51,10 @@
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <string>
#include <fstream>
CAF_PDM_SOURCE_INIT(RimEclipseResultCase, "EclipseCase");
//--------------------------------------------------------------------------------------------------
@ -195,6 +200,14 @@ bool RimEclipseResultCase::importGridAndResultMetaData(bool showTimeStepFilter)
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
QString rftFile = caseFileName() + ".RFT";
std::string rftFileStdString = rftFile.toStdString();
if (std::ifstream(rftFileStdString.c_str()))
{
m_readerEclipseRft = new RifReaderEclipseRft(rftFileStdString);
}
if (m_flowDiagSolutions.size() == 0)
{
m_flowDiagSolutions.push_back(new RimFlowDiagSolution());
@ -498,6 +511,14 @@ RigFlowDiagSolverInterface* RimEclipseResultCase::flowDiagSolverInterface()
return m_flowDagSolverInterface.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderEclipseRft* RimEclipseResultCase::rftReader()
{
return m_readerEclipseRft.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -26,6 +26,7 @@ class RifReaderInterface;
class RigMainGrid;
class RimFlowDiagSolution;
class RigFlowDiagSolverInterface;
class RifReaderEclipseRft;
//==================================================================================================
//
@ -62,6 +63,8 @@ public:
std::vector<RimFlowDiagSolution*> flowDiagSolutions();
RigFlowDiagSolverInterface* flowDiagSolverInterface();
RifReaderEclipseRft* rftReader();
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
@ -78,6 +81,8 @@ private:
cvf::ref<RigFlowDiagSolverInterface> m_flowDagSolverInterface;
cvf::ref<RifReaderEclipseRft> m_readerEclipseRft;
// Fields:
caf::PdmField<QString> caseFileName;
caf::PdmChildArrayField<RimFlowDiagSolution*> m_flowDiagSolutions;

View File

@ -0,0 +1,182 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellLogRftCurve.h"
#include "RimEclipseResultCase.h"
#include "RimTools.h"
#include "RifReaderEclipseRft.h"
#include "cafPdmObject.h"
#include "cvfAssert.h"
CAF_PDM_SOURCE_INIT(RimWellLogRftCurve, "WellLogRftCurve");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurve::RimWellLogRftCurve()
{
CAF_PDM_InitObject("Well Log RFT Curve", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_eclipseResultCase, "CurveEclipseResultCase", "Eclipse Result Case", "", "", "");
m_eclipseResultCase.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_timeStep, "TimeStep", "Time Step", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "WellLogChannelName", "Well Property", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurve::~RimWellLogRftCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogRftCurve::wellName() const
{
//return QString(m_eclipseRftAddress->wellName().c_str());
return m_wellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogRftCurve::wellLogChannelName() const
{
//return QString(m_eclipseRftAddress->wellLogChannelName().c_str());
return m_wellLogChannelName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimWellLogRftCurve::yValues()
{
RifReaderEclipseRft* reader = rftReader();
std::vector<double> values;
if (!reader) return values;
RifEclipseRftAddress address(m_wellName().toStdString(), m_timeStep, m_wellLogChannelName().toStdString());
reader->values(address, &values);
return values;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimWellLogRftCurve::xValues()
{
RifReaderEclipseRft* reader = rftReader();
std::vector<double> values;
if (!reader) return values;
RifEclipseRftAddress address(m_wellName().toStdString(), m_timeStep, "DEPTH");
reader->values(address, &values);
return values;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogRftCurve::currentTimeStep() const
{
return m_timeStep;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::setEclipseResultCase(RimEclipseResultCase* eclipseResultCase)
{
m_eclipseResultCase = eclipseResultCase;
//clearGeneratedSimWellPaths();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultCase* RimWellLogRftCurve::eclipseResultCase() const
{
return m_eclipseResultCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogRftCurve::createCurveAutoName()
{
QString name = wellName() + ": " + wellLogChannelName();
return name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
options = RimWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
if (options.size() > 0) return options;
if (fieldNeedingOptions == &m_eclipseResultCase)
{
RimTools::caseOptionItems(&options);
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderEclipseRft* RimWellLogRftCurve::rftReader() const
{
if (!m_eclipseResultCase()) return nullptr;
return m_eclipseResultCase()->rftReader();
}

View File

@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellLogCurve.h"
#include "RifEclipseRftAddress.h"
#include "cvfObject.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
class RimEclipseResultCase;
class RifReaderEclipseRft;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogRftCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogRftCurve();
virtual ~RimWellLogRftCurve();
virtual QString wellName() const override;
virtual QString wellLogChannelName() const override;
std::vector<double> yValues();
std::vector<double> xValues();
int currentTimeStep() const;
void setEclipseResultCase(RimEclipseResultCase* eclipseResultCase);
RimEclipseResultCase* eclipseResultCase() const;
protected:
// Overrides from RimWellLogPlotCurve
virtual QString createCurveAutoName() override;
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
private:
RifReaderEclipseRft* rftReader() const;
private:
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmField<time_t> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField<QString> m_wellLogChannelName;
};