initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / cellFeatures / cellFeatures.H
blobc2f3b8f90fb410cd7c94c037c4c1a8bdda1504d6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::cellFeatures
28 Description
29     Cell analysis class.
31     Constructs feature edges and feature points, which are edges/points with
32     and angle > given specification.
33     Can be asked for 'superFaces' which can be used to see if a cell is a
34     'splitHex'.
36 SourceFiles
37     cellFeatures.C
39 \*---------------------------------------------------------------------------*/
41 #ifndef cellFeatures_H
42 #define cellFeatures_H
44 #include "faceList.H"
45 #include "labelList.H"
46 #include "boolList.H"
47 #include "HashSet.H"
48 #include "Map.H"
49 #include "DynamicList.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 // Forward declaration of classes
57 class primitiveMesh;
59 /*---------------------------------------------------------------------------*\
60                            Class cellFeatures Declaration
61 \*---------------------------------------------------------------------------*/
63 class cellFeatures
65     // Private data
67         const primitiveMesh& mesh_;
69         //- cos of angle between two connected faces or two connected edges on
70         //  same face before edge/point is 'feature'.
71         scalar minCos_;
73         label cellI_;
75         //- Feature edges
76         labelHashSet featureEdge_;
78         //- (demand driven) Faces after removing internal points&edges
79         mutable faceList* facesPtr_;
81         //- New to old face mapping
82         mutable List<DynamicList<label> > faceMap_;
85     // Private Member Functions
87         bool faceAlignedEdge(const label, const label) const;
89         label nextEdge
90         (
91             const Map<label>& toSuperFace,
92             const label superFaceI,
93             const label thisEdgeI,
94             const label thisVertI
95         ) const;
97         bool isCellFeatureEdge(const scalar, const label) const;
99         void walkSuperFace
100         (
101             const label faceI,
102             const label superFaceI,
103             Map<label>& toSuperFace
104         ) const;
106         void calcSuperFaces() const;
109         //- Disallow default bitwise copy construct
110         cellFeatures(const cellFeatures&);
112         //- Disallow default bitwise assignment
113         void operator=(const cellFeatures&);
115 public:
117     // Constructors
119         //- Construct from cell in mesh
120         cellFeatures
121         (
122             const primitiveMesh&,
123             const scalar minCos,    // angle to use for feature recognition.
124             const label cellI
125         );
128     // Destructor
130         ~cellFeatures();
133     // Member Functions
135         // Access
137             const labelHashSet& featureEdge() const
138             {
139                 return featureEdge_;
140             }
142             const faceList& faces() const
143             {
144                 if (!facesPtr_)
145                 {
146                     calcSuperFaces();
147                 }
148                 return *facesPtr_;
149             }
151             //- New to old faceMap. Guaranteed to be shrunk.
152             const List<DynamicList<label> >& faceMap() const
153             {
154                 if (!facesPtr_)
155                 {
156                     calcSuperFaces();
157                 }
158                 return faceMap_;
159             }
162         // Check
164             //- Is edge a feature edge (uniquely determined since on cell
165             //  only two faces sharing edge)
166             bool isFeatureEdge(const label edgeI) const
167             {
168                 return featureEdge().found(edgeI);
169             }
171             //- Are two edges connected at feature point?
172             //  Is local to face since point might be seen as feature point
173             //  from one face but not from another.
174             bool isFeaturePoint(const label edge0, const label edge1) const;
176             //- Is vertexI on faceI used by two edges that form feature
177             //  point
178             bool isFeatureVertex(const label faceI, const label vertI) const;
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 #endif
191 // ************************************************************************* //