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

@ -127,20 +127,20 @@ int main(int argc, char *argv[])
argList::addOption
(
"patches",
"wordReList",
"wordRes",
"specify particular patches to write - eg '(outlet \"inlet.*\")'. "
"An empty list suppresses writing the internalMesh."
);
argList::addOption
(
"faceZones",
"wordReList",
"wordRes",
"specify faceZones to write - eg '( slice \"mfp-.*\" )'."
);
argList::addOption
(
"fields",
"wordReList",
"wordRes",
"specify fields to export (all by default) - eg '( \"U.*\" )'."
);
argList::addOption
@ -249,11 +249,8 @@ int main(int argc, char *argv[])
//
const bool noLagrangian = args.found("noLagrangian");
wordReList fieldPatterns;
if (args.found("fields"))
{
fieldPatterns = args.readList<wordRe>("fields");
}
wordRes fieldPatterns;
args.readListIfPresent<wordRe>("fields", fieldPatterns);
word cellZoneName;
if (args.readIfPresent("cellZone", cellZoneName))

View File

@ -79,8 +79,7 @@ Usage
#include "tensorIOField.H"
#include "passiveParticleCloud.H"
#include "faceSet.H"
#include "stringOps.H"
#include "wordReList.H"
#include "wordRes.H"
#include "meshSubsetHelper.H"
#include "readFields.H"
@ -117,7 +116,7 @@ void print(Ostream& os, const wordList& flds)
labelList getSelectedPatches
(
const polyBoundaryMesh& patches,
const List<wordRe>& excludePatches //HashSet<word>& excludePatches
const wordRes& excludePatches
)
{
DynamicList<label> patchIDs(patches.size());
@ -137,7 +136,7 @@ labelList getSelectedPatches
Info<< " discarding empty/processor patch " << patchi
<< " " << pp.name() << endl;
}
else if (stringOps::match(excludePatches, pp.name()))
else if (excludePatches.match(pp.name()))
{
Info<< " excluding patch " << patchi
<< " " << pp.name() << endl;
@ -227,11 +226,9 @@ int main(int argc, char *argv[])
<< "Outputting cell values only" << nl << endl;
}
List<wordRe> excludePatches;
if (args.found("excludePatches"))
wordRes excludePatches;
if (args.readListIfPresent<wordRe>("excludePatches", excludePatches))
{
args.lookup("excludePatches")() >> excludePatches;
Info<< "Not including patches " << excludePatches << nl << endl;
}

View File

@ -156,7 +156,7 @@ Note
#include "faceZoneMesh.H"
#include "Cloud.H"
#include "passiveParticle.H"
#include "stringOps.H"
#include "wordRes.H"
#include "areaFields.H"
#include "meshSubsetHelper.H"
#include "readFields.H"
@ -412,7 +412,7 @@ int main(int argc, char *argv[])
argList::addOption
(
"excludePatches",
"wordReList",
"wordRes",
"a list of patches to exclude - eg '( inlet \".*Wall\" )' "
);
argList::addBoolOption
@ -474,11 +474,9 @@ int main(int argc, char *argv[])
const bool allPatches = args.found("allPatches");
wordReList excludePatches;
if (args.found("excludePatches"))
wordRes excludePatches;
if (args.readListIfPresent<wordRe>("excludePatches", excludePatches))
{
args.lookup("excludePatches")() >> excludePatches;
Info<< "Not including patches " << excludePatches << nl << endl;
}
@ -499,7 +497,7 @@ int main(int argc, char *argv[])
else if (Pstream::parRun())
{
// Strip off leading casename, leaving just processor_DDD ending.
string::size_type i = vtkName.rfind("processor");
const auto i = vtkName.rfind("processor");
if (i != string::npos)
{
@ -1284,7 +1282,7 @@ int main(int argc, char *argv[])
{
const polyPatch& pp = patches[patchi];
if (stringOps::match(excludePatches, pp.name()))
if (excludePatches.match(pp.name()))
{
// Skip excluded patch
continue;