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 =========================================================================*/
27 #ifndef vtkTemporalStreamTracer_h
28 #define vtkTemporalStreamTracer_h
29 
30 #include "vtkFiltersFlowPathsModule.h" // For export macro
31 #include "vtkSmartPointer.h" // For protected ivars.
32 #include "vtkStreamTracer.h"
33 
34 #include <vector> // STL Header
35 #include <list> // STL Header
36 
38 
40 class vtkDataArray;
41 class vtkDoubleArray;
42 class vtkGenericCell;
43 class vtkIntArray;
45 class vtkPoints;
46 class vtkCellArray;
47 class vtkDoubleArray;
48 class vtkFloatArray;
49 class vtkIntArray;
50 class vtkCharArray;
52 
54 {
55  typedef struct { double x[4]; } Position;
56  typedef struct {
57  // These are used during iteration
59  int CachedDataSetId[2];
60  vtkIdType CachedCellId[2];
62  // These are computed scalars we might display
63  int SourceID;
68  // These are useful to track for debugging etc
69  int ErrorCode;
70  float age;
71  // these are needed across time steps to compute vorticity
72  float rotation;
73  float angularVel;
74  float time;
75  float speed;
77 
78  typedef std::vector<ParticleInformation> ParticleVector;
79  typedef ParticleVector::iterator ParticleIterator;
80  typedef std::list<ParticleInformation> ParticleDataList;
81  typedef ParticleDataList::iterator ParticleListIterator;
82 };
83 
84 class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalStreamTracer : public vtkStreamTracer
85 {
86 public:
87 
89  void PrintSelf(ostream& os, vtkIndent indent);
90 
95 
97 
102  vtkSetMacro(TimeStep,unsigned int);
103  vtkGetMacro(TimeStep,unsigned int);
105 
107 
111  vtkSetMacro(IgnorePipelineTime, int);
112  vtkGetMacro(IgnorePipelineTime, int);
113  vtkBooleanMacro(IgnorePipelineTime, int);
115 
117 
124  vtkSetMacro(TimeStepResolution,double);
125  vtkGetMacro(TimeStepResolution,double);
127 
129 
138  vtkSetMacro(ForceReinjectionEveryNSteps,int);
139  vtkGetMacro(ForceReinjectionEveryNSteps,int);
141 
142  enum Units
143  {
145  TERMINATION_STEP_UNIT
146  };
147 
149 
155  vtkSetMacro(TerminationTime,double);
156  vtkGetMacro(TerminationTime,double);
158 
160 
164  vtkSetMacro(TerminationTimeUnit,int);
165  vtkGetMacro(TerminationTimeUnit,int);
167  {this->SetTerminationTimeUnit(TERMINATION_TIME_UNIT);};
169  {this->SetTerminationTimeUnit(TERMINATION_STEP_UNIT);};
171 
173 
181  vtkSetMacro(StaticSeeds,int);
182  vtkGetMacro(StaticSeeds,int);
183  vtkBooleanMacro(StaticSeeds,int);
185 
187 
195  vtkSetMacro(StaticMesh,int);
196  vtkGetMacro(StaticMesh,int);
197  vtkBooleanMacro(StaticMesh,int);
199 
201 
208  vtkGetObjectMacro(ParticleWriter, vtkAbstractParticleWriter);
210 
212 
216  vtkSetStringMacro(ParticleFileName);
217  vtkGetStringMacro(ParticleFileName);
219 
221 
225  vtkSetMacro(EnableParticleWriting,int);
226  vtkGetMacro(EnableParticleWriting,int);
227  vtkBooleanMacro(EnableParticleWriting,int);
229 
231 
237 
238  protected:
239 
242 
243  //
244  // Make sure the pipeline knows what type we expect as input
245  //
247 
248  //
249  // The usual suspects
250  //
251  virtual int ProcessRequest(vtkInformation* request,
252  vtkInformationVector** inputVector,
253  vtkInformationVector* outputVector);
254 
255  //
256  // Store any information we need in the output and fetch what we can
257  // from the input
258  //
259  virtual int RequestInformation(vtkInformation* request,
260  vtkInformationVector** inputVector,
261  vtkInformationVector* outputVector);
262 
263  //
264  // Compute input time steps given the output step
265  //
266  virtual int RequestUpdateExtent(vtkInformation* request,
267  vtkInformationVector** inputVector,
268  vtkInformationVector* outputVector);
269 
270  //
271  // what the pipeline calls for each time step
272  //
273  virtual int RequestData(vtkInformation* request,
274  vtkInformationVector** inputVector,
275  vtkInformationVector* outputVector);
276 
277  //
278  // these routines are internally called to actually generate the output
279  //
280  virtual int ProcessInput(vtkInformationVector** inputVector);
281 
282  virtual int GenerateOutput(vtkInformationVector** inputVector,
283  vtkInformationVector* outputVector);
284 
285  //
286  // Initialization of input (vector-field) geometry
287  //
290 
291 //
292 
300  int &count);
301 
309  vtkDataSet *source, int sourceID, int ptId,
311  int &LocalAssignedCount);
312 
317  virtual void AssignUniqueIds(
319 
326 
334  bool removeself);
335 
341  double currenttime, double terminationtime,
342  vtkInitialValueProblemSolver* integrator);
343 
352  double velocity[3], double delT);
353 
354  // if the particle is added to send list, then returns value is 1,
355  // if it is kept on this process after a retry return value is 0
358  double point1[4], double delT);
359 
362 
369  double pos[4], double p2[4], double intersection[4],
370  vtkGenericCell *cell);
371 
372 //
373 
374 //
375  //Track internally which round of RequestData it is--between 0 and 2
377 
378  // Track which process we are
381 
382  // Important for Caching of Cells/Ids/Weights etc
386 
387  // Support 'pipeline' time or manual SetTimeStep
388  unsigned int TimeStep;
389  unsigned int ActualTimeStep;
392 
393  std::vector<double> InputTimeValues;
394  std::vector<double> OutputTimeValues;
395 
396  // more time management
397  double EarliestTime;
398  double CurrentTimeSteps[2];
400 
401  // Particle termination after time
404 
405  // Particle injection+Reinjection
410 
411  // Particle writing to disk
415 
416  // The main lists which are held during operation- between time step updates
417  unsigned int NumberOfParticles;
420 
421  //
422  // Scalar arrays that are generated as each particle is updated
423  //
436 
437  // The output geometry
440 
441  // List used for transmitting between processors during parallel operation
443 
444  // The velocity interpolator
446 
447  // The input datasets which are stored by time step 0 and 1
449  vtkSmartPointer<vtkDataSet> DataReferenceT[2];
450 
451  // Cache bounds info for each dataset we will use repeatedly
452  typedef struct {
453  double b[6];
454  } bounds;
455  std::vector<bounds> CachedBounds[2];
456 
457  // utility function we use to test if a point is inside any of our local datasets
458  bool InsideBounds(double point[]);
459 
460  // global Id counter used to give particles a stamp
463  // for debugging only;
464  int substeps;
465 
466 private:
471 
472 private:
473  vtkTemporalStreamTracer(const vtkTemporalStreamTracer&) VTK_DELETE_FUNCTION;
474  void operator=(const vtkTemporalStreamTracer&) VTK_DELETE_FUNCTION;
475 };
476 
477 #endif
An abstract class for obtaining the interpolated velocity values at a point.
abstract class to write particle data to file
Proxy object to connect input/output ports.
object to represent cell connectivity
Definition: vtkCellArray.h:51
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
general representation of visualization data
Definition: vtkDataObject.h:65
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
provides thread-safe access to cells
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Integrate a set of ordinary differential equations (initial value problem) in time.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
Composite dataset that organizes datasets into blocks.
Multiprocessing communication superclass.
represent and manipulate 3D points
Definition: vtkPoints.h:40
Streamline generator.
void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField *ivf)
The object used to interpolate the velocity field during integration is of the same class as this pro...
A helper class for interpolating between times during particle tracing.
A Parallel Particle tracer for unsteady vector fields.
bool RetryWithPush(vtkTemporalStreamTracerNamespace::ParticleInformation &info, double velocity[3], double delT)
and sent to the other processors for possible continuation.
virtual int ProcessInput(vtkInformationVector **inputVector)
virtual void TransmitReceiveParticles(vtkTemporalStreamTracerNamespace::ParticleVector &outofdomain, vtkTemporalStreamTracerNamespace::ParticleVector &received, bool removeself)
this is used during classification of seed points and also between iterations of the main loop as par...
virtual void AssignUniqueIds(vtkTemporalStreamTracerNamespace::ParticleVector &LocalSeedPoints)
give each one a uniqu ID.
vtkSmartPointer< vtkFloatArray > ParticleRotation
vtkSmartPointer< vtkPoints > OutputCoordinates
vtkTemporalStreamTracerNamespace::ParticleDataList ParticleHistories
virtual void SetParticleWriter(vtkAbstractParticleWriter *pw)
Set/Get the Writer associated with this Particle Tracer Ideally a parallel IO capable vtkH5PartWriter...
virtual int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
std::vector< double > OutputTimeValues
vtkTemporalStreamTracerNamespace::ParticleVector LocalSeeds
bool ComputeDomainExitLocation(double pos[4], double p2[4], double intersection[4], vtkGenericCell *cell)
In dnamic meshes, particles might leave the domain and need to be extrapolated across a gap between t...
vtkSmartPointer< vtkTemporalInterpolatedVelocityField > Interpolator
void AddSourceConnection(vtkAlgorithmOutput *input)
Provide support for multiple see sources.
vtkSmartPointer< vtkCharArray > ParticleSourceIds
int SetTemporalInput(vtkDataObject *td, int index)
vtkSmartPointer< vtkIntArray > ErrorCode
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void AssignSeedsToProcessors(vtkDataSet *source, int sourceID, int ptId, vtkTemporalStreamTracerNamespace::ParticleVector &LocalSeedPoints, int &LocalAssignedCount)
all the injection/seed points according to which processor they belong to.
vtkSmartPointer< vtkFloatArray > ParticleAngularVel
void TestParticles(vtkTemporalStreamTracerNamespace::ParticleVector &candidates, vtkTemporalStreamTracerNamespace::ParticleVector &passed, int &count)
inside our data.
static vtkTemporalStreamTracer * New()
Construct object using 2nd order Runge Kutta.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkSmartPointer< vtkCellArray > ParticleCells
vtkSmartPointer< vtkFloatArray > ParticleVorticity
vtkAbstractParticleWriter * ParticleWriter
void AddParticleToMPISendList(vtkTemporalStreamTracerNamespace::ParticleInformation &info)
bool InsideBounds(double point[])
vtkSmartPointer< vtkIntArray > InjectedStepIds
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
std::vector< double > InputTimeValues
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkSmartPointer< vtkPointData > OutputPointData
vtkTemporalStreamTracerNamespace::ParticleVector MPISendList
vtkSmartPointer< vtkIntArray > InjectedPointIds
vtkSmartPointer< vtkFloatArray > ParticleAge
void UpdateParticleList(vtkTemporalStreamTracerNamespace::ParticleVector &candidates)
and sending between processors, into a list, which is used as the master list on this processor
vtkSmartPointer< vtkDoubleArray > cellVectors
bool SendParticleToAnotherProcess(vtkTemporalStreamTracerNamespace::ParticleInformation &info, double point1[4], double delT)
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
see vtkAlgorithm for details
void IntegrateParticle(vtkTemporalStreamTracerNamespace::ParticleListIterator &it, double currenttime, double terminationtime, vtkInitialValueProblemSolver *integrator)
particle between the two times supplied.
vtkSmartPointer< vtkIntArray > ParticleIds
virtual int GenerateOutput(vtkInformationVector **inputVector, vtkInformationVector *outputVector)
record modification and/or execution time
Definition: vtkTimeStamp.h:36
std::list< ParticleInformation > ParticleDataList
std::vector< ParticleInformation > ParticleVector
ParticleDataList::iterator ParticleListIterator
ParticleVector::iterator ParticleIterator
@ point
Definition: vtkX3D.h:236
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ index
Definition: vtkX3D.h:246
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int vtkIdType
Definition: vtkType.h:287