mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
RigWellPath::interpolatedVectorValuesAlongWellPath indexed vectorValuesAlongWellPath.at( vxIdx - 1 ) when no measured depths were present, causing an out of range exception and terminate. Return cvf::Vec3d::UNDEFINED for empty geometry, matching tangentAlongWellPath. RimWellPathFracture keeps the zero anchor position when the point is undefined.
54 lines
2.3 KiB
C++
54 lines
2.3 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2026 Equinor ASA
|
|
//
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
//
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "Well/RigWellPath.h"
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
/// A well path without geometry must not throw, and must report the point as undefined
|
|
//--------------------------------------------------------------------------------------------------
|
|
TEST( RigWellPathTest, InterpolatedPointForEmptyGeometry )
|
|
{
|
|
RigWellPath wellPath;
|
|
|
|
cvf::Vec3d point = wellPath.interpolatedPointAlongWellPath( 100.0 );
|
|
EXPECT_TRUE( point.isUndefined() );
|
|
|
|
double horizontalLength = -1.0;
|
|
point = wellPath.interpolatedPointAlongWellPath( 100.0, &horizontalLength );
|
|
EXPECT_TRUE( point.isUndefined() );
|
|
EXPECT_DOUBLE_EQ( 0.0, horizontalLength );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
TEST( RigWellPathTest, InterpolatedPointAlongWellPath )
|
|
{
|
|
std::vector<cvf::Vec3d> points = { cvf::Vec3d( 0.0, 0.0, 0.0 ), cvf::Vec3d( 0.0, 0.0, -100.0 ), cvf::Vec3d( 0.0, 0.0, -200.0 ) };
|
|
std::vector<double> mds = { 0.0, 100.0, 200.0 };
|
|
|
|
RigWellPath wellPath( points, mds );
|
|
|
|
// Before, inside and after the measured depth range
|
|
EXPECT_EQ( cvf::Vec3d( 0.0, 0.0, 0.0 ), wellPath.interpolatedPointAlongWellPath( -10.0 ) );
|
|
EXPECT_EQ( cvf::Vec3d( 0.0, 0.0, -50.0 ), wellPath.interpolatedPointAlongWellPath( 50.0 ) );
|
|
EXPECT_EQ( cvf::Vec3d( 0.0, 0.0, -200.0 ), wellPath.interpolatedPointAlongWellPath( 500.0 ) );
|
|
}
|