mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
Update WellPathGeometryTools after review
This commit is contained in:
parent
686d3f0189
commit
eacd457483
@ -94,10 +94,9 @@ std::vector<double> RigWellPathGeometryTools::interpolateMdFromTvd(const std::ve
|
||||
std::vector<double> interpolatedMdValues;
|
||||
interpolatedMdValues.reserve(tvdValuesToInterpolateFrom.size());
|
||||
|
||||
|
||||
QwtSpline spline = createSpline(originalMdValues, originalTvdValues);
|
||||
QwtSpline spline = createSpline(originalMdValues, originalTvdValues);
|
||||
std::vector<int> segmentStartIndices = findSplineSegmentsContainingRoots(spline, tvdValuesToInterpolateFrom);
|
||||
|
||||
std::vector<int> segmentStartIndices = findSplineSegmentsContainingRoots(spline, originalMdValues, originalTvdValues, tvdValuesToInterpolateFrom);
|
||||
for (size_t i = 0; i < segmentStartIndices.size(); ++i)
|
||||
{
|
||||
double currentTVDValue = tvdValuesToInterpolateFrom[i];
|
||||
@ -112,16 +111,15 @@ std::vector<double> RigWellPathGeometryTools::interpolateMdFromTvd(const std::ve
|
||||
startMD = spline.points()[startIndex].x();
|
||||
endMD = spline.points().back().y();
|
||||
|
||||
double mdDiff = 0.0;
|
||||
if (interpolatedMdValues.size() > 1)
|
||||
{
|
||||
mdDiff = interpolatedMdValues[i - 1] - interpolatedMdValues[i - 2];
|
||||
}
|
||||
|
||||
if (endIndex < spline.points().size())
|
||||
{
|
||||
if (!interpolatedMdValues.empty())
|
||||
{
|
||||
double mdDiff = 0.0;
|
||||
if (interpolatedMdValues.size() > 1)
|
||||
{
|
||||
mdDiff = interpolatedMdValues[i - 1] - interpolatedMdValues[i - 2];
|
||||
}
|
||||
startMD = std::max(startMD, interpolatedMdValues.back() + 0.1 * mdDiff);
|
||||
}
|
||||
endMD = spline.points()[endIndex].x();
|
||||
@ -136,16 +134,14 @@ std::vector<double> RigWellPathGeometryTools::interpolateMdFromTvd(const std::ve
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RigWellPathGeometryTools::findSplineSegmentsContainingRoots(const QwtSpline& spline, const std::vector<double>& originalMdValues, const std::vector<double>& originalTvdValues, const std::vector<double>& tvdValuesToInterpolateFrom)
|
||||
std::vector<int> RigWellPathGeometryTools::findSplineSegmentsContainingRoots(const QwtSpline& spline, const std::vector<double>& tvdValuesToInterpolateFrom)
|
||||
{
|
||||
std::vector<int> segmentStartIndices;
|
||||
segmentStartIndices.reserve(tvdValuesToInterpolateFrom.size());
|
||||
|
||||
int lastSplineStartIndex = 0;
|
||||
for (std::vector<double>::const_iterator it = tvdValuesToInterpolateFrom.begin(); it != tvdValuesToInterpolateFrom.end(); ++it)
|
||||
for (double tvdValue : tvdValuesToInterpolateFrom)
|
||||
{
|
||||
double tvdValue = *it;
|
||||
|
||||
int currentSplineStartIndex = lastSplineStartIndex;
|
||||
|
||||
bool foundMatch = false;
|
||||
@ -266,7 +262,7 @@ cvf::Vec3d RigWellPathGeometryTools::estimateDominantDirectionInXYPlane(const st
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
/// Golden-section minimization: https://en.wikipedia.org/wiki/Golden-section_search
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellPathGeometryTools::solveForX(const QwtSpline& spline, double minX, double maxX, double y)
|
||||
{
|
||||
@ -325,6 +321,8 @@ QwtSpline RigWellPathGeometryTools::createSpline(const std::vector<double>& orig
|
||||
QPolygonF splinePoints = curveFitter.fitCurve(polygon);
|
||||
|
||||
// Extend spline from 0.0 to a large value for MD
|
||||
// This is to force a specific and known extrapolation.
|
||||
// Otherwise we get an undefined and unknown extrapolation.
|
||||
{
|
||||
double x1 = splinePoints[0].x();
|
||||
double x2 = splinePoints[1].x();
|
||||
|
@ -29,7 +29,7 @@
|
||||
class RigWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigWellPathGeometryTools
|
||||
{
|
||||
@ -41,18 +41,20 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
static std::vector<cvf::Vec3d> calculateLineSegmentNormals(const std::vector<cvf::Vec3d>& vertices,
|
||||
double angle);
|
||||
static std::vector<double> interpolateMdFromTvd(const std::vector<double>& originalMdValues, const std::vector<double>& originalTvdValues, const std::vector<double>& tvdValuesToInterpolateFrom);
|
||||
static std::vector<cvf::Vec3d> calculateLineSegmentNormals(const std::vector<cvf::Vec3d>& vertices, double angle);
|
||||
static std::vector<double> interpolateMdFromTvd(const std::vector<double>& originalMdValues,
|
||||
const std::vector<double>& originalTvdValues,
|
||||
const std::vector<double>& tvdValuesToInterpolateFrom);
|
||||
|
||||
private:
|
||||
static std::vector<cvf::Vec3d> interpolateUndefinedNormals(const cvf::Vec3d& planeNormal,
|
||||
static std::vector<cvf::Vec3d> interpolateUndefinedNormals(const cvf::Vec3d& planeNormal,
|
||||
const std::vector<cvf::Vec3d>& normals,
|
||||
const std::vector<cvf::Vec3d>& vertices);
|
||||
static cvf::Vec3d estimateDominantDirectionInXYPlane(const std::vector<cvf::Vec3d>& vertices);
|
||||
static cvf::Vec3d estimateDominantDirectionInXYPlane(const std::vector<cvf::Vec3d>& vertices);
|
||||
|
||||
static double solveForX(const QwtSpline& spline, double minX, double maxX, double y);
|
||||
|
||||
static QwtSpline createSpline(const std::vector<double>& originalMdValues, const std::vector<double>& originalTvdValues);
|
||||
static std::vector<int> findSplineSegmentsContainingRoots(const QwtSpline& spline, const std::vector<double>& originalMdValues, const std::vector<double>& originalTvdValues, const std::vector<double>& tvdValuesToInterpolateFrom);
|
||||
static std::vector<int> findSplineSegmentsContainingRoots(const QwtSpline& spline,
|
||||
const std::vector<double>& tvdValuesToInterpolateFrom);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user