OpenFOAM logo
Open Source CFD Toolkit

polyModifyFace.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     polyModifyFace
00027 
00028 Description
00029     Class describing modification of a face.
00030 
00031 
00032 \*---------------------------------------------------------------------------*/
00033 
00034 #ifndef polyModifyFace_H
00035 #define polyModifyFace_H
00036 
00037 #include "label.H"
00038 #include "face.H"
00039 #include "topoAction.H"
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047                            Class polyModifyFace Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 class polyModifyFace
00051 :
00052     public topoAction
00053 {
00054     // Private data
00055 
00056         //- Face 
00057         face face_;
00058 
00059         //- Master face ID
00060         label faceID_;
00061 
00062         //- Face owner
00063         label owner_;
00064 
00065         //- Face neighbour
00066         label neighbour_;
00067 
00068         //- Does the face flux need to be flipped
00069         bool flipFaceFlux_;
00070 
00071         //- Boundary patch ID
00072         label patchID_;
00073 
00074         //- Remove from current zone
00075         bool removeFromZone_;
00076 
00077         //- Face zone ID
00078         label zoneID_;
00079 
00080         //- Face zone flip
00081         bool zoneFlip_;
00082 
00083 
00084 public:
00085 
00086     // Static data members
00087 
00088         //- Runtime type information
00089         TypeName("modifyFace");
00090 
00091 
00092     // Constructors
00093 
00094         //- Construct null.  Used in constructing lists
00095         polyModifyFace()
00096         :
00097             face_(0),
00098             faceID_(-1),
00099             owner_(-1),
00100             neighbour_(-1),
00101             flipFaceFlux_(false),
00102             patchID_(-1),
00103             removeFromZone_(false),
00104             zoneID_(-1),
00105             zoneFlip_(false)
00106         {}
00107 
00108         //- Construct from components
00109         polyModifyFace
00110         (
00111             const face& f,
00112             const label faceID,
00113             const label owner,
00114             const label neighbour,
00115             const bool flipFaceFlux,
00116             const label patchID,
00117             const bool removeFromZone,
00118             const label zoneID,
00119             const bool zoneFlip
00120         )
00121         :
00122             face_(f),
00123             faceID_(faceID),
00124             owner_(owner),
00125             neighbour_(neighbour),
00126             flipFaceFlux_(flipFaceFlux),
00127             patchID_(patchID),
00128             removeFromZone_(removeFromZone),
00129             zoneID_(zoneID),
00130             zoneFlip_(zoneFlip)
00131         {
00132             if (face_.size() < 3)
00133             {
00134                 FatalErrorIn
00135                 (
00136                     "polyModifyFace::polyModifyFace\n"
00137                     "(\n"
00138                     "    const face& f,\n"
00139                     "    const label faceID,\n"
00140                     "    const label owner,\n"
00141                     "    const label neighbour,\n"
00142                     "    const bool flipFaceFlux,\n"
00143                     "    const label patchID,\n"
00144                     "    const bool removeFromZone,\n"
00145                     "    const label zoneID,\n"
00146                     "    const bool zoneFlip\n"
00147                     ")"
00148                 )   << "Invalid face: less than 3 points. This is not allowed\n"
00149                     << "Face: " << face_
00150                     << " faceID:" << faceID_
00151                     << " owner:" << owner_
00152                     << " neighbour:" << neighbour_
00153                     << abort(FatalError);
00154             }
00155 
00156             if (min(face_) < 0)
00157             {
00158                 FatalErrorIn
00159                 (
00160                     "polyModifyFace::polyModifyFace\n"
00161                     "(\n"
00162                     "    const face& f,\n"
00163                     "    const label faceID,\n"
00164                     "    const label owner,\n"
00165                     "    const label neighbour,\n"
00166                     "    const bool flipFaceFlux,\n"
00167                     "    const label patchID,\n"
00168                     "    const bool removeFromZone,\n"
00169                     "    const label zoneID,\n"
00170                     "    const bool zoneFlip\n"
00171                     ")"
00172                 )   << "Face contains invalid vertex ID: " << face_ << ".  "
00173                     << "This is not allowed.\n"
00174                     << " faceID:" << faceID_
00175                     << " owner:" << owner_
00176                     << " neighbour:" << neighbour_
00177                     << abort(FatalError);
00178             }
00179 
00180             if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
00181             {
00182                 FatalErrorIn
00183                 (
00184                     "polyModifyFace::polyModifyFace\n"
00185                     "(\n"
00186                     "    const face& f,\n"
00187                     "    const label faceID,\n"
00188                     "    const label owner,\n"
00189                     "    const label neighbour,\n"
00190                     "    const bool flipFaceFlux,\n"
00191                     "    const label patchID,\n"
00192                     "    const bool removeFromZone,\n"
00193                     "    const label zoneID,\n"
00194                     "    const bool zoneFlip\n"
00195                     ")"
00196                 )   << "Face owner and neighbour are identical.  "
00197                     << "This is not allowed.\n"
00198                     << "Face: " << face_
00199                     << " faceID:" << faceID_
00200                     << " owner:" << owner_
00201                     << " neighbour:" << neighbour_
00202                     << abort(FatalError);
00203             }
00204 
00205             if (neighbour_ >= 0 && patchID_ >= 0)
00206             {
00207                 FatalErrorIn
00208                 (
00209                     "polyModifyFace::polyModifyFace\n"
00210                     "(\n"
00211                     "    const face& f,\n"
00212                     "    const label faceID,\n"
00213                     "    const label owner,\n"
00214                     "    const label neighbour,\n"
00215                     "    const bool flipFaceFlux,\n"
00216                     "    const label patchID,\n"
00217                     "    const bool removeFromZone,\n"
00218                     "    const label zoneID,\n"
00219                     "    const bool zoneFlip\n"
00220                     ")"
00221                 )   << "Patch face has got a neighbour  "
00222                     << "This is not allowed.\n"
00223                     << "Face: " << face_
00224                     << " faceID:" << faceID_
00225                     << " owner:" << owner_
00226                     << " neighbour:" << neighbour_
00227                     << " patchID:" << patchID_
00228                     << abort(FatalError);
00229             }
00230 
00231             if (zoneID_ < 0 && zoneFlip )
00232             {
00233                 FatalErrorIn
00234                 (
00235                     "polyModifyFace::polyModifyFace\n"
00236                     "(\n"
00237                     "    const face& f,\n"
00238                     "    const label faceID,\n"
00239                     "    const label owner,\n"
00240                     "    const label neighbour,\n"
00241                     "    const bool flipFaceFlux,\n"
00242                     "    const label patchID,\n"
00243                     "    const bool removeFromZone,\n"
00244                     "    const label zoneID,\n"
00245                     "    const bool zoneFlip\n"
00246                     ")"
00247                 )   << "Specified zone flip for a face that does not  "
00248                     << "belong to zone.  This is not allowed.\n"
00249                     << "Face: " << face_
00250                     << " faceID:" << faceID_
00251                     << " owner:" << owner_
00252                     << " neighbour:" << neighbour_
00253                     << abort(FatalError);
00254             }
00255         }
00256 
00257         //- Construct and return a clone
00258         virtual autoPtr<topoAction> clone() const
00259         {
00260             return autoPtr<topoAction>(new polyModifyFace(*this));
00261         }
00262 
00263 
00264     // Default Destructor
00265 
00266     // Member Functions
00267 
00268         //- Return face
00269         const face& newFace() const
00270         {
00271             return face_;
00272         }
00273 
00274         //- Return master face ID
00275         label faceID() const
00276         {
00277             return faceID_;
00278         }
00279 
00280         //- Return owner cell ID
00281         label owner() const
00282         {
00283             return owner_;
00284         }
00285 
00286         //- Return owner cell ID
00287         label neighbour() const
00288         {
00289             return neighbour_;
00290         }
00291 
00292         //- Does the face flux need to be flipped
00293         bool flipFaceFlux() const
00294         {
00295             return flipFaceFlux_;
00296         }
00297 
00298         //- Does the face belong to a boundary patch?
00299         bool isInPatch() const
00300         {
00301             return patchID_ >= 0;
00302         }
00303 
00304         //- Boundary patch ID
00305         label patchID() const
00306         {
00307             return patchID_;
00308         }
00309 
00310         //- Does the face belong to a zone?
00311         bool isInZone() const
00312         {
00313             return zoneID_ >= 0;
00314         }
00315 
00316         //- Is the face only a zone face (i.e. not belonging to a cell)
00317         bool onlyInZone() const
00318         {
00319             return zoneID_ >= 0 && owner_ < 0 && neighbour_ < 0;
00320         }
00321 
00322         bool removeFromZone() const
00323         {
00324             return removeFromZone_;
00325         }
00326 
00327         //- Face zone ID
00328         label zoneID() const
00329         {
00330             return zoneID_;
00331         }
00332 
00333         //- Face zone flip
00334         label zoneFlip() const
00335         {
00336             return zoneFlip_;
00337         }
00338 };
00339 
00340 
00341 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00342 
00343 } // End namespace Foam
00344 
00345 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00346 
00347 #endif
00348 
00349 // ************************************************************************* //
For further information go to www.openfoam.org