polyAddFace.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-2020 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::polyAddFace
26 
27 Description
28  A face addition data class. A face can be inflated either from a
29  point or from another face and can either be in internal or a
30  boundary face.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef polyAddFace_H
35 #define polyAddFace_H
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 #include "label.H"
40 #include "face.H"
41 #include "topoAction.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class polyAddFace Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class polyAddFace
53 :
54  public topoAction
55 {
56  // Private Data
57 
58  //- Face identifier
59  face face_;
60 
61  //- Face owner
62  label owner_;
63 
64  //- Face neighbour
65  label neighbour_;
66 
67  //- Master point ID for faces blown up from points
68  label masterPointID_;
69 
70  //- Master edge ID for faces blown up from edges
71  label masterEdgeID_;
72 
73  //- Master face ID for faces blown up from faces
74  label masterFaceID_;
75 
76  //- Does the face flux need to be flipped
77  bool flipFaceFlux_;
78 
79  //- Boundary patch ID
80  label patchID_;
81 
82  //- Face zone ID
83  label zoneID_;
84 
85  //- Face zone flip
86  bool zoneFlip_;
87 
88 
89 public:
90 
91  // Static Data Members
92 
93  //- Runtime type information
94  TypeName("addFace");
95 
96 
97  // Constructors
98 
99  //- Construct null. Used for constructing lists
100  polyAddFace()
101  :
102  face_(0),
103  owner_(-1),
104  neighbour_(-1),
105  masterPointID_(-1),
106  masterEdgeID_(-1),
107  masterFaceID_(-1),
108  flipFaceFlux_(false),
109  patchID_(-1),
110  zoneID_(-1),
111  zoneFlip_(false)
112  {}
113 
114 
115  //- Construct from components
117  (
118  const face& f,
119  const label owner,
120  const label neighbour,
121  const label masterPointID,
122  const label masterEdgeID,
123  const label masterFaceID,
124  const bool flipFaceFlux,
125  const label patchID,
126  const label zoneID,
127  const bool zoneFlip
128  )
129  :
130  face_(f),
131  owner_(owner),
132  neighbour_(neighbour),
133  masterPointID_(masterPointID),
134  masterEdgeID_(masterEdgeID),
135  masterFaceID_(masterFaceID),
136  flipFaceFlux_(flipFaceFlux),
137  patchID_(patchID),
138  zoneID_(zoneID),
139  zoneFlip_(zoneFlip)
140  {
141  if (face_.size() < 3)
142  {
144  << "This is not allowed.\n"
145  << "Face: " << face_
146  << " masterPointID:" << masterPointID_
147  << " masterEdgeID:" << masterEdgeID_
148  << " masterFaceID:" << masterFaceID_
149  << " patchID:" << patchID_
150  << " owner:" << owner_
151  << " neighbour:" << neighbour_
152  << abort(FatalError);
153  }
154 
155  if (min(face_) < 0)
156  {
158  << "This is not allowed.\n"
159  << "Face: " << face_
160  << " masterPointID:" << masterPointID_
161  << " masterEdgeID:" << masterEdgeID_
162  << " masterFaceID:" << masterFaceID_
163  << " patchID:" << patchID_
164  << " owner:" << owner_
165  << " neighbour:" << neighbour_
166  << abort(FatalError);
167  }
168 
169  if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
170  {
172  << "This is not allowed.\n"
173  << "Face: " << face_
174  << " masterPointID:" << masterPointID_
175  << " masterEdgeID:" << masterEdgeID_
176  << " masterFaceID:" << masterFaceID_
177  << " patchID:" << patchID_
178  << " owner:" << owner_
179  << " neighbour:" << neighbour_
180  << abort(FatalError);
181  }
182 
183  if (neighbour_ >= 0 && patchID >= 0)
184  {
186  << ". This is not allowed.\n"
187  << "Face: " << face_
188  << " masterPointID:" << masterPointID_
189  << " masterEdgeID:" << masterEdgeID_
190  << " masterFaceID:" << masterFaceID_
191  << " patchID:" << patchID_
192  << " owner:" << owner_
193  << " neighbour:" << neighbour_
194  << abort(FatalError);
195  }
196 
197  if (owner_ < 0 && zoneID < 0)
198  {
200  << "This is not allowed.\n"
201  << "Face: " << face_
202  << "Face: " << face_
203  << " masterPointID:" << masterPointID_
204  << " masterEdgeID:" << masterEdgeID_
205  << " masterFaceID:" << masterFaceID_
206  << " patchID:" << patchID_
207  << " owner:" << owner_
208  << " neighbour:" << neighbour_
209  << abort(FatalError);
210  }
211 
212  if (zoneID_ == -1 && zoneFlip)
213  {
215  << "belong to zone. This is not allowed.\n"
216  << "Face: " << face_
217  << " masterPointID:" << masterPointID_
218  << " masterEdgeID:" << masterEdgeID_
219  << " masterFaceID:" << masterFaceID_
220  << " patchID:" << patchID_
221  << " owner:" << owner_
222  << " neighbour:" << neighbour_
223  << abort(FatalError);
224  }
225  }
226 
227  //- Construct and return a clone
228  virtual autoPtr<topoAction> clone() const
229  {
230  return autoPtr<topoAction>(new polyAddFace(*this));
231  }
232 
233 
234  // Default Destructor
235 
236  // Member Functions
237 
238  //- Return face
239  const face& newFace() const
240  {
241  return face_;
242  }
243 
244  //- Return owner cell
245  label owner() const
246  {
247  return owner_;
248  }
249 
250  //- Return neighbour cell
251  label neighbour() const
252  {
253  return neighbour_;
254  }
255 
256  //- Is the face mastered by a point
257  bool isPointMaster() const
258  {
259  return masterPointID_ >= 0;
260  }
261 
262  //- Is the face mastered by an edge
263  bool isEdgeMaster() const
264  {
265  return masterEdgeID_ >= 0;
266  }
267 
268  //- Is the face mastered by another face
269  bool isFaceMaster() const
270  {
271  return masterFaceID_ >= 0;
272  }
273 
274  //- Is the face appended with no master
275  bool appended() const
276  {
277  return !isPointMaster() && !isEdgeMaster() && !isFaceMaster();
278  }
279 
280  //- Return master point ID
281  label masterPointID() const
282  {
283  return masterPointID_;
284  }
285 
286  //- Return master edge ID
287  label masterEdgeID() const
288  {
289  return masterEdgeID_;
290  }
291 
292  //- Return master face ID
293  label masterFaceID() const
294  {
295  return masterFaceID_;
296  }
297 
298  //- Does the face flux need to be flipped
299  bool flipFaceFlux() const
300  {
301  return flipFaceFlux_;
302  }
303 
304  //- Does the face belong to a boundary patch?
305  bool isInPatch() const
306  {
307  return patchID_ >= 0;
308  }
309 
310  //- Boundary patch ID
311  label patchID() const
312  {
313  return patchID_;
314  }
315 
316  //- Does the face belong to a zone?
317  bool isInZone() const
318  {
319  return zoneID_ >= 0;
320  }
321 
322  //- Is the face only a zone face (i.e. not belonging to a cell)
323  bool onlyInZone() const
324  {
325  return zoneID_ >= 0 && owner_ < 0 && neighbour_ < 0;
326  }
327 
328  //- Face zone ID
329  label zoneID() const
330  {
331  return zoneID_;
332  }
333 
334  //- Face zone flip
335  label zoneFlip() const
336  {
337  return zoneFlip_;
338  }
339 };
340 
341 
342 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
343 
344 } // End namespace Foam
345 
346 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
347 
348 #endif
349 
350 // ************************************************************************* //
polyAddFace()
Construct null. Used for constructing lists.
Definition: polyAddFace.H:99
label zoneID() const
Face zone ID.
Definition: polyAddFace.H:328
bool isPointMaster() const
Is the face mastered by a point.
Definition: polyAddFace.H:256
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
const face & newFace() const
Return face.
Definition: polyAddFace.H:238
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
bool isEdgeMaster() const
Is the face mastered by an edge.
Definition: polyAddFace.H:262
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
label masterPointID() const
Return master point ID.
Definition: polyAddFace.H:280
A face addition data class. A face can be inflated either from a point or from another face and can e...
Definition: polyAddFace.H:51
label owner() const
Return owner cell.
Definition: polyAddFace.H:244
label zoneFlip() const
Face zone flip.
Definition: polyAddFace.H:334
label masterFaceID() const
Return master face ID.
Definition: polyAddFace.H:292
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
errorManip< error > abort(error &err)
Definition: errorManip.H:131
A virtual base class for topological actions.
Definition: topoAction.H:48
label patchID() const
Boundary patch ID.
Definition: polyAddFace.H:310
labelList f(nPoints)
bool onlyInZone() const
Is the face only a zone face (i.e. not belonging to a cell)
Definition: polyAddFace.H:322
label neighbour() const
Return neighbour cell.
Definition: polyAddFace.H:250
bool appended() const
Is the face appended with no master.
Definition: polyAddFace.H:274
TypeName("addFace")
Runtime type information.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
Definition: polyAddFace.H:227
bool flipFaceFlux() const
Does the face flux need to be flipped.
Definition: polyAddFace.H:298
bool isInPatch() const
Does the face belong to a boundary patch?
Definition: polyAddFace.H:304
bool isInZone() const
Does the face belong to a zone?
Definition: polyAddFace.H:316
Namespace for OpenFOAM.
label masterEdgeID() const
Return master edge ID.
Definition: polyAddFace.H:286
bool isFaceMaster() const
Is the face mastered by another face.
Definition: polyAddFace.H:268