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 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
00048
00049
00050 class polyModifyFace
00051 :
00052 public topoAction
00053 {
00054
00055
00056
00057 face face_;
00058
00059
00060 label faceID_;
00061
00062
00063 label owner_;
00064
00065
00066 label neighbour_;
00067
00068
00069 bool flipFaceFlux_;
00070
00071
00072 label patchID_;
00073
00074
00075 bool removeFromZone_;
00076
00077
00078 label zoneID_;
00079
00080
00081 bool zoneFlip_;
00082
00083
00084 public:
00085
00086
00087
00088
00089 TypeName("modifyFace");
00090
00091
00092
00093
00094
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
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
00258 virtual autoPtr<topoAction> clone() const
00259 {
00260 return autoPtr<topoAction>(new polyModifyFace(*this));
00261 }
00262
00263
00264
00265
00266
00267
00268
00269 const face& newFace() const
00270 {
00271 return face_;
00272 }
00273
00274
00275 label faceID() const
00276 {
00277 return faceID_;
00278 }
00279
00280
00281 label owner() const
00282 {
00283 return owner_;
00284 }
00285
00286
00287 label neighbour() const
00288 {
00289 return neighbour_;
00290 }
00291
00292
00293 bool flipFaceFlux() const
00294 {
00295 return flipFaceFlux_;
00296 }
00297
00298
00299 bool isInPatch() const
00300 {
00301 return patchID_ >= 0;
00302 }
00303
00304
00305 label patchID() const
00306 {
00307 return patchID_;
00308 }
00309
00310
00311 bool isInZone() const
00312 {
00313 return zoneID_ >= 0;
00314 }
00315
00316
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
00328 label zoneID() const
00329 {
00330 return zoneID_;
00331 }
00332
00333
00334 label zoneFlip() const
00335 {
00336 return zoneFlip_;
00337 }
00338 };
00339
00340
00341
00342
00343 }
00344
00345
00346
00347 #endif
00348
00349