diff --git a/ApplicationCode/ModelVisualization/Intersections/RivHexGridIntersectionTools.cpp b/ApplicationCode/ModelVisualization/Intersections/RivHexGridIntersectionTools.cpp index c88cbf91b5..b77964b7e0 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivHexGridIntersectionTools.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivHexGridIntersectionTools.cpp @@ -85,8 +85,12 @@ void RivEclipseIntersectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d //-------------------------------------------------------------------------------------------------- void RivEclipseIntersectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const { - const caf::SizeTArray8& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices(); - memcpy(cornerIndices, cornerIndicesSource.data(), 8 * sizeof(size_t)); + const std::array& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices(); + + for (size_t i = 0; i < 8; i++) + { + cornerIndices[i] = cornerIndicesSource[i]; + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp b/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp index 2ea21dd336..2c59722392 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp @@ -39,7 +39,7 @@ public: m_baseK(baseK) {} - const caf::SizeTArray8* neighborIndices(int offsetI, int offsetJ, int offsetK) + const std::array* neighborIndices(int offsetI, int offsetJ, int offsetK) { if (offsetI < 0 && m_baseI == 0) return nullptr; if (offsetJ < 0 && m_baseJ == 0) return nullptr; @@ -88,35 +88,35 @@ void RigCaseToCaseCellMapperTools::estimatedFemCellFromEclCell(const RigMainGrid // 6 <- PI[7] PIPJ[4] PJ[5] PK[2] PIPK[3] PIPJPK[0] PJPK[1] // 7 <- PJ[4] NIPJ[5] NI[6] PK[3] PJPK[0] NIPJPK[1] NIPK[2] - const caf::SizeTArray8* IJK = nbFinder.neighborIndices( 0, 0, 0); - const caf::SizeTArray8* NI = nbFinder.neighborIndices(-1, 0, 0); - const caf::SizeTArray8* NJ = nbFinder.neighborIndices( 0,-1, 0); - const caf::SizeTArray8* PI = nbFinder.neighborIndices( 1, 0, 0); - const caf::SizeTArray8* PJ = nbFinder.neighborIndices( 0, 1, 0); - const caf::SizeTArray8* NK = nbFinder.neighborIndices( 0, 0,-1); - const caf::SizeTArray8* PK = nbFinder.neighborIndices( 0, 0, 1); - const caf::SizeTArray8* NINJ = nbFinder.neighborIndices(-1,-1, 0); - const caf::SizeTArray8* PINJ = nbFinder.neighborIndices( 1,-1, 0); + const std::array* IJK = nbFinder.neighborIndices( 0, 0, 0); + const std::array* NI = nbFinder.neighborIndices(-1, 0, 0); + const std::array* NJ = nbFinder.neighborIndices( 0,-1, 0); + const std::array* PI = nbFinder.neighborIndices( 1, 0, 0); + const std::array* PJ = nbFinder.neighborIndices( 0, 1, 0); + const std::array* NK = nbFinder.neighborIndices( 0, 0,-1); + const std::array* PK = nbFinder.neighborIndices( 0, 0, 1); + const std::array* NINJ = nbFinder.neighborIndices(-1,-1, 0); + const std::array* PINJ = nbFinder.neighborIndices( 1,-1, 0); - const caf::SizeTArray8* PIPJ = nbFinder.neighborIndices( 1, 1, 0); - const caf::SizeTArray8* NIPJ = nbFinder.neighborIndices(-1, 1, 0); - const caf::SizeTArray8* NINK = nbFinder.neighborIndices(-1, 0,-1); - const caf::SizeTArray8* NJNK = nbFinder.neighborIndices( 0,-1,-1); - const caf::SizeTArray8* PINK = nbFinder.neighborIndices( 1, 0,-1); - const caf::SizeTArray8* PJNK = nbFinder.neighborIndices( 0, 1,-1); - const caf::SizeTArray8* NIPK = nbFinder.neighborIndices(-1, 0, 1); - const caf::SizeTArray8* NJPK = nbFinder.neighborIndices( 0,-1, 1); - const caf::SizeTArray8* PIPK = nbFinder.neighborIndices( 1, 0, 1); + const std::array* PIPJ = nbFinder.neighborIndices( 1, 1, 0); + const std::array* NIPJ = nbFinder.neighborIndices(-1, 1, 0); + const std::array* NINK = nbFinder.neighborIndices(-1, 0,-1); + const std::array* NJNK = nbFinder.neighborIndices( 0,-1,-1); + const std::array* PINK = nbFinder.neighborIndices( 1, 0,-1); + const std::array* PJNK = nbFinder.neighborIndices( 0, 1,-1); + const std::array* NIPK = nbFinder.neighborIndices(-1, 0, 1); + const std::array* NJPK = nbFinder.neighborIndices( 0,-1, 1); + const std::array* PIPK = nbFinder.neighborIndices( 1, 0, 1); - const caf::SizeTArray8* PJPK = nbFinder.neighborIndices( 0, 1, 1); - const caf::SizeTArray8* NINJNK = nbFinder.neighborIndices(-1,-1,-1); - const caf::SizeTArray8* PINJNK = nbFinder.neighborIndices( 1,-1,-1); - const caf::SizeTArray8* PIPJNK = nbFinder.neighborIndices( 1, 1,-1); - const caf::SizeTArray8* NIPJNK = nbFinder.neighborIndices(-1, 1,-1); - const caf::SizeTArray8* NINJPK = nbFinder.neighborIndices(-1,-1, 1); - const caf::SizeTArray8* PINJPK = nbFinder.neighborIndices( 1,-1, 1); - const caf::SizeTArray8* PIPJPK = nbFinder.neighborIndices( 1, 1, 1); - const caf::SizeTArray8* NIPJPK = nbFinder.neighborIndices(-1, 1, 1); + const std::array* PJPK = nbFinder.neighborIndices( 0, 1, 1); + const std::array* NINJNK = nbFinder.neighborIndices(-1,-1,-1); + const std::array* PINJNK = nbFinder.neighborIndices( 1,-1,-1); + const std::array* PIPJNK = nbFinder.neighborIndices( 1, 1,-1); + const std::array* NIPJNK = nbFinder.neighborIndices(-1, 1,-1); + const std::array* NINJPK = nbFinder.neighborIndices(-1,-1, 1); + const std::array* PINJPK = nbFinder.neighborIndices( 1,-1, 1); + const std::array* PIPJPK = nbFinder.neighborIndices( 1, 1, 1); + const std::array* NIPJPK = nbFinder.neighborIndices(-1, 1, 1); std::vector contributingNodeIndicesPrCellCorner[8]; @@ -432,7 +432,7 @@ if ( ( (es.x() + xyTolerance) >= cs.x() && (el.x() - xyTolerance) <= cl.x()) { const std::vector& eclNodes = eclGrid->nodes(); const RigCell& cell = eclGrid->cells()[reservoirCellIndex]; - const caf::SizeTArray8& cornerIndices = cell.cornerIndices(); + const std::array& cornerIndices = cell.cornerIndices(); int faceNodeCount; const int* localElmNodeIndicesForTopZFace = RigFemTypes::localElmNodeIndicesForFace(HEX8, 4, &faceNodeCount); const int* localElmNodeIndicesForBotZFace = RigFemTypes::localElmNodeIndicesForFace(HEX8, 5, &faceNodeCount); diff --git a/ApplicationCode/ReservoirDataModel/RigCell.h b/ApplicationCode/ReservoirDataModel/RigCell.h index 22887b2c73..a762e404d2 100644 --- a/ApplicationCode/ReservoirDataModel/RigCell.h +++ b/ApplicationCode/ReservoirDataModel/RigCell.h @@ -20,8 +20,10 @@ #pragma once #include "RigLocalGrid.h" + #include "cvfStructGrid.h" -#include "cafFixedArray.h" + +#include namespace cvf { @@ -36,8 +38,9 @@ public: RigCell(); ~RigCell(); // Not virtual, to save space. Do not inherit from this class - caf::SizeTArray8& cornerIndices() { return m_cornerIndices;} - const caf::SizeTArray8& cornerIndices() const { return m_cornerIndices;} + std::array& cornerIndices() { return m_cornerIndices;} + const std::array& cornerIndices() const { return m_cornerIndices;} + void faceIndices(cvf::StructGridInterface::FaceType face, caf::SizeTArray4 * faceIndices) const ; bool isInvalid() const { return m_isInvalid; } @@ -71,7 +74,7 @@ public: bool isLongPyramidCell(double maxHeightFactor = 5, double nodeNearTolerance = 1e-3 ) const; bool isCollapsedCell( double nodeNearTolerance = 1e-3) const; private: - caf::SizeTArray8 m_cornerIndices; + std::array m_cornerIndices; size_t m_gridLocalCellIndex; ///< This cells index in the grid it belongs to. RigGridBase* m_hostGrid; diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp index f826c41094..95fd8f54f1 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -626,17 +626,15 @@ void RigEclipseCaseData::computeActiveCellsGeometryBoundingBox() } else { + std::array hexCorners; for (size_t i = 0; i < m_mainGrid->cellCount(); i++) { if (activeInfos[acIdx]->isActive(i)) { - const RigCell& c = m_mainGrid->globalCellArray()[i]; - const caf::SizeTArray8& indices = c.cornerIndices(); - - size_t idx; - for (idx = 0; idx < 8; idx++) + m_mainGrid->cellCornerVertices(i, hexCorners.data()); + for (const auto& corner : hexCorners) { - bb.add(m_mainGrid->nodes()[indices[idx]]); + bb.add(corner); } } } diff --git a/ApplicationCode/ReservoirDataModel/RigGridBase.cpp b/ApplicationCode/ReservoirDataModel/RigGridBase.cpp index 6e42c71bfd..6a8d72e160 100644 --- a/ApplicationCode/ReservoirDataModel/RigGridBase.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGridBase.cpp @@ -154,7 +154,7 @@ void RigGridBase::initSubCellsMainGridCellIndex() //-------------------------------------------------------------------------------------------------- void RigGridBase::cellCornerVertices(size_t cellIndex, cvf::Vec3d vertices[8]) const { - const caf::SizeTArray8& indices = cell(cellIndex).cornerIndices(); + const std::array& indices = cell(cellIndex).cornerIndices(); vertices[0].set(m_mainGrid->nodes()[indices[0]]); vertices[1].set(m_mainGrid->nodes()[indices[1]]); diff --git a/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp b/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp index 8a3c6ef002..db1f14e726 100644 --- a/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp +++ b/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp @@ -597,10 +597,10 @@ void RigMainGrid::buildCellSearchTree() for (size_t cIdx = 0; cIdx < cellCount; ++cIdx) { - const caf::SizeTArray8& cellIndices = m_cells[cIdx].cornerIndices(); - if (m_cells[cIdx].isInvalid()) continue; + const std::array& cellIndices = m_cells[cIdx].cornerIndices(); + cvf::BoundingBox& cellBB = cellBoundingBoxes[cIdx]; cellBB.add(m_nodes[cellIndices[0]]); cellBB.add(m_nodes[cellIndices[1]]); diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index 07505ad984..7458e7971b 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -222,7 +222,7 @@ void RigReservoirBuilderMock::populateReservoir(RigEclipseCaseData* eclipseCase) { RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[mainGridIndicesWithSubGrid[cellIdx]]; - caf::SizeTArray8& indices = cell.cornerIndices(); + std::array& indices = cell.cornerIndices(); int nodeIdx; for (nodeIdx = 0; nodeIdx < 8; nodeIdx++) { diff --git a/ApplicationCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp index 2d47615e51..64f04cc5b0 100644 --- a/ApplicationCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp @@ -754,7 +754,7 @@ private: if ( wellCell.isInvalid() ) continue; - const caf::SizeTArray8& cellIndices = wellCell.cornerIndices(); + const std::array& cellIndices = wellCell.cornerIndices(); cvf::BoundingBox& cellBB = m_cellBoundingBoxes[cIdx]; cellBB.add(nodes[cellIndices[0]]);