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:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user