polyModifyFace.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::polyModifyFace
26 
27 Description
28  Class describing modification of a face.
29 
30 
31 \*---------------------------------------------------------------------------*/
32 
33 #ifndef polyModifyFace_H
34 #define polyModifyFace_H
35 
36 #include "label.H"
37 #include "face.H"
38 #include "topoAction.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class polyModifyFace Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class polyModifyFace
50 :
51  public topoAction
52 {
53  // Private data
54 
55  //- Face
56  face face_;
57 
58  //- Master face ID
59  label faceID_;
60 
61  //- Face owner
62  label owner_;
63 
64  //- Face neighbour
66 
67  //- Does the face flux need to be flipped
68  bool flipFaceFlux_;
69 
70  //- Boundary patch ID
72 
73  //- Remove from current zone
74  bool removeFromZone_;
75 
76  //- Face zone ID
77  label zoneID_;
78 
79  //- Face zone flip
80  bool zoneFlip_;
81 
82 
83 public:
84 
85  // Static data members
86 
87  //- Runtime type information
88  TypeName("modifyFace");
89 
90 
91  // Constructors
92 
93  //- Construct null. Used in constructing lists
95  :
96  face_(0),
97  faceID_(-1),
98  owner_(-1),
99  neighbour_(-1),
100  flipFaceFlux_(false),
101  patchID_(-1),
102  removeFromZone_(false),
103  zoneID_(-1),
104  zoneFlip_(false)
105  {}
106 
107  //- Construct from components
109  (
110  const face& f,
111  const label faceID,
112  const label owner,
113  const label neighbour,
114  const bool flipFaceFlux,
115  const label patchID,
116  const bool removeFromZone,
117  const label zoneID,
118  const bool zoneFlip
119  )
120  :
121  face_(f),
122  faceID_(faceID),
123  owner_(owner),
126  patchID_(patchID),
128  zoneID_(zoneID),
130  {
131  if (face_.size() < 3)
132  {
134  << "Invalid face: less than 3 points. This is not allowed\n"
135  << "Face: " << face_
136  << " faceID:" << faceID_
137  << " owner:" << owner_
138  << " neighbour:" << neighbour_
139  << abort(FatalError);
140  }
141 
142  if (min(face_) < 0)
143  {
145  << "This is not allowed.\n"
146  << " faceID:" << faceID_
147  << " owner:" << owner_
148  << " neighbour:" << neighbour_
149  << abort(FatalError);
150  }
151 
152  if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
153  {
155  << "This is not allowed.\n"
156  << "Face: " << face_
157  << " faceID:" << faceID_
158  << " owner:" << owner_
159  << " neighbour:" << neighbour_
160  << abort(FatalError);
161  }
162 
163  if (neighbour_ >= 0 && patchID_ >= 0)
164  {
166  << "This is not allowed.\n"
167  << "Face: " << face_
168  << " faceID:" << faceID_
169  << " owner:" << owner_
170  << " neighbour:" << neighbour_
171  << " patchID:" << patchID_
172  << abort(FatalError);
173  }
174 
175  if (zoneID_ < 0 && zoneFlip )
176  {
178  << "belong to zone. This is not allowed.\n"
179  << "Face: " << face_
180  << " faceID:" << faceID_
181  << " owner:" << owner_
182  << " neighbour:" << neighbour_
183  << abort(FatalError);
184  }
185  }
186 
187  //- Construct and return a clone
188  virtual autoPtr<topoAction> clone() const
189  {
190  return autoPtr<topoAction>(new polyModifyFace(*this));
191  }
192 
193 
194  // Default Destructor
195 
196  // Member Functions
197 
198  //- Return face
199  const face& newFace() const
200  {
201  return face_;
202  }
203 
204  //- Return master face ID
205  label faceID() const
206  {
207  return faceID_;
208  }
209 
210  //- Return owner cell ID
211  label owner() const
212  {
213  return owner_;
214  }
215 
216  //- Return owner cell ID
217  label neighbour() const
218  {
219  return neighbour_;
220  }
221 
222  //- Does the face flux need to be flipped
223  bool flipFaceFlux() const
224  {
225  return flipFaceFlux_;
226  }
227 
228  //- Does the face belong to a boundary patch?
229  bool isInPatch() const
230  {
231  return patchID_ >= 0;
232  }
233 
234  //- Boundary patch ID
235  label patchID() const
236  {
237  return patchID_;
238  }
239 
240  //- Does the face belong to a zone?
241  bool isInZone() const
242  {
243  return zoneID_ >= 0;
244  }
245 
246  //- Is the face only a zone face (i.e. not belonging to a cell)
247  bool onlyInZone() const
248  {
249  return zoneID_ >= 0 && owner_ < 0 && neighbour_ < 0;
250  }
251 
252  bool removeFromZone() const
253  {
254  return removeFromZone_;
255  }
256 
257  //- Face zone ID
258  label zoneID() const
259  {
260  return zoneID_;
261  }
262 
263  //- Face zone flip
264  label zoneFlip() const
265  {
266  return zoneFlip_;
267  }
268 };
269 
270 
271 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272 
273 } // End namespace Foam
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 #endif
278 
279 // ************************************************************************* //
Foam::polyModifyFace::TypeName
TypeName("modifyFace")
Runtime type information.
Foam::polyModifyFace::zoneFlip
label zoneFlip() const
Face zone flip.
Definition: polyModifyFace.H:263
Foam::polyModifyFace::flipFaceFlux
bool flipFaceFlux() const
Does the face flux need to be flipped.
Definition: polyModifyFace.H:222
Foam::polyModifyFace::onlyInZone
bool onlyInZone() const
Is the face only a zone face (i.e. not belonging to a cell)
Definition: polyModifyFace.H:246
Foam::polyModifyFace::faceID_
label faceID_
Master face ID.
Definition: polyModifyFace.H:58
Foam::polyModifyFace::zoneFlip_
bool zoneFlip_
Face zone flip.
Definition: polyModifyFace.H:79
Foam::polyModifyFace::patchID_
label patchID_
Boundary patch ID.
Definition: polyModifyFace.H:70
face.H
Foam::polyModifyFace
Class describing modification of a face.
Definition: polyModifyFace.H:48
Foam::polyModifyFace::isInZone
bool isInZone() const
Does the face belong to a zone?
Definition: polyModifyFace.H:240
topoAction.H
Foam::polyModifyFace::flipFaceFlux_
bool flipFaceFlux_
Does the face flux need to be flipped.
Definition: polyModifyFace.H:67
Foam::polyModifyFace::clone
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
Definition: polyModifyFace.H:187
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::polyModifyFace::removeFromZone_
bool removeFromZone_
Remove from current zone.
Definition: polyModifyFace.H:73
Foam::polyModifyFace::newFace
const face & newFace() const
Return face.
Definition: polyModifyFace.H:198
Foam::polyModifyFace::neighbour
label neighbour() const
Return owner cell ID.
Definition: polyModifyFace.H:216
Foam::FatalError
error FatalError
Foam::polyModifyFace::face_
face face_
Face.
Definition: polyModifyFace.H:55
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::polyModifyFace::faceID
label faceID() const
Return master face ID.
Definition: polyModifyFace.H:204
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::polyModifyFace::neighbour_
label neighbour_
Face neighbour.
Definition: polyModifyFace.H:64
Foam::polyModifyFace::owner
label owner() const
Return owner cell ID.
Definition: polyModifyFace.H:210
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
Foam::polyModifyFace::patchID
label patchID() const
Boundary patch ID.
Definition: polyModifyFace.H:234
Foam::polyModifyFace::owner_
label owner_
Face owner.
Definition: polyModifyFace.H:61
f
labelList f(nPoints)
label.H
Foam::polyModifyFace::isInPatch
bool isInPatch() const
Does the face belong to a boundary patch?
Definition: polyModifyFace.H:228
Foam::polyModifyFace::removeFromZone
bool removeFromZone() const
Definition: polyModifyFace.H:251
Foam::polyModifyFace::zoneID
label zoneID() const
Face zone ID.
Definition: polyModifyFace.H:257
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::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::polyModifyFace::zoneID_
label zoneID_
Face zone ID.
Definition: polyModifyFace.H:76
Foam::polyModifyFace::polyModifyFace
polyModifyFace()
Construct null. Used in constructing lists.
Definition: polyModifyFace.H:93
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)