mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
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:
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 );
|
||||
}
|
||||
Reference in new issue
Block a user