00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00026 #ifndef __vtkTemporalStreamTracer_h
00027 #define __vtkTemporalStreamTracer_h
00028
00029 #include "vtkSmartPointer.h"
00030 #include "vtkStreamTracer.h"
00031
00032
00033 #include <vtkstd/vector>
00034 #include <vtkstd/list>
00035
00036
00037 class vtkMultiProcessController;
00038
00039 class vtkMultiBlockDataSet;
00040 class vtkDataArray;
00041 class vtkDoubleArray;
00042 class vtkGenericCell;
00043 class vtkIntArray;
00044 class vtkTemporalInterpolatedVelocityField;
00045 class vtkPoints;
00046 class vtkCellArray;
00047 class vtkDoubleArray;
00048 class vtkFloatArray;
00049 class vtkIntArray;
00050 class vtkCharArray;
00051 class vtkAbstractParticleWriter;
00052 class vtkTemporalDataSet;
00053
00054
00055 namespace vtkTemporalStreamTracerNamespace
00056 {
00057 typedef struct { double x[4]; } Position;
00058 typedef struct {
00059
00060 Position CurrentPosition;
00061 int CachedDataSetId[2];
00062 vtkIdType CachedCellId[2];
00063 int LocationState;
00064
00065 int SourceID;
00066 int TimeStepAge;
00067 int InjectedPointId;
00068 int InjectedStepId;
00069 int UniqueParticleId;
00070
00071 int ErrorCode;
00072 float age;
00073
00074 float rotation;
00075 float angularVel;
00076 float time;
00077 float speed;
00078 } ParticleInformation;
00079
00080 typedef vtkstd::vector<ParticleInformation> ParticleVector;
00081 typedef ParticleVector::iterator ParticleIterator;
00082 typedef vtkstd::list<ParticleInformation> ParticleDataList;
00083 typedef ParticleDataList::iterator ParticleListIterator;
00084 };
00085
00086
00087 class VTK_PARALLEL_EXPORT vtkTemporalStreamTracer : public vtkStreamTracer
00088 {
00089 public:
00090
00091 vtkTypeMacro(vtkTemporalStreamTracer,vtkStreamTracer);
00092 void PrintSelf(ostream& os, vtkIndent indent);
00093
00095 static vtkTemporalStreamTracer *New();
00096
00098
00101 vtkSetMacro(TimeStep,unsigned int);
00102 vtkGetMacro(TimeStep,unsigned int);
00104
00106
00108 vtkSetMacro(IgnorePipelineTime, int);
00109 vtkGetMacro(IgnorePipelineTime, int);
00110 vtkBooleanMacro(IgnorePipelineTime, int);
00112
00114
00119 vtkSetMacro(TimeStepResolution,double);
00120 vtkGetMacro(TimeStepResolution,double);
00122
00124
00131 vtkSetMacro(ForceReinjectionEveryNSteps,int);
00132 vtkGetMacro(ForceReinjectionEveryNSteps,int);
00134
00135
00136 enum Units
00137 {
00138 TERMINATION_TIME_UNIT,
00139 TERMINATION_STEP_UNIT
00140 };
00141
00142
00144
00148 vtkSetMacro(TerminationTime,double);
00149 vtkGetMacro(TerminationTime,double);
00151
00153
00155 vtkSetMacro(TerminationTimeUnit,int);
00156 vtkGetMacro(TerminationTimeUnit,int);
00157 void SetTerminationTimeUnitToTimeUnit()
00158 {this->SetTerminationTimeUnit(TERMINATION_TIME_UNIT);};
00159 void SetTerminationTimeUnitToStepUnit()
00160 {this->SetTerminationTimeUnit(TERMINATION_STEP_UNIT);};
00162
00164
00170 vtkSetMacro(StaticSeeds,int);
00171 vtkGetMacro(StaticSeeds,int);
00172 vtkBooleanMacro(StaticSeeds,int);
00174
00176
00181 vtkSetMacro(StaticMesh,int);
00182 vtkGetMacro(StaticMesh,int);
00183 vtkBooleanMacro(StaticMesh,int);
00185
00187
00191 virtual void SetController(vtkMultiProcessController* controller);
00192 vtkGetObjectMacro(Controller, vtkMultiProcessController);
00194
00196
00200 virtual void SetParticleWriter(vtkAbstractParticleWriter *pw);
00201 vtkGetObjectMacro(ParticleWriter, vtkAbstractParticleWriter);
00203
00205
00207 vtkSetStringMacro(ParticleFileName);
00208 vtkGetStringMacro(ParticleFileName);
00210
00212
00214 vtkSetMacro(EnableParticleWriting,int);
00215 vtkGetMacro(EnableParticleWriting,int);
00216 vtkBooleanMacro(EnableParticleWriting,int);
00218
00220
00221 void AddSourceConnection(vtkAlgorithmOutput* input);
00222 void RemoveAllSources();
00224
00225 protected:
00226
00227 vtkTemporalStreamTracer();
00228 ~vtkTemporalStreamTracer();
00229
00230
00231
00232
00233 virtual int FillInputPortInformation(int port, vtkInformation* info);
00234
00235
00236
00237
00238 virtual int ProcessRequest(vtkInformation* request,
00239 vtkInformationVector** inputVector,
00240 vtkInformationVector* outputVector);
00241
00242
00243
00244
00245
00246 virtual int RequestInformation(vtkInformation* request,
00247 vtkInformationVector** inputVector,
00248 vtkInformationVector* outputVector);
00249
00250
00251
00252
00253 virtual int RequestUpdateExtent(vtkInformation* request,
00254 vtkInformationVector** inputVector,
00255 vtkInformationVector* outputVector);
00256
00257
00258
00259
00260 virtual int RequestData(vtkInformation* request,
00261 vtkInformationVector** inputVector,
00262 vtkInformationVector* outputVector);
00263
00264
00265
00266
00267 int InitializeInterpolator();
00268 int AddTemporalInput(vtkTemporalDataSet *td);
00269
00270
00271
00272
00273
00275
00277 void TestParticles(
00278 vtkTemporalStreamTracerNamespace::ParticleVector &candidates,
00279 vtkTemporalStreamTracerNamespace::ParticleVector &passed,
00280 int &count);
00282
00284
00288 void AssignSeedsToProcessors(
00289 vtkDataSet *source, int sourceID, int ptId,
00290 vtkTemporalStreamTracerNamespace::ParticleVector &LocalSeedPoints,
00291 int &LocalAssignedCount);
00293
00295
00297 void AssignUniqueIds(
00298 vtkTemporalStreamTracerNamespace::ParticleVector &LocalSeedPoints);
00300
00302
00304 void UpdateParticleList(
00305 vtkTemporalStreamTracerNamespace::ParticleVector &candidates);
00307
00309
00312 void TransmitReceiveParticles(
00313 vtkTemporalStreamTracerNamespace::ParticleVector &outofdomain,
00314 vtkTemporalStreamTracerNamespace::ParticleVector &received,
00315 bool removeself);
00317
00319
00320 void IntegrateParticle(
00321 vtkTemporalStreamTracerNamespace::ParticleListIterator &it,
00322 double currenttime, double terminationtime,
00323 vtkInitialValueProblemSolver* integrator);
00325
00327
00332 bool RetryWithPush(
00333 vtkTemporalStreamTracerNamespace::ParticleInformation &info,
00334 double velocity[3], double delT);
00336
00337
00338
00339 bool SendParticleToAnotherProcess(
00340 vtkTemporalStreamTracerNamespace::ParticleInformation &info,
00341 double point1[4], double delT);
00342
00343 void AddParticleToMPISendList(
00344 vtkTemporalStreamTracerNamespace::ParticleInformation &info);
00345
00347
00350 bool ComputeDomainExitLocation(
00351 double pos[4], double p2[4], double intersection[4],
00352 vtkGenericCell *cell);
00354
00355
00356
00357
00358
00359
00360 int UpdatePiece;
00361 int UpdateNumPieces;
00362
00363
00364 int AllFixedGeometry;
00365 int StaticMesh;
00366 int StaticSeeds;
00367
00368
00369 unsigned int TimeStep;
00370 unsigned int ActualTimeStep;
00371 int IgnorePipelineTime;
00372 unsigned int NumberOfInputTimeSteps;
00373
00374 vtkstd::vector<double> InputTimeValues;
00375 vtkstd::vector<double> OutputTimeValues;
00376
00377
00378
00379 double EarliestTime;
00380 double CurrentTimeSteps[2];
00381 double TimeStepResolution;
00382
00383
00384 double TerminationTime;
00385 int TerminationTimeUnit;
00386
00387
00388 int ForceReinjectionEveryNSteps;
00389 bool ReinjectionFlag;
00390 int ReinjectionCounter;
00391 vtkTimeStamp ParticleInjectionTime;
00392
00393
00394 vtkAbstractParticleWriter *ParticleWriter;
00395 char *ParticleFileName;
00396 int EnableParticleWriting;
00397
00398
00399
00400 unsigned int NumberOfParticles;
00401 vtkTemporalStreamTracerNamespace::ParticleDataList ParticleHistories;
00402 vtkTemporalStreamTracerNamespace::ParticleVector LocalSeeds;
00403
00404
00405
00406
00407
00408
00409 vtkSmartPointer<vtkFloatArray> ParticleAge;
00410 vtkSmartPointer<vtkIntArray> ParticleIds;
00411 vtkSmartPointer<vtkCharArray> ParticleSourceIds;
00412 vtkSmartPointer<vtkIntArray> InjectedPointIds;
00413 vtkSmartPointer<vtkIntArray> InjectedStepIds;
00414 vtkSmartPointer<vtkIntArray> ErrorCode;
00415 vtkSmartPointer<vtkFloatArray> ParticleVorticity;
00416 vtkSmartPointer<vtkFloatArray> ParticleRotation;
00417 vtkSmartPointer<vtkFloatArray> ParticleAngularVel;
00418 vtkSmartPointer<vtkDoubleArray> cellVectors;
00419 vtkSmartPointer<vtkPointData> OutputPointData;
00420 int InterpolationCount;
00421
00422
00423 vtkSmartPointer<vtkCellArray> ParticleCells;
00424 vtkSmartPointer<vtkPoints> OutputCoordinates;
00425
00426
00427 vtkTemporalStreamTracerNamespace::ParticleVector MPISendList;
00428
00429
00430 vtkSmartPointer<vtkTemporalInterpolatedVelocityField> Interpolator;
00431
00432
00433 vtkSmartPointer<vtkMultiBlockDataSet> InputDataT[2];
00434 vtkSmartPointer<vtkDataSet> DataReferenceT[2];
00435
00436
00437 typedef struct {
00438 double b[6];
00439 } bounds;
00440 vtkstd::vector<bounds> CachedBounds[2];
00441
00442
00443 bool InsideBounds(double point[]);
00444
00445
00446
00447
00448 vtkMultiProcessController* Controller;
00449
00450
00451 vtkIdType UniqueIdCounter;
00452 vtkIdType UniqueIdCounterMPI;
00453
00454 int substeps;
00455
00456 private:
00458 void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField*) {};
00459
00460 private:
00461 vtkTemporalStreamTracer(const vtkTemporalStreamTracer&);
00462 void operator=(const vtkTemporalStreamTracer&);
00463 };
00464
00465
00466 #endif
00467
00468