#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)
{
superAICD.reset(new RicMswPerforationAICD(valveLabel));
superAICD = std::make_shared<RicMswPerforationAICD>(valveLabel);
superAICD->addSubSegment(subSegment);
}
else
{
superICD.reset(new RicMswPerforationICD(valveLabel));
superICD = std::make_shared<RicMswPerforationICD>(valveLabel);
superICD->addSubSegment(subSegment);
}
}
@ -1152,14 +1152,14 @@ void RicWellPathExportMswCompletionsImpl::assignSuperValveCompletions(
{
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));
superICD.reset(new RicMswPerforationICD(valveLabel));
superICD = std::make_shared<RicMswPerforationICD>(valveLabel);
superICD->addSubSegment(subSegment);
}
else if (overlap > 0.0 && (isAicd && !superAICD))
{
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));
superAICD.reset(new RicMswPerforationAICD(valveLabel));
superAICD = std::make_shared<RicMswPerforationAICD>(valveLabel);
superAICD->addSubSegment(subSegment);
}
@ -1216,11 +1216,11 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves(
std::shared_ptr<RicMswValveAccumulator> accumulator;
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))
{
accumulator.reset(new RicMswAICDAccumulator(unitSystem));
accumulator = std::make_shared<RicMswAICDAccumulator>(unitSystem);
}
for (const RimPerforationInterval* interval : perforationIntervals)
@ -1260,7 +1260,7 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves(
for (auto regularValvePair : assignedRegularValves)
{
if (regularValvePair.second.size())
if (!regularValvePair.second.empty())
{
QStringList valveLabels;
for (std::pair<const RimWellPathValve*, size_t> regularValve : regularValvePair.second)
@ -1610,9 +1610,8 @@ std::vector<SubSegmentIntersectionInfo> SubSegmentIntersectionInfo::spiltInterse
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;
int segCount = (int)std::trunc(segLen / maxSegmentLength) + 1;
@ -1621,12 +1620,12 @@ std::vector<SubSegmentIntersectionInfo> SubSegmentIntersectionInfo::spiltInterse
if (segCount == 1)
{
out.push_back(SubSegmentIntersectionInfo(intersection.globCellIndex,
-intersection.startPoint.z(),
-intersection.endPoint.z(),
intersection.startMD,
intersection.endMD,
intersection.intersectionLengthsInCellCS));
out.emplace_back(intersection.globCellIndex,
-intersection.startPoint.z(),
-intersection.endPoint.z(),
intersection.startMD,
intersection.endMD,
intersection.intersectionLengthsInCellCS);
}
else
{
@ -1640,12 +1639,12 @@ std::vector<SubSegmentIntersectionInfo> SubSegmentIntersectionInfo::spiltInterse
currEndMd = currStartMd + effectiveMaxSegLen;
cvf::Vec3d segEndPoint = pathGeometry->interpolatedPointAlongWellPath(currEndMd);
out.push_back(SubSegmentIntersectionInfo(intersection.globCellIndex,
lastTvd,
lasti ? -intersection.endPoint.z() : -segEndPoint.z(),
currStartMd,
lasti ? intersection.endMD : currEndMd,
intersection.intersectionLengthsInCellCS / segCount));
out.emplace_back(intersection.globCellIndex,
lastTvd,
lasti ? -intersection.endPoint.z() : -segEndPoint.z(),
currStartMd,
lasti ? intersection.endMD : currEndMd,
intersection.intersectionLengthsInCellCS / segCount);
currStartMd = currEndMd;
lastTvd = -segEndPoint.z();

View File

@ -67,6 +67,21 @@ RimMultipleValveLocations::RimMultipleValveLocations()
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)
{
recomputeLocations = true;
m_rangeStart = cvf::Math::clamp(m_rangeStart(), rangeMin(), rangeMax());
m_rangeEnd = cvf::Math::clamp(m_rangeEnd(), rangeMin(), rangeMax());
m_rangeStart = cvf::Math::clamp(m_rangeStart(), perforationStartMD(), perforationEndMD());
m_rangeEnd = cvf::Math::clamp(m_rangeEnd(), perforationStartMD(), perforationEndMD());
}
if (changedField == &m_rangeValveSpacing)
@ -376,7 +391,7 @@ double RimMultipleValveLocations::minimumSpacingMeters() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::rangeMin() const
double RimMultipleValveLocations::perforationStartMD() const
{
const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType(perfInterval);
@ -391,7 +406,7 @@ double RimMultipleValveLocations::rangeMin() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::rangeMax() const
double RimMultipleValveLocations::perforationEndMD() const
{
const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType(perfInterval);

View File

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

View File

@ -314,6 +314,15 @@ void RimPerforationInterval::fieldChangedByUi(const caf::PdmFieldHandle* changed
const QVariant& oldValue,
const QVariant& newValue)
{
if (changedField == &m_startMD ||
changedField == &m_endMD)
{
for (RimWellPathValve* valve : m_valves())
{
valve->perforationIntervalUpdated();
}
}
this->updateAllReferringTracks();
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 /*= ""*/)
{
QString fullName = componentLabel() + QString(" %1").arg(m_measuredDepth());
this->setName(fullName);
if ( m_type() == RiaDefines::ICD )
{
this->setUiIcon(QIcon(":/ICDValve16x16.png"));
}
else if ( m_type() == RiaDefines::ICV )
if ( m_type() == RiaDefines::ICV )
{
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 )
{
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() override;
void perforationIntervalUpdated();
void setMeasuredDepthAndCount(double startMD, double spacing, int valveCount);
void multipleValveGeometryUpdated();
std::vector<double> valveLocations() const;