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