FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::polyModifyFace
00026 
00027 Description
00028     Class describing modification of a face.
00029 
00030 
00031 \*---------------------------------------------------------------------------*/
00032 
00033 #ifndef polyModifyFace_H
00034 #define polyModifyFace_H
00035 
00036 #include <OpenFOAM/label.H>
00037 #include <OpenFOAM/face.H>
00038 #include <dynamicMesh/topoAction.H>
00039 
00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00041 
00042 namespace Foam
00043 {
00044 
00045 /*---------------------------------------------------------------------------*\
00046                            Class polyModifyFace Declaration
00047 \*---------------------------------------------------------------------------*/
00048 
00049 class polyModifyFace
00050 :
00051     public topoAction
00052 {
00053     // Private data
00054 
00055         //- Face 
00056         face face_;
00057 
00058         //- Master face ID
00059         label faceID_;
00060 
00061         //- Face owner
00062         label owner_;
00063 
00064         //- Face neighbour
00065         label neighbour_;
00066 
00067         //- Does the face flux need to be flipped
00068         bool flipFaceFlux_;
00069 
00070         //- Boundary patch ID
00071         label patchID_;
00072 
00073         //- Remove from current zone
00074         bool removeFromZone_;
00075 
00076         //- Face zone ID
00077         label zoneID_;
00078 
00079         //- Face zone flip
00080         bool zoneFlip_;
00081 
00082 
00083 public:
00084 
00085     // Static data members
00086 
00087         //- Runtime type information
00088         TypeName("modifyFace");
00089 
00090 
00091     // Constructors
00092 
00093         //- Construct null.  Used in constructing lists
00094         polyModifyFace()
00095         :
00096             face_(0),
00097             faceID_(-1),
00098             owner_(-1),
00099             neighbour_(-1),
00100             flipFaceFlux_(false),
00101             patchID_(-1),
00102             removeFromZone_(false),
00103             zoneID_(-1),
00104             zoneFlip_(false)
00105         {}
00106 
00107         //- Construct from components
00108         polyModifyFace
00109         (
00110             const face& f,
00111             const label faceID,
00112             const label owner,
00113             const label neighbour,
00114             const bool flipFaceFlux,
00115             const label patchID,
00116             const bool removeFromZone,
00117             const label zoneID,
00118             const bool zoneFlip
00119         )
00120         :
00121             face_(f),
00122             faceID_(faceID),
00123             owner_(owner),
00124             neighbour_(neighbour),
00125             flipFaceFlux_(flipFaceFlux),
00126             patchID_(patchID),
00127             removeFromZone_(removeFromZone),
00128             zoneID_(zoneID),
00129             zoneFlip_(zoneFlip)
00130         {
00131             if (face_.size() < 3)
00132             {
00133                 FatalErrorIn
00134                 (
00135                     "polyModifyFace::polyModifyFace\n"
00136                     "(\n"
00137                     "    const face& f,\n"
00138                     "    const label faceID,\n"
00139                     "    const label owner,\n"
00140                     "    const label neighbour,\n"
00141                     "    const bool flipFaceFlux,\n"
00142                     "    const label patchID,\n"
00143                     "    const bool removeFromZone,\n"
00144                     "    const label zoneID,\n"
00145                     "    const bool zoneFlip\n"
00146                     ")"
00147                 )   << "Invalid face: less than 3 points. This is not allowed\n"
00148                     << "Face: " << face_
00149                     << " faceID:" << faceID_
00150                     << " owner:" << owner_
00151                     << " neighbour:" << neighbour_
00152                     << abort(FatalError);
00153             }
00154 
00155             if (min(face_) < 0)
00156             {
00157                 FatalErrorIn
00158                 (
00159                     "polyModifyFace::polyModifyFace\n"
00160                     "(\n"
00161                     "    const face& f,\n"
00162                     "    const label faceID,\n"
00163                     "    const label owner,\n"
00164                     "    const label neighbour,\n"
00165                     "    const bool flipFaceFlux,\n"
00166                     "    const label patchID,\n"
00167                     "    const bool removeFromZone,\n"
00168                     "    const label zoneID,\n"
00169                     "    const bool zoneFlip\n"
00170                     ")"
00171                 )   << "Face contains invalid vertex ID: " << face_ << ".  "
00172                     << "This is not allowed.\n"
00173                     << " faceID:" << faceID_
00174                     << " owner:" << owner_
00175                     << " neighbour:" << neighbour_
00176                     << abort(FatalError);
00177             }
00178 
00179             if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
00180             {
00181                 FatalErrorIn
00182                 (
00183                     "polyModifyFace::polyModifyFace\n"
00184                     "(\n"
00185                     "    const face& f,\n"
00186                     "    const label faceID,\n"
00187                     "    const label owner,\n"
00188                     "    const label neighbour,\n"
00189                     "    const bool flipFaceFlux,\n"
00190                     "    const label patchID,\n"
00191                     "    const bool removeFromZone,\n"
00192                     "    const label zoneID,\n"
00193                     "    const bool zoneFlip\n"
00194                     ")"
00195                 )   << "Face owner and neighbour are identical.  "
00196                     << "This is not allowed.\n"
00197                     << "Face: " << face_
00198                     << " faceID:" << faceID_
00199                     << " owner:" << owner_
00200                     << " neighbour:" << neighbour_
00201                     << abort(FatalError);
00202             }
00203 
00204             if (neighbour_ >= 0 && patchID_ >= 0)
00205             {
00206                 FatalErrorIn
00207                 (
00208                     "polyModifyFace::polyModifyFace\n"
00209                     "(\n"
00210                     "    const face& f,\n"
00211                     "    const label faceID,\n"
00212                     "    const label owner,\n"
00213                     "    const label neighbour,\n"
00214                     "    const bool flipFaceFlux,\n"
00215                     "    const label patchID,\n"
00216                     "    const bool removeFromZone,\n"
00217                     "    const label zoneID,\n"
00218                     "    const bool zoneFlip\n"
00219                     ")"
00220                 )   << "Patch face has got a neighbour  "
00221                     << "This is not allowed.\n"
00222                     << "Face: " << face_
00223                     << " faceID:" << faceID_
00224                     << " owner:" << owner_
00225                     << " neighbour:" << neighbour_
00226                     << " patchID:" << patchID_
00227                     << abort(FatalError);
00228             }
00229 
00230             if (zoneID_ < 0 && zoneFlip )
00231             {
00232                 FatalErrorIn
00233                 (
00234                     "polyModifyFace::polyModifyFace\n"
00235                     "(\n"
00236                     "    const face& f,\n"
00237                     "    const label faceID,\n"
00238                     "    const label owner,\n"
00239                     "    const label neighbour,\n"
00240                     "    const bool flipFaceFlux,\n"
00241                     "    const label patchID,\n"
00242                     "    const bool removeFromZone,\n"
00243                     "    const label zoneID,\n"
00244                     "    const bool zoneFlip\n"
00245                     ")"
00246                 )   << "Specified zone flip for a face that does not  "
00247                     << "belong to zone.  This is not allowed.\n"
00248                     << "Face: " << face_
00249                     << " faceID:" << faceID_
00250                     << " owner:" << owner_
00251                     << " neighbour:" << neighbour_
00252                     << abort(FatalError);
00253             }
00254         }
00255 
00256         //- Construct and return a clone
00257         virtual autoPtr<topoAction> clone() const
00258         {
00259             return autoPtr<topoAction>(new polyModifyFace(*this));
00260         }
00261 
00262 
00263     // Default Destructor
00264 
00265     // Member Functions
00266 
00267         //- Return face
00268         const face& newFace() const
00269         {
00270             return face_;
00271         }
00272 
00273         //- Return master face ID
00274         label faceID() const
00275         {
00276             return faceID_;
00277         }
00278 
00279         //- Return owner cell ID
00280         label owner() const
00281         {
00282             return owner_;
00283         }
00284 
00285         //- Return owner cell ID
00286         label neighbour() const
00287         {
00288             return neighbour_;
00289         }
00290 
00291         //- Does the face flux need to be flipped
00292         bool flipFaceFlux() const
00293         {
00294             return flipFaceFlux_;
00295         }
00296 
00297         //- Does the face belong to a boundary patch?
00298         bool isInPatch() const
00299         {
00300             return patchID_ >= 0;
00301         }
00302 
00303         //- Boundary patch ID
00304         label patchID() const
00305         {
00306             return patchID_;
00307         }
00308 
00309         //- Does the face belong to a zone?
00310         bool isInZone() const
00311         {
00312             return zoneID_ >= 0;
00313         }
00314 
00315         //- Is the face only a zone face (i.e. not belonging to a cell)
00316         bool onlyInZone() const
00317         {
00318             return zoneID_ >= 0 && owner_ < 0 && neighbour_ < 0;
00319         }
00320 
00321         bool removeFromZone() const
00322         {
00323             return removeFromZone_;
00324         }
00325 
00326         //- Face zone ID
00327         label zoneID() const
00328         {
00329             return zoneID_;
00330         }
00331 
00332         //- Face zone flip
00333         label zoneFlip() const
00334         {
00335             return zoneFlip_;
00336         }
00337 };
00338 
00339 
00340 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00341 
00342 } // End namespace Foam
00343 
00344 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00345 
00346 #endif
00347 
00348 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines