mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor: Extract getPartIndexFromPoint to avoid duplication.
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigHexIntersectionTools.h"
|
||||
#include "RigReservoirGridTools.h"
|
||||
|
||||
#include "RimFaultReactivationTools.h"
|
||||
@@ -253,8 +252,8 @@ void RimGeoMechFaultReactivationResult::createWellGeometry()
|
||||
m_faceBWellPath->createWellPathGeometry();
|
||||
|
||||
// Detect which part well path centers are in
|
||||
m_faceAWellPathPartIndex = getPartIndexFromPoint( geoMechPartCollection, partATop );
|
||||
m_faceBWellPathPartIndex = getPartIndexFromPoint( geoMechPartCollection, partBTop );
|
||||
m_faceAWellPathPartIndex = geoMechPartCollection->getPartIndexFromPoint( partATop );
|
||||
m_faceBWellPathPartIndex = geoMechPartCollection->getPartIndexFromPoint( partBTop );
|
||||
|
||||
// Update UI
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
@@ -328,40 +327,7 @@ void RimGeoMechFaultReactivationResult::createWellLogCurves()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimGeoMechFaultReactivationResult::getPartIndexFromPoint( const RigFemPartCollection* const partCollection, const cvf::Vec3d& point ) const
|
||||
{
|
||||
const int idx = 0;
|
||||
if ( !partCollection ) return idx;
|
||||
|
||||
// Find candidates for intersected global elements
|
||||
const cvf::BoundingBox intersectingBb( point, point );
|
||||
std::vector<size_t> intersectedGlobalElementIndexCandidates;
|
||||
partCollection->findIntersectingGlobalElementIndices( intersectingBb, &intersectedGlobalElementIndexCandidates );
|
||||
|
||||
if ( intersectedGlobalElementIndexCandidates.empty() ) return idx;
|
||||
|
||||
// Iterate through global element candidates and check if point is in hexCorners
|
||||
for ( const auto& globalElementIndex : intersectedGlobalElementIndexCandidates )
|
||||
{
|
||||
const auto [part, elementIndex] = partCollection->partAndElementIndex( globalElementIndex );
|
||||
|
||||
// Find nodes from element
|
||||
std::array<cvf::Vec3d, 8> coordinates;
|
||||
const bool isSuccess = part->fillElementCoordinates( elementIndex, coordinates );
|
||||
if ( !isSuccess ) continue;
|
||||
|
||||
const bool isPointInCell = RigHexIntersectionTools::isPointInCell( point, coordinates.data() );
|
||||
if ( isPointInCell ) return part->elementPartId();
|
||||
}
|
||||
|
||||
// Utilize first part to have an id
|
||||
return idx;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogExtractionCurve* RimGeoMechFaultReactivationResult::createWellLogExtractionCurveAndAddToTrack( RimWellLogTrack* track,
|
||||
RimWellLogExtractionCurve* RimGeoMechFaultReactivationResult::createWellLogExtractionCurveAndAddToTrack( RimWellLogTrack* track,
|
||||
const RigFemResultAddress& resultAddress,
|
||||
RimModeledWellPath* wellPath,
|
||||
int partId )
|
||||
|
||||
@@ -58,8 +58,6 @@ private:
|
||||
void createWellGeometry();
|
||||
void createWellLogCurves();
|
||||
|
||||
int getPartIndexFromPoint( const RigFemPartCollection* const partCollection, const cvf::Vec3d& point ) const;
|
||||
|
||||
RimWellLogExtractionCurve* createWellLogExtractionCurveAndAddToTrack( RimWellLogTrack* track,
|
||||
const RigFemResultAddress& resultAddress,
|
||||
RimModeledWellPath* wellPath,
|
||||
|
||||
Reference in New Issue
Block a user