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 directPolyTopoChange_H
00064 #define directPolyTopoChange_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 directPolyTopoChange
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
00290 static void renumberCompact(const labelList&, labelList&);
00291
00292
00293
00294
00295
00296 inline bool pointRemoved(const label pointI) const;
00297 inline bool faceRemoved(const label faceI) const;
00298 inline bool cellRemoved(const label cellI) const;
00299
00300
00301 void checkFace
00302 (
00303 const face&,
00304 const label faceI,
00305 const label own,
00306 const label nei,
00307 const label patchI,
00308 const label zoneI
00309 ) const;
00310
00311
00312 void makeCells
00313 (
00314 const label nActiveFaces,
00315 labelList& cellFaces,
00316 labelList& cellFaceOffsets
00317 ) const;
00318
00319
00320 labelList getFaceOrder
00321 (
00322 const label nActiveFaces,
00323 const labelList& cellFaces,
00324 const labelList& cellFaceOffsets
00325 ) const;
00326
00327
00328 void reorderCompactFaces
00329 (
00330 const label newSize,
00331 const labelList& oldToNew
00332 );
00333
00334
00335
00336 void compact();
00337
00338
00339 void calcPatchSizes
00340 (
00341 labelList& patchSizes,
00342 labelList& patchStarts
00343 ) const;
00344
00345
00346 static labelList selectFaces
00347 (
00348 const primitiveMesh&,
00349 const labelList& faceLabels,
00350 const bool internalFacesOnly
00351 );
00352
00353
00354 void calcPatchPointMap
00355 (
00356 const List<Map<label> >&,
00357 const labelList&,
00358 const polyBoundaryMesh&,
00359 labelListList&
00360 ) const;
00361
00362 void calcFaceInflationMaps
00363 (
00364 const polyMesh&,
00365 List<objectMap>&,
00366 List<objectMap>&
00367 ) const;
00368
00369 void calcCellInflationMaps
00370 (
00371 const polyMesh&,
00372 List<objectMap>&,
00373 List<objectMap>&,
00374 List<objectMap>&
00375 ) const;
00376
00377 void resetZones
00378 (
00379 polyMesh&,
00380 labelListList&,
00381 labelListList&,
00382 labelListList&
00383 ) const;
00384
00385 void calcFaceZonePointMap
00386 (
00387 polyMesh&,
00388 const List<Map<label> >&,
00389 labelListList&
00390 ) const;
00391
00392
00393
00394
00395
00396 static face rotateFace(const face& f, const label nPos);
00397
00398
00399 void reorderCoupledFaces
00400 (
00401 const polyBoundaryMesh&,
00402 const labelList& patchStarts,
00403 const labelList& patchSizes,
00404 const pointField& points
00405 );
00406
00407 public:
00408
00409
00410 ClassName("directPolyTopoChange");
00411
00412
00413
00414
00415
00416
00417 directPolyTopoChange(const polyMesh& mesh, const bool strict = true);
00418
00419
00420
00421
00422
00423
00424
00425 const DynamicList<point>& points() const
00426 {
00427 return points_;
00428 }
00429
00430 const DynamicList<face>& faces() const
00431 {
00432 return faces_;
00433 }
00434
00435 const DynamicList<label>& region()const
00436 {
00437 return region_;
00438 }
00439
00440 const DynamicList<label>& faceOwner()const
00441 {
00442 return faceOwner_;
00443 }
00444
00445 const DynamicList<label>& faceNeighbour()const
00446 {
00447 return faceNeighbour_;
00448 }
00449
00450
00451
00452
00453
00454 void clear();
00455
00456
00457
00458 void addMesh
00459 (
00460 const polyMesh&,
00461 const labelList& patchMap,
00462 const labelList& pointZoneMap,
00463 const labelList& faceZoneMap,
00464 const labelList& cellZoneMap
00465 );
00466
00467
00468
00469 label setAction(const topoAction& action);
00470
00471
00472
00473
00474
00475 label addPoint
00476 (
00477 const point&,
00478 const label masterPointID,
00479 const label zoneID,
00480 const bool inCell
00481 );
00482
00483
00484
00485
00486 void modifyPoint
00487 (
00488 const label,
00489 const point&,
00490 const label newZoneID,
00491 const bool inCell
00492 );
00493
00494
00495 void removePoint(const label);
00496
00497
00498
00499 label addFace
00500 (
00501 const face& f,
00502 const label own,
00503 const label nei,
00504 const label masterPointID,
00505 const label masterEdgeID,
00506 const label masterFaceID,
00507 const bool flipFaceFlux,
00508 const label patchID,
00509 const label zoneID,
00510 const bool zoneFlip
00511 );
00512
00513
00514 void modifyFace
00515 (
00516 const face& f,
00517 const label faceI,
00518 const label own,
00519 const label nei,
00520 const bool flipFaceFlux,
00521 const label patchID,
00522 const label zoneID,
00523 const bool zoneFlip
00524 );
00525
00526
00527 void removeFace(const label);
00528
00529
00530 label addCell
00531 (
00532 const label masterPointID,
00533 const label masterEdgeID,
00534 const label masterFaceID,
00535 const label masterCellID,
00536 const label zoneID
00537 );
00538
00539
00540 void modifyCell(const label, const label zoneID);
00541
00542
00543 void removeCell(const label);
00544
00545
00546
00547
00548
00549
00550
00551 autoPtr<mapPolyMesh> changeMesh(polyMesh& mesh);
00552 };
00553
00554
00555
00556
00557 }
00558
00559
00560
00561 #include "directPolyTopoChangeI.H"
00562
00563 #ifdef NoRepository
00564 # include "directPolyTopoChangeTemplates.C"
00565 #endif
00566
00567
00568
00569 #endif
00570
00571