OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

primitiveMeshGeometry.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::primitiveMeshGeometry
00027 
00028 Description
00029     Updateable mesh geometry + checking routines.
00030 
00031 SourceFiles
00032     primitiveMeshGeometry.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef primitiveMeshGeometry_H
00037 #define primitiveMeshGeometry_H
00038 
00039 #include "pointFields.H"
00040 #include "HashSet.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                            Class primitiveMeshGeometry Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 class primitiveMeshGeometry
00052 {
00053         //- Reference to primitiveMesh.
00054         const primitiveMesh& mesh_;
00055 
00056         //- Uptodate copy of face areas
00057         vectorField faceAreas_;
00058 
00059         //- Uptodate copy of face centres
00060         vectorField faceCentres_;
00061 
00062         //- Uptodate copy of cell centres
00063         vectorField cellCentres_;
00064 
00065         //- Uptodate copy of cell volumes
00066         scalarField cellVolumes_;
00067 
00068 
00069     // Private Member Functions
00070 
00071         //- Update face areas and centres on selected faces.
00072         void updateFaceCentresAndAreas
00073         (
00074             const pointField& p,
00075             const labelList& changedFaces
00076         );
00077 
00078         //- Update cell volumes and centres on selected cells. Requires
00079         //  cells and faces to be consistent set.
00080         void updateCellCentresAndVols
00081         (
00082             const labelList& changedCells,
00083             const labelList& changedFaces
00084         );
00085 
00086 public:
00087 
00088     ClassName("primitiveMeshGeometry");
00089 
00090     // Constructors
00091 
00092         //- Construct from mesh
00093         primitiveMeshGeometry(const primitiveMesh&);
00094 
00095 
00096     // Member Functions
00097 
00098         // Access
00099 
00100             const primitiveMesh& mesh() const
00101             {
00102                 return mesh_;
00103             }
00104 
00105             const vectorField& faceAreas() const
00106             {
00107                 return faceAreas_;
00108             }
00109             const vectorField& faceCentres() const
00110             {
00111                 return faceCentres_;
00112             }
00113             const vectorField& cellCentres() const
00114             {
00115                 return cellCentres_;
00116             }
00117             const scalarField& cellVolumes() const
00118             {
00119                 return cellVolumes_;
00120             }
00121 
00122         // Edit
00123 
00124             //- Take over properties from mesh
00125             void correct();
00126 
00127             //- Recalculate on selected faces. Recalculates cell properties
00128             //  on owner and neighbour of these cells.
00129             void correct
00130             (
00131                 const pointField& p,
00132                 const labelList& changedFaces
00133             );
00134 
00135             //- Helper function: get affected cells from faces
00136             labelList affectedCells(const labelList& changedFaces) const;
00137 
00138 
00139         // Checking of selected faces with supplied geometry (mesh only used for
00140         // topology). Parallel aware.
00141 
00142             static bool checkFaceDotProduct
00143             (
00144                 const bool report,
00145                 const scalar orthWarn,
00146                 const primitiveMesh&,
00147                 const vectorField& cellCentres,
00148                 const vectorField& faceAreas,
00149                 const labelList& checkFaces,
00150                 labelHashSet* setPtr
00151             );
00152 
00153             static bool checkFacePyramids
00154             (
00155                 const bool report,
00156                 const scalar minPyrVol,
00157                 const primitiveMesh&,
00158                 const vectorField& cellCentres,
00159                 const pointField& p,
00160                 const labelList& checkFaces,
00161                 labelHashSet*
00162             );
00163 
00164             static bool checkFaceSkewness
00165             (
00166                 const bool report,
00167                 const scalar internalSkew,
00168                 const scalar boundarySkew,
00169                 const primitiveMesh& mesh,
00170                 const vectorField& cellCentres,
00171                 const vectorField& faceCentres,
00172                 const vectorField& faceAreas,
00173                 const labelList& checkFaces,
00174                 labelHashSet* setPtr
00175             );
00176 
00177             static bool checkFaceWeights
00178             (
00179                 const bool report,
00180                 const scalar warnWeight,
00181                 const primitiveMesh& mesh,
00182                 const vectorField& cellCentres,
00183                 const vectorField& faceCentres,
00184                 const vectorField& faceAreas,
00185                 const labelList& checkFaces,
00186                 labelHashSet* setPtr
00187             );
00188 
00189             static bool checkFaceAngles
00190             (
00191                 const bool report,
00192                 const scalar maxDeg,
00193                 const primitiveMesh& mesh,
00194                 const vectorField& faceAreas,
00195                 const pointField& p,
00196                 const labelList& checkFaces,
00197                 labelHashSet* setPtr
00198             );
00199 
00200             //static bool checkFaceFlatness
00201             //(
00202             //    const bool report,
00203             //    const scalar warnFlatness,
00204             //    const primitiveMesh&,
00205             //    const vectorField& faceAreas,
00206             //    const vectorField& faceCentres,
00207             //    const pointField& p,
00208             //    const labelList& checkFaces,
00209             //    labelHashSet* setPtr
00210             //);
00211 
00212             static bool checkFaceTwist
00213             (
00214                 const bool report,
00215                 const scalar minTwist,
00216                 const primitiveMesh&,
00217                 const vectorField& faceAreas,
00218                 const vectorField& faceCentres,
00219                 const pointField& p,
00220                 const labelList& checkFaces,
00221                 labelHashSet* setPtr
00222             );
00223 
00224             static bool checkFaceArea
00225             (
00226                 const bool report,
00227                 const scalar minArea,
00228                 const primitiveMesh&,
00229                 const vectorField& faceAreas,
00230                 const labelList& checkFaces,
00231                 labelHashSet* setPtr
00232             );
00233 
00234             static bool checkCellDeterminant
00235             (
00236                 const bool report,
00237                 const scalar minDet,
00238                 const primitiveMesh&,
00239                 const vectorField& faceAreas,
00240                 const labelList& checkFaces,
00241                 const labelList& affectedCells,
00242                 labelHashSet* setPtr
00243             );
00244 
00245 
00246         // Checking of selected faces with local geometry. Uses above static
00247         // functions. Parallel aware.
00248 
00249             bool checkFaceDotProduct
00250             (
00251                 const bool report,
00252                 const scalar orthWarn,
00253                 const labelList& checkFaces,
00254                 labelHashSet* setPtr
00255             ) const;
00256 
00257             bool checkFacePyramids
00258             (
00259                 const bool report,
00260                 const scalar minPyrVol,
00261                 const pointField& p,
00262                 const labelList& checkFaces,
00263                 labelHashSet* setPtr
00264             ) const;
00265 
00266             bool checkFaceSkewness
00267             (
00268                 const bool report,
00269                 const scalar internalSkew,
00270                 const scalar boundarySkew,
00271                 const labelList& checkFaces,
00272                 labelHashSet* setPtr
00273             ) const;
00274 
00275             bool checkFaceWeights
00276             (
00277                 const bool report,
00278                 const scalar warnWeight,
00279                 const labelList& checkFaces,
00280                 labelHashSet* setPtr
00281             ) const;
00282 
00283             bool checkFaceAngles
00284             (
00285                 const bool report,
00286                 const scalar maxDeg,
00287                 const pointField& p,
00288                 const labelList& checkFaces,
00289                 labelHashSet* setPtr
00290             ) const;
00291 
00292             //bool checkFaceFlatness
00293             //(
00294             //    const bool report,
00295             //    const scalar warnFlatness,
00296             //    const pointField& p,
00297             //    const labelList& checkFaces,
00298             //    labelHashSet* setPtr
00299             //) const;
00300 
00301             bool checkFaceTwist
00302             (
00303                 const bool report,
00304                 const scalar minTwist,
00305                 const pointField& p,
00306                 const labelList& checkFaces,
00307                 labelHashSet* setPtr
00308             ) const;
00309 
00310             bool checkFaceArea
00311             (
00312                 const bool report,
00313                 const scalar minArea,
00314                 const labelList& checkFaces,
00315                 labelHashSet* setPtr
00316             ) const;
00317 
00318             bool checkCellDeterminant
00319             (
00320                 const bool report,
00321                 const scalar warnDet,
00322                 const labelList& checkFaces,
00323                 const labelList& affectedCells,
00324                 labelHashSet* setPtr
00325             ) const;
00326 };
00327 
00328 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00329 
00330 } // End namespace Foam
00331 
00332 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00333 
00334 #endif
00335 
00336 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd