mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2127 Clamp sim well branch index to valid range
This commit is contained in:
parent
0e5e88008a
commit
46bad03c4a
@ -106,3 +106,23 @@ void RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaSimWellBranchTools::clampBranchIndex(const QString& simWellName, int branchIndexValue, bool branchDetection)
|
||||
{
|
||||
auto branches = RiaSimWellBranchTools::simulationWellBranches(simWellName, branchDetection);
|
||||
|
||||
if (branches.size() == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (branchIndexValue >= branches.size())
|
||||
{
|
||||
branchIndexValue = static_cast<int>(branches.size()) - 1;
|
||||
}
|
||||
|
||||
return branchIndexValue;
|
||||
}
|
||||
|
@ -44,11 +44,14 @@ public:
|
||||
static QList<caf::PdmOptionItemInfo>
|
||||
valueOptionsForBranchIndexField(const std::vector<const RigWellPath*>& simulationWellPaths);
|
||||
|
||||
static void appendSimWellBranchFieldsIfRequiredFromWellName(caf::PdmUiOrdering* uiOrdering, const QString& wellPathOrSimWellName,
|
||||
const caf::PdmField<bool>& branchDetectionField,
|
||||
const caf::PdmField<int>& branchIndexField);
|
||||
static void appendSimWellBranchFieldsIfRequiredFromWellName(caf::PdmUiOrdering* uiOrdering,
|
||||
const QString& wellPathOrSimWellName,
|
||||
const caf::PdmField<bool>& branchDetectionField,
|
||||
const caf::PdmField<int>& branchIndexField);
|
||||
|
||||
static void appendSimWellBranchFieldsIfRequiredFromSimWellName(caf::PdmUiOrdering* uiOrdering, const QString& simWellName,
|
||||
const caf::PdmField<bool>& branchDetectionField,
|
||||
const caf::PdmField<int>& branchIndexField);
|
||||
const caf::PdmField<bool>& branchDetectionField,
|
||||
const caf::PdmField<int>& branchIndexField);
|
||||
|
||||
static int clampBranchIndex(const QString& simWellName, int branchIndexValue, bool branchDetection);
|
||||
};
|
||||
|
@ -704,6 +704,9 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
else if (changedField == &m_branchIndex ||
|
||||
changedField == &m_branchDetection)
|
||||
{
|
||||
const QString simWellName = associatedSimWellName();
|
||||
m_branchIndex = RiaSimWellBranchTools::clampBranchIndex(simWellName, m_branchIndex, m_branchDetection);
|
||||
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
|
||||
|
@ -581,12 +581,11 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
|
||||
else
|
||||
{
|
||||
curveDataGroup->add(&m_simWellName);
|
||||
curveDataGroup->add(&m_branchDetection);
|
||||
|
||||
if ( simulationWellBranches().size() > 1 )
|
||||
{
|
||||
curveDataGroup->add(&m_branchIndex);
|
||||
}
|
||||
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName(curveDataGroup,
|
||||
m_simWellName,
|
||||
m_branchDetection,
|
||||
m_branchIndex);
|
||||
}
|
||||
|
||||
if (eclipseCase)
|
||||
|
@ -467,6 +467,10 @@ void RimWellLogRftCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel
|
||||
else if (changedField == &m_branchDetection ||
|
||||
changedField == &m_branchIndex)
|
||||
{
|
||||
QString simWellName = RimWellPlotTools::simWellName(m_wellName);
|
||||
|
||||
m_branchIndex = RiaSimWellBranchTools::clampBranchIndex(simWellName, m_branchIndex, m_branchDetection);
|
||||
|
||||
updateWellChannelNameAndTimeStep();
|
||||
this->loadDataAndUpdate(true);
|
||||
}
|
||||
|
@ -281,6 +281,8 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
else if (changedField == &m_formationBranchIndex ||
|
||||
changedField == &m_formationBranchDetection)
|
||||
{
|
||||
m_formationBranchIndex = RiaSimWellBranchTools::clampBranchIndex(m_formationSimWellName, m_formationBranchIndex, m_formationBranchDetection);
|
||||
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user