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

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