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

@ -106,11 +106,10 @@ void ReadAndMapFields
}
else if (index < 0)
{
label facei = -index-1;
label bFacei = facei - mesh.nInternalFaces();
if (bFacei >= 0)
const label facei = -index-1;
const label patchi = mesh.boundaryMesh().patchID(facei);
if (patchi >= 0)
{
label patchi = mesh.boundaryMesh().patchID()[bFacei];
label localFacei = mesh.boundaryMesh()[patchi].whichFace
(
facei