polyModifyFace.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-2019 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
65  label neighbour_;
66 
67  //- Does the face flux need to be flipped
68  bool flipFaceFlux_;
69 
70  //- Boundary patch ID
71  label patchID_;
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),
124  neighbour_(neighbour),
125  flipFaceFlux_(flipFaceFlux),
126  patchID_(patchID),
127  removeFromZone_(removeFromZone),
128  zoneID_(zoneID),
129  zoneFlip_(zoneFlip)
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  }
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 // ************************************************************************* //
const face & newFace() const
Return face.
label neighbour() const
Return owner cell ID.
bool isInPatch() const
Does the face belong to a boundary patch?
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
label faceID() const
Return master face ID.
Class describing modification of a face.
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
label zoneFlip() const
Face zone flip.
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
label patchID() const
Boundary patch ID.
label owner() const
Return owner cell ID.
label zoneID() const
Face zone ID.
bool removeFromZone() const
bool flipFaceFlux() const
Does the face flux need to be flipped.
polyModifyFace()
Construct null. Used in constructing lists.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
A virtual base class for topological actions.
Definition: topoAction.H:48
bool onlyInZone() const
Is the face only a zone face (i.e. not belonging to a cell)
labelList f(nPoints)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
bool isInZone() const
Does the face belong to a zone?
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Namespace for OpenFOAM.
TypeName("modifyFace")
Runtime type information.