ENH: more explicit about handling empty matchers for index lookup

- for boundary meshes, zones etc. The behaviour with an empty matcher
  was either not properly documented, and looped through all
  names just to establish there was no match.

STYLE: removed redundant typedefs for point fields
This commit is contained in:
Mark Olesen
2020-12-07 11:46:28 +01:00
parent df74e8448c
commit 0b68f14f7d
18 changed files with 89 additions and 43 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -289,6 +289,11 @@ Foam::label Foam::faBoundaryMesh::findIndex(const keyType& key) const
Foam::label Foam::faBoundaryMesh::findPatchID(const word& patchName) const
{
if (patchName.empty())
{
return -1;
}
return findIndexImpl(*this, patchName);
}

View File

@ -55,7 +55,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Forward declarations
// Forward Declarations
class faMesh;
class faBoundaryMesh;
Ostream& operator<<(Ostream&, const faBoundaryMesh&);
@ -121,7 +121,7 @@ public:
const faMesh& mesh() const;
//- Return a list of pointers for each patch
// with only those pointing to interfaces being set
//- with only those pointing to interfaces being set
lduInterfacePtrsList interfaces() const;
//- Return a list of patch names
@ -131,7 +131,8 @@ public:
wordList types() const;
//- Return patch indices for all matches.
// \not Matching patchGroups currently not supported
// A no-op (returns -1) for an empty key
// \note Matching patchGroups currently not supported
labelList indices
(
const keyType& key,
@ -139,9 +140,11 @@ public:
) const;
//- Return patch index for the first match, return -1 if not found
// A no-op (returns -1) for an empty key
label findIndex(const keyType& key) const;
//- Find patch index given a name, return -1 if not found
// A no-op (returns -1) for an empty name
label findPatchID(const word& patchName) const;
//- Return patch index for a given edge label