FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::primitiveMeshGeometry
00026 
00027 Description
00028     Updateable mesh geometry + checking routines.
00029 
00030 SourceFiles
00031     primitiveMeshGeometry.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef primitiveMeshGeometry_H
00036 #define primitiveMeshGeometry_H
00037 
00038 #include <OpenFOAM/pointFields.H>
00039 #include <OpenFOAM/HashSet.H>
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047                            Class primitiveMeshGeometry Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 class primitiveMeshGeometry
00051 {
00052         //- Reference to primitiveMesh.
00053         const primitiveMesh& mesh_;
00054 
00055         //- Uptodate copy of face areas
00056         vectorField faceAreas_;
00057 
00058         //- Uptodate copy of face centres
00059         vectorField faceCentres_;
00060 
00061         //- Uptodate copy of cell centres
00062         vectorField cellCentres_;
00063 
00064         //- Uptodate copy of cell volumes
00065         scalarField cellVolumes_;
00066 
00067 
00068     // Private Member Functions
00069 
00070         //- Update face areas and centres on selected faces.
00071         void updateFaceCentresAndAreas
00072         (
00073             const pointField& p,
00074             const labelList& changedFaces
00075         );
00076 
00077         //- Update cell volumes and centres on selected cells. Requires
00078         //  cells and faces to be consistent set.
00079         void updateCellCentresAndVols
00080         (
00081             const labelList& changedCells,
00082             const labelList& changedFaces
00083         );
00084 
00085 public:
00086 
00087     ClassName("primitiveMeshGeometry");
00088 
00089     // Constructors
00090 
00091         //- Construct from mesh
00092         primitiveMeshGeometry(const primitiveMesh&);
00093 
00094 
00095     // Member Functions
00096 
00097         // Access
00098 
00099             const primitiveMesh& mesh() const
00100             {
00101                 return mesh_;
00102             }
00103 
00104             const vectorField& faceAreas() const
00105             {
00106                 return faceAreas_;
00107             }
00108             const vectorField& faceCentres() const
00109             {
00110                 return faceCentres_;
00111             }
00112             const vectorField& cellCentres() const
00113             {
00114                 return cellCentres_;
00115             }
00116             const scalarField& cellVolumes() const
00117             {
00118                 return cellVolumes_;
00119             }
00120 
00121         // Edit
00122 
00123             //- Take over properties from mesh
00124             void correct();
00125 
00126             //- Recalculate on selected faces. Recalculates cell properties
00127             //  on owner and neighbour of these cells.
00128             void correct
00129             (
00130                 const pointField& p,
00131                 const labelList& changedFaces
00132             );
00133 
00134             //- Helper function: get affected cells from faces
00135             labelList affectedCells(const labelList& changedFaces) const;
00136 
00137 
00138         // Checking of selected faces with supplied geometry (mesh only used for
00139         // topology). Parallel aware.
00140 
00141             static bool checkFaceDotProduct
00142             (
00143                 const bool report,
00144                 const scalar orthWarn,
00145                 const primitiveMesh&,
00146                 const vectorField& cellCentres,
00147                 const vectorField& faceAreas,
00148                 const labelList& checkFaces,
00149                 labelHashSet* setPtr
00150             );
00151 
00152             static bool checkFacePyramids
00153             (
00154                 const bool report,
00155                 const scalar minPyrVol,
00156                 const primitiveMesh&,
00157                 const vectorField& cellCentres,
00158                 const pointField& p,
00159                 const labelList& checkFaces,
00160                 labelHashSet*
00161             );
00162 
00163             static bool checkFaceSkewness
00164             (
00165                 const bool report,
00166                 const scalar internalSkew,
00167                 const scalar boundarySkew,
00168                 const primitiveMesh& mesh,
00169                 const vectorField& cellCentres,
00170                 const vectorField& faceCentres,
00171                 const vectorField& faceAreas,
00172                 const labelList& checkFaces,
00173                 labelHashSet* setPtr
00174             );
00175 
00176             static bool checkFaceWeights
00177             (
00178                 const bool report,
00179                 const scalar warnWeight,
00180                 const primitiveMesh& mesh,
00181                 const vectorField& cellCentres,
00182                 const vectorField& faceCentres,
00183                 const vectorField& faceAreas,
00184                 const labelList& checkFaces,
00185                 labelHashSet* setPtr
00186             );
00187 
00188             static bool checkFaceAngles
00189             (
00190                 const bool report,
00191                 const scalar maxDeg,
00192                 const primitiveMesh& mesh,
00193                 const vectorField& faceAreas,
00194                 const pointField& p,
00195                 const labelList& checkFaces,
00196                 labelHashSet* setPtr
00197             );
00198 
00199             //static bool checkFaceFlatness
00200             //(
00201             //    const bool report,
00202             //    const scalar warnFlatness,
00203             //    const primitiveMesh&,
00204             //    const vectorField& faceAreas,
00205             //    const vectorField& faceCentres,
00206             //    const pointField& p,
00207             //    const labelList& checkFaces,
00208             //    labelHashSet* setPtr
00209             //);
00210 
00211             static bool checkFaceTwist
00212             (
00213                 const bool report,
00214                 const scalar minTwist,
00215                 const primitiveMesh&,
00216                 const vectorField& faceAreas,
00217                 const vectorField& faceCentres,
00218                 const pointField& p,
00219                 const labelList& checkFaces,
00220                 labelHashSet* setPtr
00221             );
00222 
00223             static bool checkFaceArea
00224             (
00225                 const bool report,
00226                 const scalar minArea,
00227                 const primitiveMesh&,
00228                 const vectorField& faceAreas,
00229                 const labelList& checkFaces,
00230                 labelHashSet* setPtr
00231             );
00232 
00233             static bool checkCellDeterminant
00234             (
00235                 const bool report,
00236                 const scalar minDet,
00237                 const primitiveMesh&,
00238                 const vectorField& faceAreas,
00239                 const labelList& checkFaces,
00240                 const labelList& affectedCells,
00241                 labelHashSet* setPtr
00242             );
00243 
00244 
00245         // Checking of selected faces with local geometry. Uses above static
00246         // functions. Parallel aware.
00247 
00248             bool checkFaceDotProduct
00249             (
00250                 const bool report,
00251                 const scalar orthWarn,
00252                 const labelList& checkFaces,
00253                 labelHashSet* setPtr
00254             ) const;
00255 
00256             bool checkFacePyramids
00257             (
00258                 const bool report,
00259                 const scalar minPyrVol,
00260                 const pointField& p,
00261                 const labelList& checkFaces,
00262                 labelHashSet* setPtr
00263             ) const;
00264 
00265             bool checkFaceSkewness
00266             (
00267                 const bool report,
00268                 const scalar internalSkew,
00269                 const scalar boundarySkew,
00270                 const labelList& checkFaces,
00271                 labelHashSet* setPtr
00272             ) const;
00273 
00274             bool checkFaceWeights
00275             (
00276                 const bool report,
00277                 const scalar warnWeight,
00278                 const labelList& checkFaces,
00279                 labelHashSet* setPtr
00280             ) const;
00281 
00282             bool checkFaceAngles
00283             (
00284                 const bool report,
00285                 const scalar maxDeg,
00286                 const pointField& p,
00287                 const labelList& checkFaces,
00288                 labelHashSet* setPtr
00289             ) const;
00290 
00291             //bool checkFaceFlatness
00292             //(
00293             //    const bool report,
00294             //    const scalar warnFlatness,
00295             //    const pointField& p,
00296             //    const labelList& checkFaces,
00297             //    labelHashSet* setPtr
00298             //) const;
00299 
00300             bool checkFaceTwist
00301             (
00302                 const bool report,
00303                 const scalar minTwist,
00304                 const pointField& p,
00305                 const labelList& checkFaces,
00306                 labelHashSet* setPtr
00307             ) const;
00308 
00309             bool checkFaceArea
00310             (
00311                 const bool report,
00312                 const scalar minArea,
00313                 const labelList& checkFaces,
00314                 labelHashSet* setPtr
00315             ) const;
00316 
00317             bool checkCellDeterminant
00318             (
00319                 const bool report,
00320                 const scalar warnDet,
00321                 const labelList& checkFaces,
00322                 const labelList& affectedCells,
00323                 labelHashSet* setPtr
00324             ) const;
00325 };
00326 
00327 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00328 
00329 } // End namespace Foam
00330 
00331 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00332 
00333 #endif
00334 
00335 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines