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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::polyAddFace
28 
29 Description
30  A face addition data class. A face can be inflated either from a
31  point or from another face and can either be in internal or a
32  boundary face.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef polyAddFace_H
37 #define polyAddFace_H
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 #include "label.H"
42 #include "face.H"
43 #include "topoAction.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class polyAddFace Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class polyAddFace
55 :
56  public topoAction
57 {
58  // Private data
59 
60  //- Face identifier
61  face face_;
62 
63  //- Face owner
64  label owner_;
65 
66  //- Face neighbour
67  label neighbour_;
68 
69  //- Master point ID for faces blown up from points
70  label masterPointID_;
71 
72  //- Master edge ID for faces blown up from edges
73  label masterEdgeID_;
74 
75  //- Master face ID for faces blown up from faces
76  label masterFaceID_;
77 
78  //- Does the face flux need to be flipped
79  bool flipFaceFlux_;
80 
81  //- Boundary patch ID
82  label patchID_;
83 
84  //- Face zone ID
85  label zoneID_;
86 
87  //- Face zone flip
88  bool zoneFlip_;
89 
90 
91 public:
92 
93  // Static data members
94 
95  //- Runtime type information
96  TypeName("addFace");
97 
98 
99  // Constructors
100 
101  //- Construct null. Used for constructing lists
102  polyAddFace()
103  :
104  face_(0),
105  owner_(-1),
106  neighbour_(-1),
107  masterPointID_(-1),
108  masterEdgeID_(-1),
109  masterFaceID_(-1),
110  flipFaceFlux_(false),
111  patchID_(-1),
112  zoneID_(-1),
113  zoneFlip_(false)
114  {}
115 
116 
117  //- Construct from components
119  (
120  const face& f,
121  const label owner,
122  const label neighbour,
123  const label masterPointID,
124  const label masterEdgeID,
125  const label masterFaceID,
126  const bool flipFaceFlux,
127  const label patchID,
128  const label zoneID,
129  const bool zoneFlip
130  )
131  :
132  face_(f),
133  owner_(owner),
134  neighbour_(neighbour),
135  masterPointID_(masterPointID),
136  masterEdgeID_(masterEdgeID),
137  masterFaceID_(masterFaceID),
138  flipFaceFlux_(flipFaceFlux),
139  patchID_(patchID),
140  zoneID_(zoneID),
141  zoneFlip_(zoneFlip)
142  {
143  if (face_.size() < 3)
144  {
146  << "This is not allowed.\n"
147  << "Face: " << face_
148  << " masterPointID:" << masterPointID_
149  << " masterEdgeID:" << masterEdgeID_
150  << " masterFaceID:" << masterFaceID_
151  << " patchID:" << patchID_
152  << " owner:" << owner_
153  << " neighbour:" << neighbour_
154  << abort(FatalError);
155  }
156 
157  if (min(face_) < 0)
158  {
160  << "This is not allowed.\n"
161  << "Face: " << face_
162  << " masterPointID:" << masterPointID_
163  << " masterEdgeID:" << masterEdgeID_
164  << " masterFaceID:" << masterFaceID_
165  << " patchID:" << patchID_
166  << " owner:" << owner_
167  << " neighbour:" << neighbour_
168  << abort(FatalError);
169  }
170 
171  if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
172  {
174  << "This is not allowed.\n"
175  << "Face: " << face_
176  << " masterPointID:" << masterPointID_
177  << " masterEdgeID:" << masterEdgeID_
178  << " masterFaceID:" << masterFaceID_
179  << " patchID:" << patchID_
180  << " owner:" << owner_
181  << " neighbour:" << neighbour_
182  << abort(FatalError);
183  }
184 
185  if (neighbour_ >= 0 && patchID >= 0)
186  {
188  << ". This is not allowed.\n"
189  << "Face: " << face_
190  << " masterPointID:" << masterPointID_
191  << " masterEdgeID:" << masterEdgeID_
192  << " masterFaceID:" << masterFaceID_
193  << " patchID:" << patchID_
194  << " owner:" << owner_
195  << " neighbour:" << neighbour_
196  << abort(FatalError);
197  }
198 
199  if (owner_ < 0 && zoneID < 0)
200  {
202  << "This is not allowed.\n"
203  << "Face: " << face_
204  << "Face: " << face_
205  << " masterPointID:" << masterPointID_
206  << " masterEdgeID:" << masterEdgeID_
207  << " masterFaceID:" << masterFaceID_
208  << " patchID:" << patchID_
209  << " owner:" << owner_
210  << " neighbour:" << neighbour_
211  << abort(FatalError);
212  }
213 
214  if (zoneID_ == -1 && zoneFlip)
215  {
217  << "belong to zone. This is not allowed.\n"
218  << "Face: " << face_
219  << " masterPointID:" << masterPointID_
220  << " masterEdgeID:" << masterEdgeID_
221  << " masterFaceID:" << masterFaceID_
222  << " patchID:" << patchID_
223  << " owner:" << owner_
224  << " neighbour:" << neighbour_
225  << abort(FatalError);
226  }
227  }
228 
229  //- Construct and return a clone
230  virtual autoPtr<topoAction> clone() const
231  {
232  return autoPtr<topoAction>(new polyAddFace(*this));
233  }
234 
235 
236  // Default Destructor
237 
238  // Member Functions
239 
240  //- Return face
241  const face& newFace() const
242  {
243  return face_;
244  }
245 
246  //- Return owner cell
247  label owner() const
248  {
249  return owner_;
250  }
251 
252  //- Return neighbour cell
253  label neighbour() const
254  {
255  return neighbour_;
256  }
257 
258  //- Is the face mastered by a point
259  bool isPointMaster() const
260  {
261  return masterPointID_ >= 0;
262  }
263 
264  //- Is the face mastered by an edge
265  bool isEdgeMaster() const
266  {
267  return masterEdgeID_ >= 0;
268  }
269 
270  //- Is the face mastered by another face
271  bool isFaceMaster() const
272  {
273  return masterFaceID_ >= 0;
274  }
275 
276  //- Is the face appended with no master
277  bool appended() const
278  {
279  return !isPointMaster() && !isEdgeMaster() && !isFaceMaster();
280  }
281 
282  //- Return master point ID
283  label masterPointID() const
284  {
285  return masterPointID_;
286  }
287 
288  //- Return master edge ID
289  label masterEdgeID() const
290  {
291  return masterEdgeID_;
292  }
293 
294  //- Return master face ID
295  label masterFaceID() const
296  {
297  return masterFaceID_;
298  }
299 
300  //- Does the face flux need to be flipped
301  bool flipFaceFlux() const
302  {
303  return flipFaceFlux_;
304  }
305 
306  //- Does the face belong to a boundary patch?
307  bool isInPatch() const
308  {
309  return patchID_ >= 0;
310  }
311 
312  //- Boundary patch ID
313  label patchID() const
314  {
315  return patchID_;
316  }
317 
318  //- Does the face belong to a zone?
319  bool isInZone() const
320  {
321  return zoneID_ >= 0;
322  }
323 
324  //- Is the face only a zone face (i.e. not belonging to a cell)
325  bool onlyInZone() const
326  {
327  return zoneID_ >= 0 && owner_ < 0 && neighbour_ < 0;
328  }
329 
330  //- Face zone ID
331  label zoneID() const
332  {
333  return zoneID_;
334  }
335 
336  //- Face zone flip
337  label zoneFlip() const
338  {
339  return zoneFlip_;
340  }
341 };
342 
343 
344 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
345 
346 } // End namespace Foam
347 
348 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
349 
350 #endif
351 
352 // ************************************************************************* //
Foam::polyAddFace::masterFaceID
label masterFaceID() const
Return master face ID.
Definition: polyAddFace.H:294
Foam::polyAddFace::owner
label owner() const
Return owner cell.
Definition: polyAddFace.H:246
Foam::polyAddFace::polyAddFace
polyAddFace()
Construct null. Used for constructing lists.
Definition: polyAddFace.H:101
Foam::polyAddFace::flipFaceFlux
bool flipFaceFlux() const
Does the face flux need to be flipped.
Definition: polyAddFace.H:300
Foam::polyAddFace::onlyInZone
bool onlyInZone() const
Is the face only a zone face (i.e. not belonging to a cell)
Definition: polyAddFace.H:324
Foam::polyAddFace::isInPatch
bool isInPatch() const
Does the face belong to a boundary patch?
Definition: polyAddFace.H:306
face.H
Foam::polyAddFace::masterEdgeID
label masterEdgeID() const
Return master edge ID.
Definition: polyAddFace.H:288
Foam::polyAddFace::patchID
label patchID() const
Boundary patch ID.
Definition: polyAddFace.H:312
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
topoAction.H
Foam::polyAddFace::neighbour
label neighbour() const
Return neighbour cell.
Definition: polyAddFace.H:252
Foam::polyAddFace::isEdgeMaster
bool isEdgeMaster() const
Is the face mastered by an edge.
Definition: polyAddFace.H:264
Foam::polyAddFace::zoneID
label zoneID() const
Face zone ID.
Definition: polyAddFace.H:330
Foam::polyAddFace::clone
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
Definition: polyAddFace.H:229
Foam::FatalError
error FatalError
Foam::polyAddFace::isPointMaster
bool isPointMaster() const
Is the face mastered by a point.
Definition: polyAddFace.H:258
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::polyAddFace::isFaceMaster
bool isFaceMaster() const
Is the face mastered by another face.
Definition: polyAddFace.H:270
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
f
labelList f(nPoints)
label.H
Foam::polyAddFace::masterPointID
label masterPointID() const
Return master point ID.
Definition: polyAddFace.H:282
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:53
Foam::polyAddFace::isInZone
bool isInZone() const
Does the face belong to a zone?
Definition: polyAddFace.H:318
Foam::topoAction
A virtual base class for topological actions.
Definition: topoAction.H:51
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
Foam::polyAddFace::appended
bool appended() const
Is the face appended with no master.
Definition: polyAddFace.H:276
Foam::polyAddFace::TypeName
TypeName("addFace")
Runtime type information.
Foam::polyAddFace::zoneFlip
label zoneFlip() const
Face zone flip.
Definition: polyAddFace.H:336
Foam::polyAddFace::newFace
const face & newFace() const
Return face.
Definition: polyAddFace.H:240