OpenFOAM logo
Open Source CFD Toolkit

polyAddFace.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     polyAddFace
00027 
00028 Description
00029     A face addition data class. A face can be inflated either from a
00030     point or from another face and can either be in internal or a
00031     boundary face.
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef polyAddFace_H
00036 #define polyAddFace_H
00037 
00038 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00039 
00040 #include "label.H"
00041 #include "face.H"
00042 #include "topoAction.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 /*---------------------------------------------------------------------------*\
00050                            Class polyAddFace Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 class polyAddFace
00054 :
00055     public topoAction
00056 {
00057     // Private data
00058 
00059         //- Face identifier
00060         face face_;
00061 
00062         //- Face owner
00063         label owner_;
00064 
00065         //- Face neighbour
00066         label neighbour_;
00067 
00068         //- Master point ID for faces blown up from points
00069         label masterPointID_;
00070 
00071         //- Master edge ID for faces blown up from edges
00072         label masterEdgeID_;
00073 
00074         //- Master face ID for faces blown up from faces
00075         label masterFaceID_;
00076 
00077         //- Does the face flux need to be flipped
00078         bool flipFaceFlux_;
00079 
00080         //- Boundary patch ID
00081         label patchID_;
00082 
00083         //- Face zone ID
00084         label zoneID_;
00085 
00086         //- Face zone flip
00087         bool zoneFlip_;
00088 
00089 
00090 public:
00091 
00092     // Static data members
00093 
00094         //- Runtime type information
00095         TypeName("addFace");
00096 
00097 
00098     // Constructors
00099 
00100         //- Construct null.  Used for constructing lists
00101         polyAddFace()
00102         :
00103             face_(0),
00104             owner_(-1),
00105             neighbour_(-1),
00106             masterPointID_(-1),
00107             masterEdgeID_(-1),
00108             masterFaceID_(-1),
00109             flipFaceFlux_(false),
00110             patchID_(-1),
00111             zoneID_(-1),
00112             zoneFlip_(false)
00113         {}
00114 
00115 
00116         //- Construct from components
00117         polyAddFace
00118         (
00119             const face& f,
00120             const label owner,
00121             const label neighbour,
00122             const label masterPointID,
00123             const label masterEdgeID,
00124             const label masterFaceID,
00125             const bool flipFaceFlux,
00126             const label patchID,
00127             const label zoneID,
00128             const bool zoneFlip
00129         )
00130         :
00131             face_(f),
00132             owner_(owner),
00133             neighbour_(neighbour),
00134             masterPointID_(masterPointID),
00135             masterEdgeID_(masterEdgeID),
00136             masterFaceID_(masterFaceID),
00137             flipFaceFlux_(flipFaceFlux),
00138             patchID_(patchID),
00139             zoneID_(zoneID),
00140             zoneFlip_(zoneFlip)
00141         {
00142             if (face_.size() < 3)
00143             {
00144                 FatalErrorIn
00145                 (
00146                     "polyAddFace\n"
00147                     "(\n"
00148                     "    const face& f,\n"
00149                     "    const label owner,"
00150                     "    const label neighbour,\n"
00151                     "    const label masterPointID,\n"
00152                     "    const label masterEdgeID,\n"
00153                     "    const label masterFaceID,\n"
00154                     "    const bool flipFaceFlux,\n"
00155                     "    const label patchID,\n"
00156                     "    const label zoneID,\n"
00157                     "    const bool zoneFlip\n"
00158                     ")"
00159                 )   << "Invalid face: less than 3 points.  "
00160                     << "This is not allowed.\n"
00161                     << "Face: " << face_
00162                     << " masterPointID:" << masterPointID_
00163                     << " masterEdgeID:" << masterEdgeID_
00164                     << " masterFaceID:" << masterFaceID_
00165                     << " patchID:" << patchID_
00166                     << " owner:" << owner_
00167                     << " neighbour:" << neighbour_
00168                     << abort(FatalError);
00169             }
00170 
00171             if (min(face_) < 0)
00172             {
00173                 FatalErrorIn
00174                 (
00175                     "polyAddFace\n"
00176                     "(\n"
00177                     "    const face& f,\n"
00178                     "    const label owner,"
00179                     "    const label neighbour,\n"
00180                     "    const label masterPointID,\n"
00181                     "    const label masterEdgeID,\n"
00182                     "    const label masterFaceID,\n"
00183                     "    const bool flipFaceFlux,\n"
00184                     "    const label patchID,\n"
00185                     "    const label zoneID,\n"
00186                     "    const bool zoneFlip\n"
00187                     ")"
00188                 )   << "Face contains invalid vertex ID: " << face_ << ".  "
00189                     << "This is not allowed.\n"
00190                     << "Face: " << face_
00191                     << " masterPointID:" << masterPointID_
00192                     << " masterEdgeID:" << masterEdgeID_
00193                     << " masterFaceID:" << masterFaceID_
00194                     << " patchID:" << patchID_
00195                     << " owner:" << owner_
00196                     << " neighbour:" << neighbour_
00197                     << abort(FatalError);
00198             }
00199 
00200             if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
00201             {
00202                 FatalErrorIn
00203                 (
00204                     "polyAddFace\n"
00205                     "(\n"
00206                     "    const face& f,\n"
00207                     "    const label owner,"
00208                     "    const label neighbour,\n"
00209                     "    const label masterPointID,\n"
00210                     "    const label masterEdgeID,\n"
00211                     "    const label masterFaceID,\n"
00212                     "    const bool flipFaceFlux,\n"
00213                     "    const label patchID,\n"
00214                     "    const label zoneID,\n"
00215                     "    const bool zoneFlip\n"
00216                     ")"
00217                 )   << "Face owner and neighbour are identical.  "
00218                     << "This is not allowed.\n"
00219                     << "Face: " << face_
00220                     << " masterPointID:" << masterPointID_
00221                     << " masterEdgeID:" << masterEdgeID_
00222                     << " masterFaceID:" << masterFaceID_
00223                     << " patchID:" << patchID_
00224                     << " owner:" << owner_
00225                     << " neighbour:" << neighbour_
00226                     << abort(FatalError);
00227             }
00228 
00229             if (neighbour_ >= 0 && patchID >= 0)
00230             {
00231                 FatalErrorIn
00232                 (
00233                     "polyAddFace\n"
00234                     "(\n"
00235                     "    const face& f,\n"
00236                     "    const label owner,"
00237                     "    const label neighbour,\n"
00238                     "    const label masterPointID,\n"
00239                     "    const label masterEdgeID,\n"
00240                     "    const label masterFaceID,\n"
00241                     "    const bool flipFaceFlux,\n"
00242                     "    const label patchID,\n"
00243                     "    const label zoneID,\n"
00244                     "    const bool zoneFlip\n"
00245                     ")"
00246                 )   << "Patch face has got a neighbour.  Patch ID: " << patchID
00247                     << ".  This is not allowed.\n"
00248                     << "Face: " << face_
00249                     << " masterPointID:" << masterPointID_
00250                     << " masterEdgeID:" << masterEdgeID_
00251                     << " masterFaceID:" << masterFaceID_
00252                     << " patchID:" << patchID_
00253                     << " owner:" << owner_
00254                     << " neighbour:" << neighbour_
00255                     << abort(FatalError);
00256             }
00257 
00258             if (owner_ < 0 && zoneID < 0)
00259             {
00260                 FatalErrorIn
00261                 (
00262                     "polyAddFace\n"
00263                     "(\n"
00264                     "    const face& f,\n"
00265                     "    const label owner,"
00266                     "    const label neighbour,\n"
00267                     "    const label patchID,\n"
00268                     "    const label zoneID"
00269                     ")"
00270                 )   << "Face has no owner and is not in a zone.  "
00271                     << "This is not allowed.\n"
00272                     << "Face: " << face_
00273                     << "Face: " << face_
00274                     << " masterPointID:" << masterPointID_
00275                     << " masterEdgeID:" << masterEdgeID_
00276                     << " masterFaceID:" << masterFaceID_
00277                     << " patchID:" << patchID_
00278                     << " owner:" << owner_
00279                     << " neighbour:" << neighbour_
00280                     << abort(FatalError);
00281             }
00282 
00283             if (zoneID_ == -1 && zoneFlip)
00284             {
00285                 FatalErrorIn
00286                 (
00287                     "polyAddFace\n"
00288                     "(\n"
00289                     "    const face& f,\n"
00290                     "    const label owner,"
00291                     "    const label neighbour,\n"
00292                     "    const label masterPointID,\n"
00293                     "    const label masterEdgeID,\n"
00294                     "    const label masterFaceID,\n"
00295                     "    const label patchID,\n"
00296                     "    const label zoneID,\n"
00297                     "    const bool zoneFlip\n"
00298                     ")"
00299                 )   << "Specified zone flip for a face that does not  "
00300                     << "belong to zone.  This is not allowed.\n"
00301                     << "Face: " << face_
00302                     << " masterPointID:" << masterPointID_
00303                     << " masterEdgeID:" << masterEdgeID_
00304                     << " masterFaceID:" << masterFaceID_
00305                     << " patchID:" << patchID_
00306                     << " owner:" << owner_
00307                     << " neighbour:" << neighbour_
00308                     << abort(FatalError);
00309             }
00310         }
00311 
00312         //- Construct and return a clone
00313         virtual autoPtr<topoAction> clone() const
00314         {
00315             return autoPtr<topoAction>(new polyAddFace(*this));
00316         }
00317 
00318 
00319     // Default Destructor
00320 
00321     // Member Functions
00322 
00323         //- Return face
00324         const face& newFace() const
00325         {
00326             return face_;
00327         }
00328 
00329         //- Return owner cell
00330         label owner() const
00331         {
00332             return owner_;
00333         }
00334 
00335         //- Return neighour cell
00336         label neighbour() const
00337         {
00338             return neighbour_;
00339         }
00340 
00341         //- Is the face mastered by a point
00342         bool isPointMaster() const
00343         {
00344             return masterPointID_ >= 0;
00345         }
00346 
00347         //- Is the face mastered by an edge
00348         bool isEdgeMaster() const
00349         {
00350             return masterEdgeID_ >= 0;
00351         }
00352 
00353         //- Is the face mastered by another face
00354         bool isFaceMaster() const
00355         {
00356             return masterFaceID_ >= 0;
00357         }
00358 
00359         //- Is the face appended with no master
00360         bool appended() const
00361         {
00362             return !isPointMaster() && !isEdgeMaster() && !isFaceMaster();
00363         }
00364 
00365         //- Return master point ID
00366         label masterPointID() const
00367         {
00368             return masterPointID_;
00369         }
00370 
00371         //- Return master edge ID
00372         label masterEdgeID() const
00373         {
00374             return masterEdgeID_;
00375         }
00376 
00377         //- Return master face ID
00378         label masterFaceID() const
00379         {
00380             return masterFaceID_;
00381         }
00382 
00383         //- Does the face flux need to be flipped
00384         bool flipFaceFlux() const
00385         {
00386             return flipFaceFlux_;
00387         }
00388 
00389         //- Does the face belong to a boundary patch?
00390         bool isInPatch() const
00391         {
00392             return patchID_ >= 0;
00393         }
00394 
00395         //- Boundary patch ID
00396         label patchID() const
00397         {
00398             return patchID_;
00399         }
00400 
00401         //- Does the face belong to a zone?
00402         bool isInZone() const
00403         {
00404             return zoneID_ >= 0;
00405         }
00406 
00407         //- Is the face only a zone face (i.e. not belonging to a cell)
00408         bool onlyInZone() const
00409         {
00410             return zoneID_ >= 0 && owner_ < 0 && neighbour_ < 0;
00411         }
00412 
00413         //- Face zone ID
00414         label zoneID() const
00415         {
00416             return zoneID_;
00417         }
00418 
00419         //- Face zone flip
00420         label zoneFlip() const
00421         {
00422             return zoneFlip_;
00423         }
00424 };
00425 
00426 
00427 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00428 
00429 } // End namespace Foam
00430 
00431 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00432 
00433 #endif
00434 
00435 // ************************************************************************* //
For further information go to www.openfoam.org