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
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef distributedTriSurfaceMesh_H
00050 #define distributedTriSurfaceMesh_H
00051
00052 #include "triSurfaceMesh.H"
00053 #include "IOdictionary.H"
00054 #include "Pair.H"
00055 #include "globalIndex.H"
00056
00057
00058
00059 namespace Foam
00060 {
00061
00062 class mapDistribute;
00063 class decompositionMethod;
00064
00065
00066 typedef Pair<point> segment;
00067 template<>
00068 inline bool contiguous<segment>() {return contiguous<point>();}
00069
00070
00071
00072
00073
00074
00075 class distributedTriSurfaceMesh
00076 :
00077 public triSurfaceMesh
00078 {
00079 public:
00080
00081
00082
00083 enum distributionType
00084 {
00085 FOLLOW = 0,
00086 INDEPENDENT = 1,
00087 FROZEN = 2
00088 };
00089
00090 static const NamedEnum<distributionType, 3> distributionTypeNames_;
00091
00092 private:
00093
00094
00095
00096
00097 scalar mergeDist_;
00098
00099
00100 autoPtr<decompositionMethod> decomposer_;
00101
00102
00103 IOdictionary dict_;
00104
00105
00106 List<List<treeBoundBox> > procBb_;
00107
00108
00109 mutable autoPtr<globalIndex> globalTris_;
00110
00111
00112 distributionType distType_;
00113
00114
00115
00116
00117
00118
00119
00120 bool read();
00121
00122
00123
00124
00125 static bool isLocal
00126 (
00127 const List<treeBoundBox>& myBbs,
00128 const point& start,
00129 const point& end
00130 );
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 void distributeSegment
00149 (
00150 const label,
00151 const point& start,
00152 const point& end,
00153
00154 DynamicList<segment>&,
00155 DynamicList<label>&,
00156 List<DynamicList<label> >&
00157 ) const;
00158
00159
00160
00161 autoPtr<mapDistribute> distributeSegments
00162 (
00163 const pointField& start,
00164 const pointField& end,
00165
00166 List<segment>& allSegments,
00167 List<label>& allSegmentMap
00168 ) const;
00169
00170
00171 void findLine
00172 (
00173 const bool nearestIntersection,
00174 const pointField& start,
00175 const pointField& end,
00176 List<pointIndexHit>& info
00177 ) const;
00178
00179
00180
00181
00182
00183
00184
00185 autoPtr<mapDistribute> calcLocalQueries
00186 (
00187 const List<pointIndexHit>&,
00188 labelList& triangleIndex
00189 ) const;
00190
00191
00192
00193
00194 label calcOverlappingProcs
00195 (
00196 const point& centre,
00197 const scalar radiusSqr,
00198 boolList& overlaps
00199 ) const;
00200
00201 autoPtr<mapDistribute> calcLocalQueries
00202 (
00203 const pointField& centres,
00204 const scalarField& radiusSqr,
00205
00206 pointField& allCentres,
00207 scalarField& allRadiusSqr,
00208 labelList& allSegmentMap
00209 ) const;
00210
00211
00212
00213
00214
00215 List<List<treeBoundBox> > independentlyDistributedBbs
00216 (
00217 const triSurface&
00218 );
00219
00220
00221 void calcBounds(boundBox& bb, label& nPoints) const;
00222
00223
00224 static bool overlaps
00225 (
00226 const List<treeBoundBox>& bb,
00227 const point& p0,
00228 const point& p1,
00229 const point& p2
00230 );
00231
00232
00233 static void subsetMeshMap
00234 (
00235 const triSurface& s,
00236 const boolList& include,
00237 const label nIncluded,
00238 labelList& newToOldPoints,
00239 labelList& oldToNewPoints,
00240 labelList& newToOldFaces
00241 );
00242
00243
00244 static triSurface subsetMesh
00245 (
00246 const triSurface& s,
00247 const labelList& newToOldPoints,
00248 const labelList& oldToNewPoints,
00249 const labelList& newToOldFaces
00250 );
00251
00252
00253 static triSurface subsetMesh
00254 (
00255 const triSurface& s,
00256 const boolList& include,
00257 labelList& newToOldPoints,
00258 labelList& newToOldFaces
00259 );
00260
00261
00262 static triSurface subsetMesh
00263 (
00264 const triSurface& s,
00265 const labelList& newToOldFaces,
00266 labelList& newToOldPoints
00267 );
00268
00269
00270 static label findTriangle
00271 (
00272 const List<labelledTri>& allFaces,
00273 const labelListList& allPointFaces,
00274 const labelledTri& otherF
00275 );
00276
00277
00278 static void merge
00279 (
00280 const scalar mergeDist,
00281 const List<labelledTri>& subTris,
00282 const pointField& subPoints,
00283
00284 List<labelledTri>& allTris,
00285 pointField& allPoints,
00286
00287 labelList& faceConstructMap,
00288 labelList& pointConstructMap
00289 );
00290
00291
00292 template<class Type>
00293 void distributeFields(const mapDistribute& map);
00294
00295
00296
00297 distributedTriSurfaceMesh(const distributedTriSurfaceMesh&);
00298
00299
00300 void operator=(const distributedTriSurfaceMesh&);
00301
00302
00303 public:
00304
00305
00306 TypeName("distributedTriSurfaceMesh");
00307
00308
00309
00310
00311
00312 distributedTriSurfaceMesh
00313 (
00314 const IOobject&,
00315 const triSurface&,
00316 const dictionary& dict
00317 );
00318
00319
00320 distributedTriSurfaceMesh(const IOobject& io);
00321
00322
00323
00324 distributedTriSurfaceMesh
00325 (
00326 const IOobject& io,
00327 const dictionary& dict
00328 );
00329
00330
00331
00332
00333 virtual ~distributedTriSurfaceMesh();
00334
00335
00336 void clearOut();
00337
00338
00339
00340
00341
00342 const globalIndex& globalTris() const;
00343
00344
00345
00346
00347
00348
00349 virtual bool hasVolumeType() const
00350 {
00351 return false;
00352 }
00353
00354
00355 virtual label globalSize() const
00356 {
00357 return globalTris().size();
00358 }
00359
00360 virtual void findNearest
00361 (
00362 const pointField& sample,
00363 const scalarField& nearestDistSqr,
00364 List<pointIndexHit>&
00365 ) const;
00366
00367 virtual void findLine
00368 (
00369 const pointField& start,
00370 const pointField& end,
00371 List<pointIndexHit>&
00372 ) const;
00373
00374 virtual void findLineAny
00375 (
00376 const pointField& start,
00377 const pointField& end,
00378 List<pointIndexHit>&
00379 ) const;
00380
00381
00382 virtual void findLineAll
00383 (
00384 const pointField& start,
00385 const pointField& end,
00386 List<List<pointIndexHit> >&
00387 ) const;
00388
00389
00390 virtual void getRegion
00391 (
00392 const List<pointIndexHit>&,
00393 labelList& region
00394 ) const;
00395
00396
00397 virtual void getNormal
00398 (
00399 const List<pointIndexHit>&,
00400 vectorField& normal
00401 ) const;
00402
00403
00404
00405 virtual void getVolumeType
00406 (
00407 const pointField&,
00408 List<volumeType>&
00409 ) const;
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422 virtual void distribute
00423 (
00424 const List<treeBoundBox>&,
00425 const bool keepNonLocal,
00426 autoPtr<mapDistribute>& faceMap,
00427 autoPtr<mapDistribute>& pointMap
00428 );
00429
00430
00431
00432
00433
00434
00435 virtual void getField
00436 (
00437 const word& fieldName,
00438 const List<pointIndexHit>&,
00439 labelList& values
00440 ) const;
00441
00442
00443 static triSurface overlappingSurface
00444 (
00445 const triSurface&,
00446 const List<treeBoundBox>&,
00447 labelList& subPointMap,
00448 labelList& subFaceMap
00449 );
00450
00451
00452
00453 void writeStats(Ostream& os) const;
00454
00455
00456
00457
00458
00459 virtual bool writeObject
00460 (
00461 IOstream::streamFormat fmt,
00462 IOstream::versionNumber ver,
00463 IOstream::compressionType cmp
00464 ) const;
00465
00466 };
00467
00468
00469
00470
00471 }
00472
00473
00474
00475 #ifdef NoRepository
00476 # include "distributedTriSurfaceMeshTemplates.C"
00477 #endif
00478
00479
00480
00481 #endif
00482
00483