OpenFOAM logo
Open Source CFD Toolkit

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