polyDualMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::polyDualMesh
26 
27 Description
28  Creates dual of polyMesh.
29 
30  Every polyMesh point becomes a cell on the dual mesh
31 
32  Every polyMesh cell and patchFace becomes a point on the dual mesh.
33 
34 
35 SourceFiles
36  polyDualMesh.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef polyDualMesh_H
41 #define polyDualMesh_H
42 
43 #include "polyMesh.H"
44 #include "labelIOList.H"
45 #include "typeInfo.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class polyDualMesh Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class polyDualMesh
57 :
58  public polyMesh
59 {
60  // Private Data
61 
62  //- From polyMesh cell to my point
63  labelIOList cellPoint_;
64 
65  //- From polyMesh boundary face (face-mesh.nInternalFaces()) to my point
66  labelIOList boundaryFacePoint_;
67 
68 
69  // Private Member Functions
70 
71  static labelList getFaceOrder
72  (
73  const labelList& faceOwner,
74  const labelList& faceNeighbour,
75  const cellList& cells,
77  );
78 
79  static void getPointEdges
80  (
81  const primitivePatch& patch,
82  const label facei,
83  const label pointi,
84  label& e0,
85  label& e1
86  );
87 
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,
95 
96  label& edgeI
97  );
98 
99  static void collectPatchInternalFace
100  (
101  const polyPatch& patch,
102  const label patchToDualOffset,
103  const labelList& edgeToDualPoint,
104 
105  const label pointi,
106  const label startEdgeI,
107 
108  labelList& dualFace2,
109  labelList& featEdgeIndices2
110  );
111 
112  static void splitFace
113  (
114  const polyPatch& patch,
115  const labelList& pointToDualPoint,
116 
117  const label pointi,
118  const labelList& dualFace,
119  const labelList& featEdgeIndices,
120 
121  DynamicList<face>& dualFaces,
122  DynamicList<label>& dualOwner,
123  DynamicList<label>& dualNeighbour,
124  DynamicList<label>& dualRegion
125  );
126 
127  static void dualPatch
128  (
129  const polyPatch& patch,
130  const label patchToDualOffset,
131  const labelList& edgeToDualPoint,
132  const labelList& pointToDualPoint,
133 
134  const pointField& dualPoints,
135 
136  DynamicList<face>& dualFaces,
137  DynamicList<label>& dualOwner,
138  DynamicList<label>& dualNeighbour,
139  DynamicList<label>& dualRegion
140  );
141 
142  void calcDual
143  (
144  const polyMesh& mesh,
145  const labelList& featureEdges,
146  const labelList& featurePoints
147  );
148 
149 
150 public:
151 
152  //- Runtime type information
153  ClassName("polyDualMesh");
154 
155 
156  // Constructors
157 
158  //- Construct from IOobject
159  polyDualMesh(const IOobject&);
160 
161  //- Construct from polyMesh and list of edges and points to represent.
162  // Feature edge and point labels are in local addressing of a patch
163  // over all boundary faces.
165  (
166  const polyMesh&,
167  const labelList& featureEdges,
168  const labelList& featurePoints
169  );
170 
171  //- Construct from polyMesh and feature edge angle. Uses calcFeatures
172  // below to determine feature edges and points.
174  (
175  const polyMesh&,
176  const scalar featureCos
177  );
178 
179  //- Disallow default bitwise copy construction
180  polyDualMesh(const polyDualMesh&) = delete;
181 
182  //- Helper function to create feature edges and points based on
183  // feature angle and patches.
184  static void calcFeatures
185  (
186  const polyMesh&,
187  const scalar featureCos,
188  labelList& featureEdges,
189  labelList& featurePoints
190  );
191 
192 
193  //- Destructor
194  ~polyDualMesh();
195 
196 
197  // Member Functions
198 
199  // Access
200 
201  //- From polyMesh cell to dual point
202  const labelIOList& cellPoint() const
203  {
204  return cellPoint_;
205  }
206 
207  //- From polyMesh patch face to dual point
208  const labelIOList& boundaryFacePoint() const
209  {
210  return boundaryFacePoint_;
211  }
212 
213 
214  // Member Operators
215 
216  //- Disallow default bitwise assignment
217  void operator=(const polyDualMesh&) = delete;
218 };
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
ClassName("polyDualMesh")
Runtime type information.
polyDualMesh(const IOobject &)
Construct from IOobject.
label nInternalFaces() const
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1243
const cellList & cells() const
void operator=(const polyDualMesh &)=delete
Disallow default bitwise assignment.
fvMesh & mesh
A list of faces which address into the list of points.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1237
const labelIOList & boundaryFacePoint() const
From polyMesh patch face to dual point.
Definition: polyDualMesh.H:207
const labelIOList & cellPoint() const
From polyMesh cell to dual point.
Definition: polyDualMesh.H:201
static void calcFeatures(const polyMesh &, const scalar featureCos, labelList &featureEdges, labelList &featurePoints)
Helper function to create feature edges and points based on.
~polyDualMesh()
Destructor.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
Creates dual of polyMesh.
Definition: polyDualMesh.H:55
Namespace for OpenFOAM.