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