VTK
vtkTemporalStreamTracer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTemporalStreamTracer.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
26 #ifndef vtkTemporalStreamTracer_h
27 #define vtkTemporalStreamTracer_h
28 
29 #include "vtkFiltersFlowPathsModule.h" // For export macro
30 #include "vtkSmartPointer.h" // For protected ivars.
31 #include "vtkStreamTracer.h"
32 
33 //BTX
34 #include <vector> // STL Header
35 #include <list> // STL Header
36 //ETX
37 
39 
41 class vtkDataArray;
42 class vtkDoubleArray;
43 class vtkGenericCell;
44 class vtkIntArray;
46 class vtkPoints;
47 class vtkCellArray;
48 class vtkDoubleArray;
49 class vtkFloatArray;
50 class vtkIntArray;
51 class vtkCharArray;
53 
54 //BTX
56 {
57  typedef struct { double x[4]; } Position;
58  typedef struct {
59  // These are used during iteration
61  int CachedDataSetId[2];
62  vtkIdType CachedCellId[2];
64  // These are computed scalars we might display
65  int SourceID;
70  // These are useful to track for debugging etc
71  int ErrorCode;
72  float age;
73  // these are needed across time steps to compute vorticity
74  float rotation;
75  float angularVel;
76  float time;
77  float speed;
79 
80  typedef std::vector<ParticleInformation> ParticleVector;
81  typedef ParticleVector::iterator ParticleIterator;
82  typedef std::list<ParticleInformation> ParticleDataList;
83  typedef ParticleDataList::iterator ParticleListIterator;
84 };
85 //ETX
86 
88 {
89 public:
90 
92  void PrintSelf(ostream& os, vtkIndent indent);
93 
95  static vtkTemporalStreamTracer *New();
96 
98 
101  vtkSetMacro(TimeStep,unsigned int);
102  vtkGetMacro(TimeStep,unsigned int);
104 
106 
108  vtkSetMacro(IgnorePipelineTime, int);
109  vtkGetMacro(IgnorePipelineTime, int);
110  vtkBooleanMacro(IgnorePipelineTime, int);
112 
114 
119  vtkSetMacro(TimeStepResolution,double);
120  vtkGetMacro(TimeStepResolution,double);
122 
124 
131  vtkSetMacro(ForceReinjectionEveryNSteps,int);
132  vtkGetMacro(ForceReinjectionEveryNSteps,int);
134 
135 //BTX
136  enum Units
137  {
139  TERMINATION_STEP_UNIT
140  };
141 //ETX
142 
144 
148  vtkSetMacro(TerminationTime,double);
149  vtkGetMacro(TerminationTime,double);
151 
153 
155  vtkSetMacro(TerminationTimeUnit,int);
156  vtkGetMacro(TerminationTimeUnit,int);
158  {this->SetTerminationTimeUnit(TERMINATION_TIME_UNIT);};
160  {this->SetTerminationTimeUnit(TERMINATION_STEP_UNIT);};
162 
164 
170  vtkSetMacro(StaticSeeds,int);
171  vtkGetMacro(StaticSeeds,int);
172  vtkBooleanMacro(StaticSeeds,int);
174 
176 
181  vtkSetMacro(StaticMesh,int);
182  vtkGetMacro(StaticMesh,int);
183  vtkBooleanMacro(StaticMesh,int);
185 
187 
191  virtual void SetParticleWriter(vtkAbstractParticleWriter *pw);
192  vtkGetObjectMacro(ParticleWriter, vtkAbstractParticleWriter);
194 
196 
198  vtkSetStringMacro(ParticleFileName);
199  vtkGetStringMacro(ParticleFileName);
201 
203 
205  vtkSetMacro(EnableParticleWriting,int);
206  vtkGetMacro(EnableParticleWriting,int);
207  vtkBooleanMacro(EnableParticleWriting,int);
209 
211 
212  void AddSourceConnection(vtkAlgorithmOutput* input);
213  void RemoveAllSources();
215 
216  protected:
217 
220 
221  //
222  // Make sure the pipeline knows what type we expect as input
223  //
225 
226  //
227  // The usual suspects
228  //
229  virtual int ProcessRequest(vtkInformation* request,
230  vtkInformationVector** inputVector,
231  vtkInformationVector* outputVector);
232 
233  //
234  // Store any information we need in the output and fetch what we can
235  // from the input
236  //
237  virtual int RequestInformation(vtkInformation* request,
238  vtkInformationVector** inputVector,
239  vtkInformationVector* outputVector);
240 
241  //
242  // Compute input time steps given the output step
243  //
244  virtual int RequestUpdateExtent(vtkInformation* request,
245  vtkInformationVector** inputVector,
246  vtkInformationVector* outputVector);
247 
248  //
249  // what the pipeline calls for each time step
250  //
251  virtual int RequestData(vtkInformation* request,
252  vtkInformationVector** inputVector,
253  vtkInformationVector* outputVector);
254 
255  //
256  // these routines are internally called to actually generate the output
257  //
258  virtual int ProcessInput(vtkInformationVector** inputVector);
259 
260  virtual int GenerateOutput(vtkInformationVector** inputVector,
261  vtkInformationVector* outputVector);
262 
263  //
264  // Initialization of input (vector-field) geometry
265  //
266  int InitializeInterpolator();
267  int SetTemporalInput(vtkDataObject *td, int index);
268 
269 //BTX
270 //
271 
273 
275  void TestParticles(
278  int &count);
280 
282 
286  virtual void AssignSeedsToProcessors(
287  vtkDataSet *source, int sourceID, int ptId,
289  int &LocalAssignedCount);
291 
293 
295  virtual void AssignUniqueIds(
298 
300 
302  void UpdateParticleList(
305 
307 
310  virtual void TransmitReceiveParticles(
313  bool removeself);
315 
317 
318  void IntegrateParticle(
320  double currenttime, double terminationtime,
321  vtkInitialValueProblemSolver* integrator);
323 
325 
330  bool RetryWithPush(
332  double velocity[3], double delT);
334 
335  // if the particle is added to send list, then returns value is 1,
336  // if it is kept on this process after a retry return value is 0
337  bool SendParticleToAnotherProcess(
339  double point1[4], double delT);
340 
341  void AddParticleToMPISendList(
343 
345 
348  bool ComputeDomainExitLocation(
349  double pos[4], double p2[4], double intersection[4],
350  vtkGenericCell *cell);
352 
353 //
354 //ETX
355 //
356  //Track internally which round of RequestData it is--between 0 and 2
358 
359  // Track which process we are
362 
363  // Important for Caching of Cells/Ids/Weights etc
367 
368  // Support 'pipeline' time or manual SetTimeStep
369  unsigned int TimeStep;
370  unsigned int ActualTimeStep;
373 //BTX
374  std::vector<double> InputTimeValues;
375  std::vector<double> OutputTimeValues;
376 //ETX
377 
378  // more time management
379  double EarliestTime;
380  double CurrentTimeSteps[2];
382 
383  // Particle termination after time
386 
387  // Particle injection+Reinjection
392 
393  // Particle writing to disk
397 
398 //BTX
399  // The main lists which are held during operation- between time step updates
400  unsigned int NumberOfParticles;
403 //ETX
404 
405 //BTX
406  //
407  // Scalar arrays that are generated as each particle is updated
408  //
421 
422  // The output geometry
425 
426  // List used for transmitting between processors during parallel operation
428 
429  // The velocity interpolator
431 
432  // The input datasets which are stored by time step 0 and 1
434  vtkSmartPointer<vtkDataSet> DataReferenceT[2];
435 
436  // Cache bounds info for each dataset we will use repeatedly
437  typedef struct {
438  double b[6];
439  } bounds;
440  std::vector<bounds> CachedBounds[2];
441 
442  // utility function we use to test if a point is inside any of our local datasets
443  bool InsideBounds(double point[]);
444 
445 //ETX
446 
447  // global Id counter used to give particles a stamp
450  // for debugging only;
451  int substeps;
452 
453 private:
456 
457 private:
458  vtkTemporalStreamTracer(const vtkTemporalStreamTracer&); // Not implemented.
459  void operator=(const vtkTemporalStreamTracer&); // Not implemented.
460 };
461 
462 #endif
#define VTKFILTERSFLOWPATHS_EXPORT
A helper class for interpolating between times during particle tracing.
vtkSmartPointer< vtkDoubleArray > cellVectors
void PrintSelf(ostream &os, vtkIndent indent)
abstract class to write particle data to file
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkSmartPointer< vtkTemporalInterpolatedVelocityField > Interpolator
vtkSmartPointer< vtkFloatArray > ParticleAge
record modification and/or execution time
Definition: vtkTimeStamp.h:34
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
An abstract class for obtaining the interpolated velocity values at a point.
vtkSmartPointer< vtkPointData > OutputPointData
std::list< ParticleInformation > ParticleDataList
int vtkIdType
Definition: vtkType.h:275
vtkTemporalStreamTracerNamespace::ParticleDataList ParticleHistories
std::vector< double > InputTimeValues
vtkSmartPointer< vtkIntArray > InjectedStepIds
ParticleVector::iterator ParticleIterator
provides thread-safe access to cells
Proxy object to connect input/output ports.
dynamic, self-adjusting array of double
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:42
virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
vtkSmartPointer< vtkIntArray > InjectedPointIds
static vtkStreamTracer * New()
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
A Parallel Particle tracer for unsteady vector fields.
vtkAbstractParticleWriter * ParticleWriter
vtkSmartPointer< vtkFloatArray > ParticleVorticity
vtkSmartPointer< vtkCellArray > ParticleCells
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
object to represent cell connectivity
Definition: vtkCellArray.h:49
vtkSmartPointer< vtkCharArray > ParticleSourceIds
vtkSmartPointer< vtkPoints > OutputCoordinates
vtkTemporalStreamTracerNamespace::ParticleVector MPISendList
Composite dataset that organizes datasets into blocks.
Streamline generator.
void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField *ivf)
vtkSmartPointer< vtkFloatArray > ParticleAngularVel
ParticleDataList::iterator ParticleListIterator
vtkSmartPointer< vtkIntArray > ErrorCode
std::vector< double > OutputTimeValues
Store zero or more vtkInformation instances.
vtkSmartPointer< vtkIntArray > ParticleIds
vtkTemporalStreamTracerNamespace::ParticleVector LocalSeeds
general representation of visualization data
Definition: vtkDataObject.h:64
std::vector< ParticleInformation > ParticleVector
virtual int FillInputPortInformation(int, vtkInformation *)
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkSmartPointer< vtkFloatArray > ParticleRotation
Integrate a set of ordinary differential equations (initial value problem) in time.
Multiprocessing communication superclass.