#3393 Continous sensible tangent calculation for targets wo tangent constraint.

Using abs(90 -inclination) and inverse distance as weights.
Moved well path calculations into a separate class
This commit is contained in:
Jacob Støren
2018-09-28 14:06:56 +02:00
parent 71c36208c3
commit f4761b55ab
8 changed files with 415 additions and 13 deletions

View File

@@ -128,9 +128,12 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
{
cvf::ref<RigWellPath> wellPathGeometry = new RigWellPath;
if (activeWellTargets().size() < 2) return wellPathGeometry;
RiaLineArcWellPathCalculator wellPathCalculator = lineArcWellPathCalculator();
if (wellPathCalculator.lineArcEndpoints().size() < 2) return wellPathGeometry;
RiaPolyArcLineSampler arcLineSampler(wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints());
RiaPolyArcLineSampler arcLineSampler(startTangent(), lineArcEndpoints());
arcLineSampler.sampledPointsAndMDs(30,
false,
@@ -144,7 +147,10 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
//--------------------------------------------------------------------------------------------------
std::vector<RiaWellPlanCalculator::WellPlanSegment> RimWellPathGeometryDef::wellPlan() const
{
RiaWellPlanCalculator wpCalc(startTangent(), lineArcEndpoints());
RiaLineArcWellPathCalculator wellPathCalculator = lineArcWellPathCalculator();
RiaWellPlanCalculator wpCalc(wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints());
return wpCalc.wellPlan();
}
@@ -375,6 +381,7 @@ std::vector<RimWellPathTarget*> RimWellPathGeometryDef::activeWellTargets() cons
return active;
}
#if 0 // Kept for reference a bit longer
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -528,21 +535,47 @@ std::vector<cvf::Vec3d> RimWellPathGeometryDef::lineArcEndpoints() const
return endPoints;
}
#endif
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathGeometryDef::startTangent() const
RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator() const
{
std::vector<RimWellPathTarget*> wellTargets = activeWellTargets();
std::vector<RimWellPathTarget*> wellTargets = activeWellTargets();
if (!wellTargets.empty() && wellTargets[0]->targetType() == RimWellPathTarget::POINT_AND_TANGENT)
std::vector< RiaLineArcWellPathCalculator::WellTarget> targetDatas;
for (auto wellTarget : wellTargets)
{
return wellTargets[0]->tangent();
targetDatas.push_back(wellTarget->wellTargetData());
}
else
RiaLineArcWellPathCalculator wellPathCalculator(referencePointXyz(), targetDatas);
const std::vector<RiaLineArcWellPathCalculator::WellTargetStatus>& targetStatuses = wellPathCalculator.targetStatuses();
for ( size_t tIdx = 0 ; tIdx < wellTargets.size(); ++tIdx )
{
return { 0, 0, -1 };
wellTargets[tIdx]->flagRadius1AsIncorrect(false, 0 );
wellTargets[tIdx]->flagRadius2AsIncorrect(false, 0 );
if ( targetStatuses[tIdx].hasDerivedTangent )
{
wellTargets[tIdx]->setDerivedTangent(targetStatuses[tIdx].resultAzimuth, targetStatuses[tIdx].resultInclination);
}
if ( targetStatuses[tIdx].hasOverriddenRadius1 )
{
wellTargets[tIdx]->flagRadius1AsIncorrect(true, targetStatuses[tIdx].resultRadius1);
}
if ( targetStatuses[tIdx].hasOverriddenRadius2 )
{
wellTargets[tIdx]->flagRadius2AsIncorrect(true, targetStatuses[tIdx].resultRadius2);
}
}
return wellPathCalculator;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -26,6 +26,7 @@
#include "cafPdmPtrField.h"
#include "cafPdmChildArrayField.h"
#include "RiaWellPlanCalculator.h"
#include "RiaLineArcWellPathCalculator.h"
class RimWellPath;
@@ -88,8 +89,7 @@ private:
void initAfterRead() override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
std::vector<cvf::Vec3d> lineArcEndpoints() const;
cvf::Vec3d startTangent() const;
RiaLineArcWellPathCalculator lineArcWellPathCalculator() const;
private:
caf::PdmField<cvf::Vec3d> m_referencePointUtmXyd;

View File

@@ -89,6 +89,23 @@ void RimWellPathTarget::setDerivedTangent(double azimuth, double inclination)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaLineArcWellPathCalculator::WellTarget RimWellPathTarget::wellTargetData()
{
RiaLineArcWellPathCalculator::WellTarget targetData;
targetData.targetPointXYZ = targetPointXYZ();
targetData.isTangentConstrained = (targetType() == POINT_AND_TANGENT);
targetData.azimuth = azimuth();
targetData.inclination = inclination();
targetData.radius1 = radius1();
targetData.radius2 = radius2();
return targetData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -159,6 +176,8 @@ double RimWellPathTarget::radius1() const
// Degrees pr 10m
// Degrees pr 30m
if (fabs(m_dogleg1) < 1e-6) return std::numeric_limits<double>::infinity();
return 30.0/cvf::Math::toRadians(m_dogleg1);
}
@@ -172,6 +191,9 @@ double RimWellPathTarget::radius2() const
// Degrees pr 10m
// Degrees pr 30m
if (fabs(m_dogleg2) < 1e-6) return std::numeric_limits<double>::infinity();
return 30.0/cvf::Math::toRadians(m_dogleg2);
}

View File

@@ -24,6 +24,7 @@
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmCoreVec3d.h"
#include "RiaLineArcWellPathCalculator.h"
class RimWellPathTarget : public caf::PdmObject
{
@@ -38,6 +39,8 @@ public:
void setAsPointXYZAndTangentTarget(const cvf::Vec3d& point, double azimuth, double inclination);
void setDerivedTangent(double azimuth, double inclination);
RiaLineArcWellPathCalculator::WellTarget wellTargetData();
enum TargetTypeEnum { POINT_AND_TANGENT, POINT };
TargetTypeEnum targetType() const;
cvf::Vec3d targetPointXYZ() const;