From 709472a7bbe49ddfe7e522f0153a599f00cc8e4e Mon Sep 17 00:00:00 2001 From: alonzameret Date: Mon, 27 Feb 2023 15:32:32 +0200 Subject: [PATCH] ENH: improve efficiency of point-cell/cell-point construction (#2715) - reworked simpler looping, reinstate pointCells() calculation but with markup as per cellPoints() --- .../primitiveMesh/primitiveMeshCellPoints.C | 61 ++++++--------- .../primitiveMesh/primitiveMeshPointCells.C | 77 ++++++++++++++++++- 2 files changed, 100 insertions(+), 38 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C index 9748e8f9a1..a0e1f3d7e6 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C @@ -29,6 +29,7 @@ License #include "primitiveMesh.H" #include "cell.H" #include "bitSet.H" +#include "DynamicList.H" #include "ListOps.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -67,52 +68,40 @@ void Foam::primitiveMesh::calcCellPoints() const { // Calculate cell-point topology - const cellList& cL = cells(); - const faceList& fL = faces(); - cpPtr_ = new labelListList(nCells()); - labelListList& cellPoints = *cpPtr_; + auto& cellPointAddr = *cpPtr_; - // Mark points we have found as to not count them twice for the same cell - Foam::bitSet foundPoint(nPoints(), false); + const cellList& cellLst = cells(); + const faceList& faceLst = faces(); - forAll (cL, cellIdx) + // For tracking (only use each point id once) + bitSet usedPoints(nPoints()); + + // Vertex labels for the current cell + DynamicList