Files
ResInsight/ApplicationLibCode/ProjectDataModel/WellPath/RimPointBasedWellPath.cpp
T
Kristian Bendiksen d8566b679f Rename RimFixedTrajectoryWellPath to RimPointBasedWellPath
- Renamed class from RimFixedTrajectoryWellPath to RimPointBasedWellPath
- Updated header and implementation files
- Changed PDM object display name to "Point-Based Well Path"
- Updated script keyword from "FixedTrajectoryWellPath" to "PointBasedWellPath"
- Modified CMakeLists_files.cmake to reference new filenames
- Updated all includes and instantiation references
- Applied clang-format-19 to modified C++ files
- Updated Python docstring to reflect new return type

The new name better describes the class purpose of creating well paths
from XYZ coordinate points. All tests continue to pass.
2025-08-29 16:28:30 +02:00

114 lines
4.4 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 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 "RimPointBasedWellPath.h"
#include "Well/RigWellPath.h"
// Make sure to include cafPdmFieldScriptingCapabilityCvfVec3d. Include of general cafPdmFieldScriptingCapability causes unity build issues.
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiOrdering.h"
CAF_PDM_SOURCE_INIT( RimPointBasedWellPath, "PointBasedWellPath" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPointBasedWellPath::RimPointBasedWellPath()
{
CAF_PDM_InitScriptableObject( "Point-Based Well Path", ":/Well.svg", "", "PointBasedWellPath" );
CAF_PDM_InitScriptableField( &m_trajectoryPoints, "TrajectoryPoints", std::vector<cvf::Vec3d>(), "Trajectory Points" );
m_trajectoryPoints.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPointBasedWellPath::~RimPointBasedWellPath()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPointBasedWellPath::setTrajectoryPoints( const std::vector<cvf::Vec3d>& wellTargets )
{
m_trajectoryPoints = wellTargets;
createWellPathGeometry();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RimPointBasedWellPath::trajectoryPoints() const
{
return m_trajectoryPoints();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPointBasedWellPath::createWellPathGeometry()
{
if ( m_trajectoryPoints().empty() )
{
return;
}
// Create well path geometry from the target points
std::vector<cvf::Vec3d> wellPathPoints = m_trajectoryPoints();
std::vector<double> measuredDepths;
// Calculate measured depths along the path
double totalMD = 0.0;
measuredDepths.push_back( totalMD );
for ( size_t i = 1; i < wellPathPoints.size(); ++i )
{
cvf::Vec3d segmentVector = wellPathPoints[i] - wellPathPoints[i - 1];
double segmentLength = segmentVector.length();
totalMD += segmentLength;
measuredDepths.push_back( totalMD );
}
auto wellPathGeometry = new RigWellPath( wellPathPoints, measuredDepths );
setWellPathGeometry( wellPathGeometry );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPointBasedWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimWellPath::defineUiOrdering( uiConfigName, uiOrdering );
// Hide the well targets field from UI since this is Python-only
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPointBasedWellPath::initAfterRead()
{
createWellPathGeometry();
}