Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::cellFeatures
28
29Description
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
37SourceFiles
38 cellFeatures.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef Foam_cellFeatures_H
43#define Foam_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
54namespace Foam
55{
56
57// Forward Declarations
58class primitiveMesh;
60/*---------------------------------------------------------------------------*\
61 Class cellFeatures Declaration
62\*---------------------------------------------------------------------------*/
63
64class 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 std::unique_ptr<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
116public:
117
118 // Constructors
119
120 //- Construct from cell in mesh
121 cellFeatures
122 (
123 const primitiveMesh&,
124 const scalar minCos, // angle to use for feature recognition.
125 const label celli
126 );
127
128
129 //- Destructor
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_;
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// ************************************************************************* //
bool found(const Key &key) const
Same as contains().
Definition HashTable.H:1370
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A HashTable to objects of type <T> with a label key.
Definition Map.H:54
bool isFeaturePoint(const label edge0, const label edge1) const
Are two edges connected at feature point?
bool isFeatureVertex(const label facei, const label vertI) const
Is vertexI on facei used by two edges that form feature.
bool isFeatureEdge(const label edgeI) const
Is edge a feature edge (uniquely determined since on cell.
const List< DynamicList< label > > & faceMap() const
New to old faceMap. Guaranteed to be shrunk.
~cellFeatures()
Destructor.
const faceList & faces() const
const labelHashSet & featureEdge() const
Cell-face mesh analysis engine.
Namespace for OpenFOAM.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
List< face > faceList
List of faces.
Definition faceListFwd.H:41