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

cellFeatures.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::cellFeatures
00027 
00028 Description
00029     Cell analysis class.
00030 
00031     Constructs feature edges and feature points, which are edges/points with
00032     and angle > given specification.
00033     Can be asked for 'superFaces' which can be used to see if a cell is a
00034     'splitHex'.
00035 
00036 SourceFiles
00037     cellFeatures.C
00038 
00039 \*---------------------------------------------------------------------------*/
00040 
00041 #ifndef cellFeatures_H
00042 #define cellFeatures_H
00043 
00044 #include "faceList.H"
00045 #include "labelList.H"
00046 #include "boolList.H"
00047 #include "HashSet.H"
00048 #include "Map.H"
00049 #include "DynamicList.H"
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 // Forward declaration of classes
00057 class primitiveMesh;
00058 
00059 /*---------------------------------------------------------------------------*\
00060                            Class cellFeatures Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 class cellFeatures
00064 {
00065     // Private data
00066 
00067         const primitiveMesh& mesh_;
00068 
00069         //- cos of angle between two connected faces or two connected edges on
00070         //  same face before edge/point is 'feature'.
00071         scalar minCos_;
00072 
00073         label cellI_;
00074 
00075         //- Feature edges
00076         labelHashSet featureEdge_;
00077 
00078         //- (demand driven) Faces after removing internal points&edges
00079         mutable faceList* facesPtr_;
00080 
00081         //- New to old face mapping
00082         mutable List<DynamicList<label> > faceMap_;
00083 
00084 
00085     // Private Member Functions
00086 
00087         bool faceAlignedEdge(const label, const label) const;
00088 
00089         label nextEdge
00090         (
00091             const Map<label>& toSuperFace,
00092             const label superFaceI,
00093             const label thisEdgeI,
00094             const label thisVertI
00095         ) const;
00096 
00097         bool isCellFeatureEdge(const scalar, const label) const;
00098 
00099         void walkSuperFace
00100         (
00101             const label faceI,
00102             const label superFaceI,
00103             Map<label>& toSuperFace
00104         ) const;
00105 
00106         void calcSuperFaces() const;
00107 
00108 
00109         //- Disallow default bitwise copy construct
00110         cellFeatures(const cellFeatures&);
00111 
00112         //- Disallow default bitwise assignment
00113         void operator=(const cellFeatures&);
00114 
00115 public:
00116 
00117     // Constructors
00118 
00119         //- Construct from cell in mesh
00120         cellFeatures
00121         (
00122             const primitiveMesh&,
00123             const scalar minCos,    // angle to use for feature recognition.
00124             const label cellI
00125         );
00126 
00127 
00128     // Destructor
00129 
00130         ~cellFeatures();
00131 
00132 
00133     // Member Functions
00134 
00135         // Access
00136 
00137             const labelHashSet& featureEdge() const
00138             {
00139                 return featureEdge_;
00140             }
00141 
00142             const faceList& faces() const
00143             {
00144                 if (!facesPtr_)
00145                 {
00146                     calcSuperFaces();
00147                 }
00148                 return *facesPtr_;
00149             }
00150 
00151             //- New to old faceMap. Guaranteed to be shrunk.
00152             const List<DynamicList<label> >& faceMap() const
00153             {
00154                 if (!facesPtr_)
00155                 {
00156                     calcSuperFaces();
00157                 }
00158                 return faceMap_;
00159             }
00160 
00161 
00162         // Check
00163 
00164             //- Is edge a feature edge (uniquely determined since on cell
00165             //  only two faces sharing edge)
00166             bool isFeatureEdge(const label edgeI) const
00167             {
00168                 return featureEdge().found(edgeI);
00169             }
00170 
00171             //- Are two edges connected at feature point?
00172             //  Is local to face since point might be seen as feature point
00173             //  from one face but not from another.
00174             bool isFeaturePoint(const label edge0, const label edge1) const;
00175 
00176             //- Is vertexI on faceI used by two edges that form feature
00177             //  point
00178             bool isFeatureVertex(const label faceI, const label vertI) const;
00179 
00180 };
00181 
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 } // End namespace Foam
00186 
00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00188 
00189 #endif
00190 
00191 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd