mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use wordReList for patch and faceZone names in foamToEnsight
- avoids odd side effects that can occur when a wordList is treated as a list of regex patterns
This commit is contained in:
@ -87,16 +87,26 @@ Foam::ensightMesh::ensightMesh
|
|||||||
|
|
||||||
if (args.optionFound("patches"))
|
if (args.optionFound("patches"))
|
||||||
{
|
{
|
||||||
wordList patchNameList(args.optionLookup("patches")());
|
wordReList patterns(args.optionLookup("patches")());
|
||||||
|
|
||||||
if (patchNameList.empty())
|
if (patterns.empty())
|
||||||
{
|
{
|
||||||
patchNameList = allPatchNames_;
|
forAll(allPatchNames_, nameI)
|
||||||
|
{
|
||||||
|
patchNames_.insert(allPatchNames_[nameI]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
forAll(patchNameList, i)
|
else
|
||||||
{
|
{
|
||||||
patchNames_.insert(patchNameList[i]);
|
// Find patch names which match that requested at command-line
|
||||||
|
forAll(allPatchNames_, nameI)
|
||||||
|
{
|
||||||
|
const word& patchName = allPatchNames_[nameI];
|
||||||
|
if (findStrings(patterns, patchName))
|
||||||
|
{
|
||||||
|
patchNames_.insert(patchName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,19 +257,17 @@ Foam::ensightMesh::ensightMesh
|
|||||||
// faceZones
|
// faceZones
|
||||||
if (args.optionFound("faceZones"))
|
if (args.optionFound("faceZones"))
|
||||||
{
|
{
|
||||||
wordList patchNameList(args.optionLookup("faceZones")());
|
wordReList patterns(args.optionLookup("faceZones")());
|
||||||
|
|
||||||
const wordList faceZoneNamesAll = mesh_.faceZones().names();
|
const wordList faceZoneNamesAll = mesh_.faceZones().names();
|
||||||
|
|
||||||
// Find out faceZone names that match with what requested at command
|
// Find faceZone names which match that requested at command-line
|
||||||
// line
|
forAll(faceZoneNamesAll, nameI)
|
||||||
forAll(patchNameList, i)
|
|
||||||
{
|
{
|
||||||
labelList matches = findStrings(patchNameList[i], faceZoneNamesAll);
|
const word& zoneName = faceZoneNamesAll[nameI];
|
||||||
|
if (findStrings(patterns, zoneName))
|
||||||
forAll(matches, matchI)
|
|
||||||
{
|
{
|
||||||
faceZoneNames_.insert(faceZoneNamesAll[matches[matchI]]);
|
faceZoneNames_.insert(zoneName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,8 +361,8 @@ Foam::ensightMesh::ensightMesh
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
faceZoneFaceSets_[zoneI].tris.size()
|
faceZoneFaceSets_[zoneI].tris.size()
|
||||||
|| faceZoneFaceSets_[zoneI].quads.size() ||
|
|| faceZoneFaceSets_[zoneI].quads.size()
|
||||||
faceZoneFaceSets_[zoneI].polys.size()
|
|| faceZoneFaceSets_[zoneI].polys.size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
nfp.nTris = faceZoneFaceSets_[zoneI].tris.size();
|
nfp.nTris = faceZoneFaceSets_[zoneI].tris.size();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -112,21 +112,21 @@ int main(int argc, char *argv[])
|
|||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
"patches",
|
"patches",
|
||||||
"wordList",
|
"wordReList",
|
||||||
"specify particular patches to write - eg '(inlet outlet)'. "
|
"specify particular patches to write - eg '(outlet \"inlet.*\")'. "
|
||||||
"An empty list suppresses writing the internalMesh."
|
"An empty list suppresses writing the internalMesh."
|
||||||
);
|
);
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
"faceZones",
|
"faceZones",
|
||||||
"wordList",
|
"wordReList",
|
||||||
"specify faceZones to write, with wildcards - eg '(mfp-.*)'. "
|
"specify faceZones to write - eg '( slice \"mfp-.*\" )'."
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
|
|
||||||
// Check options
|
// Check options
|
||||||
bool binary = !args.optionFound("ascii");
|
const bool binary = !args.optionFound("ascii");
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user