/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Description Simple timing tests for some polyMesh primitives \*---------------------------------------------------------------------------*/ #include "argList.H" #include "clockTime.H" #include "Time.H" #include "PDRblock.H" #include "polyMesh.H" #include "ListOps.H" using namespace Foam; void printAlloc(const polyMesh& mesh) { Info<< "memory" << " hasCellPoints:" << mesh.hasCellPoints() << " hasPointCells:" << mesh.hasPointCells() << endl; } void printInfo(const polyMesh& mesh) { Info<< "polyMesh" << " nPoints:" << mesh.nPoints() << " nInternalFaces:" << mesh.nInternalFaces() << " nFaces:" << mesh.nFaces() << " nCells:" << mesh.nCells() << endl; } // How point cells are calculated in OpenFOAM-v2212 and earlier autoPtr pointCells_2212(const polyMesh& mesh) { const cellList& cf = mesh.cells(); // Count number of cells per point labelList npc(mesh.nPoints(), Zero); forAll(cf, celli) { const labelList curPoints = cf[celli].labels(mesh.faces()); for (const label pointi : curPoints) { ++npc[pointi]; } } // Size and fill cells per point auto pcPtr_ = autoPtr::New(npc.size()); labelListList& pointCellAddr = *pcPtr_; forAll(pointCellAddr, pointi) { pointCellAddr[pointi].setSize(npc[pointi]); npc[pointi] = 0; } forAll(cf, celli) { const labelList curPoints = cf[celli].labels(mesh.faces()); for (const label pointi : curPoints) { pointCellAddr[pointi][npc[pointi]++] = celli; } } return pcPtr_; } // Line cell::labels but with persistent storage void cell_labels ( const cell& cFaces, const faceUList& meshFaces, DynamicList