1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Foam::primitiveMeshGeometry
28 Updateable mesh geometry + checking routines.
31 primitiveMeshGeometry.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef primitiveMeshGeometry_H
36 #define primitiveMeshGeometry_H
38 #include "pointFields.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 /*---------------------------------------------------------------------------*\
47 Class primitiveMeshGeometry Declaration
48 \*---------------------------------------------------------------------------*/
50 class primitiveMeshGeometry
52 //- Reference to primitiveMesh.
53 const primitiveMesh& mesh_;
55 //- Uptodate copy of face areas
56 vectorField faceAreas_;
58 //- Uptodate copy of face centres
59 vectorField faceCentres_;
61 //- Uptodate copy of cell centres
62 vectorField cellCentres_;
64 //- Uptodate copy of cell volumes
65 scalarField cellVolumes_;
68 // Private Member Functions
70 //- Update face areas and centres on selected faces.
71 void updateFaceCentresAndAreas
74 const labelList& changedFaces
77 //- Update cell volumes and centres on selected cells. Requires
78 // cells and faces to be consistent set.
79 void updateCellCentresAndVols
81 const labelList& changedCells,
82 const labelList& changedFaces
87 ClassName("primitiveMeshGeometry");
91 //- Construct from mesh
92 primitiveMeshGeometry(const primitiveMesh&);
99 const primitiveMesh& mesh() const
104 const vectorField& faceAreas() const
108 const vectorField& faceCentres() const
112 const vectorField& cellCentres() const
116 const scalarField& cellVolumes() const
123 //- Take over properties from mesh
126 //- Recalculate on selected faces. Recalculates cell properties
127 // on owner and neighbour of these cells.
131 const labelList& changedFaces
134 //- Helper function: get affected cells from faces
135 labelList affectedCells(const labelList& changedFaces) const;
138 // Checking of selected faces with supplied geometry (mesh only used for
139 // topology). Parallel aware.
141 static bool checkFaceDotProduct
144 const scalar orthWarn,
145 const primitiveMesh&,
146 const vectorField& cellCentres,
147 const vectorField& faceAreas,
148 const labelList& checkFaces,
152 static bool checkFacePyramids
155 const scalar minPyrVol,
156 const primitiveMesh&,
157 const vectorField& cellCentres,
159 const labelList& checkFaces,
163 static bool checkFaceSkewness
166 const scalar internalSkew,
167 const scalar boundarySkew,
168 const primitiveMesh& mesh,
169 const vectorField& cellCentres,
170 const vectorField& faceCentres,
171 const vectorField& faceAreas,
172 const labelList& checkFaces,
176 static bool checkFaceWeights
179 const scalar warnWeight,
180 const primitiveMesh& mesh,
181 const vectorField& cellCentres,
182 const vectorField& faceCentres,
183 const vectorField& faceAreas,
184 const labelList& checkFaces,
188 static bool checkFaceAngles
192 const primitiveMesh& mesh,
193 const vectorField& faceAreas,
195 const labelList& checkFaces,
199 //static bool checkFaceFlatness
201 // const bool report,
202 // const scalar warnFlatness,
203 // const primitiveMesh&,
204 // const vectorField& faceAreas,
205 // const vectorField& faceCentres,
206 // const pointField& p,
207 // const labelList& checkFaces,
208 // labelHashSet* setPtr
211 static bool checkFaceTwist
214 const scalar minTwist,
215 const primitiveMesh&,
216 const vectorField& faceAreas,
217 const vectorField& faceCentres,
219 const labelList& checkFaces,
223 static bool checkFaceArea
226 const scalar minArea,
227 const primitiveMesh&,
228 const vectorField& faceAreas,
229 const labelList& checkFaces,
233 static bool checkCellDeterminant
237 const primitiveMesh&,
238 const vectorField& faceAreas,
239 const labelList& checkFaces,
240 const labelList& affectedCells,
245 // Checking of selected faces with local geometry. Uses above static
246 // functions. Parallel aware.
248 bool checkFaceDotProduct
251 const scalar orthWarn,
252 const labelList& checkFaces,
256 bool checkFacePyramids
259 const scalar minPyrVol,
261 const labelList& checkFaces,
265 bool checkFaceSkewness
268 const scalar internalSkew,
269 const scalar boundarySkew,
270 const labelList& checkFaces,
274 bool checkFaceWeights
277 const scalar warnWeight,
278 const labelList& checkFaces,
287 const labelList& checkFaces,
291 //bool checkFaceFlatness
293 // const bool report,
294 // const scalar warnFlatness,
295 // const pointField& p,
296 // const labelList& checkFaces,
297 // labelHashSet* setPtr
303 const scalar minTwist,
305 const labelList& checkFaces,
312 const scalar minArea,
313 const labelList& checkFaces,
317 bool checkCellDeterminant
320 const scalar warnDet,
321 const labelList& checkFaces,
322 const labelList& affectedCells,
327 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
329 } // End namespace Foam
331 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
335 // ************************************************************************* //