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

@@ -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;
};