From 51bb06764ad91c7fede76dcac4a401bdb79d6045 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 12 Mar 2025 16:23:13 +0100 Subject: [PATCH] ENH: add polyBoundaryMesh::nNonProcessorFaces() - the number boundary faces before the first processor patch. This approximately equals the 'real' number of boundary faces --- .../compat/polyBoundaryMeshTemplates.C | 1 + .../polyBoundaryMesh/polyBoundaryMesh.C | 22 ++++++++++++++++++- .../polyBoundaryMesh/polyBoundaryMesh.H | 9 +++++--- ...ryMeshTemplates.C => polyBoundaryMesh.txx} | 0 .../faMesh/faBoundaryMesh/faBoundaryMesh.C | 22 ++++++++++++++++++- .../faMesh/faBoundaryMesh/faBoundaryMesh.H | 5 ++++- 6 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 src/OpenFOAM/compat/polyBoundaryMeshTemplates.C rename src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/{polyBoundaryMeshTemplates.C => polyBoundaryMesh.txx} (100%) diff --git a/src/OpenFOAM/compat/polyBoundaryMeshTemplates.C b/src/OpenFOAM/compat/polyBoundaryMeshTemplates.C new file mode 100644 index 0000000000..7cec1b4541 --- /dev/null +++ b/src/OpenFOAM/compat/polyBoundaryMeshTemplates.C @@ -0,0 +1 @@ +#warning File removed - left for old dependency check only diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index c3e9cd5d6a..f127ff9d2c 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -656,6 +656,26 @@ Foam::label Foam::polyBoundaryMesh::nProcessorPatches() const } +Foam::label Foam::polyBoundaryMesh::nNonProcessorFaces() const +{ + const polyPatchList& patches = *this; + + label count = 0; + + for (const polyPatch& p : patches) + { + if (isA(p)) + { + break; + } + + count += p.nFaces(); + } + + return count; +} + + Foam::wordList Foam::polyBoundaryMesh::names() const { return PtrListOps::get(*this, nameOp()); diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index d21d9cf0b5..80af040dc7 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,7 +33,7 @@ Description SourceFiles polyBoundaryMesh.C - polyBoundaryMeshTemplates.C + polyBoundaryMesh.txx \*---------------------------------------------------------------------------*/ @@ -212,6 +212,9 @@ public: //- The number of processorPolyPatch patches label nProcessorPatches() const; + //- The number of boundary faces before the first processor patch. + label nNonProcessorFaces() const; + //- Return a list of patch names wordList names() const; @@ -427,7 +430,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "polyBoundaryMeshTemplates.C" + #include "polyBoundaryMesh.txx" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshTemplates.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.txx similarity index 100% rename from src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshTemplates.C rename to src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.txx diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C index e770328a70..c2552d8d96 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -422,6 +422,26 @@ Foam::label Foam::faBoundaryMesh::nProcessorPatches() const } +Foam::label Foam::faBoundaryMesh::nNonProcessorEdges() const +{ + const faPatchList& patches = *this; + + label count = 0; + + for (const faPatch& p : patches) + { + if (isA(p)) + { + break; + } + + count += p.nEdges(); + } + + return count; +} + + const Foam::HashTable& Foam::faBoundaryMesh::groupPatchIDs() const { diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H index cad2924791..2bba989a4d 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -188,6 +188,9 @@ public: //- The number of processorFaPatch patches label nProcessorPatches() const; + //- The number of boundary edges before the first processor patch. + label nNonProcessorEdges() const; + //- Return a list of patch names wordList names() const;