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 | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::cellFeatures
26 
27 Description
28  Cell analysis class.
29 
30  Constructs feature edges and feature points, which are edges/points with
31  and angle > given specification.
32  Can be asked for 'superFaces' which can be used to see if a cell is a
33  'splitHex'.
34 
35 SourceFiles
36  cellFeatures.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef cellFeatures_H
41 #define cellFeatures_H
42 
43 #include "faceList.H"
44 #include "labelList.H"
45 #include "boolList.H"
46 #include "HashSet.H"
47 #include "Map.H"
48 #include "DynamicList.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 class primitiveMesh;
57 
58 /*---------------------------------------------------------------------------*\
59  Class cellFeatures Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class cellFeatures
63 {
64  // Private data
65 
66  const primitiveMesh& mesh_;
67 
68  //- Cos of angle between two connected faces or two connected edges on
69  // same face before edge/point is 'feature'.
70  scalar minCos_;
71 
72  label cellI_;
73 
74  //- Feature edges
76 
77  //- (demand driven) Faces after removing internal points&edges
78  mutable faceList* facesPtr_;
79 
80  //- New to old face mapping
82 
83 
84  // Private Member Functions
85 
86  bool faceAlignedEdge(const label, const label) const;
87 
89  (
90  const Map<label>& toSuperFace,
91  const label superFaceI,
92  const label thisEdgeI,
93  const label thisVertI
94  ) const;
95 
96  bool isCellFeatureEdge(const scalar, const label) const;
97 
98  void walkSuperFace
99  (
100  const label faceI,
101  const label superFaceI,
102  Map<label>& toSuperFace
103  ) const;
104 
105  void calcSuperFaces() const;
106 
107 
108  //- Disallow default bitwise copy construct
109  cellFeatures(const cellFeatures&);
110 
111  //- Disallow default bitwise assignment
112  void operator=(const cellFeatures&);
113 
114 public:
115 
116  // Constructors
117 
118  //- Construct from cell in mesh
120  (
121  const primitiveMesh&,
122  const scalar minCos, // angle to use for feature recognition.
123  const label cellI
124  );
125 
126 
127  //- Destructor
128  ~cellFeatures();
129 
130 
131  // Member Functions
132 
133  // Access
134 
135  const labelHashSet& featureEdge() const
136  {
137  return featureEdge_;
138  }
139 
140  const faceList& faces() const
141  {
142  if (!facesPtr_)
143  {
144  calcSuperFaces();
145  }
146  return *facesPtr_;
147  }
148 
149  //- New to old faceMap. Guaranteed to be shrunk.
150  const List<DynamicList<label> >& faceMap() const
151  {
152  if (!facesPtr_)
153  {
154  calcSuperFaces();
155  }
156  return faceMap_;
157  }
158 
159 
160  // Check
161 
162  //- Is edge a feature edge (uniquely determined since on cell
163  // only two faces sharing edge)
164  bool isFeatureEdge(const label edgeI) const
165  {
166  return featureEdge().found(edgeI);
167  }
168 
169  //- Are two edges connected at feature point?
170  // Is local to face since point might be seen as feature point
171  // from one face but not from another.
172  bool isFeaturePoint(const label edge0, const label edge1) const;
173 
174  //- Is vertexI on faceI used by two edges that form feature
175  // point
176  bool isFeatureVertex(const label faceI, const label vertI) const;
177 
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
Foam::cellFeatures::mesh_
const primitiveMesh & mesh_
Definition: cellFeatures.H:65
boolList.H
Foam::cellFeatures::operator=
void operator=(const cellFeatures &)
Disallow default bitwise assignment.
Foam::cellFeatures::featureEdge
const labelHashSet & featureEdge() const
Definition: cellFeatures.H:134
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:149
Foam::HashSet< label, Hash< label > >
Map.H
Foam::cellFeatures::~cellFeatures
~cellFeatures()
Destructor.
Definition: cellFeatures.C:406
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
labelList.H
Foam::cellFeatures::faces
const faceList & faces() const
Definition: cellFeatures.H:139
Foam::cellFeatures::walkSuperFace
void walkSuperFace(const label faceI, const label superFaceI, Map< label > &toSuperFace) const
Definition: cellFeatures.C:180
Foam::cellFeatures::featureEdge_
labelHashSet featureEdge_
Feature edges.
Definition: cellFeatures.H:74
Foam::cellFeatures::isFeatureEdge
bool isFeatureEdge(const label edgeI) const
Is edge a feature edge (uniquely determined since on cell.
Definition: cellFeatures.H:163
HashSet.H
Foam::cellFeatures::isCellFeatureEdge
bool isCellFeatureEdge(const scalar, const label) const
Definition: cellFeatures.C:114
Foam::cellFeatures
Cell analysis class.
Definition: cellFeatures.H:61
Foam::HashTable::found
bool found(const Key &) const
Return true if hashedEntry is found in table.
Definition: HashTable.C:109
Foam::cellFeatures::nextEdge
label nextEdge(const Map< label > &toSuperFace, const label superFaceI, const label thisEdgeI, const label thisVertI) const
Definition: cellFeatures.C:67
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::cellFeatures::cellI_
label cellI_
Definition: cellFeatures.H:71
Foam::cellFeatures::facesPtr_
faceList * facesPtr_
(demand driven) Faces after removing internal points&edges
Definition: cellFeatures.H:77
Foam::cellFeatures::faceMap_
List< DynamicList< label > > faceMap_
New to old face mapping.
Definition: cellFeatures.H:80
Foam::cellFeatures::minCos_
scalar minCos_
Cos of angle between two connected faces or two connected edges on.
Definition: cellFeatures.H:69
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::cellFeatures::faceAlignedEdge
bool faceAlignedEdge(const label, const label) const
Definition: cellFeatures.C:39
Foam::cellFeatures::calcSuperFaces
void calcSuperFaces() const
Definition: cellFeatures.C:219
DynamicList.H
Foam::cellFeatures::isFeaturePoint
bool isFeaturePoint(const label edge0, const label edge1) const
Are two edges connected at feature point?
Definition: cellFeatures.C:414
Foam::cellFeatures::cellFeatures
cellFeatures(const cellFeatures &)
Disallow default bitwise copy construct.
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:481
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:79