/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- 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 . Description Collapse short edges and combines edges that are in line. - collapse short edges. Length of edges to collapse provided as argument. - merge two edges if they are in line. Maximum angle provided as argument. - remove unused points. Optionally removes cells. Can remove faces and points but does not check for nonsense resulting topology. When collapsing an edge with one point on the boundary it will leave the boundary point intact. When both points inside it chooses random. When both points on boundary random again. Usage - collapseEdges [OPTION] \param -allowCellCollapse \n Allow collapsing of cells to a single point \param -meshQuality \n Only collapse if not exceeding user defined (in \a system/meshQualityDict) quality settings \*---------------------------------------------------------------------------*/ #include "argList.H" #include "Time.H" #include "polyTopoChange.H" #include "fvMesh.H" #include "mapPolyMesh.H" #include "mathematicalConstants.H" #include "PackedBoolList.H" #include "unitConversion.H" #include "globalMeshData.H" #include "globalIndex.H" #include "PointEdgeWave.H" #include "pointEdgeCollapse.H" #include "motionSmoother.H" #include "removePoints.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // void filterFace ( const label faceI, face& f, const List& allPointInfo, const Map >& collapseStrings ) { label newFp = 0; face oldFace = f; forAll(f, fp) { label pointI = f[fp]; label collapsePoint = allPointInfo[pointI].collapseIndex(); if (collapseStrings.found(collapsePoint)) { collapsePoint = collapseStrings[collapsePoint][0]; } if (collapsePoint == -1) { WarningIn ( "filterFace" "(const label, face&, const List&)" ) << "Point " << pointI << " was not visited by PointEdgeWave" << endl; } else if (collapsePoint == -2) { f[newFp++] = pointI; } else { if (findIndex(SubList