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