topoCellLooper.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::topoCellLooper
26 
27 Description
28  Implementation of cellLooper. This one recognizes 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  // inbetween 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  //- Disallow default bitwise copy construct
149 
150  //- Disallow default bitwise assignment
151  void operator=(const topoCellLooper&);
152 
153 
154 public:
155 
156  //- Runtime type information
157  TypeName("topoCellLooper");
158 
159  // Static data members
160 
161  //- Cos of angle for feature recognition (of splitHexes)
162  static const scalar featureCos;
163 
164 
165  // Constructors
166 
167  //- Construct from components
168  topoCellLooper(const polyMesh& mesh);
169 
170 
171  //- Destructor
172  virtual ~topoCellLooper();
173 
174 
175  // Member Functions
176 
177  //- Create cut along circumference of cellI. Gets current mesh cuts.
178  // Cut along circumference is expressed as loop of cuts plus weights
179  // for cuts along edges (only valid for edge cuts).
180  // Return true if successful cut.
181  virtual bool cut
182  (
183  const vector& refDir,
184  const label cellI,
185  const boolList& vertIsCut,
186  const boolList& edgeIsCut,
187  const scalarField& edgeWeight,
188 
189  labelList& loop,
190  scalarField& loopWeights
191  ) const;
192 
193  //- Same but now also base point of cut provided (instead of always
194  // cell centre)
195  virtual bool cut
196  (
197  const plane& cutPlane,
198  const label cellI,
199  const boolList& vertIsCut,
200  const boolList& edgeIsCut,
201  const scalarField& edgeWeight,
202 
203  labelList& loop,
204  scalarField& loopWeights
205  ) const;
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
Cell analysis class.
Definition: cellFeatures.H:61
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.
Namespace for OpenFOAM.
Implementation of cellLooper.
Definition: hexCellLooper.H:60
static const scalar featureCos
Cos of angle for feature recognition (of splitHexes)
TypeName("topoCellLooper")
Runtime type information.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
Implementation of cellLooper. This one recognizes splitHexes and tries to make a cut such that if the...
const polyMesh & mesh() const
Definition: edgeVertex.H:98
virtual ~topoCellLooper()
Destructor.