diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 67c4cb10ad..a413e8037e 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-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,6 +34,7 @@ License #include "lduSchedule.H" #include "globalMeshData.H" #include "stringListOps.H" +#include "PtrListOps.H" #include "edgeHashes.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -43,81 +44,6 @@ namespace Foam defineTypeNameAndDebug(polyBoundaryMesh, 0); } -// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // - -namespace Foam -{ - // Templated implementation for types(), names(), etc - file-scope - template - static ListType getMethodImpl - ( - const polyPatchList& list, - const GetOp& getop - ) - { - const label len = list.size(); - - ListType output(len); - - for (label i = 0; i < len; ++i) - { - output[i] = getop(list[i]); - } - - return output; - } - - - // Templated implementation for indices() - file-scope - template - static labelList indicesImpl - ( - const polyPatchList& list, - const UnaryMatchPredicate& matcher - ) - { - const label len = list.size(); - - labelList output(len); - - label count = 0; - for (label i = 0; i < len; ++i) - { - if (matcher(list[i].name())) - { - output[count++] = i; - } - } - - output.resize(count); - - return output; - } - - - // Templated implementation for findIndex() - file-scope - template - label findIndexImpl - ( - const polyPatchList& list, - const UnaryMatchPredicate& matcher - ) - { - const label len = list.size(); - - for (label i = 0; i < len; ++i) - { - if (matcher(list[i].name())) - { - return i; - } - } - - return -1; - } - -} // End namespace Foam - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -592,20 +518,20 @@ Foam::label Foam::polyBoundaryMesh::nNonProcessor() const Foam::wordList Foam::polyBoundaryMesh::names() const { - return getMethodImpl(*this, getNameOp()); + return PtrListOps::get(*this, nameOp()); } Foam::wordList Foam::polyBoundaryMesh::types() const { - return getMethodImpl(*this, getTypeOp()); + return PtrListOps::get(*this, typeOp()); } Foam::wordList Foam::polyBoundaryMesh::physicalTypes() const { return - getMethodImpl + PtrListOps::get ( *this, [](const polyPatch& p) { return p.physicalType(); } @@ -616,7 +542,7 @@ Foam::wordList Foam::polyBoundaryMesh::physicalTypes() const Foam::labelList Foam::polyBoundaryMesh::patchStarts() const { return - getMethodImpl + PtrListOps::get