Fault distance from point (#13367)

* Add python interface for distance to closest fault
* Split up some older code into multiple files.
* Add python test
This commit is contained in:
JJ authored and GitHub committed 2025-12-20 09:50:51 +01:00
1 parent 4d312ecc82
commit 225d034327
17 files changed
+896 -554

No files matched your search

@@ -231,3 +231,28 @@ void RigFaultsPrCellAccumulator::setFaultIdx( size_t reservoirCellIndex, cvf::St
{
m_faultIdxForCellFace[reservoirCellIndex][face] = faultIdx;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<double, cvf::StructGridInterface::FaceType> RigFault::minimumDistanceToPoint( const cvf::Vec3d& point, const RigMainGrid* mainGrid ) const
{
double minDistance = std::numeric_limits<double>::max();
cvf::StructGridInterface::FaceType minFace = cvf::StructGridInterface::NO_FACE;
for ( const FaultFace& ff : m_faultFaces )
{
const RigCell& cell = mainGrid->cell( ff.m_nativeReservoirCellIndex );
if ( cell.isInvalid() ) continue;
for ( auto& c : cell.faceCorners( ff.m_nativeFace ) )
{
double distance = ( c - point ).length();
if ( distance < minDistance )
{
minDistance = distance;
minFace = ff.m_nativeFace;
}
}
}
return std::make_pair( minDistance, minFace );
}