ENH: consistency updates for patchToFace topoSetSource (#1060)
- Support specification with "patches" and "patch" keywords (similar to zone selection). Keyword "name" for compatibility.
This commit is contained in:
parent
de1832abdd
commit
9a87a043d6
@ -51,7 +51,7 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
|
||||
{
|
||||
labelHashSet patchIDs = mesh_.boundaryMesh().patchSet
|
||||
(
|
||||
List<wordRe>(1, patchName_),
|
||||
selectedPatches_,
|
||||
true, // warn if not found
|
||||
true // use patch groups if available
|
||||
);
|
||||
@ -77,8 +77,10 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
|
||||
if (patchIDs.empty())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find any patch named " << patchName_ << endl
|
||||
<< "Valid names are " << mesh_.boundaryMesh().names() << endl;
|
||||
<< "Cannot find any patches matching "
|
||||
<< flatOutput(selectedPatches_) << nl
|
||||
<< "Valid names are " << flatOutput(mesh_.boundaryMesh().names())
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,11 +90,11 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
|
||||
Foam::patchToFace::patchToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& patchName
|
||||
const wordRe& patchName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
patchName_(patchName)
|
||||
selectedPatches_(one(), patchName)
|
||||
{}
|
||||
|
||||
|
||||
@ -103,8 +105,16 @@ Foam::patchToFace::patchToFace
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
patchName_(dict.get<wordRe>("name"))
|
||||
{}
|
||||
selectedPatches_()
|
||||
{
|
||||
// Look for 'patches' and 'patch', but accept 'name' as well
|
||||
if (!dict.readIfPresent("patches", selectedPatches_))
|
||||
{
|
||||
selectedPatches_.resize(1);
|
||||
selectedPatches_.first() =
|
||||
dict.getCompat<wordRe>("patch", {{"name", 1806}});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::patchToFace::patchToFace
|
||||
@ -114,7 +124,7 @@ Foam::patchToFace::patchToFace
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
patchName_(checkIs(is))
|
||||
selectedPatches_(one(), wordRe(checkIs(is)))
|
||||
{}
|
||||
|
||||
|
||||
@ -128,14 +138,15 @@ void Foam::patchToFace::applyToSet
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Info<< " Adding all faces of patch " << patchName_ << " ..." << endl;
|
||||
Info<< " Adding all faces of patches "
|
||||
<< flatOutput(selectedPatches_) << " ..." << endl;
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Info<< " Removing all faces of patch " << patchName_ << " ..."
|
||||
<< endl;
|
||||
Info<< " Removing all faces of patches "
|
||||
<< flatOutput(selectedPatches_) << " ..." << endl;
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,10 +29,15 @@ Description
|
||||
|
||||
\heading Dictionary parameters
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
name | Patch name or regex to select | yes |
|
||||
Property | Description | Required | Default
|
||||
patch | The face zone name or regex | possibly |
|
||||
patches | The face zone names or regexs | possibly |
|
||||
name | Older specification for 'patch' | no |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
Selection of multiple patches has precedence.
|
||||
|
||||
SourceFiles
|
||||
patchToFace.C
|
||||
|
||||
@ -42,7 +47,7 @@ SourceFiles
|
||||
#define patchToFace_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "wordRe.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -63,8 +68,8 @@ class patchToFace
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name/regular expression of patch
|
||||
wordRe patchName_;
|
||||
//- Matcher for patches
|
||||
wordRes selectedPatches_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -80,11 +85,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
patchToFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& patchName
|
||||
);
|
||||
patchToFace(const polyMesh& mesh, const wordRe& patchName);
|
||||
|
||||
//- Construct from dictionary
|
||||
patchToFace(const polyMesh& mesh, const dictionary& dict);
|
||||
|
@ -67,7 +67,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name inlet;
|
||||
patch inlet;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name coupledWallTmp;
|
||||
patch coupledWallTmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name coupledPatch;
|
||||
patch coupledPatch;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name couple1;
|
||||
patch couple1;
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -49,7 +49,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name couple2;
|
||||
patch couple2;
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name outerCylinder;
|
||||
patch outerCylinder;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name "AMI.*";
|
||||
patch "AMI.*";
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name "side1";
|
||||
patch side1;
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -57,7 +57,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name "walls";
|
||||
patch walls;
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name filmWalls;
|
||||
patch filmWalls;
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name filmWalls;
|
||||
patch filmWalls;
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name filmWalls;
|
||||
patch filmWalls;
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ FoamFile
|
||||
// // All faces of patch
|
||||
// source patchToFace;
|
||||
// {
|
||||
// name ".*Wall"; // Name of patch, regular expressions allowed
|
||||
// patch ".*Wall"; // Name of patch, regular expressions allowed
|
||||
// }
|
||||
//
|
||||
// // All faces of faceZone
|
||||
|
@ -21,7 +21,7 @@ newFromPatch
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name outer;
|
||||
patch outer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name top;
|
||||
patch top;
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name bottom;
|
||||
patch bottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name sides;
|
||||
patch sides;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name outerCylinder;
|
||||
patch outerCylinder;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name "AMI.*";
|
||||
patch "AMI.*";
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -41,7 +41,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name freeSurface;
|
||||
patch freeSurface;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name floatingObject;
|
||||
patch floatingObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ actions
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name freeSurface;
|
||||
patch freeSurface;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user