1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 Creates dual of polyMesh. Every point becomes a cell (or multiple cells
30 for feature points), a walk around every edge creates faces between them.
32 Put all points you want in the final mesh into featurePoints; all edge(mid)s
33 you want in the final mesh into featureEdges; all face(centre)s in
36 Usually to preserve boundaries:
37 - all boundary faces are featureFaces
38 - all edges and points inbetween different patches are
41 In same way you can also preserve internal faces (e.g. faceZones)
46 \*---------------------------------------------------------------------------*/
48 #ifndef meshDualiser_H
49 #define meshDualiser_H
51 #include "DynamicList.H"
52 #include "PackedBoolList.H"
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 /*---------------------------------------------------------------------------*\
65 Class meshDualiser Declaration
66 \*---------------------------------------------------------------------------*/
72 const polyMesh& mesh_;
74 //- From point on cell to dual cell. Either single entry or
75 // one entry per pointCells
76 labelListList pointToDualCells_;
78 //- From point to dual point (or -1 if not feature point).
79 labelList pointToDualPoint_;
81 //- From cell to dual point. All cells become point
82 labelList cellToDualPoint_;
84 //- From face to dual point (or -1 if not feature face)
85 labelList faceToDualPoint_;
87 //- From edge to dual point (or -1 if not feature edge)
88 labelList edgeToDualPoint_;
91 // Private Member Functions
93 static void checkPolyTopoChange(const polyTopoChange&);
95 static void dumpPolyTopoChange(const polyTopoChange&, const fileName&);
97 //- Find dual cell given point and cell
98 label findDualCell(const label cellI, const label pointI) const;
100 //- Helper function to generate dualpoints on all boundary edges
101 // emanating from (boundary & feature) point
102 void generateDualBoundaryEdges
104 const PackedBoolList&,
109 //- Check that owner and neighbour of face have same dual cell
116 //- Add internal face
117 label addInternalFace
119 const label masterPointI,
120 const label masterEdgeI,
121 const label masterFaceI,
123 const bool edgeOrder,
124 const label dualCell0,
125 const label dualCell1,
126 const DynamicList<label>& verts,
127 polyTopoChange& meshMod
130 //- Add boundary face
131 label addBoundaryFace
133 const label masterPointI,
134 const label masterEdgeI,
135 const label masterFaceI,
137 const label dualCellI,
139 const DynamicList<label>& verts,
140 polyTopoChange& meshMod
143 //- Create internal faces walking around edge
144 void createFacesAroundEdge
146 const bool splitFace,
147 const PackedBoolList&,
149 const label startFaceI,
154 //- Create single internal face from internal face
155 void createFaceFromInternalFace
162 //- Creates boundary faces walking around point on patchI.
163 void createFacesAroundBoundaryPoint
166 const label patchPointI,
167 const label startFaceI,
169 boolList& donePFaces // pFaces visited
172 //- Disallow default bitwise copy construct
173 meshDualiser(const meshDualiser&);
175 //- Disallow default bitwise assignment
176 void operator=(const meshDualiser&);
181 //- Runtime type information
182 ClassName("meshDualiser");
187 //- Construct from mesh
188 meshDualiser(const polyMesh&);
195 //- From point on cell to dual cell. Either single entry or
196 // one entry per pointCells.
197 const labelListList& pointToDualCells() const
199 return pointToDualCells_;
202 //- From point to dual point (or -1 if not feature point).
203 const labelList& pointToDualPoint() const
205 return pointToDualPoint_;
208 //- From cell to dual point (at cell centre). All cells become
210 const labelList& cellToDualPoint() const
212 return cellToDualPoint_;
215 //- From face to dual point (at face centre; or -1 if not
217 const labelList& faceToDualPoint() const
219 return faceToDualPoint_;
222 //- From edge to dual point (at edge mid; or -1 if not feature
224 const labelList& edgeToDualPoint() const
226 return edgeToDualPoint_;
233 //- Insert all changes into meshMod to convert the polyMesh into
235 // featureFaces : faces where we want a point at the face centre
236 // featureEdges : edges ,, edge mid
237 // featurePoints : points ,, point. Two variants:
238 // singleCellFeaturePoints : point becomes one dualcell.
239 // Use this for e.g. convex boundary points.
240 // multiCellFeaturePoints : one dualcell per original cell
241 // around point. Use this for e.g. concave boundary points
242 // since it prevents big concave boundary cells.
245 const bool splitFace,
246 const labelList& featureFaces,
247 const labelList& featureEdges,
248 const labelList& singleCellFeaturePoints,
249 const labelList& multiCellFeaturePoints,
250 polyTopoChange& meshMod
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 } // End namespace Foam
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 // ************************************************************************* //