ENH: change wordRes to be a List of wordRe instead of a wrapper (issue #259)

- this permits direct storage of a list with additional matcher
  capabilities

- provide wordRes::matcher class for similar behaviour as previously
This commit is contained in:
Mark Olesen
2018-02-21 10:05:30 +01:00
parent 03b287ed24
commit c126464d1c
113 changed files with 572 additions and 801 deletions

View File

@ -28,8 +28,6 @@ License
#include "IFstream.H"
#include "StringStream.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::boundaryTemplates::boundaryTemplates

View File

@ -27,9 +27,9 @@ Class
Description
Class to store boundary template specifications
Templates are typically stored centrally, and constructed in a hierarchical
manner. The main use is to convert the (user) specified conditions into
a form which can be inserted into each field file as dictionary entries.
Templates are typically stored centrally, and constructed hierarchically.
The main use is to convert the (user) specified conditions into
a form that can be inserted into each field file as dictionary entries.
\*---------------------------------------------------------------------------*/
@ -37,8 +37,6 @@ Description
#define boundaryTemplates_H
#include "dictionary.H"
#include "wordList.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -43,26 +43,26 @@ Foam::label Foam::caseInfo::findPatchConditionID
// Assign condition according to last condition applied, wins
forAllReverse(conditionNames_, conditionI)
{
const wordReList& patchNames = patchNames_[conditionI];
const wordRes& patchNames = patchNames_[conditionI];
forAll(patchNames, nameI)
for (const wordRe& select : patchNames)
{
if (patchNames[nameI] == patchName)
if (select == patchName)
{
// Check for explicit match
// Literal match
return conditionI;
}
else if (patchNames[nameI].match(patchName))
else if (select.match(patchName))
{
// Check wildcards
// Regex match
return conditionI;
}
else
{
// Check for group match
forAll(patchGroups, groupI)
for (const word& groupName : patchGroups)
{
if (patchNames[nameI] == patchGroups[groupI])
if (select == groupName)
{
return conditionI;
}
@ -160,7 +160,7 @@ void Foam::caseInfo::checkPatches
}
const Foam::List<Foam::wordReList>& Foam::caseInfo::patchNames() const
const Foam::List<Foam::wordRes>& Foam::caseInfo::patchNames() const
{
return patchNames_;
}

View File

@ -36,7 +36,7 @@ Description
#include "labelList.H"
#include "wordList.H"
#include "HashSet.H"
#include "wordReList.H"
#include "wordRes.H"
#include "IOdictionary.H"
#include "boundaryInfo.H"
@ -72,7 +72,7 @@ class caseInfo
// Per-condition information
//- List of patch names
List<wordReList> patchNames_;
List<wordRes> patchNames_;
//- Patch category
wordList patchCategories_;
@ -103,7 +103,7 @@ public:
) const;
//- Return the list of patch names
const List<wordReList>& patchNames() const;
const List<wordRes>& patchNames() const;
//- Return the condition name for patch with index patchI
const word& conditionName(const label patchI) const;