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