#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

+3 -2
View File
@@ -39,6 +39,7 @@
#include "cvfBoundingBox.h"
#include <algorithm>
#include <array>
namespace caf
{
@@ -372,8 +373,8 @@ void StructGridInterface::computeCharacteristicCellSize( const std::vector<size_
double jLengthAccumulated = 0.0;
double kLengthAccumulated = 0.0;
cvf::Vec3d cornerVerts[8];
size_t evaluatedCellCount = 0;
std::array<cvf::Vec3d, 8> cornerVerts;
size_t evaluatedCellCount = 0;
// Evaluate N-th cells, compute the stride between each index
size_t stride = std::max( size_t( 1 ), globalCellIndices.size() / 100 );
+5 -3
View File
@@ -38,10 +38,12 @@
#include "cvfObject.h"
#include "cvfVector3.h"
#include <cstddef>
#include "cafAppEnum.h"
#include <array>
#include <cstddef>
namespace cvf
{
class CellFilterBase;
@@ -99,8 +101,8 @@ public:
virtual bool cellIJKFromCoordinate( const cvf::Vec3d& coord, size_t* i, size_t* j, size_t* k ) const = 0;
virtual void cellCornerVertices( size_t cellIndex, cvf::Vec3d vertices[8] ) const = 0;
virtual cvf::Vec3d cellCentroid( size_t cellIndex ) const = 0;
virtual void cellCornerVertices( size_t cellIndex, std::array<cvf::Vec3d, 8>& vertices ) const = 0;
virtual cvf::Vec3d cellCentroid( size_t cellIndex ) const = 0;
virtual void cellMinMaxCordinates( size_t cellIndex, cvf::Vec3d* minCoordinate, cvf::Vec3d* maxCoordinate ) const = 0;
virtual size_t gridPointIndexFromIJK( size_t i, size_t j, size_t k ) const = 0;
@@ -47,6 +47,8 @@
#include "cvfArray.h"
#include "cvfOutlineEdgeExtractor.h"
#include <array>
#include <cmath>
namespace cvf
@@ -274,7 +276,7 @@ ref<DrawableGeo> StructGridGeometryGenerator::createMeshDrawableFromSingleCell(
size_t cellIndex,
const cvf::Vec3d& displayModelOffset )
{
cvf::Vec3d cornerVerts[8];
std::array<cvf::Vec3d, 8> cornerVerts;
grid->cellCornerVertices( cellIndex, cornerVerts );
std::vector<Vec3f> vertices;
@@ -413,7 +415,7 @@ void StructGridGeometryGenerator::computeArrays()
if ( !visibleFaces.empty() )
{
cvf::Vec3d cornerVerts[8];
std::array<cvf::Vec3d, 8> cornerVerts;
m_grid->cellCornerVertices( cellIndex, cornerVerts );
size_t idx;
@@ -755,8 +755,8 @@ cvf::Vec3d HexGridIntersectionTools::planeLineIntersectionForMC( const cvf::Plan
// The cellFaceForEachTriangleEdge refer to the edge after the corresponding triangle vertex.
//--------------------------------------------------------------------------------------------------
int HexGridIntersectionTools::planeHexIntersectionMC( const cvf::Plane& plane,
const cvf::Vec3d cell[8],
const size_t hexCornersIds[8],
const std::array<cvf::Vec3d, 8>& cell,
const std::array<size_t , 8>& hexCornersIds,
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge )
{
@@ -1304,11 +1304,11 @@ are stacked together to a chain, the mesh of each cube must be rotated by an ang
*/
//--------------------------------------------------------------------------------------------------
int HexGridIntersectionTools::planeHexIntersectionMCTet( const cvf::Plane& plane,
const cvf::Vec3d cell[8],
const size_t hexCornersIds[8],
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge )
int HexGridIntersectionTools::planeHexIntersectionMCTet( const cvf::Plane& plane,
const std::array<cvf::Vec3d, 8>& cell,
const std::array<size_t, 8>& hexCornersIds,
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge )
{
std::array<double, 8> cellCornerSqDistToPlane = {
plane.distanceSquared( cell[0] ),
@@ -1383,13 +1383,13 @@ int HexGridIntersectionTools::planeHexIntersectionMCTet( const cvf::Plane& pl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::uint HexGridIntersectionTools::planeMcTetIntersection( const cvf::Plane& plane,
const cvf::Vec3d hexCell[8],
const size_t hexCornersIds[8],
const double cornerDistToPlane[8],
const std::array<int, 4>& tetCell,
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge )
cvf::uint HexGridIntersectionTools::planeMcTetIntersection( const cvf::Plane& plane,
const std::array<cvf::Vec3d, 8>& hexCell,
const std::array<size_t, 8>& hexCornersIds,
const double cornerDistToPlane[8],
const std::array<int, 4>& tetCell,
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge )
{
// clang-format off
@@ -86,24 +86,24 @@ public:
const cvf::Vec3d& p2,
double* normalizedDistFromP1 );
static int planeHexIntersectionMC( const cvf::Plane& plane,
const cvf::Vec3d cell[8],
const size_t hexCornersIds[8],
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge );
static int planeHexIntersectionMC( const cvf::Plane& plane,
const std::array<cvf::Vec3d, 8>& cell,
const std::array<size_t, 8>& hexCornersIds,
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge );
static int planeHexIntersectionMCTet( const cvf::Plane& plane,
const cvf::Vec3d cell[8],
const size_t hexCornersIds[8],
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge );
static cvf::uint planeMcTetIntersection( const cvf::Plane& plane,
const cvf::Vec3d hexCell[8],
const size_t hexCornersIds[8],
const double cornerDistToPlane[8],
const std::array<int, 4>& tetCell,
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge );
static int planeHexIntersectionMCTet( const cvf::Plane& plane,
const std::array<cvf::Vec3d, 8>& cell,
const std::array<size_t, 8>& hexCornersIds,
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge );
static cvf::uint planeMcTetIntersection( const cvf::Plane& plane,
const std::array<cvf::Vec3d, 8>& cell,
const std::array<size_t, 8>& hexCornersIds,
const double cornerDistToPlane[8],
const std::array<int, 4>& tetCell,
std::vector<ClipVx>* triangleVxes,
std::vector<int>* cellFaceForEachTriangleEdge );
};
}; // namespace caf
}; // namespace caf