topoCellLooper.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2021 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::topoCellLooper
26 
27 Description
28  Implementation of cellLooper. This one recognises splitHexes and tries
29  to make a cut such that if the neighbour was split (in a previous iteration)
30  this one also gets split in the same direction so that the result
31  will be a mesh without splitHexes.
32 
33  'splitHexes' are cells of which the 'featureEdges'
34  (see cellFeatures class) form a hex. The remaining non-feature edges
35  are assumed to result from splitting the neighbour and this class tries
36  to start from one of these and cut through to an opposite edge.
37 
38  The current set of cuts (vertIsCut, edgeIsCut, edgeWeight) are not being
39  used by this implementation.
40 
41  All non-splitHexes are done by the parent classes.
42 
43 
44 SourceFiles
45  topoCellLooper.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef topoCellLooper_H
50 #define topoCellLooper_H
51 
52 #include "hexCellLooper.H"
53 #include "typeInfo.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 // Forward declaration of classes
61 class cellFeatures;
62 
63 /*---------------------------------------------------------------------------*\
64  Class topoCellLooper Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class topoCellLooper
68 :
69  public hexCellLooper
70 {
71 
72  // Private Member Functions
73 
74  //- In-memory truncate a list
75  template<class T>
76  static void subsetList
77  (
78  const label startI,
79  const label freeI,
80  DynamicList<T>& lst
81  );
82 
83  //- Walk across superface discarding non-feature points.
84  void walkFace
85  (
86  const cellFeatures& features,
87  const label facei,
88  const label startEdgeI,
89  const label startVertI,
90  const label nFeaturePts,
91 
92  label& edgeI,
93  label& vertI
94  ) const;
95 
96  //- Returns list of vertices on 'superEdge' i.e. list of edges connected
97  // by non-feature points. First and last are feature points, ones
98  // in between are not.
99  labelList getSuperEdge
100  (
101  const cellFeatures& features,
102  const label facei,
103  const label startEdgeI,
104  const label startVertI
105  ) const;
106 
107  // Return non-feature edge from cells' edges that is most
108  // perpendicular to refinement direction. Used as starting edge.
109  label getAlignedNonFeatureEdge
110  (
111  const vector& refDir,
112  const label celli,
113  const cellFeatures& features
114  ) const;
115 
116  //- Starts from edge and vertex on edge on face (or neighbouring face)
117  // and steps either to existing vertex (vertI != -1) or to edge
118  // (vertI == -1)
119  // by walking point-edge and crossing nFeats featurePoints.
120  void walkAcrossFace
121  (
122  const cellFeatures& features,
123  const label facei,
124  const label startEdgeI,
125  const label startVertI,
126  const label nFeats,
127 
128  label& edgeI,
129  label& vertI
130  ) const;
131 
132  //- Walks splitcell circumference. Sets loop/loopweights to walk on
133  // outside of cell.
134  void walkSplitHex
135  (
136  const label celli,
137  const cellFeatures& features,
138  const label fromFacei,
139  const label fromEdgeI,
140  const label fromVertI,
141 
142  DynamicList<label>& loop,
143  DynamicList<scalar>& loopWeights
144  ) const;
145 
146 
147 public:
148 
149  //- Runtime type information
150  TypeName("topoCellLooper");
151 
152  // Static Data Members
153 
154  //- Cos of angle for feature recognition (of splitHexes)
155  static const scalar featureCos;
156 
157 
158  // Constructors
159 
160  //- Construct from components
161  topoCellLooper(const polyMesh& mesh);
162 
163  //- Disallow default bitwise copy construction
164  topoCellLooper(const topoCellLooper&) = delete;
165 
166 
167  //- Destructor
168  virtual ~topoCellLooper();
169 
170 
171  // Member Functions
172 
173  //- Create cut along circumference of celli. Gets current mesh cuts.
174  // Cut along circumference is expressed as loop of cuts plus weights
175  // for cuts along edges (only valid for edge cuts).
176  // Return true if successful cut.
177  virtual bool cut
178  (
179  const vector& refDir,
180  const label celli,
181  const boolList& vertIsCut,
182  const boolList& edgeIsCut,
183  const scalarField& edgeWeight,
184 
185  labelList& loop,
186  scalarField& loopWeights
187  ) const;
188 
189  //- Same but now also base point of cut provided (instead of always
190  // cell centre)
191  virtual bool cut
192  (
193  const plane& cutPlane,
194  const label celli,
195  const boolList& vertIsCut,
196  const boolList& edgeIsCut,
197  const scalarField& edgeWeight,
198 
199  labelList& loop,
200  scalarField& loopWeights
201  ) const;
202 
203 
204  // Member Operators
205 
206  //- Disallow default bitwise assignment
207  void operator=(const topoCellLooper&) = delete;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
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
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const
Create cut along circumference of celli. Gets current mesh cuts.
virtual ~topoCellLooper()
Destructor.
topoCellLooper(const polyMesh &mesh)
Construct from components.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
static const scalar featureCos
Cos of angle for feature recognition (of splitHexes)
void operator=(const topoCellLooper &)=delete
Disallow default bitwise assignment.
const polyMesh & mesh() const
Definition: edgeVertex.H:93
Implementation of cellLooper.
Definition: hexCellLooper.H:60
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Cell analysis class.
Definition: cellFeatures.H:61
Implementation of cellLooper. This one recognises splitHexes and tries to make a cut such that if the...
TypeName("topoCellLooper")
Runtime type information.
Namespace for OpenFOAM.