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 #ifndef vtkPV3Foam_H
00059 #define vtkPV3Foam_H
00060
00061
00062 #ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
00063 # define VTK_EXCLUDE_STRSTREAM_HEADERS
00064 #endif
00065
00066 #include "className.H"
00067 #include "fileName.H"
00068 #include "stringList.H"
00069 #include "wordList.H"
00070 #include "primitivePatch.H"
00071 #include "PrimitivePatchInterpolation.H"
00072 #include "volPointInterpolation.H"
00073
00074 #undef VTKPV3FOAM_DUALPORT
00075
00076
00077
00078 class vtkDataArraySelection;
00079 class vtkDataSet;
00080 class vtkPoints;
00081 class vtkPV3FoamReader;
00082 class vtkRenderer;
00083 class vtkTextActor;
00084 class vtkMultiBlockDataSet;
00085 class vtkPolyData;
00086 class vtkUnstructuredGrid;
00087 class vtkIndent;
00088
00089
00090
00091 namespace Foam
00092 {
00093
00094
00095 class argList;
00096 class Time;
00097 class fvMesh;
00098 class IOobjectList;
00099 class polyPatch;
00100 class faceSet;
00101 class pointSet;
00102
00103 template<class Type> class IOField;
00104 template<class Type> class List;
00105
00106
00107
00108
00109
00110 class vtkPV3Foam
00111 {
00112
00113
00114
00115 class partInfo
00116 {
00117 const char *name_;
00118 int block_;
00119 int start_;
00120 int size_;
00121
00122 public:
00123
00124 partInfo(const char *name, const int blockNo=0)
00125 :
00126 name_(name),
00127 block_(blockNo),
00128 start_(-1),
00129 size_(0)
00130 {}
00131
00132
00133 int block() const
00134 {
00135 return block_;
00136 }
00137
00138
00139 int block(int blockNo)
00140 {
00141 int prev = block_;
00142 block_ = blockNo;
00143 return prev;
00144 }
00145
00146 const char* name() const
00147 {
00148 return name_;
00149 }
00150
00151 int start() const
00152 {
00153 return start_;
00154 }
00155
00156 int end() const
00157 {
00158 return start_ + size_;
00159 }
00160
00161 int size() const
00162 {
00163 return size_;
00164 }
00165
00166 bool empty() const
00167 {
00168 return !size_;
00169 }
00170
00171 void reset()
00172 {
00173 start_ = -1;
00174 size_ = 0;
00175 }
00176
00177
00178 void operator=(const int i)
00179 {
00180 start_ = i;
00181 size_ = 0;
00182 }
00183
00184
00185 void operator+=(const int n)
00186 {
00187 size_ += n;
00188 }
00189 };
00190
00191
00192
00193 class polyDecomp
00194 {
00195 labelList superCells_;
00196 labelList addPointCellLabels_;
00197 labelList pointMap_;
00198
00199 public:
00200
00201 polyDecomp()
00202 {}
00203
00204
00205 labelList& superCells()
00206 {
00207 return superCells_;
00208 }
00209
00210
00211 const labelList& superCells() const
00212 {
00213 return superCells_;
00214 }
00215
00216
00217 labelList& addPointCellLabels()
00218 {
00219 return addPointCellLabels_;
00220 }
00221
00222
00223 const labelList& addPointCellLabels() const
00224 {
00225 return addPointCellLabels_;
00226 }
00227
00228
00229 labelList& pointMap()
00230 {
00231 return pointMap_;
00232 }
00233
00234
00235 const labelList& pointMap() const
00236 {
00237 return pointMap_;
00238 }
00239
00240
00241
00242 void clear()
00243 {
00244 superCells_.clear();
00245 addPointCellLabels_.clear();
00246 pointMap_.clear();
00247 }
00248 };
00249
00250
00251
00252
00253
00254 vtkPV3FoamReader* reader_;
00255
00256
00257 autoPtr<Time> dbPtr_;
00258
00259
00260 fvMesh* meshPtr_;
00261
00262
00263 word meshRegion_;
00264
00265
00266 fileName meshDir_;
00267
00268
00269 int timeIndex_;
00270
00271
00272 bool meshChanged_;
00273
00274
00275 bool fieldsChanged_;
00276
00277
00278 boolList partStatus_;
00279
00280
00281
00282 labelList partDataset_;
00283
00284
00285
00286 partInfo partInfoVolume_;
00287 partInfo partInfoPatches_;
00288 partInfo partInfoLagrangian_;
00289 partInfo partInfoCellZones_;
00290 partInfo partInfoFaceZones_;
00291 partInfo partInfoPointZones_;
00292 partInfo partInfoCellSets_;
00293 partInfo partInfoFaceSets_;
00294 partInfo partInfoPointSets_;
00295
00296
00297
00298 List<polyDecomp> regionPolyDecomp_;
00299
00300
00301 List<polyDecomp> zonePolyDecomp_;
00302
00303
00304 List<polyDecomp> csetPolyDecomp_;
00305
00306
00307 List<vtkTextActor*> patchTextActorsPtrs_;
00308
00309
00310
00311
00312
00313 static void AddToBlock
00314 (
00315 vtkMultiBlockDataSet* output,
00316 vtkDataSet* dataset,
00317 const partInfo&,
00318 const label datasetNo,
00319 const string& datasetName
00320 );
00321
00322
00323
00324 static vtkDataSet* GetDataSetFromBlock
00325 (
00326 vtkMultiBlockDataSet* output,
00327 const partInfo&,
00328 const label datasetNo
00329 );
00330
00331
00332
00333 static label GetNumberOfDataSets
00334 (
00335 vtkMultiBlockDataSet* output,
00336 const partInfo&
00337 );
00338
00339
00340 void resetCounters();
00341
00342
00343
00344
00345 void updateMeshPartsStatus();
00346
00347
00348 void updateInfoInternalMesh();
00349
00350
00351 void updateInfoLagrangian();
00352
00353
00354 void updateInfoPatches();
00355
00356
00357 void updateInfoSets();
00358
00359
00360 void updateInfoZones();
00361
00362
00363 wordList readZoneNames(const word& zoneType);
00364
00365
00366 template<class Type>
00367 label addToSelection
00368 (
00369 vtkDataArraySelection*,
00370 const IOobjectList&,
00371 const string& suffix=string::null
00372 );
00373
00374
00375 template<template<class> class patchType, class meshType>
00376 void updateInfoFields(vtkDataArraySelection*);
00377
00378
00379 void updateInfoLagrangianFields();
00380
00381
00382
00383
00384
00385 void updateFoamMesh();
00386
00387
00388 void reduceMemory();
00389
00390
00391 void updateVolFields(vtkMultiBlockDataSet*);
00392
00393
00394 void updatePointFields(vtkMultiBlockDataSet*);
00395
00396
00397 void updateLagrangianFields(vtkMultiBlockDataSet*);
00398
00399
00400
00401
00402
00403 void convertMeshVolume(vtkMultiBlockDataSet*, int& blockNo);
00404
00405
00406 void convertMeshLagrangian(vtkMultiBlockDataSet*, int& blockNo);
00407
00408
00409 void convertMeshPatches(vtkMultiBlockDataSet*, int& blockNo);
00410
00411
00412 void convertMeshCellZones(vtkMultiBlockDataSet*, int& blockNo);
00413
00414
00415 void convertMeshFaceZones(vtkMultiBlockDataSet*, int& blockNo);
00416
00417
00418 void convertMeshPointZones(vtkMultiBlockDataSet*, int& blockNo);
00419
00420
00421 void convertMeshCellSets(vtkMultiBlockDataSet*, int& blockNo);
00422
00423
00424 void convertMeshFaceSets(vtkMultiBlockDataSet*, int& blockNo);
00425
00426
00427 void convertMeshPointSets(vtkMultiBlockDataSet*, int& blockNo);
00428
00429
00430
00431
00432
00433 vtkUnstructuredGrid* volumeVTKMesh(const fvMesh&, polyDecomp&);
00434
00435
00436 vtkPolyData* lagrangianVTKMesh
00437 (
00438 const fvMesh&,
00439 const word& cloudName
00440 );
00441
00442
00443 vtkPolyData* patchVTKMesh(const polyPatch&);
00444
00445
00446 vtkPolyData* faceZoneVTKMesh
00447 (
00448 const fvMesh&,
00449 const labelList& faceLabels
00450 );
00451
00452
00453 vtkPolyData* pointZoneVTKMesh
00454 (
00455 const fvMesh&,
00456 const labelList& pointLabels
00457 );
00458
00459
00460 vtkPolyData* faceSetVTKMesh
00461 (
00462 const fvMesh&,
00463 const faceSet&
00464 );
00465
00466
00467 vtkPolyData* pointSetVTKMesh
00468 (
00469 const fvMesh&,
00470 const pointSet&
00471 );
00472
00473
00474
00475
00476 void convertVolFields(vtkMultiBlockDataSet*);
00477
00478
00479 void convertPointFields(vtkMultiBlockDataSet*);
00480
00481
00482 void convertLagrangianFields(vtkMultiBlockDataSet*);
00483
00484
00485
00486
00487 template<class GeoField>
00488 label addObjectsToSelection
00489 (
00490 vtkDataArraySelection*,
00491 const IOobjectList&,
00492 const string& suffix=string::null
00493 );
00494
00495
00496
00497
00498
00499 template<class Type>
00500 void convertVolFields
00501 (
00502 const fvMesh&,
00503 const PtrList<PrimitivePatchInterpolation<primitivePatch> >&,
00504 const IOobjectList&,
00505 vtkMultiBlockDataSet* output
00506 );
00507
00508
00509 template<class Type>
00510 void convertVolFieldBlock
00511 (
00512 const GeometricField<Type, fvPatchField, volMesh>&,
00513 autoPtr<GeometricField<Type, pointPatchField, pointMesh> >&,
00514 vtkMultiBlockDataSet* output,
00515 const partInfo& selector,
00516 const List<polyDecomp>& decompLst
00517 );
00518
00519
00520 template<class Type>
00521 void convertVolField
00522 (
00523 const GeometricField<Type, fvPatchField, volMesh>&,
00524 vtkMultiBlockDataSet* output,
00525 const partInfo&,
00526 const label datasetNo,
00527 const polyDecomp&
00528 );
00529
00530
00531 template<class Type>
00532 void convertPatchField
00533 (
00534 const word& name,
00535 const Field<Type>&,
00536 vtkMultiBlockDataSet* output,
00537 const partInfo&,
00538 const label datasetNo
00539 );
00540
00541
00542 template<class Type>
00543 void convertFaceField
00544 (
00545 const GeometricField<Type, fvPatchField, volMesh>&,
00546 vtkMultiBlockDataSet* output,
00547 const partInfo&,
00548 const label datasetNo,
00549 const fvMesh&,
00550 const labelList& faceLabels
00551 );
00552
00553
00554 template<class Type>
00555 void convertFaceField
00556 (
00557 const GeometricField<Type, fvPatchField, volMesh>&,
00558 vtkMultiBlockDataSet* output,
00559 const partInfo&,
00560 const label datasetNo,
00561 const fvMesh&,
00562 const faceSet&
00563 );
00564
00565
00566 template<class Type>
00567 void convertLagrangianFields
00568 (
00569 const IOobjectList&,
00570 vtkMultiBlockDataSet* output,
00571 const label datasetNo
00572 );
00573
00574
00575 template<class Type>
00576 void convertLagrangianField
00577 (
00578 const IOField<Type>&,
00579 vtkMultiBlockDataSet* output,
00580 const partInfo&,
00581 const label datasetNo
00582 );
00583
00584
00585 template<class Type>
00586 void convertPointFields
00587 (
00588 const fvMesh&,
00589 const pointMesh&,
00590 const IOobjectList&,
00591 vtkMultiBlockDataSet* output
00592 );
00593
00594
00595 template<class Type>
00596 void convertPointFieldBlock
00597 (
00598 const GeometricField<Type, pointPatchField, pointMesh>&,
00599 vtkMultiBlockDataSet* output,
00600 const partInfo& selector,
00601 const List<polyDecomp>&
00602 );
00603
00604
00605 template<class Type>
00606 void convertPointField
00607 (
00608 const GeometricField<Type, pointPatchField, pointMesh>&,
00609 const GeometricField<Type, fvPatchField, volMesh>&,
00610 vtkMultiBlockDataSet* output,
00611 const partInfo&,
00612 const label datasetNo,
00613 const polyDecomp&
00614 );
00615
00616
00617 template<class Type>
00618 void convertPatchPointField
00619 (
00620 const word& name,
00621 const Field<Type>&,
00622 vtkMultiBlockDataSet* output,
00623 const partInfo&,
00624 const label datasetNo
00625 );
00626
00627
00628
00629
00630
00631 inline static word getFirstWord(const char*);
00632
00633
00634 static void pruneObjectList
00635 (
00636 IOobjectList&,
00637 const wordHashSet&
00638 );
00639
00640
00641 static wordHashSet getSelected(vtkDataArraySelection*);
00642
00643
00644 static wordHashSet getSelected
00645 (
00646 vtkDataArraySelection*,
00647 const partInfo&
00648 );
00649
00650
00651 static stringList getSelectedArrayEntries(vtkDataArraySelection*);
00652
00653
00654 static stringList getSelectedArrayEntries
00655 (
00656 vtkDataArraySelection*,
00657 const partInfo&
00658 );
00659
00660
00661 static void setSelectedArrayEntries
00662 (
00663 vtkDataArraySelection*,
00664 const stringList&
00665 );
00666
00667
00668 word getPartName(int);
00669
00670
00671
00672 vtkPV3Foam(const vtkPV3Foam&);
00673
00674
00675 void operator=(const vtkPV3Foam&);
00676
00677
00678 public:
00679
00680
00681
00682 ClassName("vtkPV3Foam");
00683
00684
00685
00686
00687
00688 vtkPV3Foam
00689 (
00690 const char* const FileName,
00691 vtkPV3FoamReader* reader
00692 );
00693
00694
00695
00696
00697 ~vtkPV3Foam();
00698
00699
00700
00701
00702
00703 void updateInfo();
00704
00705 void Update
00706 (
00707 vtkMultiBlockDataSet* output,
00708 vtkMultiBlockDataSet* lagrangianOutput
00709 );
00710
00711
00712 void CleanUp();
00713
00714
00715
00716 double* findTimes(int& nTimeSteps);
00717
00718
00719 void addPatchNames(vtkRenderer* renderer);
00720
00721
00722 void removePatchNames(vtkRenderer* renderer);
00723
00724
00725
00726
00727 int setTime(int count, const double requestTimes[]);
00728
00729
00730
00731 int timeIndex() const
00732 {
00733 return timeIndex_;
00734 }
00735
00736
00737
00738
00739
00740 void PrintSelf(ostream&, vtkIndent) const;
00741
00742
00743 static void printMemory();
00744
00745 };
00746
00747
00748
00749
00750 }
00751
00752
00753
00754 # include "vtkPV3FoamI.H"
00755
00756 #endif
00757
00758