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
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 #ifndef polyTopoChange_H
00064 #define polyTopoChange_H
00065
00066 #include "autoPtr.H"
00067 #include "DynamicList.H"
00068 #include "labelList.H"
00069 #include "IOobject.H"
00070 #include "typeInfo.H"
00071 #include "pointField.H"
00072 #include "PtrList.H"
00073 #include "cellList.H"
00074 #include "Map.H"
00075 #include "labelHashSet.H"
00076 #include "mapPolyMesh.H"
00077
00078
00079
00080 namespace Foam
00081 {
00082
00083
00084 class face;
00085 class primitiveMesh;
00086 class polyMesh;
00087 class fvMesh;
00088 class Time;
00089 class fileName;
00090 class polyBoundaryMesh;
00091 class polyPatch;
00092 class dictionary;
00093 class topoAction;
00094 class objectMap;
00095
00096
00097
00098
00099
00100 class polyTopoChange
00101 {
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 private:
00170
00171
00172
00173
00174 static const point greatPoint;
00175
00176
00177
00178
00179
00180
00181 const bool strict_;
00182
00183
00184
00185
00186
00187 label nPatches_;
00188
00189
00190
00191
00192
00193 DynamicList<point> points_;
00194
00195
00196 DynamicList<label> pointMap_;
00197
00198
00199
00200 DynamicList<label> reversePointMap_;
00201
00202
00203 Map<label> pointZone_;
00204
00205
00206 labelHashSet retiredPoints_;
00207
00208
00209
00210
00211
00212 DynamicList<face> faces_;
00213
00214
00215 DynamicList<label> region_;
00216
00217
00218 DynamicList<label> faceOwner_;
00219
00220
00221 DynamicList<label> faceNeighbour_;
00222
00223
00224
00225 DynamicList<label> faceMap_;
00226
00227
00228
00229 DynamicList<label> reverseFaceMap_;
00230
00231
00232
00233 Map<label> faceFromPoint_;
00234
00235
00236
00237 Map<label> faceFromEdge_;
00238
00239
00240 labelHashSet flipFaceFlux_;
00241
00242
00243 Map<label> faceZone_;
00244
00245
00246 Map<bool> faceZoneFlip_;
00247
00248
00249 label nActiveFaces_;
00250
00251
00252
00253
00254
00255
00256 DynamicList<label> cellMap_;
00257
00258
00259
00260 DynamicList<label> reverseCellMap_;
00261
00262
00263 Map<label> cellFromPoint_;
00264
00265
00266 Map<label> cellFromEdge_;
00267
00268
00269 Map<label> cellFromFace_;
00270
00271
00272 DynamicList<label> cellZone_;
00273
00274
00275
00276
00277
00278 template<class T>
00279 static void reorder(const labelList& map, DynamicList<T>&);
00280 template<class T>
00281 static void reorder(const labelList& map, List<DynamicList<T> >&);
00282 template<class T>
00283 static void renumberKey(const labelList& map, Map<T>&);
00284
00285
00286 static void renumber(const labelList&, DynamicList<label>&);
00287 static void renumber(const labelList&, labelHashSet&);
00288
00289 static void renumberReverseMap(const labelList&, DynamicList<label>&);
00290
00291
00292 static void renumberCompact(const labelList&, labelList&);
00293
00294
00295 static void countMap
00296 (
00297 const labelList& map,
00298 const labelList& reverseMap,
00299 label& nAdd,
00300 label& nInflate,
00301 label& nMerge,
00302 label& nRemove
00303 );
00304
00305
00306 static void writeMeshStats(const polyMesh& mesh, Ostream&);
00307
00308
00309
00310 static void getMergeSets
00311 (
00312 const labelList& reverseCellMap,
00313 const labelList& cellMap,
00314 List<objectMap>& cellsFromCells
00315 );
00316
00317
00318 void checkFace
00319 (
00320 const face&,
00321 const label faceI,
00322 const label own,
00323 const label nei,
00324 const label patchI,
00325 const label zoneI
00326 ) const;
00327
00328
00329 void makeCells
00330 (
00331 const label nActiveFaces,
00332 labelList& cellFaces,
00333 labelList& cellFaceOffsets
00334 ) const;
00335
00336
00337 void getFaceOrder
00338 (
00339 const label nActiveFaces,
00340 const labelList& cellFaces,
00341 const labelList& cellFaceOffsets,
00342
00343 labelList& oldToNew,
00344 labelList& patchSizes,
00345 labelList& patchStarts
00346 ) const;
00347
00348
00349 void reorderCompactFaces
00350 (
00351 const label newSize,
00352 const labelList& oldToNew
00353 );
00354
00355
00356
00357 void compact
00358 (
00359 labelList& patchSizes,
00360 labelList& patchStarts
00361 );
00362
00363
00364 static labelList selectFaces
00365 (
00366 const primitiveMesh&,
00367 const labelList& faceLabels,
00368 const bool internalFacesOnly
00369 );
00370
00371
00372 void calcPatchPointMap
00373 (
00374 const List<Map<label> >&,
00375 const labelList&,
00376 const polyBoundaryMesh&,
00377 labelListList&
00378 ) const;
00379
00380 void calcFaceInflationMaps
00381 (
00382 const polyMesh&,
00383 List<objectMap>&,
00384 List<objectMap>&,
00385 List<objectMap>&
00386 ) const;
00387
00388 void calcCellInflationMaps
00389 (
00390 const polyMesh&,
00391 List<objectMap>&,
00392 List<objectMap>&,
00393 List<objectMap>&,
00394 List<objectMap>&
00395 ) const;
00396
00397 void resetZones
00398 (
00399 const polyMesh&,
00400 polyMesh&,
00401 labelListList&,
00402 labelListList&,
00403 labelListList&
00404 ) const;
00405
00406 void calcFaceZonePointMap
00407 (
00408 const polyMesh&,
00409 const List<Map<label> >&,
00410 labelListList&
00411 ) const;
00412
00413
00414
00415
00416
00417 static face rotateFace(const face& f, const label nPos);
00418
00419
00420 void reorderCoupledFaces
00421 (
00422 const bool syncParallel,
00423 const polyBoundaryMesh&,
00424 const labelList& patchStarts,
00425 const labelList& patchSizes,
00426 const pointField& points
00427 );
00428
00429 void compactAndReorder
00430 (
00431 const polyMesh&,
00432 const bool syncParallel,
00433 pointField& newPoints,
00434 labelList& patchSizes,
00435 labelList& patchStarts,
00436 List<objectMap>& pointsFromPoints,
00437 List<objectMap>& facesFromPoints,
00438 List<objectMap>& facesFromEdges,
00439 List<objectMap>& facesFromFaces,
00440 List<objectMap>& cellsFromPoints,
00441 List<objectMap>& cellsFromEdges,
00442 List<objectMap>& cellsFromFaces,
00443 List<objectMap>& cellsFromCells,
00444 List<Map<label> >& oldPatchMeshPointMaps,
00445 labelList& oldPatchNMeshPoints,
00446 labelList& oldPatchStarts,
00447 List<Map<label> >& oldFaceZoneMeshPointMaps
00448 );
00449
00450 public:
00451
00452
00453 ClassName("polyTopoChange");
00454
00455
00456
00457
00458
00459
00460 polyTopoChange(const polyMesh& mesh, const bool strict = true);
00461
00462
00463
00464
00465
00466
00467
00468 const DynamicList<point>& points() const
00469 {
00470 return points_;
00471 }
00472
00473 const DynamicList<face>& faces() const
00474 {
00475 return faces_;
00476 }
00477
00478 const DynamicList<label>& region()const
00479 {
00480 return region_;
00481 }
00482
00483 const DynamicList<label>& faceOwner()const
00484 {
00485 return faceOwner_;
00486 }
00487
00488 const DynamicList<label>& faceNeighbour()const
00489 {
00490 return faceNeighbour_;
00491 }
00492
00493
00494 inline bool pointRemoved(const label pointI) const;
00495
00496 inline bool faceRemoved(const label faceI) const;
00497
00498 inline bool cellRemoved(const label cellI) const;
00499
00500
00501
00502
00503
00504 void clear();
00505
00506
00507
00508 void addMesh
00509 (
00510 const polyMesh&,
00511 const labelList& patchMap,
00512 const labelList& pointZoneMap,
00513 const labelList& faceZoneMap,
00514 const labelList& cellZoneMap
00515 );
00516
00517
00518 void movePoints(const pointField& newPoints);
00519
00520
00521 label setAction(const topoAction& action);
00522
00523
00524
00525
00526
00527 label addPoint
00528 (
00529 const point&,
00530 const label masterPointID,
00531 const label zoneID,
00532 const bool inCell
00533 );
00534
00535
00536
00537
00538 void modifyPoint
00539 (
00540 const label,
00541 const point&,
00542 const label newZoneID,
00543 const bool inCell
00544 );
00545
00546
00547 void removePoint(const label, const label);
00548
00549
00550
00551 label addFace
00552 (
00553 const face& f,
00554 const label own,
00555 const label nei,
00556 const label masterPointID,
00557 const label masterEdgeID,
00558 const label masterFaceID,
00559 const bool flipFaceFlux,
00560 const label patchID,
00561 const label zoneID,
00562 const bool zoneFlip
00563 );
00564
00565
00566 void modifyFace
00567 (
00568 const face& f,
00569 const label faceI,
00570 const label own,
00571 const label nei,
00572 const bool flipFaceFlux,
00573 const label patchID,
00574 const label zoneID,
00575 const bool zoneFlip
00576 );
00577
00578
00579 void removeFace(const label, const label);
00580
00581
00582 label addCell
00583 (
00584 const label masterPointID,
00585 const label masterEdgeID,
00586 const label masterFaceID,
00587 const label masterCellID,
00588 const label zoneID
00589 );
00590
00591
00592 void modifyCell(const label, const label zoneID);
00593
00594
00595 void removeCell(const label, const label);
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608 autoPtr<mapPolyMesh> changeMesh
00609 (
00610 polyMesh& mesh,
00611 const bool inflate,
00612 const bool syncParallel = true
00613 );
00614
00615
00616 autoPtr<mapPolyMesh> makeMesh
00617 (
00618 autoPtr<fvMesh>& newMesh,
00619 const IOobject& io,
00620 const fvMesh& mesh,
00621 const bool syncParallel = true
00622 );
00623 };
00624
00625
00626
00627
00628 }
00629
00630
00631
00632 #include "polyTopoChangeI.H"
00633
00634 #ifdef NoRepository
00635 # include "polyTopoChangeTemplates.C"
00636 #endif
00637
00638
00639
00640 #endif
00641
00642
Copyright © 2000-2007 OpenCFD Ltd