Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / conversion / polyDualMesh / polyDualMesh.H
blob42a4c04cfc17d2fb3b895f34835c2cc25c5dbd0c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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/>.
24 Class
25     Foam::polyDualMesh
27 Description
28     Creates dual of polyMesh.
30     Every polyMesh point becomes a cell on the dual mesh
32     Every polyMesh cell and patchFace becomes a point on the dual mesh.
35 SourceFiles
36     polyDualMesh.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef polyDualMesh_H
41 #define polyDualMesh_H
43 #include "polyMesh.H"
44 #include "labelIOList.H"
45 #include "typeInfo.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 namespace Foam
52 /*---------------------------------------------------------------------------*\
53                            Class polyDualMesh Declaration
54 \*---------------------------------------------------------------------------*/
56 class polyDualMesh
58     public polyMesh
60     // Private data
62         //- From polyMesh cell to my point
63         labelIOList cellPoint_;
65         //- From polyMesh boundary face (face-mesh.nInternalFaces()) to my point
66         labelIOList boundaryFacePoint_;
69     // Private Member Functions
71         static labelList getFaceOrder
72         (
73             const labelList& faceOwner,
74             const labelList& faceNeighbour,
75             const cellList& cells,
76             label& nInternalFaces
77         );
79         static void getPointEdges
80         (
81             const primitivePatch& patch,
82             const label faceI,
83             const label pointI,
84             label& e0,
85             label& e1
86         );
88         static labelList collectPatchSideFace
89         (
90             const polyPatch& patch,
91             const label patchToDualOffset,
92             const labelList& edgeToDualPoint,
93             const labelList& pointToDualPoint,
94             const label pointI,
96             label& edgeI
97         );
99         static void collectPatchInternalFace
100         (
101             const polyPatch& patch,
102             const label patchToDualOffset,
103             const labelList& edgeToDualPoint,
105             const label pointI,
106             const label startEdgeI,
108             labelList& dualFace2,
109             labelList& featEdgeIndices2
110         );
112         static void splitFace
113         (
114             const polyPatch& patch,
115             const labelList& pointToDualPoint,
117             const label pointI,
118             const labelList& dualFace,
119             const labelList& featEdgeIndices,
121             DynamicList<face>& dualFaces,
122             dynamicLabelList& dualOwner,
123             dynamicLabelList& dualNeighbour,
124             dynamicLabelList& dualRegion
125         );
127         static void dualPatch
128         (
129             const polyPatch& patch,
130             const label patchToDualOffset,
131             const labelList& edgeToDualPoint,
132             const labelList& pointToDualPoint,
134             const pointField& dualPoints,
136             DynamicList<face>& dualFaces,
137             dynamicLabelList& dualOwner,
138             dynamicLabelList& dualNeighbour,
139             dynamicLabelList& dualRegion
140         );
142         void calcDual
143         (
144             const polyMesh& mesh,
145             const labelList& featureEdges,
146             const labelList& featurePoints
147         );
150         //- Disallow default bitwise copy construct
151         polyDualMesh(const polyDualMesh&);
153         //- Disallow default bitwise assignment
154         void operator=(const polyDualMesh&);
157 public:
159     //- Runtime type information
160     ClassName("polyDualMesh");
163     // Constructors
165         //- Construct from IOobject
166         polyDualMesh(const IOobject&);
168         //- Construct from polyMesh and list of edges and points to represent.
169         //  Feature edge and point labels are in local addressing of a patch
170         //  over all boundary faces.
171         polyDualMesh
172         (
173             const polyMesh&,
174             const labelList& featureEdges,
175             const labelList& featurePoints
176         );
178         //- Construct from polyMesh and feature edge angle. Uses calcFeatures
179         //  below to determine feature edges and points.
180         polyDualMesh
181         (
182             const polyMesh&,
183             const scalar featureCos
184         );
186         //- Helper function to create feature edges and points based on
187         //  feature angle and patches.
188         static void calcFeatures
189         (
190             const polyMesh&,
191             const scalar featureCos,
192             labelList& featureEdges,
193             labelList& featurePoints
194         );
197     // Destructor
199         ~polyDualMesh();
202     // Member Functions
204         // Access
206             //- From polyMesh cell to dual point
207             const labelIOList& cellPoint() const
208             {
209                 return cellPoint_;
210             }
212             //- From polyMesh patch face to dual point
213             const labelIOList& boundaryFacePoint() const
214             {
215                 return boundaryFacePoint_;
216             }
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 } // End namespace Foam
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 #endif
227 // ************************************************************************* //