1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Creates dual of polyMesh. Every point becomes a cell (or multiple cells
29 for feature points), a walk around every edge creates faces between them.
31 Put all points you want in the final mesh into featurePoints;
32 all edge(mid)s you want in the final mesh into featureEdges;
33 all face(centre)s in faceFaces.
35 Usually to preserve boundaries:
36 - all boundary faces are featureFaces
37 - all edges and points inbetween different patches are
40 In same way you can also preserve internal faces (e.g. faceZones)
45 \*---------------------------------------------------------------------------*/
47 #ifndef meshDualiser_H
48 #define meshDualiser_H
50 #include "DynamicList.H"
51 #include "PackedBoolList.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 class directTopoChange;
63 /*---------------------------------------------------------------------------*\
64 Class meshDualiser Declaration
65 \*---------------------------------------------------------------------------*/
71 const polyMesh& mesh_;
73 //- From point on cell to dual cell. Either single entry or
74 // one entry per pointCells
75 labelListList pointToDualCells_;
77 //- From point to dual point (or -1 if not feature point).
78 labelList pointToDualPoint_;
80 //- From cell to dual point. All cells become point
81 labelList cellToDualPoint_;
83 //- From face to dual point (or -1 if not feature face)
84 labelList faceToDualPoint_;
86 //- From edge to dual point (or -1 if not feature edge)
87 labelList edgeToDualPoint_;
90 // Private Member Functions
92 static void checkPolyTopoChange(const directTopoChange&);
94 static void dumpPolyTopoChange(const directTopoChange&, const fileName&);
96 //- Find dual cell given point and cell
97 label findDualCell(const label cellI, const label pointI) const;
99 //- Helper function to generate dualpoints on all boundary edges
100 // emanating from (boundary & feature) point
101 void generateDualBoundaryEdges
103 const PackedBoolList&,
108 //- Check that owner and neighbour of face have same dual cell
115 //- Add internal face
116 label addInternalFace
118 const label masterPointI,
119 const label masterEdgeI,
120 const label masterFaceI,
122 const bool edgeOrder,
123 const label dualCell0,
124 const label dualCell1,
125 const DynamicList<label>& verts,
126 directTopoChange& meshMod
129 //- Add boundary face
130 label addBoundaryFace
132 const label masterPointI,
133 const label masterEdgeI,
134 const label masterFaceI,
136 const label dualCellI,
138 const DynamicList<label>& verts,
139 directTopoChange& meshMod
142 //- Create internal faces walking around edge
143 void createFacesAroundEdge
145 const bool splitFace,
146 const PackedBoolList&,
148 const label startFaceI,
153 //- Create single internal face from internal face
154 void createFaceFromInternalFace
161 //- Creates boundary faces walking around point on patchI.
162 void createFacesAroundBoundaryPoint
165 const label patchPointI,
166 const label startFaceI,
168 boolList& donePFaces // pFaces visited
171 //- Disallow default bitwise copy construct
172 meshDualiser(const meshDualiser&);
174 //- Disallow default bitwise assignment
175 void operator=(const meshDualiser&);
180 //- Runtime type information
181 ClassName("meshDualiser");
186 //- Construct from mesh
187 meshDualiser(const polyMesh&);
194 //- From point on cell to dual cell. Either single entry or
195 // one entry per pointCells.
196 const labelListList& pointToDualCells() const
198 return pointToDualCells_;
201 //- From point to dual point (or -1 if not feature point).
202 const labelList& pointToDualPoint() const
204 return pointToDualPoint_;
207 //- From cell to dual point (at cell centre). All cells become
209 const labelList& cellToDualPoint() const
211 return cellToDualPoint_;
214 //- From face to dual point (at face centre; or -1 if not
216 const labelList& faceToDualPoint() const
218 return faceToDualPoint_;
221 //- From edge to dual point (at edge mid; or -1 if not feature
223 const labelList& edgeToDualPoint() const
225 return edgeToDualPoint_;
232 //- Insert all changes into meshMod to convert the polyMesh into
234 // featureFaces : faces where we want a point at the face centre
235 // featureEdges : edges ,, edge mid
236 // featurePoints : points ,, point. Two variants:
237 // singleCellFeaturePoints : point becomes one dualcell.
238 // Use this for e.g. convex boundary points.
239 // multiCellFeaturePoints : one dualcell per original cell
240 // around point. Use this for e.g. concave boundary points
241 // since it prevents big concave boundary cells.
244 const bool splitFace,
245 const labelList& featureFaces,
246 const labelList& featureEdges,
247 const labelList& singleCellFeaturePoints,
248 const labelList& multiCellFeaturePoints,
249 directTopoChange& meshMod
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 } // End namespace Foam
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 // ************************************************************************* //