initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / primitiveMeshGeometry / primitiveMeshGeometry.H
blobe6338e249f35da4c2ec246691a75f0f5318c1650
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::primitiveMeshGeometry
28 Description
29     Updateable mesh geometry + checking routines.
31 SourceFiles
32     primitiveMeshGeometry.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef primitiveMeshGeometry_H
37 #define primitiveMeshGeometry_H
39 #include "pointFields.H"
40 #include "HashSet.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class primitiveMeshGeometry Declaration
49 \*---------------------------------------------------------------------------*/
51 class primitiveMeshGeometry
53         //- Reference to primitiveMesh.
54         const primitiveMesh& mesh_;
56         //- Uptodate copy of face areas
57         vectorField faceAreas_;
59         //- Uptodate copy of face centres
60         vectorField faceCentres_;
62         //- Uptodate copy of cell centres
63         vectorField cellCentres_;
65         //- Uptodate copy of cell volumes
66         scalarField cellVolumes_;
69     // Private Member Functions
71         //- Update face areas and centres on selected faces.
72         void updateFaceCentresAndAreas
73         (
74             const pointField& p,
75             const labelList& changedFaces
76         );
78         //- Update cell volumes and centres on selected cells. Requires
79         //  cells and faces to be consistent set.
80         void updateCellCentresAndVols
81         (
82             const labelList& changedCells,
83             const labelList& changedFaces
84         );
86 public:
88     ClassName("primitiveMeshGeometry");
90     // Constructors
92         //- Construct from mesh
93         primitiveMeshGeometry(const primitiveMesh&);
96     // Member Functions
98         // Access
100             const primitiveMesh& mesh() const
101             {
102                 return mesh_;
103             }
105             const vectorField& faceAreas() const
106             {
107                 return faceAreas_;
108             }
109             const vectorField& faceCentres() const
110             {
111                 return faceCentres_;
112             }
113             const vectorField& cellCentres() const
114             {
115                 return cellCentres_;
116             }
117             const scalarField& cellVolumes() const
118             {
119                 return cellVolumes_;
120             }
122         // Edit
124             //- Take over properties from mesh
125             void correct();
127             //- Recalculate on selected faces. Recalculates cell properties
128             //  on owner and neighbour of these cells.
129             void correct
130             (
131                 const pointField& p,
132                 const labelList& changedFaces
133             );
135             //- Helper function: get affected cells from faces
136             labelList affectedCells(const labelList& changedFaces) const;
139         // Checking of selected faces with supplied geometry (mesh only used for
140         // topology). Parallel aware.
142             static bool checkFaceDotProduct
143             (
144                 const bool report,
145                 const scalar orthWarn,
146                 const primitiveMesh&,
147                 const vectorField& cellCentres,
148                 const vectorField& faceAreas,
149                 const labelList& checkFaces,
150                 labelHashSet* setPtr
151             );
153             static bool checkFacePyramids
154             (
155                 const bool report,
156                 const scalar minPyrVol,
157                 const primitiveMesh&,
158                 const vectorField& cellCentres,
159                 const pointField& p,
160                 const labelList& checkFaces,
161                 labelHashSet*
162             );
164             static bool checkFaceSkewness
165             (
166                 const bool report,
167                 const scalar internalSkew,
168                 const scalar boundarySkew,
169                 const primitiveMesh& mesh,
170                 const vectorField& cellCentres,
171                 const vectorField& faceCentres,
172                 const vectorField& faceAreas,
173                 const labelList& checkFaces,
174                 labelHashSet* setPtr
175             );
177             static bool checkFaceWeights
178             (
179                 const bool report,
180                 const scalar warnWeight,
181                 const primitiveMesh& mesh,
182                 const vectorField& cellCentres,
183                 const vectorField& faceCentres,
184                 const vectorField& faceAreas,
185                 const labelList& checkFaces,
186                 labelHashSet* setPtr
187             );
189             static bool checkFaceAngles
190             (
191                 const bool report,
192                 const scalar maxDeg,
193                 const primitiveMesh& mesh,
194                 const vectorField& faceAreas,
195                 const pointField& p,
196                 const labelList& checkFaces,
197                 labelHashSet* setPtr
198             );
200             //static bool checkFaceFlatness
201             //(
202             //    const bool report,
203             //    const scalar warnFlatness,
204             //    const primitiveMesh&,
205             //    const vectorField& faceAreas,
206             //    const vectorField& faceCentres,
207             //    const pointField& p,
208             //    const labelList& checkFaces,
209             //    labelHashSet* setPtr
210             //);
212             static bool checkFaceTwist
213             (
214                 const bool report,
215                 const scalar minTwist,
216                 const primitiveMesh&,
217                 const vectorField& faceAreas,
218                 const vectorField& faceCentres,
219                 const pointField& p,
220                 const labelList& checkFaces,
221                 labelHashSet* setPtr
222             );
224             static bool checkFaceArea
225             (
226                 const bool report,
227                 const scalar minArea,
228                 const primitiveMesh&,
229                 const vectorField& faceAreas,
230                 const labelList& checkFaces,
231                 labelHashSet* setPtr
232             );
234             static bool checkCellDeterminant
235             (
236                 const bool report,
237                 const scalar minDet,
238                 const primitiveMesh&,
239                 const vectorField& faceAreas,
240                 const labelList& checkFaces,
241                 const labelList& affectedCells,
242                 labelHashSet* setPtr
243             );
246         // Checking of selected faces with local geometry. Uses above static
247         // functions. Parallel aware.
249             bool checkFaceDotProduct
250             (
251                 const bool report,
252                 const scalar orthWarn,
253                 const labelList& checkFaces,
254                 labelHashSet* setPtr
255             ) const;
257             bool checkFacePyramids
258             (
259                 const bool report,
260                 const scalar minPyrVol,
261                 const pointField& p,
262                 const labelList& checkFaces,
263                 labelHashSet* setPtr
264             ) const;
266             bool checkFaceSkewness
267             (
268                 const bool report,
269                 const scalar internalSkew,
270                 const scalar boundarySkew,
271                 const labelList& checkFaces,
272                 labelHashSet* setPtr
273             ) const;
275             bool checkFaceWeights
276             (
277                 const bool report,
278                 const scalar warnWeight,
279                 const labelList& checkFaces,
280                 labelHashSet* setPtr
281             ) const;
283             bool checkFaceAngles
284             (
285                 const bool report,
286                 const scalar maxDeg,
287                 const pointField& p,
288                 const labelList& checkFaces,
289                 labelHashSet* setPtr
290             ) const;
292             //bool checkFaceFlatness
293             //(
294             //    const bool report,
295             //    const scalar warnFlatness,
296             //    const pointField& p,
297             //    const labelList& checkFaces,
298             //    labelHashSet* setPtr
299             //) const;
301             bool checkFaceTwist
302             (
303                 const bool report,
304                 const scalar minTwist,
305                 const pointField& p,
306                 const labelList& checkFaces,
307                 labelHashSet* setPtr
308             ) const;
310             bool checkFaceArea
311             (
312                 const bool report,
313                 const scalar minArea,
314                 const labelList& checkFaces,
315                 labelHashSet* setPtr
316             ) const;
318             bool checkCellDeterminant
319             (
320                 const bool report,
321                 const scalar warnDet,
322                 const labelList& checkFaces,
323                 const labelList& affectedCells,
324                 labelHashSet* setPtr
325             ) const;
328 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330 } // End namespace Foam
332 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
334 #endif
336 // ************************************************************************* //