diff --git a/applications/test/boundBox2/Test-boundBox2.C b/applications/test/boundBox2/Test-boundBox2.C index 3c88e70d51..4d929dd7a4 100644 --- a/applications/test/boundBox2/Test-boundBox2.C +++ b/applications/test/boundBox2/Test-boundBox2.C @@ -143,7 +143,7 @@ int main(int argc, char *argv[]) { #include "setRootCase.H" - treeBoundBox bb(cube(0, 1)); + treeBoundBox bb(zero_one{}); treeBoundBox sub(cube(0.1, 0.8)); Info<< nl diff --git a/applications/test/polyMeshGeom-speed1/Make/files b/applications/test/polyMeshGeom-speed1/Make/files new file mode 100644 index 0000000000..e6c64cc479 --- /dev/null +++ b/applications/test/polyMeshGeom-speed1/Make/files @@ -0,0 +1,3 @@ +Test-polyMeshGeom-speed1.C + +EXE = $(FOAM_USER_APPBIN)/Test-polyMeshGeom-speed1 diff --git a/applications/test/polyMeshGeom-speed1/Make/options b/applications/test/polyMeshGeom-speed1/Make/options new file mode 100644 index 0000000000..b4f99e5295 --- /dev/null +++ b/applications/test/polyMeshGeom-speed1/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/mesh/blockMesh/lnInclude + +EXE_LIBS = \ + -lblockMesh diff --git a/applications/test/polyMeshGeom-speed1/Test-polyMeshGeom-speed1.C b/applications/test/polyMeshGeom-speed1/Test-polyMeshGeom-speed1.C new file mode 100644 index 0000000000..4c268797dd --- /dev/null +++ b/applications/test/polyMeshGeom-speed1/Test-polyMeshGeom-speed1.C @@ -0,0 +1,804 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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