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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::topoCellLooper
29
30Description
31 Implementation of cellLooper. This one recognizes splitHexes and tries
32 to make a cut such that if the neighbour was split (in a previous iteration)
33 this one also gets split in the same direction so that the result
34 will be a mesh without splitHexes.
35
36 'splitHexes' are cells of which the 'featureEdges'
37 (see cellFeatures class) form a hex. The remaining non-feature edges
38 are assumed to result from splitting the neighbour and this class tries
39 to start from one of these and cut through to an opposite edge.
40
41 The current set of cuts (vertIsCut, edgeIsCut, edgeWeight) are not being
42 used by this implementation.
43
44 All non-splitHexes are done by the parent classes.
45
46
47SourceFiles
48 topoCellLooper.C
49
50\*---------------------------------------------------------------------------*/
51
52#ifndef topoCellLooper_H
53#define topoCellLooper_H
54
55#include "hexCellLooper.H"
56#include "typeInfo.H"
57
58// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
60namespace Foam
61{
62
63// Forward Declarations
64class cellFeatures;
65
66/*---------------------------------------------------------------------------*\
67 Class topoCellLooper Declaration
68\*---------------------------------------------------------------------------*/
71:
72 public hexCellLooper
73{
74 // Private Member Functions
75
76 //- In-memory truncate a list
77 template<class T>
78 static void subsetList
79 (
80 const label startI,
81 const label freeI,
83 );
84
85 //- Walk across superface discarding non-feature points.
86 void walkFace
87 (
88 const cellFeatures& features,
89 const label facei,
90 const label startEdgeI,
91 const label startVertI,
92 const label nFeaturePts,
93
94 label& edgeI,
95 label& vertI
96 ) const;
97
98 //- Returns list of vertices on 'superEdge' i.e. list of edges connected
99 // by non-feature points. First and last are feature points, ones
100 // inbetween are not.
101 labelList getSuperEdge
102 (
103 const cellFeatures& features,
104 const label facei,
105 const label startEdgeI,
106 const label startVertI
107 ) const;
108
109 // Return non-feature edge from cells' edges that is most
110 // perpendicular to refinement direction. Used as starting edge.
111 label getAlignedNonFeatureEdge
112 (
113 const vector& refDir,
114 const label celli,
115 const cellFeatures& features
116 ) const;
117
118 //- Starts from edge and vertex on edge on face (or neighbouring face)
119 // and steps either to existing vertex (vertI != -1) or to edge
120 // (vertI == -1)
121 // by walking point-edge and crossing nFeats featurePoints.
122 void walkAcrossFace
123 (
124 const cellFeatures& features,
125 const label facei,
126 const label startEdgeI,
127 const label startVertI,
128 const label nFeats,
129
130 label& edgeI,
131 label& vertI
132 ) const;
133
134 //- Walks splitcell circumference. Sets loop/loopweights to walk on
135 // outside of cell.
136 void walkSplitHex
137 (
138 const label celli,
139 const cellFeatures& features,
140 const label fromFacei,
141 const label fromEdgeI,
142 const label fromVertI,
143
144 DynamicList<label>& loop,
145 DynamicList<scalar>& loopWeights
146 ) const;
147
148
149 //- No copy construct
150 topoCellLooper(const topoCellLooper&) = delete;
151
152 //- No copy assignment
153 void operator=(const topoCellLooper&) = delete;
154
155
156public:
157
158 //- Runtime type information
159 TypeName("topoCellLooper");
160
161 // Static data members
162
163 //- Cos of angle for feature recognition (of splitHexes)
164 static const scalar featureCos;
165
166
167 // Constructors
168
169 //- Construct from mesh
170 explicit topoCellLooper(const polyMesh& mesh);
171
172
173 //- Destructor
174 virtual ~topoCellLooper() = default;
175
176
177 // Member Functions
178
179 //- Create cut along circumference of celli. Gets current mesh cuts.
180 // Cut along circumference is expressed as loop of cuts plus weights
181 // for cuts along edges (only valid for edge cuts).
182 // Return true if successful cut.
183 virtual bool cut
184 (
185 const vector& refDir,
186 const label celli,
187 const boolList& vertIsCut,
188 const boolList& edgeIsCut,
189 const scalarField& edgeWeight,
190
191 labelList& loop,
192 scalarField& loopWeights
193 ) const;
194
195 //- Same but now also base point of cut provided (instead of always
196 // cell centre)
197 virtual bool cut
198 (
199 const plane& cutPlane,
200 const label celli,
201 const boolList& vertIsCut,
202 const boolList& edgeIsCut,
203 const scalarField& edgeWeight,
204
205 labelList& loop,
206 scalarField& loopWeights
207 ) const;
208};
209
210
211// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212
213} // End namespace Foam
214
215// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216
217#endif
218
219// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
Cell analysis class.
Definition: cellFeatures.H:64
Implementation of cellLooper.
Definition: hexCellLooper.H:65
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Definition: plane.H:95
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Patchify triangles based on orientation w.r.t other (triangulated or triangulatable) surfaces.
Implementation of cellLooper. This one recognizes splitHexes and tries to make a cut such that if the...
TypeName("topoCellLooper")
Runtime type information.
static const scalar featureCos
Cos of angle for feature recognition (of splitHexes)
virtual ~topoCellLooper()=default
Destructor.
dynamicFvMesh & mesh
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73