1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 A face addition data class. A face can be inflated either from a
30 point or from another face and can either be in internal or a
33 \*---------------------------------------------------------------------------*/
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 #include "topoAction.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class polyAddFace Declaration
51 \*---------------------------------------------------------------------------*/
68 //- Master point ID for faces blown up from points
71 //- Master edge ID for faces blown up from edges
74 //- Master face ID for faces blown up from faces
77 //- Does the face flux need to be flipped
92 // Static data members
94 //- Runtime type information
100 //- Construct null. Used for constructing lists
109 flipFaceFlux_(false),
116 //- Construct from components
121 const label neighbour,
122 const label masterPointID,
123 const label masterEdgeID,
124 const label masterFaceID,
125 const bool flipFaceFlux,
133 neighbour_(neighbour),
134 masterPointID_(masterPointID),
135 masterEdgeID_(masterEdgeID),
136 masterFaceID_(masterFaceID),
137 flipFaceFlux_(flipFaceFlux),
142 if (face_.size() < 3)
149 " const label owner,"
150 " const label neighbour,\n"
151 " const label masterPointID,\n"
152 " const label masterEdgeID,\n"
153 " const label masterFaceID,\n"
154 " const bool flipFaceFlux,\n"
155 " const label patchID,\n"
156 " const label zoneID,\n"
157 " const bool zoneFlip\n"
159 ) << "Invalid face: less than 3 points. "
160 << "This is not allowed.\n"
162 << " masterPointID:" << masterPointID_
163 << " masterEdgeID:" << masterEdgeID_
164 << " masterFaceID:" << masterFaceID_
165 << " patchID:" << patchID_
166 << " owner:" << owner_
167 << " neighbour:" << neighbour_
168 << abort(FatalError);
178 " const label owner,"
179 " const label neighbour,\n"
180 " const label masterPointID,\n"
181 " const label masterEdgeID,\n"
182 " const label masterFaceID,\n"
183 " const bool flipFaceFlux,\n"
184 " const label patchID,\n"
185 " const label zoneID,\n"
186 " const bool zoneFlip\n"
188 ) << "Face contains invalid vertex ID: " << face_ << ". "
189 << "This is not allowed.\n"
191 << " masterPointID:" << masterPointID_
192 << " masterEdgeID:" << masterEdgeID_
193 << " masterFaceID:" << masterFaceID_
194 << " patchID:" << patchID_
195 << " owner:" << owner_
196 << " neighbour:" << neighbour_
197 << abort(FatalError);
200 if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
207 " const label owner,"
208 " const label neighbour,\n"
209 " const label masterPointID,\n"
210 " const label masterEdgeID,\n"
211 " const label masterFaceID,\n"
212 " const bool flipFaceFlux,\n"
213 " const label patchID,\n"
214 " const label zoneID,\n"
215 " const bool zoneFlip\n"
217 ) << "Face owner and neighbour are identical. "
218 << "This is not allowed.\n"
220 << " masterPointID:" << masterPointID_
221 << " masterEdgeID:" << masterEdgeID_
222 << " masterFaceID:" << masterFaceID_
223 << " patchID:" << patchID_
224 << " owner:" << owner_
225 << " neighbour:" << neighbour_
226 << abort(FatalError);
229 if (neighbour_ >= 0 && patchID >= 0)
236 " const label owner,"
237 " const label neighbour,\n"
238 " const label masterPointID,\n"
239 " const label masterEdgeID,\n"
240 " const label masterFaceID,\n"
241 " const bool flipFaceFlux,\n"
242 " const label patchID,\n"
243 " const label zoneID,\n"
244 " const bool zoneFlip\n"
246 ) << "Patch face has got a neighbour. Patch ID: " << patchID
247 << ". This is not allowed.\n"
249 << " masterPointID:" << masterPointID_
250 << " masterEdgeID:" << masterEdgeID_
251 << " masterFaceID:" << masterFaceID_
252 << " patchID:" << patchID_
253 << " owner:" << owner_
254 << " neighbour:" << neighbour_
255 << abort(FatalError);
258 if (owner_ < 0 && zoneID < 0)
265 " const label owner,"
266 " const label neighbour,\n"
267 " const label patchID,\n"
268 " const label zoneID"
270 ) << "Face has no owner and is not in a zone. "
271 << "This is not allowed.\n"
274 << " masterPointID:" << masterPointID_
275 << " masterEdgeID:" << masterEdgeID_
276 << " masterFaceID:" << masterFaceID_
277 << " patchID:" << patchID_
278 << " owner:" << owner_
279 << " neighbour:" << neighbour_
280 << abort(FatalError);
283 if (zoneID_ == -1 && zoneFlip)
290 " const label owner,"
291 " const label neighbour,\n"
292 " const label masterPointID,\n"
293 " const label masterEdgeID,\n"
294 " const label masterFaceID,\n"
295 " const label patchID,\n"
296 " const label zoneID,\n"
297 " const bool zoneFlip\n"
299 ) << "Specified zone flip for a face that does not "
300 << "belong to zone. This is not allowed.\n"
302 << " masterPointID:" << masterPointID_
303 << " masterEdgeID:" << masterEdgeID_
304 << " masterFaceID:" << masterFaceID_
305 << " patchID:" << patchID_
306 << " owner:" << owner_
307 << " neighbour:" << neighbour_
308 << abort(FatalError);
312 //- Construct and return a clone
313 virtual autoPtr<topoAction> clone() const
315 return autoPtr<topoAction>(new polyAddFace(*this));
319 // Default Destructor
324 const face& newFace() const
329 //- Return owner cell
335 //- Return neighour cell
336 label neighbour() const
341 //- Is the face mastered by a point
342 bool isPointMaster() const
344 return masterPointID_ >= 0;
347 //- Is the face mastered by an edge
348 bool isEdgeMaster() const
350 return masterEdgeID_ >= 0;
353 //- Is the face mastered by another face
354 bool isFaceMaster() const
356 return masterFaceID_ >= 0;
359 //- Is the face appended with no master
360 bool appended() const
362 return !isPointMaster() && !isEdgeMaster() && !isFaceMaster();
365 //- Return master point ID
366 label masterPointID() const
368 return masterPointID_;
371 //- Return master edge ID
372 label masterEdgeID() const
374 return masterEdgeID_;
377 //- Return master face ID
378 label masterFaceID() const
380 return masterFaceID_;
383 //- Does the face flux need to be flipped
384 bool flipFaceFlux() const
386 return flipFaceFlux_;
389 //- Does the face belong to a boundary patch?
390 bool isInPatch() const
392 return patchID_ >= 0;
395 //- Boundary patch ID
396 label patchID() const
401 //- Does the face belong to a zone?
402 bool isInZone() const
407 //- Is the face only a zone face (i.e. not belonging to a cell)
408 bool onlyInZone() const
410 return zoneID_ >= 0 && owner_ < 0 && neighbour_ < 0;
420 label zoneFlip() const
427 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
429 } // End namespace Foam
431 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
435 // ************************************************************************* //