VTK  9.0.1
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 =========================================================================*/
32 #ifndef vtkTemporalStreamTracer_h
33 #define vtkTemporalStreamTracer_h
34 
35 #include "vtkConfigure.h" // For legacy defines
36 #include "vtkSetGet.h" // For legacy macros
37 #ifndef VTK_LEGACY_REMOVE
38 
39 #include "vtkFiltersFlowPathsModule.h" // For export macro
40 #include "vtkSmartPointer.h" // For protected ivars.
41 #include "vtkStreamTracer.h"
42 
43 #include <list> // STL Header
44 #include <vector> // STL Header
45 
47 
49 class vtkDataArray;
50 class vtkDoubleArray;
51 class vtkGenericCell;
52 class vtkIntArray;
54 class vtkPoints;
55 class vtkCellArray;
56 class vtkDoubleArray;
57 class vtkFloatArray;
58 class vtkIntArray;
59 class vtkCharArray;
61 
63 {
64 typedef struct
65 {
66  double x[4];
67 } Position;
68 typedef struct
69 {
70  // These are used during iteration
72  int CachedDataSetId[2];
73  vtkIdType CachedCellId[2];
75  // These are computed scalars we might display
76  int SourceID;
81  // These are useful to track for debugging etc
82  int ErrorCode;
83  float age;
84  // these are needed across time steps to compute vorticity
85  float rotation;
86  float angularVel;
87  float time;
88  float speed;
90 
91 typedef std::vector<ParticleInformation> ParticleVector;
92 typedef ParticleVector::iterator ParticleIterator;
93 typedef std::list<ParticleInformation> ParticleDataList;
94 typedef ParticleDataList::iterator ParticleListIterator;
95 };
96 
97 class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalStreamTracer : public vtkStreamTracer
98 {
99 public:
101  void PrintSelf(ostream& os, vtkIndent indent) override;
102 
107 
109 
114  vtkSetMacro(TimeStep, unsigned int);
115  vtkGetMacro(TimeStep, unsigned int);
117 
119 
123  vtkSetMacro(IgnorePipelineTime, vtkTypeBool);
124  vtkGetMacro(IgnorePipelineTime, vtkTypeBool);
125  vtkBooleanMacro(IgnorePipelineTime, vtkTypeBool);
127 
129 
136  vtkSetMacro(TimeStepResolution, double);
137  vtkGetMacro(TimeStepResolution, double);
139 
141 
150  vtkSetMacro(ForceReinjectionEveryNSteps, int);
151  vtkGetMacro(ForceReinjectionEveryNSteps, int);
153 
154  enum Units
155  {
157  TERMINATION_STEP_UNIT
158  };
159 
161 
167  vtkSetMacro(TerminationTime, double);
168  vtkGetMacro(TerminationTime, double);
170 
172 
176  vtkSetMacro(TerminationTimeUnit, int);
177  vtkGetMacro(TerminationTimeUnit, int);
178  void SetTerminationTimeUnitToTimeUnit() { this->SetTerminationTimeUnit(TERMINATION_TIME_UNIT); }
179  void SetTerminationTimeUnitToStepUnit() { this->SetTerminationTimeUnit(TERMINATION_STEP_UNIT); }
181 
183 
191  vtkSetMacro(StaticSeeds, vtkTypeBool);
192  vtkGetMacro(StaticSeeds, vtkTypeBool);
193  vtkBooleanMacro(StaticSeeds, vtkTypeBool);
195 
197 
205  vtkSetMacro(StaticMesh, vtkTypeBool);
206  vtkGetMacro(StaticMesh, vtkTypeBool);
207  vtkBooleanMacro(StaticMesh, vtkTypeBool);
209 
211 
218  vtkGetObjectMacro(ParticleWriter, vtkAbstractParticleWriter);
220 
222 
226  vtkSetStringMacro(ParticleFileName);
227  vtkGetStringMacro(ParticleFileName);
229 
231 
235  vtkSetMacro(EnableParticleWriting, vtkTypeBool);
236  vtkGetMacro(EnableParticleWriting, vtkTypeBool);
237  vtkBooleanMacro(EnableParticleWriting, vtkTypeBool);
239 
241 
247 
248 protected:
249  VTK_LEGACY(vtkTemporalStreamTracer());
251 
252  //
253  // Make sure the pipeline knows what type we expect as input
254  //
256 
257  //
258  // The usual suspects
259  //
261  vtkInformationVector* outputVector) override;
262 
263  //
264  // Store any information we need in the output and fetch what we can
265  // from the input
266  //
268  vtkInformationVector* outputVector) override;
269 
270  //
271  // Compute input time steps given the output step
272  //
274  vtkInformationVector* outputVector) override;
275 
276  //
277  // what the pipeline calls for each time step
278  //
279  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
280  vtkInformationVector* outputVector) override;
281 
282  //
283  // these routines are internally called to actually generate the output
284  //
285  virtual int ProcessInput(vtkInformationVector** inputVector);
286 
287  virtual int GenerateOutput(
288  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
289 
290  //
291  // Initialization of input (vector-field) geometry
292  //
295 
296  //
297 
304 
311  virtual void AssignSeedsToProcessors(vtkDataSet* source, int sourceID, int ptId,
312  vtkTemporalStreamTracerNamespace::ParticleVector& LocalSeedPoints, int& LocalAssignedCount);
313 
319 
325 
332  vtkTemporalStreamTracerNamespace::ParticleVector& received, bool removeself);
333 
338  double currenttime, double terminationtime, vtkInitialValueProblemSolver* integrator);
339 
347  vtkTemporalStreamTracerNamespace::ParticleInformation& info, double velocity[3], double delT);
348 
349  // if the particle is added to send list, then returns value is 1,
350  // if it is kept on this process after a retry return value is 0
352  vtkTemporalStreamTracerNamespace::ParticleInformation& info, double point1[4], double delT);
353 
355 
362  double pos[4], double p2[4], double intersection[4], vtkGenericCell* cell);
363 
364  //
365 
366  //
367  // Track internally which round of RequestData it is--between 0 and 2
369 
370  // Track which process we are
373 
374  // Important for Caching of Cells/Ids/Weights etc
378 
379  // Support 'pipeline' time or manual SetTimeStep
380  unsigned int TimeStep;
381  unsigned int ActualTimeStep;
384 
385  std::vector<double> InputTimeValues;
386  std::vector<double> OutputTimeValues;
387 
388  // more time management
389  double EarliestTime;
390  double CurrentTimeSteps[2];
392 
393  // Particle termination after time
396 
397  // Particle injection+Reinjection
402 
403  // Particle writing to disk
407 
408  // The main lists which are held during operation- between time step updates
409  unsigned int NumberOfParticles;
412 
413  //
414  // Scalar arrays that are generated as each particle is updated
415  //
428 
429  // The output geometry
432 
433  // List used for transmitting between processors during parallel operation
435 
436  // The velocity interpolator
438 
439  // The input datasets which are stored by time step 0 and 1
441  vtkSmartPointer<vtkDataSet> DataReferenceT[2];
442 
443  // Cache bounds info for each dataset we will use repeatedly
444  typedef struct
445  {
446  double b[6];
447  } bounds;
448  std::vector<bounds> CachedBounds[2];
449 
450  // utility function we use to test if a point is inside any of our local datasets
451  bool InsideBounds(double point[]);
452 
453  // global Id counter used to give particles a stamp
456  // for debugging only;
457  int substeps;
458 
459 private:
464 
465 private:
467  void operator=(const vtkTemporalStreamTracer&) = delete;
468 };
469 
470 #endif // VTK_LEGACY_REMOVE
471 
472 #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:180
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:36
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
general representation of visualization data
Definition: vtkDataObject.h:60
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
provides thread-safe access to cells
a simple class to control print indentation
Definition: vtkIndent.h:34
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:40
Composite dataset that organizes datasets into blocks.
Multiprocessing communication superclass.
represent and manipulate 3D points
Definition: vtkPoints.h:34
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 unique 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...
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
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
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void AddSourceConnection(vtkAlgorithmOutput *input)
Provide support for multiple see sources.
vtkSmartPointer< vtkCharArray > ParticleSourceIds
int SetTemporalInput(vtkDataObject *td, int index)
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.
vtkSmartPointer< vtkCellArray > ParticleCells
vtkSmartPointer< vtkFloatArray > ParticleVorticity
vtkAbstractParticleWriter * ParticleWriter
void AddParticleToMPISendList(vtkTemporalStreamTracerNamespace::ParticleInformation &info)
bool InsideBounds(double point[])
vtkSmartPointer< vtkIntArray > InjectedStepIds
std::vector< double > InputTimeValues
int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkSmartPointer< vtkPointData > OutputPointData
vtkTemporalStreamTracerNamespace::ParticleVector MPISendList
vtkSmartPointer< vtkIntArray > InjectedPointIds
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer< vtkFloatArray > ParticleAge
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
see vtkAlgorithm for details
void UpdateParticleList(vtkTemporalStreamTracerNamespace::ParticleVector &candidates)
and sending between processors, into a list, which is used as the master list on this processor
~vtkTemporalStreamTracer() override
vtkSmartPointer< vtkDoubleArray > cellVectors
vtkSmartPointer< vtkIntArray > ErrorCodeArray
bool SendParticleToAnotherProcess(vtkTemporalStreamTracerNamespace::ParticleInformation &info, double point1[4], double delT)
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
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:33
std::list< ParticleInformation > ParticleDataList
std::vector< ParticleInformation > ParticleVector
ParticleDataList::iterator ParticleListIterator
ParticleVector::iterator ParticleIterator
@ point
Definition: vtkX3D.h:242
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ index
Definition: vtkX3D.h:252
int vtkTypeBool
Definition: vtkABI.h:69
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition: vtkType.h:338