/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Application createPatch Group grpMeshManipulationUtilities Description Utility to create patches out of selected boundary faces. Faces come either from existing patches or from a faceSet. More specifically it: - creates new patches (from selected boundary faces). Synchronise faces on coupled patches. - synchronises points on coupled boundaries - remove patches with 0 faces in them \*---------------------------------------------------------------------------*/ #include "cyclicPolyPatch.H" #include "syncTools.H" #include "argList.H" #include "polyMesh.H" #include "Time.H" #include "SortableList.H" #include "OFstream.H" #include "meshTools.H" #include "faceSet.H" #include "IOPtrList.H" #include "polyTopoChange.H" #include "polyModifyFace.H" #include "wordReList.H" #include "processorMeshes.H" #include "IOdictionary.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { defineTemplateTypeNameAndDebug(IOPtrList, 0); } void changePatchID ( const polyMesh& mesh, const label faceID, const label patchID, polyTopoChange& meshMod ) { const label zoneID = mesh.faceZones().whichZone(faceID); bool zoneFlip = false; if (zoneID >= 0) { const faceZone& fZone = mesh.faceZones()[zoneID]; zoneFlip = fZone.flipMap()[fZone.whichFace(faceID)]; } meshMod.setAction ( polyModifyFace ( mesh.faces()[faceID], // face faceID, // face ID mesh.faceOwner()[faceID], // owner -1, // neighbour false, // flip flux patchID, // patch ID false, // remove from zone zoneID, // zone ID zoneFlip // zone flip ) ); } // Filter out the empty patches. void filterPatches(polyMesh& mesh, const wordHashSet& addedPatchNames) { const polyBoundaryMesh& patches = mesh.boundaryMesh(); // Patches to keep DynamicList allPatches(patches.size()); label nOldPatches = returnReduce(patches.size(), sumOp