meshCutAndRemove.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::meshCutAndRemove
29
30Description
31 Like meshCutter but also removes non-anchor side of cell.
32
33SourceFiles
34 meshCutAndRemove.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef meshCutAndRemove_H
39#define meshCutAndRemove_H
40
41#include "edgeVertex.H"
42#include "boolList.H"
43#include "labelList.H"
44#include "typeInfo.H"
45#include "Map.H"
46#include "edgeHashes.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53// Forward Declarations
54class Time;
55class polyTopoChange;
56class cellCuts;
57class polyMesh;
58class face;
59class mapPolyMesh;
60
61/*---------------------------------------------------------------------------*\
62 Class meshCutAndRemove Declaration
63\*---------------------------------------------------------------------------*/
66:
67 public edgeVertex
68{
69 // Private Data
70
71 //- Faces added in last setRefinement.
72 // Per split cell label of added face
73 Map<label> addedFaces_;
74
75 //- Points added in last setRefinement.
76 // Per split edge label of added point
77 EdgeMap<label> addedPoints_;
78
79
80 // Private Static Functions
81
82 // Returns -1 or index in elems1 of first shared element.
83 static label firstCommon(const labelList& lst1, const labelList& lst2);
84
85 //- Do the elements of edge appear in consecutive order in the list
86 static bool isIn(const edge&, const labelList&);
87
88
89 // Private Member Functions
90
91 //- Returns -1 or the cell in cellLabels that is cut.
92 label findCutCell(const cellCuts&, const labelList&) const;
93
94 //- Returns first pointi in pointLabels that uses an internal
95 // face. Used to find point to inflate cell/face from (has to be
96 // connected to internal face)
97 label findInternalFacePoint(const labelList& pointLabels) const;
98
99 //- Find point on face that is part of original mesh and that is
100 // point connected to the patch
101 label findPatchFacePoint(const face& f, const label patchi) const;
102
103 //- Get new owner and neighbour of face. Checks anchor points to see if
104 // need to get original or added cell.
105 void faceCells
106 (
107 const cellCuts& cuts,
108 const label exposedPatchi,
109 const label facei,
110 label& own,
111 label& nei,
112 label& patchID
113 ) const;
114
115 //- Get zone information for face.
116 void getZoneInfo
117 (
118 const label facei,
119 label& zoneID,
120 bool& zoneFlip
121 ) const;
122
123 //- Adds a face from point. Flips face if owner>neighbour
124 void addFace
125 (
126 polyTopoChange& meshMod,
127 const label facei,
128 const label masterPointi,
129 const face& newFace,
130 const label owner,
131 const label neighbour,
132 const label patchID
133 );
134
135 //- Modifies existing facei for either new owner/neighbour or
136 // new face points. Checks if anything changed and flips face
137 // if owner>neighbour
138 void modFace
139 (
140 polyTopoChange& meshMod,
141 const label facei,
142 const face& newFace,
143 const label owner,
144 const label neighbour,
145 const label patchID
146 );
147
148 // Copies face starting from startFp. Jumps cuts. Marks visited
149 // vertices in visited.
150 void copyFace
151 (
152 const face& f,
153 const label startFp,
154 const label endFp,
155 face& newFace
156 ) const;
157
158 //- Split face along cut into two faces. Faces are in same point
159 // order as original face (i.e. maintain normal direction)
160 void splitFace
161 (
162 const face& f,
163 const label v0,
164 const label v1,
165
166 face& f0,
167 face& f1
168 ) const;
169
170 //- Add cuts of edges to face
171 face addEdgeCutsToFace(const label facei) const;
172
173 //- Convert loop of cuts into face.
174 face loopToFace
175 (
176 const label celli,
177 const labelList& loop
178 ) const;
179
180
181
182 //- No copy construct
183 meshCutAndRemove(const meshCutAndRemove&) = delete;
184
185 //- No copy assignment
186 void operator=(const meshCutAndRemove&) = delete;
187
188public:
189
190 //- Runtime type information
191 ClassName("meshCutAndRemove");
192
193
194 // Constructors
195
196 //- Construct from mesh
197 explicit meshCutAndRemove(const polyMesh& mesh);
198
199
200 // Member Functions
201
202 // Edit
203
204 //- Do actual cutting with cut description. Inserts mesh changes
205 // into meshMod.
206 // cuts: all loops and topological information
207 // cutPatch: for every cell that has loop the patch number
208 // exposedPatch: patch for other exposed faces
209 void setRefinement
210 (
211 const label exposedPatchi,
212 const cellCuts& cuts,
213 const labelList& cutPatch,
214 polyTopoChange& meshMod
215 );
216
217 //- Force recalculation of locally stored data on topological change
218 void updateMesh(const mapPolyMesh&);
219
220
221 // Access
222
223 //- Faces added. Per split cell label of added face
224 const Map<label>& addedFaces() const
225 {
226 return addedFaces_;
227 }
228
229 //- Points added. Per split edge label of added point.
230 // (note: fairly useless across topology changes since one of the
231 // points of the edge will probably disappear)
232 const EdgeMap<label>& addedPoints() const
233 {
234 return addedPoints_;
235 }
236};
237
238
239// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240
241} // End namespace Foam
242
243// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244
245#endif
246
247// ************************************************************************* //
Map from edge (expressed as its endpoints) to value. For easier forward declaration it is currently i...
Definition: EdgeMap.H:54
A HashTable to objects of type <T> with a label key.
Definition: Map.H:60
Description of cuts across cells.
Definition: cellCuts.H:113
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Definition: edgeVertex.H:56
const polyMesh & mesh() const
Definition: edgeVertex.H:101
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:59
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Like meshCutter but also removes non-anchor side of cell.
const EdgeMap< label > & addedPoints() const
Points added. Per split edge label of added point.
const Map< label > & addedFaces() const
Faces added. Per split cell label of added face.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
ClassName("meshCutAndRemove")
Runtime type information.
void setRefinement(const label exposedPatchi, const cellCuts &cuts, const labelList &cutPatch, polyTopoChange &meshMod)
Do actual cutting with cut description. Inserts mesh changes.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Direct mesh changes based on v1.3 polyTopoChange syntax.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
const labelIOList & zoneID
Namespace for OpenFOAM.
labelList f(nPoints)
labelList pointLabels(nPoints, -1)