/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2017-2024 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 surfaceMeshExtract Group grpSurfaceUtilities Description Extract patch or faceZone surfaces from a polyMesh. Depending on output surface format triangulates faces. Region numbers on faces not guaranteed to be the same as the patch indices. Optionally only extracts named patches. Optionally filters out points on faceZones, feature-edges and featurePoints and generates pointPatches for these - written to pointMesh/boundary. If run in parallel, processor patches get filtered out by default and the mesh is merged (based on topology). Usage \b surfaceMeshExtract [OPTION] \ Options: - \par -patches NAME | LIST Specify single patch or multiple patches (name or regex) to extract - \par -faceZones NAME | LIST Specify single zone or multiple face zones (name or regex) to extract - \par -exclude-patches NAME | LIST Exclude single or multiple patches (name or regex) from extraction - \par -excludeProcPatches Exclude processor patches (default if parallel) - \par -featureAngle \ Extract feature edges/points and put into separate point-patches - \par -extractZonePoints Extract all face zone points and put into separate point-patches \*---------------------------------------------------------------------------*/ #include "MeshedSurface.H" #include "UnsortedMeshedSurface.H" #include "argList.H" #include "Time.H" #include "polyMesh.H" #include "pointMesh.H" #include "emptyPolyPatch.H" #include "processorPolyPatch.H" #include "ListListOps.H" #include "stringListOps.H" // For stringListOps::findMatching() #include "indirectPrimitivePatch.H" #include "globalMeshData.H" #include "globalIndex.H" #include "timeSelector.H" #include "meshPointPatch.H" #include "unitConversion.H" #include "dummyTransform.H" #include "syncTools.H" #include "processorPointPatch.H" #include "pointMeshTools.H" #include "OBJstream.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // void writeOBJ ( const fileName& path, const pointPatch& pp ) { const meshPointPatch& ppp = refCast(pp); const polyMesh& mesh = ppp.boundaryMesh().mesh().mesh(); // Count constraints label maxConstraint = 0; const auto& constraints = ppp.constraints(); forAll(constraints, i) { maxConstraint = Foam::max(maxConstraint, constraints[i].first()); } reduce(maxConstraint, maxOp