polyAddFace.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::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
66 
67  //- Master point ID for faces blown up from points
69 
70  //- Master edge ID for faces blown up from edges
72 
73  //- Master face ID for faces blown up from faces
75 
76  //- Does the face flux need to be flipped
77  bool flipFaceFlux_;
78 
79  //- Boundary patch ID
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),
137  patchID_(patchID),
138  zoneID_(zoneID),
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 neighour 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 // ************************************************************************* //
Foam::polyAddFace::zoneID_
label zoneID_
Face zone ID.
Definition: polyAddFace.H:82
Foam::polyAddFace::masterFaceID
label masterFaceID() const
Return master face ID.
Definition: polyAddFace.H:292
Foam::polyAddFace::owner
label owner() const
Return owner cell.
Definition: polyAddFace.H:244
Foam::polyAddFace::polyAddFace
polyAddFace()
Construct null. Used for constructing lists.
Definition: polyAddFace.H:99
Foam::polyAddFace::flipFaceFlux
bool flipFaceFlux() const
Does the face flux need to be flipped.
Definition: polyAddFace.H:298
Foam::polyAddFace::onlyInZone
bool onlyInZone() const
Is the face only a zone face (i.e. not belonging to a cell)
Definition: polyAddFace.H:322
Foam::polyAddFace::isInPatch
bool isInPatch() const
Does the face belong to a boundary patch?
Definition: polyAddFace.H:304
face.H
Foam::polyAddFace::face_
face face_
Face identifier.
Definition: polyAddFace.H:58
Foam::polyAddFace::patchID_
label patchID_
Boundary patch ID.
Definition: polyAddFace.H:79
Foam::polyAddFace::masterEdgeID
label masterEdgeID() const
Return master edge ID.
Definition: polyAddFace.H:286
Foam::polyAddFace::flipFaceFlux_
bool flipFaceFlux_
Does the face flux need to be flipped.
Definition: polyAddFace.H:76
Foam::polyAddFace::neighbour_
label neighbour_
Face neighbour.
Definition: polyAddFace.H:64
Foam::polyAddFace::patchID
label patchID() const
Boundary patch ID.
Definition: polyAddFace.H:310
topoAction.H
Foam::label
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
Foam::polyAddFace::neighbour
label neighbour() const
Return neighour cell.
Definition: polyAddFace.H:250
Foam::polyAddFace::owner_
label owner_
Face owner.
Definition: polyAddFace.H:61
Foam::polyAddFace::isEdgeMaster
bool isEdgeMaster() const
Is the face mastered by an edge.
Definition: polyAddFace.H:262
Foam::polyAddFace::zoneID
label zoneID() const
Face zone ID.
Definition: polyAddFace.H:328
Foam::polyAddFace::clone
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
Definition: polyAddFace.H:227
Foam::polyAddFace::masterEdgeID_
label masterEdgeID_
Master edge ID for faces blown up from edges.
Definition: polyAddFace.H:70
Foam::FatalError
error FatalError
Foam::polyAddFace::zoneFlip_
bool zoneFlip_
Face zone flip.
Definition: polyAddFace.H:85
Foam::polyAddFace::isPointMaster
bool isPointMaster() const
Is the face mastered by a point.
Definition: polyAddFace.H:256
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::polyAddFace::masterFaceID_
label masterFaceID_
Master face ID for faces blown up from faces.
Definition: polyAddFace.H:73
Foam::polyAddFace::masterPointID_
label masterPointID_
Master point ID for faces blown up from points.
Definition: polyAddFace.H:67
Foam::polyAddFace::isFaceMaster
bool isFaceMaster() const
Is the face mastered by another face.
Definition: polyAddFace.H:268
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
f
labelList f(nPoints)
label.H
Foam::polyAddFace::masterPointID
label masterPointID() const
Return master point ID.
Definition: polyAddFace.H:280
Foam::polyAddFace
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
Foam::polyAddFace::isInZone
bool isInZone() const
Does the face belong to a zone?
Definition: polyAddFace.H:316
Foam::topoAction
A virtual base class for topological actions.
Definition: topoAction.H:48
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::polyAddFace::appended
bool appended() const
Is the face appended with no master.
Definition: polyAddFace.H:274
Foam::polyAddFace::TypeName
TypeName("addFace")
Runtime type information.
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::polyAddFace::zoneFlip
label zoneFlip() const
Face zone flip.
Definition: polyAddFace.H:334
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::polyAddFace::newFace
const face & newFace() const
Return face.
Definition: polyAddFace.H:238