Refactor: improve interface for finding intersecting cells.

This commit is contained in:
Kristian Bendiksen 2024-01-03 09:34:09 +01:00
parent ffa117e736
commit 544e6974e7
29 changed files with 75 additions and 105 deletions

View File

@ -516,19 +516,21 @@ cvf::BoundingBox RigFemPart::boundingBox() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemPart::findIntersectingElementIndices( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const
std::vector<size_t> RigFemPart::findIntersectingElementIndices( const cvf::BoundingBox& inputBB ) const
{
ensureIntersectionSearchTreeIsBuilt();
findIntersectingElementsWithExistingSearchTree( inputBB, elementIndices );
return findIntersectingElementsWithExistingSearchTree( inputBB );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemPart::findIntersectingElementsWithExistingSearchTree( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const
std::vector<size_t> RigFemPart::findIntersectingElementsWithExistingSearchTree( const cvf::BoundingBox& inputBB ) const
{
CVF_ASSERT( m_elementSearchTree.notNull() );
m_elementSearchTree->findIntersections( inputBB, elementIndices );
std::vector<size_t> elementIndices;
m_elementSearchTree->findIntersections( inputBB, &elementIndices );
return elementIndices;
}
//--------------------------------------------------------------------------------------------------

View File

@ -87,8 +87,8 @@ public:
cvf::BoundingBox boundingBox() const;
float characteristicElementSize() const;
const std::vector<int>& possibleGridCornerElements() const;
void findIntersectingElementIndices( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const;
void findIntersectingElementsWithExistingSearchTree( const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices ) const;
std::vector<size_t> findIntersectingElementIndices( const cvf::BoundingBox& inputBB ) const;
std::vector<size_t> findIntersectingElementsWithExistingSearchTree( const cvf::BoundingBox& inputBB ) const;
void ensureIntersectionSearchTreeIsBuilt() const;

View File

@ -169,19 +169,20 @@ size_t RigFemPartCollection::globalElementIndex( int partId, size_t localIndex )
//--------------------------------------------------------------------------------------------------
/// Find intersecting global element indexes for a given bounding box
//--------------------------------------------------------------------------------------------------
void RigFemPartCollection::findIntersectingGlobalElementIndices( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedGlobalElementIndices ) const
std::vector<size_t> RigFemPartCollection::findIntersectingGlobalElementIndices( const cvf::BoundingBox& intersectingBB ) const
{
std::vector<size_t> intersectedGlobalElementIndices;
for ( const auto& part : m_femParts )
{
std::vector<size_t> foundElements;
part->findIntersectingElementIndices( intersectingBB, &foundElements );
std::vector<size_t> foundElements = part->findIntersectingElementIndices( intersectingBB );
for ( const auto& foundElement : foundElements )
{
const size_t globalIdx = globalElementIndex( part->elementPartId(), foundElement );
intersectedGlobalElementIndices->push_back( globalIdx );
intersectedGlobalElementIndices.push_back( globalIdx );
}
}
return intersectedGlobalElementIndices;
}
//--------------------------------------------------------------------------------------------------
@ -193,8 +194,7 @@ int RigFemPartCollection::getPartIndexFromPoint( const cvf::Vec3d& point ) const
// Find candidates for intersected global elements
const cvf::BoundingBox intersectingBb( point, point );
std::vector<size_t> intersectedGlobalElementIndexCandidates;
findIntersectingGlobalElementIndices( intersectingBb, &intersectedGlobalElementIndexCandidates );
std::vector<size_t> intersectedGlobalElementIndexCandidates = findIntersectingGlobalElementIndices( intersectingBb );
if ( intersectedGlobalElementIndexCandidates.empty() ) return idx;

View File

@ -42,8 +42,7 @@ public:
std::pair<const RigFemPart*, size_t> partAndElementIndex( size_t globalIndex ) const;
size_t globalElementIndex( int partId, size_t localIndex ) const;
void findIntersectingGlobalElementIndices( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedGlobalElementIndices ) const;
std::vector<size_t> findIntersectingGlobalElementIndices( const cvf::BoundingBox& intersectingBB ) const;
int nodeIdxFromElementNodeResultIdx( size_t globalResultIdx ) const;

View File

@ -163,8 +163,7 @@ void findReferenceElementForNode( const RigFemPart& part, size_t nodeIdx, size_t
bb.add( p1 );
bb.add( p2 );
std::vector<size_t> refElementCandidates;
part.findIntersectingElementIndices( bb, &refElementCandidates );
std::vector<size_t> refElementCandidates = part.findIntersectingElementIndices( bb );
const RigFemPartGrid* grid = part.getOrCreateStructGrid();

View File

@ -289,8 +289,7 @@ void RivBoxIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray* visi
// Similar code as IntersectionGenerator :
std::vector<size_t> columnCellCandidates;
m_hexGrid->findIntersectingCells( sectionBBox, &columnCellCandidates );
std::vector<size_t> columnCellCandidates = m_hexGrid->findIntersectingCells( sectionBBox );
std::vector<caf::HexGridIntersectionTools::ClipVx> hexPlaneCutTriangleVxes;
hexPlaneCutTriangleVxes.reserve( 5 * 3 );

View File

@ -51,9 +51,9 @@ cvf::BoundingBox RivEclipseIntersectionGrid::boundingBox() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells ) const
std::vector<size_t> RivEclipseIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB ) const
{
m_mainGrid->findIntersectingCells( intersectingBB, intersectedCells );
return m_mainGrid->findIntersectingCells( intersectingBB );
}
//--------------------------------------------------------------------------------------------------

View File

@ -40,14 +40,14 @@ class RivEclipseIntersectionGrid : public RivIntersectionHexGridInterface
public:
RivEclipseIntersectionGrid( const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo, bool showInactiveCells );
cvf::Vec3d displayOffset() const override;
cvf::BoundingBox boundingBox() const override;
void findIntersectingCells( const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells ) const override;
bool useCell( size_t cellIndex ) const override;
void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const override;
void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const override;
void setKIntervalFilter( bool enabled, std::string kIntervalStr ) override;
cvf::Vec3d displayOffset() const override;
cvf::BoundingBox boundingBox() const override;
std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& intersectingBB ) const override;
bool useCell( size_t cellIndex ) const override;
void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const override;
void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const override;
void setKIntervalFilter( bool enabled, std::string kIntervalStr ) override;
private:
cvf::cref<RigMainGrid> m_mainGrid;

View File

@ -363,8 +363,7 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays( cvf::UByteA
sectionBBox.cutBelow( bottomDepth );
sectionBBox.cutAbove( topDepth );
std::vector<size_t> columnCellCandidates;
m_hexGrid->findIntersectingCells( sectionBBox, &columnCellCandidates );
std::vector<size_t> columnCellCandidates = m_hexGrid->findIntersectingCells( sectionBBox );
cvf::Plane plane;
plane.setFromPoints( p1, p2, p2 + maxHeightVec );

View File

@ -51,14 +51,11 @@ cvf::BoundingBox RivFemIntersectionGrid::boundingBox() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells ) const
std::vector<size_t> RivFemIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB ) const
{
// For FEM models the term element is used instead of cell.
// Each FEM part has a local element index which is transformed into global index for a FEM part collection.
std::vector<size_t> intersectedGlobalElementIndices;
m_femParts->findIntersectingGlobalElementIndices( intersectingBB, &intersectedGlobalElementIndices );
*intersectedCells = intersectedGlobalElementIndices;
return m_femParts->findIntersectingGlobalElementIndices( intersectingBB );
}
//--------------------------------------------------------------------------------------------------

View File

@ -38,14 +38,14 @@ class RivFemIntersectionGrid : public RivIntersectionHexGridInterface
public:
explicit RivFemIntersectionGrid( const RigFemPartCollection* femParts, const RimGeoMechPartCollection* parts );
cvf::Vec3d displayOffset() const override;
cvf::BoundingBox boundingBox() const override;
void findIntersectingCells( const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells ) const override;
bool useCell( size_t cellIndex ) const override;
void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const override;
void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const override;
void setKIntervalFilter( bool enabled, std::string kIntervalStr ) override;
cvf::Vec3d displayOffset() const override;
cvf::BoundingBox boundingBox() const override;
std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& intersectingBB ) const override;
bool useCell( size_t cellIndex ) const override;
void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const override;
void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const override;
void setKIntervalFilter( bool enabled, std::string kIntervalStr ) override;
private:
cvf::cref<RigFemPartCollection> m_femParts;

