OpenFOAM logo
Open Source CFD Toolkit

directFaceCollapser.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-2005 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     directFaceCollapser
00027 
00028 Description
00029     Collapses faces into edges. Used to remove sliver faces (faces with small
00030     area but non-zero span). Passed in as
00031     - face label
00032     - the two indices in the face (fpA, fpB) which delimit the vertices to be
00033     kept.
00034 
00035     Takes the vertices outside the range fpA..fpB and projects them onto the
00036     kept edges (edges using kept vertices only).
00037 
00038     Note:
00039     -Use in combination with edge collapse to cleanup meshes.
00040     -Can not remove cells so will mess up trying to remove a face on a tet.
00041     -WIP. Should be combined with edge collapsing and cell collapsing into
00042     proper 'collapser'.    
00043     - Caller is responsible for making sure kept vertices (fpA..fpB) for one
00044     face are not the vertices to be removed for another face.
00045 
00046 SourceFiles
00047     directFaceCollapser.C
00048 
00049 \*---------------------------------------------------------------------------*/
00050 
00051 #ifndef directFaceCollapser_H
00052 #define directFaceCollapser_H
00053 
00054 #include "labelList.H"
00055 #include "DynamicList.H"
00056 #include "point.H"
00057 #include "Map.H"
00058 #include "labelHashSet.H"
00059 #include "typeInfo.H"
00060 #include "edgeList.H"
00061 
00062 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00063 
00064 namespace Foam
00065 {
00066 
00067 // Class forward declarations
00068 class polyMesh;
00069 class directPolyTopoChange;
00070 class mapPolyMesh;
00071 
00072 /*---------------------------------------------------------------------------*\
00073                            Class directFaceCollapser Declaration
00074 \*---------------------------------------------------------------------------*/
00075 
00076 class directFaceCollapser
00077 {
00078     // Private data
00079 
00080         //- Reference to mesh
00081         const polyMesh& mesh_;
00082 
00083 
00084     // Static Functions
00085 
00086         //- Insert labelList into labelHashSet. Optional excluded element.
00087         static void insert
00088         (
00089             const labelList& elems,
00090             const label excludeElem,
00091             labelHashSet& set
00092         );
00093 
00094         //- Find edge amongst candidate edges.
00095         static label findEdge
00096         (
00097             const edgeList& edges,
00098             const labelList& edgeLabels,
00099             const label v0,
00100             const label v1
00101         );
00102 
00103 
00104     // Private Member Functions
00105 
00106         //- Replace vertices in face
00107         void filterFace
00108         (
00109             const Map<labelList>& splitEdges,
00110             const label faceI,
00111             directPolyTopoChange& meshMod
00112         ) const;
00113 
00114 
00115         //- Disallow default bitwise copy construct
00116         directFaceCollapser(const directFaceCollapser&);
00117 
00118         //- Disallow default bitwise assignment
00119         void operator=(const directFaceCollapser&);
00120 
00121 
00122 public:
00123 
00124     //- Runtime type information
00125     ClassName("directFaceCollapser");
00126 
00127 
00128     // Constructors
00129 
00130         //- Construct from mesh.
00131         directFaceCollapser(const polyMesh& mesh);
00132 
00133 
00134     // Member Functions
00135 
00136         // Edit
00137 
00138             //- Collapse faces along endpoints. Play commands into
00139             //  polyTopoChange to create mesh.
00140             void setRefinement
00141             (
00142                 const labelList& faceLabels,
00143                 const labelList& fpA,
00144                 const labelList& fpB,
00145                 directPolyTopoChange&
00146             ) const;
00147 
00148             //- Update stored quantities for new mesh labels.
00149             void updateMesh(const mapPolyMesh&)
00150             {
00151                 notImplemented("updateMesh(const mapPolyMesh&)");
00152             }
00153 };
00154 
00155 
00156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00157 
00158 } // End namespace Foam
00159 
00160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00161 
00162 #endif
00163 
00164 // ************************************************************************* //
For further information go to www.openfoam.org