Refactor: Change RigGridBase::cellCornerVertices to return std::array

Refactored RigGridBase::cellCornerVertices to return std::array<cvf::Vec3d, 8> by value instead of taking a reference to std::array as an output parameter. This change improves code readability and leverages modern C++ return value optimizations.

Updated all call sites across the codebase to reflect the new function signature.
This commit is contained in:
Kristian Bendiksen committed 2025-09-03 14:21:19 +02:00
1 parent da69eef72b
commit 10182e99a7
41 files changed
+148 -214

No files matched your search

@@ -279,9 +279,8 @@ public:
// dv(3) = 8;
// dv(4) = 3;
std::array<cvf::Vec3d, 8> cornerVerts;
size_t blockByteCount = cellCount * sizeof( double );
std::vector<double> doubleValues( blockByteCount );
size_t blockByteCount = cellCount * sizeof( double );
std::vector<double> doubleValues( blockByteCount );
for ( int coordIdx = 0; coordIdx < 3; coordIdx++ )
{
@@ -298,8 +297,8 @@ public:
for ( size_t i = 0; i < cellCountI; i++ )
{
size_t gridLocalCellIndex = rigGrid->cellIndexFromIJK( i, j, k );
rigGrid->cellCornerVertices( gridLocalCellIndex, cornerVerts );
std::array<cvf::Vec3d, 8> cornerVerts = rigGrid->cellCornerVertices( gridLocalCellIndex );
doubleValues[valueIndex++] = getCellCornerWithPositiveDepth( cornerVerts, cornerIndexMapping, coordIdx );
}
}
@@ -367,9 +366,8 @@ public:
// dv(1) = 8;
// dv(2) = 3;
std::array<cvf::Vec3d, 8> cornerVerts;
size_t blockByteCount = activeCellCount * sizeof( double );
std::vector<double> doubleValues( blockByteCount );
size_t blockByteCount = activeCellCount * sizeof( double );
std::vector<double> doubleValues( blockByteCount );
for ( int coordIdx = 0; coordIdx < 3; coordIdx++ )
{
@@ -383,9 +381,8 @@ public:
{
if ( !actCellInfo->isActive( reservoirCellIndex ) ) continue;
mainGrid->cellCornerVertices( reservoirCellIndex, cornerVerts );
doubleValues[valueIndex++] = getCellCornerWithPositiveDepth( cornerVerts, cornerIndexMapping, coordIdx );
std::array<cvf::Vec3d, 8> cornerVerts = mainGrid->cellCornerVertices( reservoirCellIndex );
doubleValues[valueIndex++] = getCellCornerWithPositiveDepth( cornerVerts, cornerIndexMapping, coordIdx );
}
CVF_ASSERT( valueIndex == activeCellCount );