View File

@ -35,12 +35,12 @@ class RigFault;
class RivIntersectionHexGridInterface : public cvf::Object
{
public:
virtual cvf::Vec3d displayOffset() const = 0;
virtual cvf::BoundingBox boundingBox() const = 0;
virtual void findIntersectingCells( const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells ) const = 0;
virtual bool useCell( size_t cellIndex ) const = 0;
virtual void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const = 0;
virtual void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const = 0;
virtual cvf::Vec3d displayOffset() const = 0;
virtual cvf::BoundingBox boundingBox() const = 0;
virtual std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& intersectingBB ) const = 0;
virtual bool useCell( size_t cellIndex ) const = 0;
virtual void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const = 0;
virtual void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const = 0;
virtual const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const = 0;
virtual void setKIntervalFilter( bool enabled, std::string kIntervalStr ) = 0;
};

View File

@ -653,8 +653,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createContainmentMaskPart( const Rim
frBBox.add( pvd );
}
std::vector<size_t> cellCandidates;
activeView.mainGrid()->findIntersectingCells( frBBox, &cellCandidates );
std::vector<size_t> cellCandidates = activeView.mainGrid()->findIntersectingCells( frBBox );
auto displCoordTrans = activeView.displayCoordTransform();
@ -780,8 +779,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createMaskOfFractureOutsideGrid( con
std::vector<std::vector<cvf::Vec3d>> clippedPolygons;
std::vector<size_t> cellCandidates;
activeView.mainGrid()->findIntersectingCells( frBBox, &cellCandidates );
std::vector<size_t> cellCandidates = activeView.mainGrid()->findIntersectingCells( frBBox );
if ( cellCandidates.empty() )
{
clippedPolygons.push_back( borderOfFractureCellPolygonLocalCsd );

View File

@ -154,8 +154,7 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
// Ensure AABB search tree is constructed outside parallel loop
{
std::vector<size_t> triIntersectedCellCandidates;
m_hexGrid->findIntersectingCells( cvf::BoundingBox(), &triIntersectedCellCandidates );
std::vector<size_t> triIntersectedCellCandidates = m_hexGrid->findIntersectingCells( cvf::BoundingBox() );
}
#pragma omp parallel num_threads( 6 ) // More threads have nearly no effect
@ -193,8 +192,7 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
cvf::Vec3d maxHeightVec;
std::vector<size_t> triIntersectedCellCandidates;
m_hexGrid->findIntersectingCells( triangleBBox, &triIntersectedCellCandidates );
std::vector<size_t> triIntersectedCellCandidates = m_hexGrid->findIntersectingCells( triangleBBox );
cvf::Plane plane;
plane.setFromPoints( p0, p1, p2 );

View File

@ -914,8 +914,7 @@ int RimPolygonFilter::findEclipseKLayer( const std::vector<cvf::Vec3d>& points,
rayBBox.add( lowestPoint );
// Find the cells intersecting the ray
std::vector<size_t> allCellIndices;
mainGrid->findIntersectingCells( rayBBox, &allCellIndices );
std::vector<size_t> allCellIndices = mainGrid->findIntersectingCells( rayBBox );
// Get the minimum K layer index
int minK = std::numeric_limits<int>::max();

View File

@ -203,14 +203,10 @@ void RimFracture::setStimPlanTimeIndexToPlot( int timeIndex )
//--------------------------------------------------------------------------------------------------
std::vector<size_t> RimFracture::getPotentiallyFracturedCells( const RigMainGrid* mainGrid ) const
{
std::vector<size_t> cellindecies;
if ( !mainGrid ) return cellindecies;
if ( !mainGrid ) return {};
cvf::BoundingBox fractureBBox = boundingBoxInDomainCoords();
mainGrid->findIntersectingCells( fractureBBox, &cellindecies );
return cellindecies;
return mainGrid->findIntersectingCells( fractureBBox );
}
//--------------------------------------------------------------------------------------------------

View File

@ -451,9 +451,7 @@ RimGridView* RimGeoMechContourMapProjection::baseView() const
//--------------------------------------------------------------------------------------------------
std::vector<size_t> RimGeoMechContourMapProjection::findIntersectingCells( const cvf::BoundingBox& bbox ) const
{
std::vector<size_t> allCellIndices;
m_femPart->findIntersectingElementsWithExistingSearchTree( bbox, &allCellIndices );
return allCellIndices;
return m_femPart->findIntersectingElementsWithExistingSearchTree( bbox );
}
//--------------------------------------------------------------------------------------------------

View File

@ -327,7 +327,7 @@ void RimGeoMechFaultReactivationResult::createWellLogCurves()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RimGeoMechFaultReactivationResult::createWellLogExtractionCurveAndAddToTrack( RimWellLogTrack* track,
RimWellLogExtractionCurve* RimGeoMechFaultReactivationResult::createWellLogExtractionCurveAndAddToTrack( RimWellLogTrack* track,
const RigFemResultAddress& resultAddress,
RimModeledWellPath* wellPath,
int partId )

View File

@ -402,9 +402,7 @@ RimGridView* RimEclipseContourMapProjection::baseView() const
//--------------------------------------------------------------------------------------------------
std::vector<size_t> RimEclipseContourMapProjection::findIntersectingCells( const cvf::BoundingBox& bbox ) const
{
std::vector<size_t> allCellIndices;
m_mainGrid->findIntersectingCells( bbox, &allCellIndices );
return allCellIndices;
return m_mainGrid->findIntersectingCells( bbox );
}
//--------------------------------------------------------------------------------------------------

View File

@ -71,8 +71,7 @@ int RimWellIADataAccess::elementIndex( cvf::Vec3d position )
auto part = m_caseData->femParts()->part( 0 );
std::vector<size_t> closeElements;
part->findIntersectingElementIndices( bb, &closeElements );
std::vector<size_t> closeElements = part->findIntersectingElementIndices( bb );
if ( closeElements.empty() ) return -1;
for ( auto elmIdx : closeElements )

View File

@ -343,10 +343,8 @@ void RigEclipseToStimPlanCellTransmissibilityCalculator::calculateStimPlanCellsM
std::vector<size_t>
RigEclipseToStimPlanCellTransmissibilityCalculator::getPotentiallyFracturedCellsForPolygon( const std::vector<cvf::Vec3d>& polygon ) const
{
std::vector<size_t> cellIndices;
const RigMainGrid* mainGrid = m_case->eclipseCaseData()->mainGrid();
if ( !mainGrid ) return cellIndices;
if ( !mainGrid ) return {};
cvf::BoundingBox polygonBBox;
for ( const cvf::Vec3d& nodeCoord : polygon )
@ -354,7 +352,7 @@ std::vector<size_t>
polygonBBox.add( nodeCoord );
}
mainGrid->findIntersectingCells( polygonBBox, &cellIndices );
std::vector<size_t> cellIndices = mainGrid->findIntersectingCells( polygonBBox );
std::vector<size_t> cellIndicesToLeafCells;
for ( const size_t& index : cellIndices )

View File

@ -159,8 +159,7 @@ void RigCaseToCaseCellMapper::calculateEclToGeomCellMapping( RigMainGrid* master
for ( int i = 0; i < 8; ++i )
elmBBox.add( geoMechConvertedEclCell[i] );
std::vector<size_t> closeElements;
dependentFemPart->findIntersectingElementIndices( elmBBox, &closeElements );
std::vector<size_t> closeElements = dependentFemPart->findIntersectingElementIndices( elmBBox );
for ( size_t ccIdx = 0; ccIdx < closeElements.size(); ++ccIdx )
{

View File

@ -382,8 +382,7 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi
for ( int i = 0; i < 8; ++i )
elmBBox.add( geoMechConvertedEclCell[i] );
std::vector<size_t> closeElements;
dependentFemPart->findIntersectingElementIndices( elmBBox, &closeElements );
std::vector<size_t> closeElements = dependentFemPart->findIntersectingElementIndices( elmBBox );
cvf::Vec3d elmCorners[8];
int elmIdxToBestMatch = -1;
@ -465,10 +464,8 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi
for ( int i = 0; i < 8; ++i )
elmBBox.add( elmCorners[i] );
std::vector<size_t> closeCells;
masterEclGrid->findIntersectingCells( elmBBox,
&closeCells ); // This might actually miss the exact one, but we have no other
// alternative yet.
// This might actually miss the exact one, but we have no other alternative yet.
std::vector<size_t> closeCells = masterEclGrid->findIntersectingCells( elmBBox );
size_t globCellIdxToBestMatch = cvf::UNDEFINED_SIZE_T;
double sqDistToClosestCellCenter = HUGE_VAL;

View File

@ -236,8 +236,7 @@ void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultF
bb.add( mainGridNodes[sourceFaceIndices[2]] );
bb.add( mainGridNodes[sourceFaceIndices[3]] );
std::vector<size_t> closeCells;
mainGrid->findIntersectingCells( bb, &closeCells );
std::vector<size_t> closeCells = mainGrid->findIntersectingCells( bb );
cvf::StructGridInterface::FaceType candidateFace = cvf::StructGridInterface::oppositeFace( sourceCellFace );

View File

@ -193,9 +193,7 @@ void RigEclipseWellLogExtractor::curveData( const RigResultAccessor* resultAcces
//--------------------------------------------------------------------------------------------------
std::vector<size_t> RigEclipseWellLogExtractor::findCloseCellIndices( const cvf::BoundingBox& bb )
{
std::vector<size_t> closeCells;
m_caseData->mainGrid()->findIntersectingCells( bb, &closeCells );
return closeCells;
return m_caseData->mainGrid()->findIntersectingCells( bb );
}
//--------------------------------------------------------------------------------------------------

View File

@ -1025,13 +1025,12 @@ void RigGeoMechWellLogExtractor::calculateIntersection()
//--------------------------------------------------------------------------------------------------
std::vector<size_t> RigGeoMechWellLogExtractor::findCloseCells( const cvf::BoundingBox& bb )
{
std::vector<size_t> closeCells;
if ( m_caseData->femParts()->partCount() )
{
m_caseData->femParts()->part( m_partId )->findIntersectingElementIndices( bb, &closeCells );
return m_caseData->femParts()->part( m_partId )->findIntersectingElementIndices( bb );
}
return closeCells;
return {};
}
//--------------------------------------------------------------------------------------------------

View File

@ -151,8 +151,7 @@ size_t RigMainGrid::findReservoirCellIndexFromPoint( const cvf::Vec3d& point ) c
cvf::BoundingBox pointBBox;
pointBBox.add( point );
std::vector<size_t> cellIndices;
m_mainGrid->findIntersectingCells( pointBBox, &cellIndices );
std::vector<size_t> cellIndices = m_mainGrid->findIntersectingCells( pointBBox );
cvf::Vec3d hexCorners[8];
for ( size_t cellIndex : cellIndices )
@ -781,11 +780,12 @@ const RigFault* RigMainGrid::findFaultFromCellIndexAndCellFace( size_t reservoir
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::findIntersectingCells( const cvf::BoundingBox& inputBB, std::vector<size_t>* cellIndices ) const
std::vector<size_t> RigMainGrid::findIntersectingCells( const cvf::BoundingBox& inputBB ) const
{
CVF_ASSERT( m_cellSearchTree.notNull() );
m_cellSearchTree->findIntersections( inputBB, cellIndices );
std::vector<size_t> cellIndices;
m_cellSearchTree->findIntersections( inputBB, &cellIndices );
return cellIndices;
}
//--------------------------------------------------------------------------------------------------

View File

@ -94,8 +94,8 @@ public:
cvf::Vec3d displayModelOffset() const override;
void setDisplayModelOffset( cvf::Vec3d offset );
void setFlipAxis( bool flipXAxis, bool flipYAxis );
void findIntersectingCells( const cvf::BoundingBox& inputBB, std::vector<size_t>* cellIndices ) const;
void setFlipAxis( bool flipXAxis, bool flipYAxis );
std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& inputBB ) const;
cvf::BoundingBox boundingBox() const;

View File

@ -54,8 +54,7 @@ cvf::Vec3d RigStimPlanModelTools::calculateTSTDirection( RigEclipseCaseData* ecl
// Find upper face of cells close to the anchor point
cvf::BoundingBox boundingBox( anchorPosition - boundingBoxSize, anchorPosition + boundingBoxSize );
std::vector<size_t> closeCells;
mainGrid->findIntersectingCells( boundingBox, &closeCells );
std::vector<size_t> closeCells = mainGrid->findIntersectingCells( boundingBox );
// The stratigraphic thickness is the averge of normals of the top face
cvf::Vec3d direction = cvf::Vec3d::ZERO;