ENH: replace keyType with wordRe for matching selectors.

- The keyType is primarily used within dictionary reading, whereas
  wordRe and wordRes are used for selectors in code.
  Unifying on wordRe and wordRes reduces the number matching options.
This commit is contained in:
Mark Olesen
2021-04-08 13:42:38 +02:00
committed by Andrew Heather
parent 95cd8ee75c
commit 2b7b3700c2
28 changed files with 255 additions and 367 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -49,11 +50,13 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createPolyMesh.H" #include "createPolyMesh.H"
const wordRes patchSelection(args.getList<wordRe>(1));
const polyBoundaryMesh& pbm = mesh.boundaryMesh(); const polyBoundaryMesh& pbm = mesh.boundaryMesh();
labelList patchIDs labelList patchIDs
( (
pbm.patchSet(args.getList<wordRe>(1)).sortedToc() pbm.patchSet(patchSelection).sortedToc()
); );
Info<< "Starting walk from patches " Info<< "Starting walk from patches "

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd. Copyright (C) 2016-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -495,7 +495,7 @@ int main(int argc, char *argv[])
wordRes zoneNames; wordRes zoneNames;
if (useCellZone) if (useCellZone)
{ {
List<wordRe> selectionNames = args.getList<wordRe>(1); wordRes selectionNames(args.getList<wordRe>(1));
zoneNames.transfer(selectionNames); zoneNames.transfer(selectionNames);
Info<< "Using cellZone " << flatOutput(zoneNames) << nl << endl; Info<< "Using cellZone " << flatOutput(zoneNames) << nl << endl;

View File

@ -59,11 +59,9 @@ static inline void writeEntryIfPresent
) )
{ {
const entry* eptr = dict.findEntry(key, keyType::LITERAL); const entry* eptr = dict.findEntry(key, keyType::LITERAL);
if (eptr) if (eptr)
{ {
const tokenList& toks = eptr->stream(); const tokenList& toks = eptr->stream();
if (!toks.empty()) if (!toks.empty())
{ {
os.writeEntry(key, toks[0]); os.writeEntry(key, toks[0]);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,7 +39,7 @@ Description
#ifndef DynamicID_H #ifndef DynamicID_H
#define DynamicID_H #define DynamicID_H
#include "keyType.H" #include "wordRe.H"
#include "labelList.H" #include "labelList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,11 +47,6 @@ Description
namespace Foam namespace Foam
{ {
// Forward declarations
template<class> class DynamicID;
template<class ObjectType>
Ostream& operator<<(Ostream&, const DynamicID<ObjectType>&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class DynamicID Declaration Class DynamicID Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -59,12 +54,12 @@ Ostream& operator<<(Ostream&, const DynamicID<ObjectType>&);
template<class ObjectType> template<class ObjectType>
class DynamicID class DynamicID
{ {
// Private data // Private Data
//- Zone name //- Selector name
keyType key_; wordRe key_;
//- Zone indices //- Selection indices
labelList indices_; labelList indices_;
@ -72,18 +67,36 @@ public:
// Constructors // Constructors
//- Construct from name //- Construct from selector name and object
DynamicID(const keyType& key, const ObjectType& obj) DynamicID(const wordRe& key, const ObjectType& obj)
: :
key_(key), key_(key),
indices_(obj.indices(key_)) indices_(obj.indices(key_))
{} {}
//- Construct from Istream //- Construct from selector name and object
DynamicID(wordRe&& key, const ObjectType& obj)
:
key_(std::move(key)),
indices_(obj.indices(key_))
{}
//- Construct from selector name and object
DynamicID(const word& key, const ObjectType& obj)
:
DynamicID(wordRe(key), obj)
{}
//- Construct from selector name and object
DynamicID(const keyType& key, const ObjectType& obj)
:
DynamicID(wordRe(key), obj)
{}
//- Construct from Istream and object
DynamicID(Istream& is, const ObjectType& obj) DynamicID(Istream& is, const ObjectType& obj)
: :
key_(is), DynamicID(wordRe(is), obj)
indices_(obj.indices(key_))
{} {}
@ -95,26 +108,26 @@ public:
// Access // Access
//- Return name //- The selector name
const keyType& name() const const wordRe& name() const noexcept
{ {
return key_; return key_;
} }
//- Return indices of matching zones //- The indices of matching items
const labelList& indices() const const labelList& indices() const noexcept
{ {
return indices_; return indices_;
} }
//- Return index of first matching zone //- The index of the first matching items, -1 if no matches
label index() const label index() const
{ {
return indices_.empty() ? -1 : indices_.first(); return indices_.empty() ? -1 : indices_.first();
} }
//- Has the zone been found //- Has the zone been found
bool active() const bool active() const noexcept
{ {
return !indices_.empty(); return !indices_.empty();
} }
@ -127,22 +140,16 @@ public:
{ {
indices_ = obj.indices(key_); indices_ = obj.indices(key_);
} }
// IOstream Operators
friend Ostream& operator<< <ObjectType>
(Ostream&, const DynamicID<ObjectType>&);
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class ObjectType> template<class ObjectType>
Ostream& operator<<(Ostream& os, const DynamicID<ObjectType>& dynId) Ostream& operator<<(Ostream& os, const DynamicID<ObjectType>& obj)
{ {
os << token::BEGIN_LIST os << token::BEGIN_LIST
<< dynId.name() << token::SPACE << dynId.index() << obj.name() << token::SPACE << obj.index()
<< token::END_LIST; << token::END_LIST;
os.check(FUNCTION_NAME); os.check(FUNCTION_NAME);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,11 +63,11 @@ Foam::pointBoundaryMesh::pointBoundaryMesh
Foam::labelList Foam::pointBoundaryMesh::indices Foam::labelList Foam::pointBoundaryMesh::indices
( (
const keyType& key, const wordRe& matcher,
const bool useGroups const bool useGroups
) const ) const
{ {
return mesh()().boundaryMesh().indices(key, useGroups); return mesh()().boundaryMesh().indices(matcher, useGroups);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -94,14 +94,14 @@ public:
// Member Functions // Member Functions
//- Return the mesh reference //- Return the mesh reference
const pointMesh& mesh() const const pointMesh& mesh() const noexcept
{ {
return mesh_; return mesh_;
} }
//- Find patch indices given a name //- Find patch indices given a name
// A no-op (returns empty list) for an empty key // A no-op (returns empty list) for an empty key
labelList indices(const keyType& key, const bool useGroups) const; labelList indices(const wordRe& matcher, const bool useGroups) const;
//- Find patch index given a name //- Find patch index given a name
// A no-op (returns -1) for an empty patchName // A no-op (returns -1) for an empty patchName
@ -118,7 +118,7 @@ public:
//- Identical to the indices() method (AUG-2018) //- Identical to the indices() method (AUG-2018)
FOAM_DEPRECATED_FOR(2018-08, "indices() method") FOAM_DEPRECATED_FOR(2018-08, "indices() method")
labelList findIndices(const keyType& key, const bool useGroups) const labelList findIndices(const wordRe& key, bool useGroups) const
{ {
return indices(key, useGroups); return indices(key, useGroups);
} }

View File

@ -604,20 +604,19 @@ Foam::labelRange Foam::polyBoundaryMesh::range(const label patchi) const
Foam::labelList Foam::polyBoundaryMesh::indices Foam::labelList Foam::polyBoundaryMesh::indices
( (
const keyType& key, const wordRe& matcher,
const bool useGroups const bool useGroups
) const ) const
{ {
if (key.empty()) if (matcher.empty())
{ {
return labelList(); return labelList();
} }
DynamicList<label> patchIndices; DynamicList<label> patchIndices;
if (key.isPattern()) if (matcher.isPattern())
{ {
const regExp matcher(key);
patchIndices = PtrListOps::findMatching(*this, matcher); patchIndices = PtrListOps::findMatching(*this, matcher);
// Only examine patch groups if requested and when they exist. // Only examine patch groups if requested and when they exist.
@ -648,7 +647,6 @@ Foam::labelList Foam::polyBoundaryMesh::indices
// Literal string. // Literal string.
// Special version of above for reduced memory footprint // Special version of above for reduced memory footprint
const word& matcher = key;
const label patchId = PtrListOps::firstMatching(*this, matcher); const label patchId = PtrListOps::firstMatching(*this, matcher);
if (patchId >= 0) if (patchId >= 0)
@ -659,7 +657,7 @@ Foam::labelList Foam::polyBoundaryMesh::indices
// Only examine patch groups if requested and when they exist. // Only examine patch groups if requested and when they exist.
if (useGroups && !groupPatchIDs().empty()) if (useGroups && !groupPatchIDs().empty())
{ {
const auto iter = groupPatchIDs().cfind(key); const auto iter = groupPatchIDs().cfind(matcher);
if (iter.found()) if (iter.found())
{ {
@ -676,24 +674,13 @@ Foam::labelList Foam::polyBoundaryMesh::indices
} }
Foam::label Foam::polyBoundaryMesh::findIndex(const keyType& key) const Foam::label Foam::polyBoundaryMesh::findIndex(const wordRe& key) const
{ {
if (key.empty()) if (key.empty())
{ {
return -1; return -1;
} }
else if (key.isPattern()) return PtrListOps::firstMatching(*this, key);
{
// Find as regex
const regExp matcher(key);
return PtrListOps::firstMatching(*this, matcher);
}
else
{
// Find as literal string
const word& matcher = key;
return PtrListOps::firstMatching(*this, matcher);
}
} }

View File

@ -132,6 +132,7 @@ public:
//- Destructor //- Destructor
~polyBoundaryMesh() = default; ~polyBoundaryMesh() = default;
//- Clear geometry at this level and at patches //- Clear geometry at this level and at patches
void clearGeom(); void clearGeom();
@ -142,7 +143,7 @@ public:
// Member Functions // Member Functions
//- Return the mesh reference //- Return the mesh reference
const polyMesh& mesh() const const polyMesh& mesh() const noexcept
{ {
return mesh_; return mesh_;
} }
@ -200,14 +201,14 @@ public:
// A no-op (returns empty list) for an empty key // A no-op (returns empty list) for an empty key
labelList indices labelList indices
( (
const keyType& key, const wordRe& matcher,
const bool useGroups = true const bool useGroups = true
) const; ) const;
//- Return patch index for the first match, return -1 if not found //- Return patch index for the first match, return -1 if not found
// A no-op (returns -1) for an empty key // A no-op (returns -1) for an empty key
label findIndex(const keyType& key) const; label findIndex(const wordRe& key) const;
//- Find patch index given a name, return -1 if not found //- Find patch index given a name, return -1 if not found
// A no-op (returns -1) for an empty patchName // A no-op (returns -1) for an empty patchName
@ -296,7 +297,7 @@ public:
polyPatch& operator[](const word& patchName); polyPatch& operator[](const word& patchName);
// Ostream operator // Ostream Operator
friend Ostream& operator<<(Ostream& os, const polyBoundaryMesh& pbm); friend Ostream& operator<<(Ostream& os, const polyBoundaryMesh& pbm);
@ -305,11 +306,7 @@ public:
//- Identical to the indices() method (AUG-2018) //- Identical to the indices() method (AUG-2018)
FOAM_DEPRECATED_FOR(2018-08, "indices() method") FOAM_DEPRECATED_FOR(2018-08, "indices() method")
labelList findIndices labelList findIndices(const wordRe& key, bool useGroups=true) const
(
const keyType& key,
const bool useGroups = true
) const
{ {
return this->indices(key, useGroups); return this->indices(key, useGroups);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -181,10 +181,10 @@ Foam::labelList Foam::processorCyclicPolyPatch::patchIDs
{ {
return bm.indices return bm.indices
( (
keyType wordRe
( (
"procBoundary.*to.*through" + cyclicPolyPatchName, "procBoundary.*to.*through" + cyclicPolyPatchName,
keyType::REGEX wordRe::REGEX
) )
); );
} }

View File

@ -311,26 +311,15 @@ const
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indices Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indices
( (
const keyType& key const wordRe& matcher
) const ) const
{ {
if (key.empty()) if (matcher.empty())
{ {
return labelList(); return labelList();
} }
else if (key.isPattern())
{
// Match as regex
const regExp matcher(key);
return PtrListOps::findMatching(*this, matcher); return PtrListOps::findMatching(*this, matcher);
} }
else
{
// Compare as literal string
const word& matcher = key;
return PtrListOps::findMatching(*this, matcher);
}
}
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
@ -350,25 +339,14 @@ Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indices
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findIndex Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findIndex
( (
const keyType& key const wordRe& key
) const ) const
{ {
if (key.empty()) if (key.empty())
{ {
return -1; return -1;
} }
else if (key.isPattern()) return PtrListOps::firstMatching(*this, key);
{
// Find as regex
const regExp matcher(key);
return PtrListOps::firstMatching(*this, matcher);
}
else
{
// Find as literal string
const word& matcher = key;
return PtrListOps::firstMatching(*this, matcher);
}
} }
@ -378,7 +356,11 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findIndex
const wordRes& matcher const wordRes& matcher
) const ) const
{ {
return (matcher.empty() ? -1 : PtrListOps::firstMatching(*this, matcher)); if (matcher.empty())
{
return -1;
}
return PtrListOps::firstMatching(*this, matcher);
} }
@ -495,11 +477,11 @@ Foam::bitSet Foam::ZoneMesh<ZoneType, MeshType>::selection
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::bitSet Foam::ZoneMesh<ZoneType, MeshType>::selection Foam::bitSet Foam::ZoneMesh<ZoneType, MeshType>::selection
( (
const keyType& key const wordRe& matcher
) const ) const
{ {
// key.empty() is handled by indices() // matcher.empty() is handled by indices()
return this->selection(this->indices(key)); return this->selection(this->indices(matcher));
} }

View File

@ -38,10 +38,10 @@ SourceFiles
#ifndef ZoneMesh_H #ifndef ZoneMesh_H
#define ZoneMesh_H #define ZoneMesh_H
#include "List.H"
#include "regIOobject.H" #include "regIOobject.H"
#include "pointField.H" #include "pointField.H"
#include "Map.H" #include "Map.H"
#include "PtrList.H"
#include "bitSet.H" #include "bitSet.H"
#include "wordRes.H" #include "wordRes.H"
@ -51,7 +51,6 @@ namespace Foam
{ {
// Forward Declarations // Forward Declarations
template<class ZoneType, class MeshType> class ZoneMesh; template<class ZoneType, class MeshType> class ZoneMesh;
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
@ -131,7 +130,7 @@ public:
// Member Functions // Member Functions
//- Return the mesh reference //- Return the mesh reference
const MeshType& mesh() const const MeshType& mesh() const noexcept
{ {
return mesh_; return mesh_;
} }
@ -167,8 +166,8 @@ public:
//- Return zone indices for all matches //- Return zone indices for all matches
// A no-op (returns empty list) for an empty key // A no-op (returns empty list) for an empty matcher
labelList indices(const keyType& key) const; labelList indices(const wordRe& matcher) const;
//- Return zone indices for all matches //- Return zone indices for all matches
// A no-op (returns empty list) for an empty matcher // A no-op (returns empty list) for an empty matcher
@ -176,7 +175,7 @@ public:
//- Zone index for the first match, return -1 if not found //- Zone index for the first match, return -1 if not found
// A no-op (returns -1) for an empty key // A no-op (returns -1) for an empty key
label findIndex(const keyType& key) const; label findIndex(const wordRe& key) const;
//- Zone index for the first match, return -1 if not found //- Zone index for the first match, return -1 if not found
// A no-op (returns -1) for an empty matcher // A no-op (returns -1) for an empty matcher
@ -205,8 +204,8 @@ public:
//- specification as a bitSet. //- specification as a bitSet.
// The bitSet is empty (zero-size) if there are no elements matched // The bitSet is empty (zero-size) if there are no elements matched
// anywhere. // anywhere.
// A no-op (returns empty bitSet) for an empty key // A no-op (returns empty bitSet) for an empty matcher
bitSet selection(const keyType& key) const; bitSet selection(const wordRe& matcher) const;
//- Return all elements (cells, faces, points) that match the zone //- Return all elements (cells, faces, points) that match the zone
//- specification as a bitSet. //- specification as a bitSet.
@ -288,7 +287,7 @@ public:
//- Identical to the indices() method (AUG-2018) //- Identical to the indices() method (AUG-2018)
FOAM_DEPRECATED_FOR(2018-08, "indices() method") FOAM_DEPRECATED_FOR(2018-08, "indices() method")
labelList findIndices(const keyType& key) const labelList findIndices(const wordRes& key) const
{ {
return indices(key); return indices(key);
} }

View File

@ -157,18 +157,17 @@ Foam::wordList Foam::faBoundaryMesh::types() const
Foam::labelList Foam::faBoundaryMesh::indices Foam::labelList Foam::faBoundaryMesh::indices
( (
const keyType& key, const wordRe& matcher,
const bool useGroups // ignored const bool useGroups // ignored
) const ) const
{ {
if (key.empty()) if (matcher.empty())
{ {
return labelList(); return labelList();
} }
if (key.isPattern()) if (matcher.isPattern())
{ {
const regExp matcher(key);
return PtrListOps::findMatching(*this, matcher); return PtrListOps::findMatching(*this, matcher);
} }
else else
@ -176,7 +175,6 @@ Foam::labelList Foam::faBoundaryMesh::indices
// Literal string. // Literal string.
// Special version of above for reduced memory footprint // Special version of above for reduced memory footprint
const word& matcher = key;
const label patchId = PtrListOps::firstMatching(*this, matcher); const label patchId = PtrListOps::firstMatching(*this, matcher);
if (patchId >= 0) if (patchId >= 0)
@ -189,24 +187,13 @@ Foam::labelList Foam::faBoundaryMesh::indices
} }
Foam::label Foam::faBoundaryMesh::findIndex(const keyType& key) const Foam::label Foam::faBoundaryMesh::findIndex(const wordRe& key) const
{ {
if (key.empty()) if (key.empty())
{ {
return -1; return -1;
} }
else if (key.isPattern()) return PtrListOps::firstMatching(*this, key);
{
// Find as regex
const regExp matcher(key);
return PtrListOps::firstMatching(*this, matcher);
}
else
{
// Find as literal string
const word& matcher = key;
return PtrListOps::firstMatching(*this, matcher);
}
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -135,13 +135,13 @@ public:
// \note Matching patchGroups currently not supported // \note Matching patchGroups currently not supported
labelList indices labelList indices
( (
const keyType& key, const wordRe& matcher,
const bool useGroups = false /* ignored */ const bool useGroups = false /* ignored */
) const; ) const;
//- Return patch index for the first match, return -1 if not found //- Return patch index for the first match, return -1 if not found
// A no-op (returns -1) for an empty key // A no-op (returns -1) for an empty key
label findIndex(const keyType& key) const; label findIndex(const wordRe& key) const;
//- Find patch index given a name, return -1 if not found //- Find patch index given a name, return -1 if not found
// A no-op (returns -1) for an empty name // A no-op (returns -1) for an empty name
@ -175,11 +175,7 @@ public:
//- Identical to the indices() method (AUG-2018) //- Identical to the indices() method (AUG-2018)
FOAM_DEPRECATED_FOR(2018-08, "indices() method") FOAM_DEPRECATED_FOR(2018-08, "indices() method")
labelList findIndices labelList findIndices(const wordRe& key, bool useGroups=false) const
(
const keyType& key,
const bool useGroups = false
) const
{ {
return indices(key, useGroups); return indices(key, useGroups);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd. Copyright (C) 2016-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -99,7 +99,7 @@ Foam::porosityModel::porosityModel
coordinateSystem::New(mesh, coeffs_, coordinateSystem::typeName_()) coordinateSystem::New(mesh, coeffs_, coordinateSystem::typeName_())
) )
{ {
if (zoneName_ == word::null) if (zoneName_.empty())
{ {
dict.readIfPresent("active", active_); dict.readIfPresent("active", active_);
dict_.readEntry("cellZone", zoneName_); dict_.readEntry("cellZone", zoneName_);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2018 OpenFOAM Foundation Copyright (C) 2012-2018 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -44,7 +45,6 @@ SourceFiles
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "coordinateSystem.H" #include "coordinateSystem.H"
#include "dimensionedVector.H" #include "dimensionedVector.H"
#include "keyType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,7 +70,7 @@ class porosityModel
protected: protected:
// Protected data // Protected Data
//- Porosity name //- Porosity name
word name_; word name_;
@ -88,7 +88,7 @@ protected:
bool active_; bool active_;
//- Name(s) of cell-zone //- Name(s) of cell-zone
keyType zoneName_; wordRe zoneName_;
//- Cell zone IDs //- Cell zone IDs
labelList cellZoneIDs_; labelList cellZoneIDs_;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -75,11 +75,11 @@ Foam::fvBoundaryMesh::fvBoundaryMesh
Foam::labelList Foam::fvBoundaryMesh::indices Foam::labelList Foam::fvBoundaryMesh::indices
( (
const keyType& key, const wordRe& matcher,
const bool useGroups const bool useGroups
) const ) const
{ {
return mesh().boundaryMesh().indices(key, useGroups); return mesh().boundaryMesh().indices(matcher, useGroups);
} }

View File

@ -110,8 +110,8 @@ public:
lduInterfacePtrsList interfaces() const; lduInterfacePtrsList interfaces() const;
//- Return patch indices for all matches. //- Return patch indices for all matches.
// A no-op (returns empty list) for an empty key // A no-op (returns empty list) for an empty matcher
labelList indices(const keyType& key, const bool useGroups) const; labelList indices(const wordRe& matcher, const bool useGroups) const;
//- Find patch index given a name //- Find patch index given a name
// A no-op (returns -1) for an empty patchName // A no-op (returns -1) for an empty patchName
@ -137,7 +137,7 @@ public:
//- Identical to the indices() method (AUG-2018) //- Identical to the indices() method (AUG-2018)
FOAM_DEPRECATED_FOR(2018-08, "indices() method") FOAM_DEPRECATED_FOR(2018-08, "indices() method")
labelList findIndices(const keyType& key, const bool useGroups) const labelList findIndices(const wordRe& key, bool useGroups) const
{ {
return indices(key, useGroups); return indices(key, useGroups);
} }

View File

@ -278,7 +278,7 @@ void Foam::functionObjects::externalCoupled::writeGeometry
( (
mesh.boundaryMesh().patchSet mesh.boundaryMesh().patchSet
( (
List<wordRe>{groupName} wordRes(one{}, groupName)
).sortedToc() ).sortedToc()
); );

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd. Copyright (C) 2015-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -80,7 +80,10 @@ bool Foam::functionObjects::externalCoupled::readData
} }
const wordRes patchSelection(one{}, groupName);
label nFound = 0; label nFound = 0;
for (const fvMesh& mesh : meshes) for (const fvMesh& mesh : meshes)
{ {
const volFieldType* vfptr = mesh.findObject<volFieldType>(fieldName); const volFieldType* vfptr = mesh.findObject<volFieldType>(fieldName);
@ -89,7 +92,7 @@ bool Foam::functionObjects::externalCoupled::readData
{ {
continue; continue;
} }
nFound++; ++nFound;
typename volFieldType::Boundary& bf = typename volFieldType::Boundary& bf =
const_cast<volFieldType*>(vfptr)->boundaryFieldRef(); const_cast<volFieldType*>(vfptr)->boundaryFieldRef();
@ -97,10 +100,7 @@ bool Foam::functionObjects::externalCoupled::readData
// Get the patches // Get the patches
const labelList patchIDs const labelList patchIDs
( (
mesh.boundaryMesh().patchSet mesh.boundaryMesh().patchSet(patchSelection).sortedToc()
(
List<wordRe>{groupName}
).sortedToc()
); );
// Handle column-wise reading of patch data. Supports most easy types // Handle column-wise reading of patch data. Supports most easy types
@ -261,7 +261,7 @@ bool Foam::functionObjects::externalCoupled::readData
} }
} }
return nFound > 0; return nFound;
} }
@ -352,8 +352,9 @@ bool Foam::functionObjects::externalCoupled::writeData
} }
bool headerDone = false; const wordRes patchSelection(one{}, groupName);
bool headerDone = false;
label nFound = 0; label nFound = 0;
for (const fvMesh& mesh : meshes) for (const fvMesh& mesh : meshes)
@ -364,7 +365,7 @@ bool Foam::functionObjects::externalCoupled::writeData
{ {
continue; continue;
} }
nFound++; ++nFound;
const typename volFieldType::Boundary& bf = const typename volFieldType::Boundary& bf =
vfptr->boundaryField(); vfptr->boundaryField();
@ -372,10 +373,7 @@ bool Foam::functionObjects::externalCoupled::writeData
// Get the patches // Get the patches
const labelList patchIDs const labelList patchIDs
( (
mesh.boundaryMesh().patchSet mesh.boundaryMesh().patchSet(patchSelection).sortedToc()
(
List<wordRe>{groupName}
).sortedToc()
); );
// Handle column-wise writing of patch data. Supports most easy types // Handle column-wise writing of patch data. Supports most easy types
@ -474,7 +472,7 @@ bool Foam::functionObjects::externalCoupled::writeData
} }
} }
return nFound > 0; return nFound;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -67,15 +67,7 @@ Foam::label Foam::ParticleErosion<CloudType>::applyToPatch
const label globalPatchi const label globalPatchi
) const ) const
{ {
forAll(patchIDs_, i) return patchIDs_.find(globalPatchi);
{
if (patchIDs_[i] == globalPatchi)
{
return i;
}
}
return -1;
} }
@ -120,7 +112,7 @@ Foam::ParticleErosion<CloudType>::ParticleErosion
labelHashSet uniqIds; labelHashSet uniqIds;
for (const wordRe& re : patchNames) for (const wordRe& re : patchNames)
{ {
labelList ids = findStrings(re, allPatchNames); labelList ids = findMatchingStrings(re, allPatchNames);
if (ids.empty()) if (ids.empty())
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,39 +34,13 @@ License
Foam::patchInteractionData::patchInteractionData() Foam::patchInteractionData::patchInteractionData()
: :
interactionTypeName_("unknownInteractionTypeName"), interactionTypeName_(),
patchName_("unknownPatch"), patchName_(),
e_(0.0), e_(0),
mu_(0.0) mu_(0)
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::word& Foam::patchInteractionData::interactionTypeName() const
{
return interactionTypeName_;
}
const Foam::keyType& Foam::patchInteractionData::patchName() const
{
return patchName_;
}
Foam::scalar Foam::patchInteractionData::e() const
{
return e_;
}
Foam::scalar Foam::patchInteractionData::mu() const
{
return mu_;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,36 +35,31 @@ Description
#ifndef patchInteractionData_H #ifndef patchInteractionData_H
#define patchInteractionData_H #define patchInteractionData_H
#include "Istream.H" #include "wordRe.H"
#include "scalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Forward Declaration
class patchInteractionData;
Istream& operator>>(Istream& is, patchInteractionData& pid);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class patchInteractionData Declaration Class patchInteractionData Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// Forward declaration of classes
class patchInteractionData;
// Forward declaration of friend functions
Istream& operator>>
(
Istream& is,
patchInteractionData& pid
);
class patchInteractionData class patchInteractionData
{ {
// Private data // Private Data
//- Interaction type name //- Interaction type name
word interactionTypeName_; word interactionTypeName_;
//- Patch name //- Patch name(s)
keyType patchName_; wordRe patchName_;
//- Elasticity coefficient //- Elasticity coefficient
scalar e_; scalar e_;
@ -76,35 +72,41 @@ public:
// Constructor // Constructor
//- Construct null //- Default construct
patchInteractionData(); patchInteractionData();
// Member functions // Member Functions
// Access //- The interaction type name
const word& interactionTypeName() const noexcept
{
return interactionTypeName_;
}
//- Return const access to the interaction type name //- The patch name(s)
const word& interactionTypeName() const; const wordRe& patchName() const noexcept
{
return patchName_;
}
//- Return const access to the patch name //- The elasticity coefficient
const keyType& patchName() const; scalar e() const noexcept
{
return e_;
}
//- Return const access to the elasticity coefficient //- The restitution coefficient
scalar e() const; scalar mu() const noexcept
{
//- Return const access to the restitution coefficient return mu_;
scalar mu() const; }
// I-O // IO Operators
//- Istream operator //- Istream operator
friend Istream& operator>> friend Istream& operator>>(Istream& is, patchInteractionData& pid);
(
Istream& is,
patchInteractionData& pid
);
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -50,14 +51,14 @@ Foam::patchInteractionDataList::patchInteractionDataList
const List<patchInteractionData>& items = *this; const List<patchInteractionData>& items = *this;
forAllReverse(items, i) forAllReverse(items, i)
{ {
const keyType& patchName = items[i].patchName(); const wordRe& patchName = items[i].patchName();
labelList ids = bMesh.indices(patchName); labelList ids = bMesh.indices(patchName);
if (ids.empty()) if (ids.empty())
{ {
WarningInFunction WarningInFunction
<< "Cannot find any patch names matching " << patchName << "Cannot find any patch names matching "
<< endl; << patchName << endl;
} }
patchGroupIDs_[i].transfer(ids); patchGroupIDs_[i].transfer(ids);
@ -65,9 +66,8 @@ Foam::patchInteractionDataList::patchInteractionDataList
// Check that all patches are specified // Check that all patches are specified
DynamicList<word> badPatches; DynamicList<word> badPatches;
forAll(bMesh, patchi) for (const polyPatch& pp : bMesh)
{ {
const polyPatch& pp = bMesh[patchi];
if if
( (
!pp.coupled() !pp.coupled()
@ -79,12 +79,13 @@ Foam::patchInteractionDataList::patchInteractionDataList
} }
} }
if (badPatches.size() > 0) if (!badPatches.empty())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "All patches must be specified when employing local patch " << "All patches must be specified when employing local patch "
<< "interaction. Please specify data for patches:" << nl << "interaction. Please specify data for patches:" << nl
<< badPatches << nl << exit(FatalError); << badPatches << nl
<< exit(FatalError);
} }
} }
@ -103,15 +104,11 @@ Foam::patchInteractionDataList::patchInteractionDataList
Foam::label Foam::patchInteractionDataList::applyToPatch(const label id) const Foam::label Foam::patchInteractionDataList::applyToPatch(const label id) const
{ {
forAll(patchGroupIDs_, groupI) forAll(patchGroupIDs_, groupi)
{ {
const labelList& patchIDs = patchGroupIDs_[groupI]; if (patchGroupIDs_[groupi].found(id))
forAll(patchIDs, patchi)
{ {
if (patchIDs[patchi] == id) return groupi;
{
return groupI;
}
} }
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,6 +28,29 @@ License
#include "blockMeshTools.H" #include "blockMeshTools.H"
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam
{
static inline const Foam::entry* resolveLabel(const entry& e, const label val)
{
if (e.isStream())
{
const tokenList& toks = e.stream();
if (!toks.empty() && toks[0].isLabel(val))
{
return &e;
}
}
return nullptr;
}
} // End namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::blockMeshTools::read void Foam::blockMeshTools::read
@ -93,21 +117,18 @@ void Foam::blockMeshTools::write
{ {
for (const entry& e : dict) for (const entry& e : dict)
{ {
if (e.isStream()) const entry* eptr = resolveLabel(e, val);
if (eptr)
{ {
label keyVal(Foam::readLabel(e.stream())); os << eptr->keyword();
if (keyVal == val)
{
os << e.keyword();
return; return;
} }
} }
}
os << val; os << val;
} }
const Foam::keyType& Foam::blockMeshTools::findEntry const Foam::entry* Foam::blockMeshTools::findEntry
( (
const dictionary& dict, const dictionary& dict,
const label val const label val
@ -115,17 +136,14 @@ const Foam::keyType& Foam::blockMeshTools::findEntry
{ {
for (const entry& e : dict) for (const entry& e : dict)
{ {
if (e.isStream()) const entry* eptr = resolveLabel(e, val);
if (eptr)
{ {
label keyVal(Foam::readLabel(e.stream())); return eptr;
if (keyVal == val)
{
return e.keyword();
}
} }
} }
return keyType::null; return nullptr;
} }

View File

@ -50,11 +50,11 @@ namespace blockMeshTools
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- In-place read with dictionary lookup //- In-place read with dictionary lookup
void read(Istream&, label&, const dictionary&); void read(Istream&, label& val, const dictionary&);
//- In-place read with dictionary lookup //- In-place read with dictionary lookup
template<class T> template<class T>
void read(Istream&, List<T>&, const dictionary&); void read(Istream&, List<T>& list, const dictionary&);
//- Return-read with dictionary lookup //- Return-read with dictionary lookup
label read(Istream&, const dictionary&); label read(Istream&, const dictionary&);
@ -64,10 +64,10 @@ namespace blockMeshTools
List<T> read(Istream& is, const dictionary&); List<T> read(Istream& is, const dictionary&);
//- Write with dictionary lookup //- Write with dictionary lookup
void write(Ostream&, const label, const dictionary&); void write(Ostream&, const label val, const dictionary&);
//- Linear search for label entry //- Linear search for labelled entry, nullptr if not found
const keyType& findEntry(const dictionary&, const label); const entry* findEntry(const dictionary& dict, const label val);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -532,7 +532,7 @@ Foam::layerParameters::layerParameters
const labelHashSet patchIDs const labelHashSet patchIDs
( (
boundaryMesh.patchSet(List<wordRe>(1, wordRe(key))) boundaryMesh.patchSet(wordRes(one{}, wordRe(key)))
); );
if (patchIDs.size() == 0) if (patchIDs.size() == 0)

View File

@ -179,24 +179,13 @@ const Foam::coordinateSystems& Foam::coordinateSystems::New
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::labelList Foam::coordinateSystems::indices(const keyType& key) const Foam::labelList Foam::coordinateSystems::indices(const wordRe& key) const
{ {
if (key.empty()) if (key.empty())
{ {
return labelList(); return labelList();
} }
else if (key.isPattern()) return PtrListOps::findMatching(*this, key);
{
// Match as regex
const regExp matcher(key);
return PtrListOps::findMatching(*this, matcher);
}
else
{
// Compare as literal string
const word& matcher = key;
return PtrListOps::findMatching(*this, matcher);
}
} }
@ -210,24 +199,13 @@ Foam::labelList Foam::coordinateSystems::indices(const wordRes& matcher) const
} }
Foam::label Foam::coordinateSystems::findIndex(const keyType& key) const Foam::label Foam::coordinateSystems::findIndex(const wordRe& key) const
{ {
if (key.empty()) if (key.empty())
{ {
return -1; return -1;
} }
else if (key.isPattern()) return PtrListOps::firstMatching(*this, key);
{
// Find as regex
const regExp matcher(key);
return PtrListOps::firstMatching(*this, matcher);
}
else
{
// Find as literal string
const word& matcher = key;
return PtrListOps::firstMatching(*this, matcher);
}
} }
@ -241,7 +219,7 @@ Foam::label Foam::coordinateSystems::findIndex(const wordRes& matcher) const
} }
bool Foam::coordinateSystems::found(const keyType& key) const bool Foam::coordinateSystems::found(const wordRe& key) const
{ {
return findIndex(key) != -1; return findIndex(key) != -1;
} }
@ -250,13 +228,16 @@ bool Foam::coordinateSystems::found(const keyType& key) const
const Foam::coordinateSystem* const Foam::coordinateSystem*
Foam::coordinateSystems::cfind(const word& name) const Foam::coordinateSystems::cfind(const word& name) const
{ {
const label index = this->findIndex(name); const label index =
(
name.empty() ? -1 : PtrListOps::firstMatching(*this, name)
);
if (coordinateSystem::debug) if (coordinateSystem::debug)
{ {
InfoInFunction InfoInFunction
<< "Global coordinate system: " << "Global coordinate system: "
<< name << "=" << index << endl; << name << '=' << index << endl;
} }
if (index < 0) if (index < 0)
@ -271,9 +252,9 @@ Foam::coordinateSystems::cfind(const word& name) const
const Foam::coordinateSystem& const Foam::coordinateSystem&
Foam::coordinateSystems::lookup(const word& name) const Foam::coordinateSystems::lookup(const word& name) const
{ {
const label index = this->findIndex(name); const coordinateSystem* ptr = this->cfind(name);
if (index < 0) if (!ptr)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Could not find coordinate system: " << name << nl << "Could not find coordinate system: " << name << nl
@ -281,14 +262,8 @@ Foam::coordinateSystems::lookup(const word& name) const
<< flatOutput(names()) << nl << nl << flatOutput(names()) << nl << nl
<< exit(FatalError); << exit(FatalError);
} }
if (coordinateSystem::debug)
{
InfoInFunction
<< "Global coordinate system: "
<< name << "=" << index << endl;
}
return this->operator[](index); return *ptr;
} }
@ -298,34 +273,13 @@ Foam::wordList Foam::coordinateSystems::names() const
} }
Foam::wordList Foam::coordinateSystems::names(const keyType& key) const Foam::wordList Foam::coordinateSystems::names(const wordRe& key) const
{ {
if (key.empty()) if (key.empty())
{ {
return wordList(); return wordList();
} }
else if (key.isPattern()) return PtrListOps::names(*this, key);
{
// Find as regex
const regExp matcher(key);
return PtrListOps::names(*this, matcher);
}
else
{
// Find as literal string
const word& matcher = key;
return PtrListOps::names(*this, matcher);
}
}
Foam::wordList Foam::coordinateSystems::names(const wordRe& matcher) const
{
if (matcher.empty())
{
return wordList();
}
return PtrListOps::names(*this, matcher);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -134,7 +134,7 @@ public:
//- Find and return indices for all matches //- Find and return indices for all matches
// A no-op (returns empty list) for an empty key // A no-op (returns empty list) for an empty key
labelList indices(const keyType& key) const; labelList indices(const wordRe& key) const;
//- Find and return indices for all matches //- Find and return indices for all matches
// A no-op (returns empty list) for an empty matcher // A no-op (returns empty list) for an empty matcher
@ -142,14 +142,14 @@ public:
//- Find and return index for the first match, return -1 if not found //- Find and return index for the first match, return -1 if not found
// A no-op (returns -1) for an empty key // A no-op (returns -1) for an empty key
label findIndex(const keyType& key) const; label findIndex(const wordRe& key) const;
//- Find and return index for the first match, return -1 if not found //- Find and return index for the first match, return -1 if not found
// A no-op (returns -1) for an empty matcher // A no-op (returns -1) for an empty matcher
label findIndex(const wordRes& matcher) const; label findIndex(const wordRes& matcher) const;
//- Search if given key exists //- Search if given key exists
bool found(const keyType& key) const; bool found(const wordRe& key) const;
//- Return pointer to named coordinateSystem or nullptr on error //- Return pointer to named coordinateSystem or nullptr on error
const coordinateSystem* cfind(const word& name) const; const coordinateSystem* cfind(const word& name) const;
@ -161,10 +161,7 @@ public:
wordList names() const; wordList names() const;
//- A list of the coordinate-system names satisfying the input matcher //- A list of the coordinate-system names satisfying the input matcher
wordList names(const keyType& key) const; wordList names(const wordRe& key) const;
//- A list of the coordinate-system names satisfying the input matcher
wordList names(const wordRe& matcher) const;
//- A list of the coordinate-system names satisfying the input matcher //- A list of the coordinate-system names satisfying the input matcher
wordList names(const wordRes& matcher) const; wordList names(const wordRes& matcher) const;
@ -193,7 +190,7 @@ public:
//- Identical to the indices() method (AUG-2018) //- Identical to the indices() method (AUG-2018)
FOAM_DEPRECATED_FOR(2018-08, "indices() method") FOAM_DEPRECATED_FOR(2018-08, "indices() method")
labelList findIndices(const keyType& key) const labelList findIndices(const wordRe& key) const
{ {
return this->indices(key); return this->indices(key);
} }