diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.C b/src/functionObjects/utilities/ensightWrite/ensightWrite.C index 0207decdff..459621b87f 100644 --- a/src/functionObjects/utilities/ensightWrite/ensightWrite.C +++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.C @@ -122,6 +122,29 @@ Foam::functionObjects::ensightWrite::ensightWrite } +Foam::wordRes Foam::functionObjects::ensightWrite::patchNameSet +( + const UList& select +) const +{ + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + + const labelList patchIDs + ( + pbm.patchSet(select).sortedToc() + ); + + wordRes names(patchIDs.size()); + + for (const label patchi : patchIDs) + { + names[patchi] = mesh_.boundary()[patchi].name(); + } + + return names; +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::functionObjects::ensightWrite::read(const dictionary& dict) @@ -152,22 +175,27 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict) << "conversion of the boundaries" << endl; } - wordRes list; - if (dict.readIfPresent("patches", list)) - { - list.uniq(); - writeOpts_.patchSelection(list); - } - if (dict.readIfPresent("excludePatches", list)) - { - list.uniq(); - writeOpts_.patchExclude(list); - } - if (dict.readIfPresent("faceZones", list)) + if (dict.found("patches")) { - list.uniq(); - writeOpts_.faceZoneSelection(list); + writeOpts_.patchSelection + ( + wordRes::uniq(patchNameSet(dict.get("patches"))) + ); + } + if (dict.found("excludePatches")) + { + writeOpts_.patchExclude + ( + wordRes::uniq(patchNameSet(dict.get("excludePatches"))) + ); + } + if (dict.found("faceZones")) + { + writeOpts_.faceZoneSelection + ( + wordRes::uniq(dict.get("faceZones")) + ); } diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.H b/src/functionObjects/utilities/ensightWrite/ensightWrite.H index 3ba712be80..62f78c243e 100644 --- a/src/functionObjects/utilities/ensightWrite/ensightWrite.H +++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.H @@ -233,6 +233,11 @@ class ensightWrite //- Update meshes, subMeshes etc. bool update(); + //- Return the set of names of available patches and patch groups + //- corresponding to the given names + // A convenience wrapper for \c polyBoundaryMesh::patchSet + wordRes patchNameSet(const UList& select) const; + // Write