ENH: added polyBoundaryMesh patchID(meshFacei) method

- this complements the whichPatch(meshFacei) method [binary search]
  and the list of patchID() by adding internal range checks.

  eg,
     Before
     ~~~~~~
     if (facei >= mesh.nInternalFaces() && facei < mesh.nFaces())
     {
         patchi = pbm.patchID()[facei - mesh.nInternalFaces()];
         ...
     }

     After
     ~~~~~
     patchi = pbm.patchID(facei);

     if (patchi >= 0)
     {
         ...
     }
This commit is contained in:
Mark Olesen
2023-05-09 10:22:29 +02:00
parent dfa5c05a16
commit f462a850ce
17 changed files with 123 additions and 109 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -412,7 +412,7 @@ void Foam::fv::directionalPressureGradientExplicitSource::correct
}
else if (fZone.flipMap()[i])
{
label patchI = pbm.patchID()[faceI-mesh_.nInternalFaces()];
const label patchI = pbm.patchID(faceI);
label localFaceI = pbm[patchI].whichFace(faceI);
scalar w = mesh_.magSf().boundaryField()[patchI][localFaceI];