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 #include "Map.H"
00028
00029
00030
00031
00032 template
00033 <
00034 class Face,
00035 template<class> class FaceList,
00036 class PointField,
00037 class PointType
00038 >
00039
00040 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00041 PrimitivePatch
00042 (
00043 const FaceList<Face>& faces,
00044 const Field<PointType>& points
00045 )
00046 :
00047 FaceList<Face>(faces),
00048 points_(points),
00049 edgesPtr_(NULL),
00050 nInternalEdges_(-1),
00051 boundaryPointsPtr_(NULL),
00052 faceFacesPtr_(NULL),
00053 edgeFacesPtr_(NULL),
00054 faceEdgesPtr_(NULL),
00055 pointEdgesPtr_(NULL),
00056 pointFacesPtr_(NULL),
00057 localFacesPtr_(NULL),
00058 meshPointsPtr_(NULL),
00059 meshPointMapPtr_(NULL),
00060 edgeLoopsPtr_(NULL),
00061 localPointsPtr_(NULL),
00062 localPointOrderPtr_(NULL),
00063 faceNormalsPtr_(NULL),
00064 pointNormalsPtr_(NULL)
00065 {}
00066
00067
00068
00069 template
00070 <
00071 class Face,
00072 template<class> class FaceList,
00073 class PointField,
00074 class PointType
00075 >
00076
00077 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00078 PrimitivePatch
00079 (
00080 FaceList<Face>& faces,
00081 Field<PointType>& points,
00082 const bool reUse
00083 )
00084 :
00085 FaceList<Face>(faces, reUse),
00086 points_(points, reUse),
00087 edgesPtr_(NULL),
00088 nInternalEdges_(-1),
00089 boundaryPointsPtr_(NULL),
00090 faceFacesPtr_(NULL),
00091 edgeFacesPtr_(NULL),
00092 faceEdgesPtr_(NULL),
00093 pointEdgesPtr_(NULL),
00094 pointFacesPtr_(NULL),
00095 localFacesPtr_(NULL),
00096 meshPointsPtr_(NULL),
00097 meshPointMapPtr_(NULL),
00098 edgeLoopsPtr_(NULL),
00099 localPointsPtr_(NULL),
00100 localPointOrderPtr_(NULL),
00101 faceNormalsPtr_(NULL),
00102 pointNormalsPtr_(NULL)
00103 {}
00104
00105
00106
00107 template
00108 <
00109 class Face,
00110 template<class> class FaceList,
00111 class PointField,
00112 class PointType
00113 >
00114
00115 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00116 PrimitivePatch
00117 (
00118 const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
00119 )
00120 :
00121 PrimitivePatchName(),
00122 FaceList<Face>(pp),
00123 points_(pp.points_),
00124 edgesPtr_(NULL),
00125 nInternalEdges_(-1),
00126 boundaryPointsPtr_(NULL),
00127 faceFacesPtr_(NULL),
00128 edgeFacesPtr_(NULL),
00129 faceEdgesPtr_(NULL),
00130 pointEdgesPtr_(NULL),
00131 pointFacesPtr_(NULL),
00132 localFacesPtr_(NULL),
00133 meshPointsPtr_(NULL),
00134 meshPointMapPtr_(NULL),
00135 edgeLoopsPtr_(NULL),
00136 localPointsPtr_(NULL),
00137 localPointOrderPtr_(NULL),
00138 faceNormalsPtr_(NULL),
00139 pointNormalsPtr_(NULL)
00140 {}
00141
00142
00143
00144
00145 template
00146 <
00147 class Face,
00148 template<class> class FaceList,
00149 class PointField,
00150 class PointType
00151 >
00152
00153 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::~PrimitivePatch()
00154 {
00155 clearOut();
00156 }
00157
00158
00159
00160
00161
00162 template
00163 <
00164 class Face,
00165 template<class> class FaceList,
00166 class PointField,
00167 class PointType
00168 >
00169
00170 void
00171 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00172 movePoints
00173 (
00174 const Field<PointType>&
00175 )
00176 {
00177 if (debug)
00178 {
00179 Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
00180 << "movePoints() : "
00181 << "recalculating PrimitivePatch geometry following mesh motion"
00182 << endl;
00183 }
00184
00185 clearGeom();
00186 }
00187
00188
00189 template
00190 <
00191 class Face,
00192 template<class> class FaceList,
00193 class PointField,
00194 class PointType
00195 >
00196
00197 const Foam::edgeList&
00198 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00199 edges() const
00200 {
00201 if (!edgesPtr_)
00202 {
00203 calcAddressing();
00204 }
00205
00206 return *edgesPtr_;
00207 }
00208
00209
00210 template
00211 <
00212 class Face,
00213 template<class> class FaceList,
00214 class PointField,
00215 class PointType
00216 >
00217
00218 Foam::label
00219 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00220 nInternalEdges() const
00221 {
00222 if (!edgesPtr_)
00223 {
00224 calcAddressing();
00225 }
00226
00227 return nInternalEdges_;
00228 }
00229
00230
00231 template
00232 <
00233 class Face,
00234 template<class> class FaceList,
00235 class PointField,
00236 class PointType
00237 >
00238
00239 const Foam::labelList&
00240 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00241 boundaryPoints() const
00242 {
00243 if (!boundaryPointsPtr_)
00244 {
00245 calcBdryPoints();
00246 }
00247
00248 return *boundaryPointsPtr_;
00249 }
00250
00251
00252 template
00253 <
00254 class Face,
00255 template<class> class FaceList,
00256 class PointField,
00257 class PointType
00258 >
00259
00260 const Foam::labelListList&
00261 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00262 faceFaces() const
00263 {
00264 if (!faceFacesPtr_)
00265 {
00266 calcAddressing();
00267 }
00268
00269 return *faceFacesPtr_;
00270 }
00271
00272
00273 template
00274 <
00275 class Face,
00276 template<class> class FaceList,
00277 class PointField,
00278 class PointType
00279 >
00280
00281 const Foam::labelListList&
00282 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00283 edgeFaces() const
00284 {
00285 if (!edgeFacesPtr_)
00286 {
00287 calcAddressing();
00288 }
00289
00290 return *edgeFacesPtr_;
00291 }
00292
00293
00294 template
00295 <
00296 class Face,
00297 template<class> class FaceList,
00298 class PointField,
00299 class PointType
00300 >
00301
00302 const Foam::labelListList&
00303 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00304 faceEdges() const
00305 {
00306 if (!faceEdgesPtr_)
00307 {
00308 calcAddressing();
00309 }
00310
00311 return *faceEdgesPtr_;
00312 }
00313
00314
00315 template
00316 <
00317 class Face,
00318 template<class> class FaceList,
00319 class PointField,
00320 class PointType
00321 >
00322
00323 const Foam::labelListList&
00324 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00325 pointEdges() const
00326 {
00327 if (!pointEdgesPtr_)
00328 {
00329 calcPointEdges();
00330 }
00331
00332 return *pointEdgesPtr_;
00333 }
00334
00335
00336 template
00337 <
00338 class Face,
00339 template<class> class FaceList,
00340 class PointField,
00341 class PointType
00342 >
00343
00344 const Foam::labelListList&
00345 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00346 pointFaces() const
00347 {
00348 if (!pointFacesPtr_)
00349 {
00350 calcPointFaces();
00351 }
00352
00353 return *pointFacesPtr_;
00354 }
00355
00356
00357 template
00358 <
00359 class Face,
00360 template<class> class FaceList,
00361 class PointField,
00362 class PointType
00363 >
00364
00365 const Foam::List<Face>&
00366 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00367 localFaces() const
00368 {
00369 if (!localFacesPtr_)
00370 {
00371 calcMeshData();
00372 }
00373
00374 return *localFacesPtr_;
00375 }
00376
00377
00378 template
00379 <
00380 class Face,
00381 template<class> class FaceList,
00382 class PointField,
00383 class PointType
00384 >
00385
00386 const Foam::labelList&
00387 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00388 meshPoints() const
00389 {
00390 if (!meshPointsPtr_)
00391 {
00392 calcMeshData();
00393 }
00394
00395 return *meshPointsPtr_;
00396 }
00397
00398
00399 template
00400 <
00401 class Face,
00402 template<class> class FaceList,
00403 class PointField,
00404 class PointType
00405 >
00406
00407 const Foam::Map<Foam::label>&
00408 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00409 meshPointMap() const
00410 {
00411 if (!meshPointMapPtr_)
00412 {
00413 calcMeshPointMap();
00414 }
00415
00416 return *meshPointMapPtr_;
00417 }
00418
00419
00420 template
00421 <
00422 class Face,
00423 template<class> class FaceList,
00424 class PointField,
00425 class PointType
00426 >
00427
00428 const Foam::Field<PointType>&
00429 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00430 localPoints() const
00431 {
00432 if (!localPointsPtr_)
00433 {
00434 calcLocalPoints();
00435 }
00436
00437 return *localPointsPtr_;
00438 }
00439
00440
00441 template
00442 <
00443 class Face,
00444 template<class> class FaceList,
00445 class PointField,
00446 class PointType
00447 >
00448
00449 const Foam::labelList&
00450 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00451 localPointOrder() const
00452 {
00453 if (!localPointOrderPtr_)
00454 {
00455 calcLocalPointOrder();
00456 }
00457
00458 return *localPointOrderPtr_;
00459 }
00460
00461
00462 template
00463 <
00464 class Face,
00465 template<class> class FaceList,
00466 class PointField,
00467 class PointType
00468 >
00469
00470 Foam::label
00471 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00472 whichPoint
00473 (
00474 const label gp
00475 ) const
00476 {
00477 Map<label>::const_iterator fnd = meshPointMap().find(gp);
00478
00479 if (fnd != meshPointMap().end())
00480 {
00481 return fnd();
00482 }
00483 else
00484 {
00485
00486 return -1;
00487 }
00488 }
00489
00490
00491 template
00492 <
00493 class Face,
00494 template<class> class FaceList,
00495 class PointField,
00496 class PointType
00497 >
00498
00499 const Foam::Field<PointType>&
00500 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00501 faceNormals() const
00502 {
00503 if (!faceNormalsPtr_)
00504 {
00505 calcFaceNormals();
00506 }
00507
00508 return *faceNormalsPtr_;
00509 }
00510
00511
00512 template
00513 <
00514 class Face,
00515 template<class> class FaceList,
00516 class PointField,
00517 class PointType
00518 >
00519
00520 const Foam::Field<PointType>&
00521 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00522 pointNormals() const
00523 {
00524 if (!pointNormalsPtr_)
00525 {
00526 calcPointNormals();
00527 }
00528
00529 return *pointNormalsPtr_;
00530 }
00531
00532
00533
00534
00535 template
00536 <
00537 class Face,
00538 template<class> class FaceList,
00539 class PointField,
00540 class PointType
00541 >
00542
00543 void
00544 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00545 operator=
00546 (
00547 const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
00548 )
00549 {
00550 clearOut();
00551
00552 FaceList<Face>::operator=(pp);
00553 }
00554
00555
00556
00557 #include "PrimitivePatchAddressing.C"
00558 #include "PrimitivePatchEdgeLoops.C"
00559 #include "PrimitivePatchClear.C"
00560 #include "PrimitivePatchBdryPoints.C"
00561 #include "PrimitivePatchLocalPointOrder.C"
00562 #include "PrimitivePatchMeshData.C"
00563 #include "PrimitivePatchMeshEdges.C"
00564 #include "PrimitivePatchPointAddressing.C"
00565 #include "PrimitivePatchProjectPoints.C"
00566 #include "PrimitivePatchCheck.C"
00567
00568