cellFeatures.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::cellFeatures
28 
29 Description
30  Cell analysis class.
31 
32  Constructs feature edges and feature points, which are edges/points with
33  and angle > given specification.
34  Can be asked for 'superFaces' which can be used to see if a cell is a
35  'splitHex'.
36 
37 SourceFiles
38  cellFeatures.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef cellFeatures_H
43 #define cellFeatures_H
44 
45 #include "faceList.H"
46 #include "labelList.H"
47 #include "boolList.H"
48 #include "HashSet.H"
49 #include "Map.H"
50 #include "DynamicList.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class primitiveMesh;
59 
60 /*---------------------------------------------------------------------------*\
61  Class cellFeatures Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class cellFeatures
65 {
66  // Private data
67 
68  const primitiveMesh& mesh_;
69 
70  //- Cos of angle between two connected faces or two connected edges on
71  // same face before edge/point is 'feature'.
72  scalar minCos_;
73 
74  label celli_;
75 
76  //- Feature edges
77  labelHashSet featureEdge_;
78 
79  //- (demand driven) Faces after removing internal points&edges
80  mutable faceList* facesPtr_;
81 
82  //- New to old face mapping
83  mutable List<DynamicList<label>> faceMap_;
84 
85 
86  // Private Member Functions
87 
88  bool faceAlignedEdge(const label, const label) const;
89 
90  label nextEdge
91  (
92  const Map<label>& toSuperFace,
93  const label superFacei,
94  const label thisEdgeI,
95  const label thisVertI
96  ) const;
97 
98  bool isCellFeatureEdge(const scalar, const label) const;
99 
100  void walkSuperFace
101  (
102  const label facei,
103  const label superFacei,
104  Map<label>& toSuperFace
105  ) const;
106 
107  void calcSuperFaces() const;
108 
109 
110  //- No copy construct
111  cellFeatures(const cellFeatures&) = delete;
112 
113  //- No copy assignment
114  void operator=(const cellFeatures&) = delete;
115 
116 public:
117 
118  // Constructors
119 
120  //- Construct from cell in mesh
122  (
123  const primitiveMesh&,
124  const scalar minCos, // angle to use for feature recognition.
125  const label celli
126  );
127 
128 
129  //- Destructor
130  ~cellFeatures();
131 
132 
133  // Member Functions
134 
135  // Access
136 
137  const labelHashSet& featureEdge() const
138  {
139  return featureEdge_;
140  }
141 
142  const faceList& faces() const
143  {
144  if (!facesPtr_)
145  {
146  calcSuperFaces();
147  }
148  return *facesPtr_;
149  }
150 
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  }
160 
161 
162  // Check
163 
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  }
170 
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;
175 
176  //- Is vertexI on facei used by two edges that form feature
177  // point
178  bool isFeatureVertex(const label facei, const label vertI) const;
179 
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
boolList.H
Foam::cellFeatures::featureEdge
const labelHashSet & featureEdge() const
Definition: cellFeatures.H:136
Foam::Map< label >
faceList.H
Foam::cellFeatures::faceMap
const List< DynamicList< label > > & faceMap() const
New to old faceMap. Guaranteed to be shrunk.
Definition: cellFeatures.H:151
Foam::HashSet< label, Hash< label > >
Map.H
Foam::cellFeatures::~cellFeatures
~cellFeatures()
Destructor.
Definition: cellFeatures.C:399
labelList.H
Foam::cellFeatures::faces
const faceList & faces() const
Definition: cellFeatures.H:141
Foam::cellFeatures::isFeatureEdge
bool isFeatureEdge(const label edgeI) const
Is edge a feature edge (uniquely determined since on cell.
Definition: cellFeatures.H:165
HashSet.H
Foam::cellFeatures
Cell analysis class.
Definition: cellFeatures.H:63
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::cellFeatures::isFeatureVertex
bool isFeatureVertex(const label facei, const label vertI) const
Is vertexI on facei used by two edges that form feature.
Definition: cellFeatures.C:471
DynamicList.H
Foam::cellFeatures::isFeaturePoint
bool isFeaturePoint(const label edge0, const label edge1) const
Are two edges connected at feature point?
Definition: cellFeatures.C:407
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78