#1584 Replace cvf::vec3d[8] with std::array<cvf::vec3d, 8>

This commit is contained in:
Kristian Bendiksen committed 2025-09-03 14:21:19 +02:00
1 parent 7b34d7f103
commit da69eef72b
43 files changed
+150 -126

No files matched your search

@@ -178,8 +178,8 @@ void RivFaultGeometryGenerator::computeArrays( bool onlyShowFacesWithDefinedNeig
{
int myThread = RiaOpenMPTools::currentThreadIndex();
cvf::Vec3d cornerVerts[8];
cvf::ubyte faceConn[4];
std::array<cvf::Vec3d, 8> cornerVerts;
cvf::ubyte faceConn[4];
// NB! We are inside a parallel section, do not use "parallel for" here
#pragma omp for
@@ -295,8 +295,8 @@ void RivBoxIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray* visi
hexPlaneCutTriangleVxes.reserve( 5 * 3 );
std::vector<int> cellFaceForEachTriangleEdge;
cellFaceForEachTriangleEdge.reserve( 5 * 3 );
cvf::Vec3d cellCorners[8];
size_t cornerIndices[8];
std::array<cvf::Vec3d, 8> cellCorners;
std::array<size_t, 8> cornerIndices;
for ( size_t cccIdx = 0; cccIdx < columnCellCandidates.size(); ++cccIdx )
{
@@ -78,7 +78,7 @@ bool RivEclipseIntersectionGrid::useCell( size_t cellIndex ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const
void RivEclipseIntersectionGrid::cellCornerVertices( size_t cellIndex, std::array<cvf::Vec3d, 8>& cellCorners ) const
{
m_mainGrid->cellCornerVertices( cellIndex, cellCorners );
}
@@ -86,14 +86,11 @@ void RivEclipseIntersectionGrid::cellCornerVertices( size_t cellIndex, cvf::Vec3
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const
void RivEclipseIntersectionGrid::cellCornerIndices( size_t cellIndex, std::array<size_t, 8>& cornerIndices ) const
{
const std::array<size_t, 8>& cornerIndicesSource = m_mainGrid->cell( cellIndex ).cornerIndices();
for ( size_t i = 0; i < 8; i++ )
{
cornerIndices[i] = cornerIndicesSource[i];
}
cornerIndices = cornerIndicesSource;
}
//--------------------------------------------------------------------------------------------------
@@ -44,8 +44,8 @@ public:
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;
void cellCornerVertices( size_t cellIndex, std::array<cvf::Vec3d, 8>& cellCorners ) const override;
void cellCornerIndices( size_t cellIndex, std::array<size_t, 8>& cornerIndices ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const override;
void setKIntervalFilter( bool enabled, std::string kIntervalStr ) override;
@@ -377,8 +377,8 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays( cvf::UByteA
hexPlaneCutTriangleVxes.reserve( 5 * 3 );
std::vector<int> cellFaceForEachTriangleEdge;
cellFaceForEachTriangleEdge.reserve( 5 * 3 );
cvf::Vec3d cellCorners[8];
size_t cornerIndices[8];
std::array<cvf::Vec3d, 8> cellCorners;
std::array<size_t, 8> cornerIndices;
cvf::Mat4d invSectionCS = m_lineSegmentTransforms[pLineIdx][lIdx];
@@ -71,7 +71,7 @@ bool RivFemIntersectionGrid::useCell( size_t globalCellIndex ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::cellCornerVertices( size_t globalCellIndex, cvf::Vec3d cellCorners[8] ) const
void RivFemIntersectionGrid::cellCornerVertices( size_t globalCellIndex, std::array<cvf::Vec3d, 8>& cellCorners ) const
{
auto [part, elementIdx] = m_femParts->partAndElementIndex( globalCellIndex );
@@ -102,7 +102,7 @@ void RivFemIntersectionGrid::cellCornerVertices( size_t globalCellIndex, cvf::Ve
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::cellCornerIndices( size_t globalCellIndex, size_t cornerIndices[8] ) const
void RivFemIntersectionGrid::cellCornerIndices( size_t globalCellIndex, std::array<size_t, 8>& cornerIndices ) const
{
auto [part, elementIdx] = m_femParts->partAndElementIndex( globalCellIndex );
@@ -42,8 +42,8 @@ public:
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;
void cellCornerVertices( size_t cellIndex, std::array<cvf::Vec3d, 8>& cellCorners ) const override;
void cellCornerIndices( size_t cellIndex, std::array<size_t, 8>& cornerIndices ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const override;
void setKIntervalFilter( bool enabled, std::string kIntervalStr ) override;
@@ -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 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 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, std::array<cvf::Vec3d, 8>& cellCorners ) const = 0;
virtual void cellCornerIndices( size_t cellIndex, std::array<size_t, 8>& cornerIndices ) const = 0;
virtual const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const = 0;
virtual void setKIntervalFilter( bool enabled, std::string kIntervalStr ) = 0;
};
@@ -63,6 +63,7 @@
#include "cvfStructGridGeometryGenerator.h"
#include "cvfTransform.h"
#include <array>
#include <cmath>
//--------------------------------------------------------------------------------------------------
@@ -669,7 +670,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createContainmentMaskPart( const Rim
// Calculate Eclipse cell intersection with fracture plane
std::array<cvf::Vec3d, 8> corners;
activeView.mainGrid()->cellCornerVertices( resCellIdx, corners.data() );
activeView.mainGrid()->cellCornerVertices( resCellIdx, corners );
std::vector<std::vector<cvf::Vec3d>> eclCellPolygons;
bool hasIntersection = RigHexIntersectionTools::planeHexIntersectionPolygons( corners, frMx, eclCellPolygons );
@@ -798,9 +799,9 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createMaskOfFractureOutsideGrid( con
std::array<cvf::Vec3d, 8> corners;
for ( size_t cellIndex : cellCandidates )
{
mainGrid->cellCornerVertices( cellIndex, corners.data() );
mainGrid->cellCornerVertices( cellIndex, corners );
if ( RigHexIntersectionTools::isPointInCell( pointInDomainCoords, corners.data() ) )
if ( RigHexIntersectionTools::isPointInCell( pointInDomainCoords, corners ) )
{
pointInsideGrid = true;
break;
@@ -822,7 +823,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createMaskOfFractureOutsideGrid( con
// Calculate Eclipse cell intersection with fracture plane
std::array<cvf::Vec3d, 8> corners;
activeView.mainGrid()->cellCornerVertices( resCellIdx, corners.data() );
activeView.mainGrid()->cellCornerVertices( resCellIdx, corners );
std::vector<std::vector<cvf::Vec3d>> eclCellPolygons;
bool hasIntersection = RigHexIntersectionTools::planeHexIntersectionPolygons( corners, frMx, eclCellPolygons );
@@ -208,12 +208,12 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
cellFaceForEachTriangleEdge.clear();
cellCutTriangles.clear();
m_hexGrid->cellCornerVertices( globalCellIdx, &cellCorners[0] );
m_hexGrid->cellCornerIndices( globalCellIdx, &cornerIndices[0] );
m_hexGrid->cellCornerVertices( globalCellIdx, cellCorners );
m_hexGrid->cellCornerIndices( globalCellIdx, cornerIndices );
int triangleCount = caf::HexGridIntersectionTools::planeHexIntersectionMCTet( plane,
&cellCorners[0],
&cornerIndices[0],
cellCorners,
cornerIndices,
&hexPlaneCutTriangleVxes,
&cellFaceForEachTriangleEdge );