OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

faceCollapser.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::faceCollapser
00027 
00028 Description
00029     Collapses faces into edges. Used to remove sliver faces (faces with small
00030     area but non-zero span).
00031 
00032     Passed in as
00033     - face label
00034     - the two indices in the face (fpA, fpB) which delimit the vertices to be
00035       kept.
00036 
00037     Takes the vertices outside the range fpA..fpB and projects them onto the
00038     kept edges (edges using kept vertices only).
00039 
00040     Note:
00041     - Use in combination with edge collapse to cleanup meshes.
00042     - Can not remove cells so will mess up trying to remove a face on a tet.
00043     - WIP. Should be combined with edge collapsing and cell collapsing into
00044       proper 'collapser'.
00045     - Caller is responsible for making sure kept vertices (fpA..fpB) for one
00046       face are not the vertices to be removed for another face.
00047 
00048 SourceFiles
00049     faceCollapser.C
00050 
00051 \*---------------------------------------------------------------------------*/
00052 
00053 #ifndef faceCollapser_H
00054 #define faceCollapser_H
00055 
00056 #include "labelList.H"
00057 #include "point.H"
00058 #include "Map.H"
00059 #include "HashSet.H"
00060 #include "typeInfo.H"
00061 #include "edgeList.H"
00062 
00063 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00064 
00065 namespace Foam
00066 {
00067 
00068 // Forward declaration of classes
00069 class polyMesh;
00070 class polyTopoChange;
00071 class mapPolyMesh;
00072 
00073 /*---------------------------------------------------------------------------*\
00074                            Class faceCollapser Declaration
00075 \*---------------------------------------------------------------------------*/
00076 
00077 class faceCollapser
00078 {
00079     // Private data
00080 
00081         //- Reference to mesh
00082         const polyMesh& mesh_;
00083 
00084 
00085     // Static Functions
00086 
00087         //- Insert labelList into labelHashSet. Optional excluded element.
00088         static void insert
00089         (
00090             const labelList& elems,
00091             const label excludeElem,
00092             labelHashSet& set
00093         );
00094 
00095         //- Find edge amongst candidate edges.
00096         static label findEdge
00097         (
00098             const edgeList& edges,
00099             const labelList& edgeLabels,
00100             const label v0,
00101             const label v1
00102         );
00103 
00104 
00105     // Private Member Functions
00106 
00107         //- Replace vertices in face
00108         void filterFace
00109         (
00110             const Map<labelList>& splitEdges,
00111             const label faceI,
00112             polyTopoChange& meshMod
00113         ) const;
00114 
00115 
00116         //- Disallow default bitwise copy construct
00117         faceCollapser(const faceCollapser&);
00118 
00119         //- Disallow default bitwise assignment
00120         void operator=(const faceCollapser&);
00121 
00122 
00123 public:
00124 
00125     //- Runtime type information
00126     ClassName("faceCollapser");
00127 
00128 
00129     // Constructors
00130 
00131         //- Construct from mesh.
00132         faceCollapser(const polyMesh& mesh);
00133 
00134 
00135     // Member Functions
00136 
00137         // Edit
00138 
00139             //- Collapse faces along endpoints. Play commands into
00140             //  polyTopoChange to create mesh.
00141             void setRefinement
00142             (
00143                 const labelList& faceLabels,
00144                 const labelList& fpA,
00145                 const labelList& fpB,
00146                 polyTopoChange&
00147             ) const;
00148 
00149             //- Update stored quantities for new mesh labels.
00150             void updateMesh(const mapPolyMesh&)
00151             {}
00152 };
00153 
00154 
00155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00156 
00157 } // End namespace Foam
00158 
00159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00160 
00161 #endif
00162 
00163 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd