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