1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Does polyTopoChanges to remove edges. Can remove faces due to edge
30 collapse but can not remove cells due to face removal!
31 Also removes unused points.
36 \*---------------------------------------------------------------------------*/
38 #ifndef edgeCollapser_H
39 #define edgeCollapser_H
41 #include "labelList.H"
42 #include "DynamicList.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of classes
56 /*---------------------------------------------------------------------------*\
57 Class edgeCollapser Declaration
58 \*---------------------------------------------------------------------------*/
65 const polyMesh& mesh_;
67 //- For every point -1 or region number
68 labelList pointRegion_;
70 //- -1 or master vertex for region number
71 DynamicList<label> pointRegionMaster_;
73 //- Stack of free region numbers. Corresponds to -1 in pointRegionMaster
74 SLList<label> freeRegions_;
79 //- Find val in list. Search starts at start, continues to size-1.
80 static label findIndex
89 // Private Member Functions
91 //- Determine points connected through edgesToRemove_.
92 // Note: Only routine that uses edgesToRemove!
93 label changePointRegion
96 const label oldRegion,
100 //- Whether point is master of region or has been removed
101 bool pointRemoved(const label) const;
103 //- Renumber f with new vertices. Removes duplicates.
104 void filterFace(const label faceI, face&) const;
106 //- Some debugging printing
107 void printRegions() const;
109 //- Collapse list of edges. Tries to find master to collapse to.
110 void collapseEdges(const labelList& edgeLabels);
112 //- Disallow default bitwise copy construct
113 edgeCollapser(const edgeCollapser&);
115 //- Disallow default bitwise assignment
116 void operator=(const edgeCollapser&);
121 //- Runtime type information
122 ClassName("edgeCollapser");
127 //- Construct from mesh.
128 edgeCollapser(const polyMesh& mesh);
135 //- For every point the region it belongs to or -1.
136 const labelList& pointRegion() const
141 //- For every region the master (i.e. the point the region will
143 const DynamicList<label>& pointRegionMaster() const
145 return pointRegionMaster_;
148 //- Check that edge is not marked for anything
149 bool unaffectedEdge(const label edgeI) const;
154 //- Set edge to collapse and point to collapse it to.
155 // Return true if collapse is valid.
156 // (always true at the moment)
157 bool collapseEdge(const label edgeI, const label master);
159 //- Play commands into polyTopoChange to create mesh. Return true
160 // if anything changed.
161 bool setRefinement(polyTopoChange&);
163 void updateMesh(const mapPolyMesh&);
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 } // End namespace Foam
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 // ************************************************************************* //