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 Class describing modification of a face.
32 \*---------------------------------------------------------------------------*/
34 #ifndef polyModifyFace_H
35 #define polyModifyFace_H
39 #include "topoAction.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 /*---------------------------------------------------------------------------*\
47 Class polyModifyFace Declaration
48 \*---------------------------------------------------------------------------*/
68 //- Does the face flux need to be flipped
74 //- Remove from current zone
86 // Static data members
88 //- Runtime type information
89 TypeName("modifyFace");
94 //- Construct null. Used in constructing lists
101 flipFaceFlux_(false),
103 removeFromZone_(false),
108 //- Construct from components
114 const label neighbour,
115 const bool flipFaceFlux,
117 const bool removeFromZone,
125 neighbour_(neighbour),
126 flipFaceFlux_(flipFaceFlux),
128 removeFromZone_(removeFromZone),
132 if (face_.size() < 3)
136 "polyModifyFace::polyModifyFace\n"
139 " const label faceID,\n"
140 " const label owner,\n"
141 " const label neighbour,\n"
142 " const bool flipFaceFlux,\n"
143 " const label patchID,\n"
144 " const bool removeFromZone,\n"
145 " const label zoneID,\n"
146 " const bool zoneFlip\n"
148 ) << "Invalid face: less than 3 points. This is not allowed\n"
150 << " faceID:" << faceID_
151 << " owner:" << owner_
152 << " neighbour:" << neighbour_
153 << abort(FatalError);
160 "polyModifyFace::polyModifyFace\n"
163 " const label faceID,\n"
164 " const label owner,\n"
165 " const label neighbour,\n"
166 " const bool flipFaceFlux,\n"
167 " const label patchID,\n"
168 " const bool removeFromZone,\n"
169 " const label zoneID,\n"
170 " const bool zoneFlip\n"
172 ) << "Face contains invalid vertex ID: " << face_ << ". "
173 << "This is not allowed.\n"
174 << " faceID:" << faceID_
175 << " owner:" << owner_
176 << " neighbour:" << neighbour_
177 << abort(FatalError);
180 if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
184 "polyModifyFace::polyModifyFace\n"
187 " const label faceID,\n"
188 " const label owner,\n"
189 " const label neighbour,\n"
190 " const bool flipFaceFlux,\n"
191 " const label patchID,\n"
192 " const bool removeFromZone,\n"
193 " const label zoneID,\n"
194 " const bool zoneFlip\n"
196 ) << "Face owner and neighbour are identical. "
197 << "This is not allowed.\n"
199 << " faceID:" << faceID_
200 << " owner:" << owner_
201 << " neighbour:" << neighbour_
202 << abort(FatalError);
205 if (neighbour_ >= 0 && patchID_ >= 0)
209 "polyModifyFace::polyModifyFace\n"
212 " const label faceID,\n"
213 " const label owner,\n"
214 " const label neighbour,\n"
215 " const bool flipFaceFlux,\n"
216 " const label patchID,\n"
217 " const bool removeFromZone,\n"
218 " const label zoneID,\n"
219 " const bool zoneFlip\n"
221 ) << "Patch face has got a neighbour "
222 << "This is not allowed.\n"
224 << " faceID:" << faceID_
225 << " owner:" << owner_
226 << " neighbour:" << neighbour_
227 << " patchID:" << patchID_
228 << abort(FatalError);
231 if (zoneID_ < 0 && zoneFlip )
235 "polyModifyFace::polyModifyFace\n"
238 " const label faceID,\n"
239 " const label owner,\n"
240 " const label neighbour,\n"
241 " const bool flipFaceFlux,\n"
242 " const label patchID,\n"
243 " const bool removeFromZone,\n"
244 " const label zoneID,\n"
245 " const bool zoneFlip\n"
247 ) << "Specified zone flip for a face that does not "
248 << "belong to zone. This is not allowed.\n"
250 << " faceID:" << faceID_
251 << " owner:" << owner_
252 << " neighbour:" << neighbour_
253 << abort(FatalError);
257 //- Construct and return a clone
258 virtual autoPtr<topoAction> clone() const
260 return autoPtr<topoAction>(new polyModifyFace(*this));
264 // Default Destructor
269 const face& newFace() const
274 //- Return master face ID
280 //- Return owner cell ID
286 //- Return owner cell ID
287 label neighbour() const
292 //- Does the face flux need to be flipped
293 bool flipFaceFlux() const
295 return flipFaceFlux_;
298 //- Does the face belong to a boundary patch?
299 bool isInPatch() const
301 return patchID_ >= 0;
304 //- Boundary patch ID
305 label patchID() const
310 //- Does the face belong to a zone?
311 bool isInZone() const
316 //- Is the face only a zone face (i.e. not belonging to a cell)
317 bool onlyInZone() const
319 return zoneID_ >= 0 && owner_ < 0 && neighbour_ < 0;
322 bool removeFromZone() const
324 return removeFromZone_;
334 label zoneFlip() const
341 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
343 } // End namespace Foam
345 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
349 // ************************************************************************* //