Loading...
Searching...
No Matches
primitiveMeshGeometry.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 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::primitiveMeshGeometry
28
29Description
30 Updateable mesh geometry + checking routines.
31
32SourceFiles
33 primitiveMeshGeometry.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef primitiveMeshGeometry_H
38#define primitiveMeshGeometry_H
39
40#include "pointFields.H"
41#include "HashSet.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
48/*---------------------------------------------------------------------------*\
49 Class primitiveMeshGeometry Declaration
50\*---------------------------------------------------------------------------*/
51
53{
54 //- Reference to primitiveMesh.
55 const primitiveMesh& mesh_;
56
57 //- Uptodate copy of face areas
58 vectorField faceAreas_;
59
60 //- Uptodate copy of face centres
61 vectorField faceCentres_;
62
63 //- Uptodate copy of cell centres
64 vectorField cellCentres_;
65
66 //- Uptodate copy of cell volumes
67 scalarField cellVolumes_;
68
69
70 // Private Member Functions
71
72 //- Update face areas and centres on selected faces.
73 void updateFaceCentresAndAreas
74 (
75 const pointField& p,
76 const labelList& changedFaces
77 );
78
79 //- Update cell volumes and centres on selected cells. Requires
80 // cells and faces to be consistent set.
81 void updateCellCentresAndVols
82 (
83 const labelList& changedCells,
84 const labelList& changedFaces
85 );
86
87public:
88
89 ClassName("primitiveMeshGeometry");
90
91 // Constructors
92
93 //- Construct from mesh
95
96
97 // Member Functions
98
99 // Access
100
101 const primitiveMesh& mesh() const
102 {
103 return mesh_;
104 }
105
106 const vectorField& faceAreas() const
107 {
108 return faceAreas_;
109 }
110 const vectorField& faceCentres() const
111 {
112 return faceCentres_;
114 const vectorField& cellCentres() const
115 {
116 return cellCentres_;
117 }
119 {
120 return cellVolumes_;
121 }
123 // Edit
124
125 //- Take over properties from mesh
126 void correct();
127
128 //- Recalculate on selected faces. Recalculates cell properties
129 // on owner and neighbour of these cells.
131 (
132 const pointField& p,
133 const labelList& changedFaces
134 );
135
136 //- Helper function: get affected cells from faces
137 labelList affectedCells(const labelList& changedFaces) const;
138
139
140 // Checking of selected faces with supplied geometry (mesh only used for
141 // topology). Parallel aware.
142
143 static bool checkFaceDotProduct
144 (
145 const bool report,
146 const scalar orthWarn,
147 const primitiveMesh&,
149 const vectorField& faceAreas,
150 const labelList& checkFaces,
151 labelHashSet* setPtr
152 );
153
154 static bool checkFacePyramids
155 (
156 const bool report,
157 const scalar minPyrVol,
158 const primitiveMesh&,
160 const pointField& p,
161 const labelList& checkFaces,
163 );
164
165 static bool checkFaceSkewness
166 (
167 const bool report,
168 const scalar internalSkew,
169 const scalar boundarySkew,
170 const primitiveMesh& mesh,
173 const vectorField& faceAreas,
174 const labelList& checkFaces,
175 labelHashSet* setPtr
176 );
177
178 static bool checkFaceWeights
179 (
180 const bool report,
181 const scalar warnWeight,
182 const primitiveMesh& mesh,
185 const vectorField& faceAreas,
186 const labelList& checkFaces,
187 labelHashSet* setPtr
188 );
189
190 static bool checkFaceAngles
191 (
192 const bool report,
193 const scalar maxDeg,
194 const primitiveMesh& mesh,
195 const vectorField& faceAreas,
196 const pointField& p,
197 const labelList& checkFaces,
198 labelHashSet* setPtr
199 );
200
201 //static bool checkFaceFlatness
202 //(
203 // const bool report,
204 // const scalar warnFlatness,
205 // const primitiveMesh&,
206 // const vectorField& faceAreas,
207 // const vectorField& faceCentres,
208 // const pointField& p,
209 // const labelList& checkFaces,
210 // labelHashSet* setPtr
211 //);
212
213 static bool checkFaceTwist
214 (
215 const bool report,
216 const scalar minTwist,
217 const primitiveMesh&,
218 const vectorField& faceAreas,
220 const pointField& p,
221 const labelList& checkFaces,
222 labelHashSet* setPtr
223 );
224
225 static bool checkFaceArea
226 (
227 const bool report,
228 const scalar minArea,
229 const primitiveMesh&,
230 const vectorField& faceAreas,
231 const labelList& checkFaces,
232 labelHashSet* setPtr
233 );
234
235 static bool checkCellDeterminant
236 (
237 const bool report,
238 const scalar minDet,
239 const primitiveMesh&,
240 const vectorField& faceAreas,
241 const labelList& checkFaces,
243 labelHashSet* setPtr
244 );
245
246
247 // Checking of selected faces with local geometry. Uses above static
248 // functions. Parallel aware.
249
251 (
252 const bool report,
253 const scalar orthWarn,
254 const labelList& checkFaces,
255 labelHashSet* setPtr
256 ) const;
257
259 (
260 const bool report,
261 const scalar minPyrVol,
262 const pointField& p,
263 const labelList& checkFaces,
264 labelHashSet* setPtr
265 ) const;
266
268 (
269 const bool report,
270 const scalar internalSkew,
271 const scalar boundarySkew,
272 const labelList& checkFaces,
273 labelHashSet* setPtr
274 ) const;
275
277 (
278 const bool report,
279 const scalar warnWeight,
280 const labelList& checkFaces,
281 labelHashSet* setPtr
282 ) const;
283
284 bool checkFaceAngles
285 (
286 const bool report,
287 const scalar maxDeg,
288 const pointField& p,
289 const labelList& checkFaces,
290 labelHashSet* setPtr
291 ) const;
292
293 //bool checkFaceFlatness
294 //(
295 // const bool report,
296 // const scalar warnFlatness,
297 // const pointField& p,
298 // const labelList& checkFaces,
299 // labelHashSet* setPtr
300 //) const;
301
302 bool checkFaceTwist
303 (
304 const bool report,
305 const scalar minTwist,
306 const pointField& p,
307 const labelList& checkFaces,
308 labelHashSet* setPtr
309 ) const;
310
311 bool checkFaceArea
312 (
313 const bool report,
314 const scalar minArea,
315 const labelList& checkFaces,
316 labelHashSet* setPtr
317 ) const;
318
320 (
321 const bool report,
322 const scalar warnDet,
323 const labelList& checkFaces,
325 labelHashSet* setPtr
326 ) const;
327};
328
329// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330
331} // End namespace Foam
332
333// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
334
335#endif
336
337// ************************************************************************* //
static bool checkFaceTwist(const bool report, const scalar minTwist, const primitiveMesh &, const vectorField &faceAreas, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
const scalarField & cellVolumes() const
static bool checkFaceAngles(const bool report, const scalar maxDeg, const primitiveMesh &mesh, const vectorField &faceAreas, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
static bool checkFaceSkewness(const bool report, const scalar internalSkew, const scalar boundarySkew, const primitiveMesh &mesh, const vectorField &cellCentres, const vectorField &faceCentres, const vectorField &faceAreas, const labelList &checkFaces, labelHashSet *setPtr)
const vectorField & faceAreas() const
void correct()
Take over properties from mesh.
static bool checkFaceWeights(const bool report, const scalar warnWeight, const primitiveMesh &mesh, const vectorField &cellCentres, const vectorField &faceCentres, const vectorField &faceAreas, const labelList &checkFaces, labelHashSet *setPtr)
labelList affectedCells(const labelList &changedFaces) const
Helper function: get affected cells from faces.
primitiveMeshGeometry(const primitiveMesh &)
Construct from mesh.
static bool checkCellDeterminant(const bool report, const scalar minDet, const primitiveMesh &, const vectorField &faceAreas, const labelList &checkFaces, const labelList &affectedCells, labelHashSet *setPtr)
const vectorField & faceCentres() const
static bool checkFaceArea(const bool report, const scalar minArea, const primitiveMesh &, const vectorField &faceAreas, const labelList &checkFaces, labelHashSet *setPtr)
ClassName("primitiveMeshGeometry")
static bool checkFaceDotProduct(const bool report, const scalar orthWarn, const primitiveMesh &, const vectorField &cellCentres, const vectorField &faceAreas, const labelList &checkFaces, labelHashSet *setPtr)
const primitiveMesh & mesh() const
static bool checkFacePyramids(const bool report, const scalar minPyrVol, const primitiveMesh &, const vectorField &cellCentres, const pointField &p, const labelList &checkFaces, labelHashSet *)
const vectorField & cellCentres() const
Cell-face mesh analysis engine.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
volScalarField & p
dynamicFvMesh & mesh
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Field< vector > vectorField
Specialisation of Field<T> for vector.
vectorField pointField
pointField is a vectorField.