#2127 Sim Well Branches : Add branch detection and branc index to RtfCurve

This commit is contained in:
Magne Sjaastad
2017-12-08 08:38:55 +01:00
parent 1841379e64
commit 9ef040d891
5 changed files with 80 additions and 21 deletions

View File

@@ -164,6 +164,17 @@ bool RimWellPlotTools::hasFlowData(RimWellPath* wellPath)
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::isWellPath(const QString& wellName)
{
RimProject* proj = RiaApplication::instance()->project();
RimWellPath* wellPath = proj->wellPathByName(wellName);
return wellPath != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -79,6 +79,7 @@ public:
// others
static bool hasFlowData(const RimWellLogFile* wellLogFile);
static bool isWellPath(const QString& wellName);
// Both
static std::vector<RimEclipseResultCase*> gridCasesForWell(const QString& simWellName);

View File

@@ -489,6 +489,7 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
RifEclipseRftAddress address(simWellName, curveDefToAdd.timeStep(), RifEclipseRftAddress::PRESSURE);
curve->setRftAddress(address);
curve->setZOrder(1);
curve->setSimWellBranchData(m_branchDetection, m_branchIndex);
applyCurveAppearance(curve);
}

View File

@@ -23,14 +23,8 @@
#include "RiaEclipseUnitTools.h"
#include "RiaSimWellBranchTools.h"
#include "RimEclipseResultCase.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RifEclipseRftAddress.h"
#include "RifReaderEclipseRft.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseWellLogExtractor.h"
@@ -39,15 +33,21 @@
#include "RigWellPath.h"
#include "RigWellPathIntersectionTools.h"
#include "RimEclipseResultCase.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimWellPlotTools.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiuWellLogTrack.h"
#include "RifEclipseRftAddress.h"
#include "RifReaderEclipseRft.h"
#include "cafPdmObject.h"
#include "cafVecIjk.h"
#include "cvfAssert.h"
#include <qwt_plot.h>
@@ -90,6 +90,9 @@ RimWellLogRftCurve::RimWellLogRftCurve()
CAF_PDM_InitFieldNoDefault(&m_timeStep, "TimeStep", "Time Step", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", "");
CAF_PDM_InitField(&m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", "");
CAF_PDM_InitField(&m_branchDetection, "BranchDetection", true, "Branch Detection", "",
"Compute branches based on how simulation well cells are organized", "");
CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "WellLogChannelName", "Well Property", "", "", "");
@@ -230,6 +233,15 @@ void RimWellLogRftCurve::updateWellChannelNameAndTimeStep()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::setSimWellBranchData(bool branchDetection, int branchIndex)
{
m_branchDetection = branchDetection;
m_branchIndex = branchIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -341,6 +353,16 @@ void RimWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderi
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_eclipseResultCase);
curveDataGroup->add(&m_wellName);
if (!RimWellPlotTools::isWellPath(m_wellName))
{
curveDataGroup->add(&m_branchDetection);
if (RiaSimWellBranchTools::simulationWellBranches(RimWellPlotTools::simWellName(m_wellName), m_branchDetection).size() > 1)
{
curveDataGroup->add(&m_branchIndex);
}
}
curveDataGroup->add(&m_wellLogChannelName);
curveDataGroup->add(&m_timeStep);
@@ -350,6 +372,8 @@ void RimWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderi
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup);
uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
@@ -412,6 +436,13 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const ca
options.push_back(caf::PdmOptionItemInfo("None", QDateTime()));
}
else if (fieldNeedingOptions == &m_branchIndex)
{
auto simulationWellBranches =
RiaSimWellBranchTools::simulationWellBranches(RimWellPlotTools::simWellName(m_wellName), m_branchDetection);
options = RiaSimWellBranchTools::valueOptionsForBranchIndexField(simulationWellBranches);
}
return options;
}
@@ -437,6 +468,12 @@ void RimWellLogRftCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel
updateWellChannelNameAndTimeStep();
this->loadDataAndUpdate(true);
}
else if (changedField == &m_branchDetection ||
changedField == &m_branchIndex)
{
updateWellChannelNameAndTimeStep();
this->loadDataAndUpdate(true);
}
else if (changedField == &m_wellLogChannelName)
{
if (m_wellLogChannelName == RifEclipseRftAddress::NONE)
@@ -485,10 +522,16 @@ RigEclipseWellLogExtractor* RimWellLogRftCurve::extractor()
if (!eclExtractor)
{
std::vector<const RigWellPath*> wellPaths = RiaSimWellBranchTools::simulationWellBranches(m_wellName(), true);
QString simWellName = RimWellPlotTools::simWellName(m_wellName);
std::vector<const RigWellPath*> wellPaths = RiaSimWellBranchTools::simulationWellBranches(simWellName, m_branchDetection);
if (wellPaths.size() == 0) return nullptr;
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor(m_wellName(), QString("Find or create sim well extractor"), wellPaths[0], m_eclipseResultCase->eclipseCaseData());
auto wellPathBranch = wellPaths[m_branchIndex];
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor(simWellName,
QString("Find or create sim well extractor"),
wellPathBranch,
m_eclipseResultCase->eclipseCaseData());
m_isUsingPseudoLength = true;
}

View File

@@ -60,6 +60,8 @@ public:
void setDefaultAddress(QString wellName);
void updateWellChannelNameAndTimeStep();
void setSimWellBranchData(bool branchDetection, int branchIndex);
protected:
// Overrides from RimWellLogPlotCurve
virtual QString createCurveAutoName() override;
@@ -84,12 +86,13 @@ private:
std::vector<double> measuredDepthValues();
private:
std::map<size_t, size_t> m_idxInWellPathToIdxInRftFile;
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_branchIndex;
caf::PdmField<bool> m_branchDetection;
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField< caf::AppEnum< RifEclipseRftAddress::RftWellLogChannelType > > m_wellLogChannelName;
bool m_isUsingPseudoLength;
std::map<size_t, size_t> m_idxInWellPathToIdxInRftFile;
bool m_isUsingPseudoLength;
caf::PdmField<caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>> m_wellLogChannelName;
};