#3864 Update and clamp valve positions to perforation interval when perforation interval changes.

This commit is contained in:
Gaute Lindkvist 2018-12-14 08:44:36 +01:00
parent 543b8fc1cc
commit 47bb14eb06
6 changed files with 82 additions and 35 deletions

View File

@ -1139,12 +1139,12 @@ void RicWellPathExportMswCompletionsImpl::assignSuperValveCompletions(
if (isAicd) if (isAicd)
{ {
superAICD.reset(new RicMswPerforationAICD(valveLabel)); superAICD = std::make_shared<RicMswPerforationAICD>(valveLabel);
superAICD->addSubSegment(subSegment); superAICD->addSubSegment(subSegment);
} }
else else
{ {
superICD.reset(new RicMswPerforationICD(valveLabel)); superICD = std::make_shared<RicMswPerforationICD>(valveLabel);
superICD->addSubSegment(subSegment); superICD->addSubSegment(subSegment);
} }
} }
@ -1152,14 +1152,14 @@ void RicWellPathExportMswCompletionsImpl::assignSuperValveCompletions(
{ {
QString valveLabel = QString("%1 #%2").arg("Combined Valve for segment").arg(nMainSegment + 2); QString valveLabel = QString("%1 #%2").arg("Combined Valve for segment").arg(nMainSegment + 2);
std::shared_ptr<RicMswSubSegment> subSegment(new RicMswSubSegment(overlapStart, overlapStart + 0.1, 0.0, 0.0)); std::shared_ptr<RicMswSubSegment> subSegment(new RicMswSubSegment(overlapStart, overlapStart + 0.1, 0.0, 0.0));
superICD.reset(new RicMswPerforationICD(valveLabel)); superICD = std::make_shared<RicMswPerforationICD>(valveLabel);
superICD->addSubSegment(subSegment); superICD->addSubSegment(subSegment);
} }
else if (overlap > 0.0 && (isAicd && !superAICD)) else if (overlap > 0.0 && (isAicd && !superAICD))
{ {
QString valveLabel = QString("%1 #%2").arg("Combined Valve for segment").arg(nMainSegment + 2); QString valveLabel = QString("%1 #%2").arg("Combined Valve for segment").arg(nMainSegment + 2);
std::shared_ptr<RicMswSubSegment> subSegment(new RicMswSubSegment(overlapStart, overlapStart + 0.1, 0.0, 0.0)); std::shared_ptr<RicMswSubSegment> subSegment(new RicMswSubSegment(overlapStart, overlapStart + 0.1, 0.0, 0.0));
superAICD.reset(new RicMswPerforationAICD(valveLabel)); superAICD = std::make_shared<RicMswPerforationAICD>(valveLabel);
superAICD->addSubSegment(subSegment); superAICD->addSubSegment(subSegment);
} }
@ -1216,11 +1216,11 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves(
std::shared_ptr<RicMswValveAccumulator> accumulator; std::shared_ptr<RicMswValveAccumulator> accumulator;
if (std::dynamic_pointer_cast<const RicMswPerforationICD>(superValve)) if (std::dynamic_pointer_cast<const RicMswPerforationICD>(superValve))
{ {
accumulator.reset(new RicMswICDAccumulator(unitSystem)); accumulator = std::make_shared<RicMswICDAccumulator>(unitSystem);
} }
else if (std::dynamic_pointer_cast<const RicMswPerforationAICD>(superValve)) else if (std::dynamic_pointer_cast<const RicMswPerforationAICD>(superValve))
{ {
accumulator.reset(new RicMswAICDAccumulator(unitSystem)); accumulator = std::make_shared<RicMswAICDAccumulator>(unitSystem);
} }
for (const RimPerforationInterval* interval : perforationIntervals) for (const RimPerforationInterval* interval : perforationIntervals)
@ -1260,7 +1260,7 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves(
for (auto regularValvePair : assignedRegularValves) for (auto regularValvePair : assignedRegularValves)
{ {
if (regularValvePair.second.size()) if (!regularValvePair.second.empty())
{ {
QStringList valveLabels; QStringList valveLabels;
for (std::pair<const RimWellPathValve*, size_t> regularValve : regularValvePair.second) for (std::pair<const RimWellPathValve*, size_t> regularValve : regularValvePair.second)
@ -1610,9 +1610,8 @@ std::vector<SubSegmentIntersectionInfo> SubSegmentIntersectionInfo::spiltInterse
if (!pathGeometry) return out; if (!pathGeometry) return out;
for (size_t i = 0; i < intersections.size(); i++) for (const auto& intersection : intersections)
{ {
const auto& intersection = intersections[i];
double segLen = intersection.endMD - intersection.startMD; double segLen = intersection.endMD - intersection.startMD;
int segCount = (int)std::trunc(segLen / maxSegmentLength) + 1; int segCount = (int)std::trunc(segLen / maxSegmentLength) + 1;
@ -1621,12 +1620,12 @@ std::vector<SubSegmentIntersectionInfo> SubSegmentIntersectionInfo::spiltInterse
if (segCount == 1) if (segCount == 1)
{ {
out.push_back(SubSegmentIntersectionInfo(intersection.globCellIndex, out.emplace_back(intersection.globCellIndex,
-intersection.startPoint.z(), -intersection.startPoint.z(),
-intersection.endPoint.z(), -intersection.endPoint.z(),
intersection.startMD, intersection.startMD,
intersection.endMD, intersection.endMD,
intersection.intersectionLengthsInCellCS)); intersection.intersectionLengthsInCellCS);
} }
else else
{ {
@ -1640,12 +1639,12 @@ std::vector<SubSegmentIntersectionInfo> SubSegmentIntersectionInfo::spiltInterse
currEndMd = currStartMd + effectiveMaxSegLen; currEndMd = currStartMd + effectiveMaxSegLen;
cvf::Vec3d segEndPoint = pathGeometry->interpolatedPointAlongWellPath(currEndMd); cvf::Vec3d segEndPoint = pathGeometry->interpolatedPointAlongWellPath(currEndMd);
out.push_back(SubSegmentIntersectionInfo(intersection.globCellIndex, out.emplace_back(intersection.globCellIndex,
lastTvd, lastTvd,
lasti ? -intersection.endPoint.z() : -segEndPoint.z(), lasti ? -intersection.endPoint.z() : -segEndPoint.z(),
currStartMd, currStartMd,
lasti ? intersection.endMD : currEndMd, lasti ? intersection.endMD : currEndMd,
intersection.intersectionLengthsInCellCS / segCount)); intersection.intersectionLengthsInCellCS / segCount);
currStartMd = currEndMd; currStartMd = currEndMd;
lastTvd = -segEndPoint.z(); lastTvd = -segEndPoint.z();

View File

@ -67,6 +67,21 @@ RimMultipleValveLocations::RimMultipleValveLocations()
m_locationOfValves.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); m_locationOfValves.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultipleValveLocations::perforationIntervalUpdated()
{
double existingRangeStart = m_rangeStart();
double existingRangeEnd = m_rangeEnd();
m_rangeStart = cvf::Math::clamp(m_rangeStart(), perforationStartMD(), perforationEndMD());
m_rangeEnd = cvf::Math::clamp(m_rangeEnd(), perforationStartMD(), perforationEndMD());
if (existingRangeStart != m_rangeStart() || existingRangeEnd != m_rangeEnd())
{
computeRangesAndLocations();
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -295,8 +310,8 @@ void RimMultipleValveLocations::fieldChangedByUi(const caf::PdmFieldHandle* chan
changedField == &m_rangeValveSpacing) changedField == &m_rangeValveSpacing)
{ {
recomputeLocations = true; recomputeLocations = true;
m_rangeStart = cvf::Math::clamp(m_rangeStart(), rangeMin(), rangeMax()); m_rangeStart = cvf::Math::clamp(m_rangeStart(), perforationStartMD(), perforationEndMD());
m_rangeEnd = cvf::Math::clamp(m_rangeEnd(), rangeMin(), rangeMax()); m_rangeEnd = cvf::Math::clamp(m_rangeEnd(), perforationStartMD(), perforationEndMD());
} }
if (changedField == &m_rangeValveSpacing) if (changedField == &m_rangeValveSpacing)
@ -376,7 +391,7 @@ double RimMultipleValveLocations::minimumSpacingMeters() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::rangeMin() const double RimMultipleValveLocations::perforationStartMD() const
{ {
const RimPerforationInterval* perfInterval = nullptr; const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType(perfInterval); this->firstAncestorOrThisOfType(perfInterval);
@ -391,7 +406,7 @@ double RimMultipleValveLocations::rangeMin() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::rangeMax() const double RimMultipleValveLocations::perforationEndMD() const
{ {
const RimPerforationInterval* perfInterval = nullptr; const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType(perfInterval); this->firstAncestorOrThisOfType(perfInterval);

View File

@ -41,6 +41,7 @@ public:
public: public:
RimMultipleValveLocations(); RimMultipleValveLocations();
void perforationIntervalUpdated();
double measuredDepth(size_t valveIndex) const; double measuredDepth(size_t valveIndex) const;
double rangeStart() const; double rangeStart() const;
double rangeEnd() const; double rangeEnd() const;
@ -62,8 +63,8 @@ protected:
private: private:
int rangeCountFromSpacing() const; int rangeCountFromSpacing() const;
double minimumSpacingMeters() const; double minimumSpacingMeters() const;
double rangeMin() const; double perforationStartMD() const;
double rangeMax() const; double perforationEndMD() const;
static std::vector<double> locationsFromStartSpacingAndCount(double start, double spacing, size_t count); static std::vector<double> locationsFromStartSpacingAndCount(double start, double spacing, size_t count);
private: private:

View File

@ -314,6 +314,15 @@ void RimPerforationInterval::fieldChangedByUi(const caf::PdmFieldHandle* changed
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue) const QVariant& newValue)
{ {
if (changedField == &m_startMD ||
changedField == &m_endMD)
{
for (RimWellPathValve* valve : m_valves())
{
valve->perforationIntervalUpdated();
}
}
this->updateAllReferringTracks(); this->updateAllReferringTracks();
RimProject* proj = nullptr; RimProject* proj = nullptr;

View File

@ -69,6 +69,25 @@ RimWellPathValve::~RimWellPathValve()
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathValve::perforationIntervalUpdated()
{
if (m_type() == RiaDefines::ICV)
{
const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType(perfInterval);
double startMD = perfInterval->startMD();
double endMD = perfInterval->endMD();
m_measuredDepth = cvf::Math::clamp(m_measuredDepth(), startMD, endMD);
}
else
{
m_multipleValveLocations->perforationIntervalUpdated();
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -436,19 +455,22 @@ void RimWellPathValve::defineEditorAttribute(const caf::PdmFieldHandle* field, Q
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPathValve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/) void RimWellPathValve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{ {
QString fullName = componentLabel() + QString(" %1").arg(m_measuredDepth()); if ( m_type() == RiaDefines::ICV )
this->setName(fullName);
if ( m_type() == RiaDefines::ICD )
{
this->setUiIcon(QIcon(":/ICDValve16x16.png"));
}
else if ( m_type() == RiaDefines::ICV )
{ {
this->setUiIcon(QIcon(":/ICVValve16x16.png")); this->setUiIcon(QIcon(":/ICVValve16x16.png"));
QString fullName = QString("%1: %2").arg(componentLabel()).arg(m_measuredDepth());
this->setName(fullName);
}
else if ( m_type() == RiaDefines::ICD )
{
this->setUiIcon(QIcon(":/ICDValve16x16.png"));
QString fullName = QString("%1: %2 - %3").arg(componentLabel()).arg(m_multipleValveLocations->rangeStart()).arg(m_multipleValveLocations->rangeEnd());
this->setName(fullName);
} }
else if ( m_type() == RiaDefines::AICD ) else if ( m_type() == RiaDefines::AICD )
{ {
this->setUiIcon(QIcon(":/AICDValve16x16.png")); this->setUiIcon(QIcon(":/AICDValve16x16.png"));
QString fullName = QString("%1: %2 - %3").arg(componentLabel()).arg(m_multipleValveLocations->rangeStart()).arg(m_multipleValveLocations->rangeEnd());
this->setName(fullName);
} }
} }

View File

@ -44,6 +44,7 @@ public:
RimWellPathValve(); RimWellPathValve();
~RimWellPathValve() override; ~RimWellPathValve() override;
void perforationIntervalUpdated();
void setMeasuredDepthAndCount(double startMD, double spacing, int valveCount); void setMeasuredDepthAndCount(double startMD, double spacing, int valveCount);
void multipleValveGeometryUpdated(); void multipleValveGeometryUpdated();
std::vector<double> valveLocations() const; std::vector<double> valveLocations() const;