VTK  9.1.0
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_0_0
36#include "vtkFiltersFlowPathsModule.h" // For export macro
37#include "vtkSmartPointer.h" // For protected ivars.
38#include "vtkStreamTracer.h"
39
40#include <list> // STL Header
41#include <vector> // STL Header
42
44
46class vtkDataArray;
47class vtkDoubleArray;
48class vtkGenericCell;
49class vtkIntArray;
51class vtkPoints;
52class vtkCellArray;
53class vtkDoubleArray;
54class vtkFloatArray;
55class vtkIntArray;
58
60{
62{
63 double x[4];
64};
65using Position = struct Position_t;
66
68{
69 // These are used during iteration
74 // These are computed scalars we might display
80 // These are useful to track for debugging etc
82 float age;
83 // these are needed across time steps to compute vorticity
84 float rotation;
86 float time;
87 float speed;
88};
90
91typedef std::vector<ParticleInformation> ParticleVector;
92typedef ParticleVector::iterator ParticleIterator;
93typedef std::list<ParticleInformation> ParticleDataList;
94typedef ParticleDataList::iterator ParticleListIterator;
95};
96
97VTK_DEPRECATED_IN_9_0_0("Use one of vtkParticleTracerBase, vtkParticleTracer, "
98 "vtkParticlePathFilter, or vtkStreaklineFilter")
99class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalStreamTracer : public vtkStreamTracer
100{
101public:
103 void PrintSelf(ostream& os, vtkIndent indent) override;
104
109
111
116 vtkSetMacro(TimeStep, unsigned int);
117 vtkGetMacro(TimeStep, unsigned int);
119
121
125 vtkSetMacro(IgnorePipelineTime, vtkTypeBool);
126 vtkGetMacro(IgnorePipelineTime, vtkTypeBool);
127 vtkBooleanMacro(IgnorePipelineTime, vtkTypeBool);
129
131
138 vtkSetMacro(TimeStepResolution, double);
139 vtkGetMacro(TimeStepResolution, double);
141
143
152 vtkSetMacro(ForceReinjectionEveryNSteps, int);
153 vtkGetMacro(ForceReinjectionEveryNSteps, int);
155
156 enum Units
157 {
159 TERMINATION_STEP_UNIT
160 };
161
163
169 vtkSetMacro(TerminationTime, double);
170 vtkGetMacro(TerminationTime, double);
172
174
178 vtkSetMacro(TerminationTimeUnit, int);
179 vtkGetMacro(TerminationTimeUnit, int);
180 void SetTerminationTimeUnitToTimeUnit() { this->SetTerminationTimeUnit(TERMINATION_TIME_UNIT); }
181 void SetTerminationTimeUnitToStepUnit() { this->SetTerminationTimeUnit(TERMINATION_STEP_UNIT); }
183
185
193 vtkSetMacro(StaticSeeds, vtkTypeBool);
194 vtkGetMacro(StaticSeeds, vtkTypeBool);
195 vtkBooleanMacro(StaticSeeds, vtkTypeBool);
197
199
207 vtkSetMacro(StaticMesh, vtkTypeBool);
208 vtkGetMacro(StaticMesh, vtkTypeBool);
209 vtkBooleanMacro(StaticMesh, vtkTypeBool);
211
213
220 vtkGetObjectMacro(ParticleWriter, vtkAbstractParticleWriter);
222
224
228 vtkSetFilePathMacro(ParticleFileName);
229 vtkGetFilePathMacro(ParticleFileName);
231
233
237 vtkSetMacro(EnableParticleWriting, vtkTypeBool);
238 vtkGetMacro(EnableParticleWriting, vtkTypeBool);
239 vtkBooleanMacro(EnableParticleWriting, vtkTypeBool);
241
243
249
250protected:
253
254 //
255 // Make sure the pipeline knows what type we expect as input
256 //
257 int FillInputPortInformation(int port, vtkInformation* info) override;
258
259 //
260 // The usual suspects
261 //
263 vtkInformationVector* outputVector) override;
264
265 //
266 // Store any information we need in the output and fetch what we can
267 // from the input
268 //
270 vtkInformationVector* outputVector) override;
271
272 //
273 // Compute input time steps given the output step
274 //
276 vtkInformationVector* outputVector) override;
277
278 //
279 // what the pipeline calls for each time step
280 //
282 vtkInformationVector* outputVector) override;
283
284 //
285 // these routines are internally called to actually generate the output
286 //
287 virtual int ProcessInput(vtkInformationVector** inputVector);
288
289 virtual int GenerateOutput(
290 vtkInformationVector** inputVector, vtkInformationVector* outputVector);
291
292 //
293 // Initialization of input (vector-field) geometry
294 //
296 int SetTemporalInput(vtkDataObject* td, int index);
297
298 //
299
306
313 virtual void AssignSeedsToProcessors(vtkDataSet* source, int sourceID, int ptId,
314 vtkTemporalStreamTracerNamespace::ParticleVector& LocalSeedPoints, int& LocalAssignedCount);
315
321
327
334 vtkTemporalStreamTracerNamespace::ParticleVector& received, bool removeself);
335
340 double currenttime, double terminationtime, vtkInitialValueProblemSolver* integrator);
341
349 vtkTemporalStreamTracerNamespace::ParticleInformation& info, double velocity[3], double delT);
350
351 // if the particle is added to send list, then returns value is 1,
352 // if it is kept on this process after a retry return value is 0
354 vtkTemporalStreamTracerNamespace::ParticleInformation& info, double point1[4], double delT);
355
357
364 double pos[4], double p2[4], double intersection[4], vtkGenericCell* cell);
365
366 //
367
368 //
369 // Track internally which round of RequestData it is--between 0 and 2
371
372 // Track which process we are
375
376 // Important for Caching of Cells/Ids/Weights etc
380
381 // Support 'pipeline' time or manual SetTimeStep
382 unsigned int TimeStep;
383 unsigned int ActualTimeStep;
386
387 std::vector<double> InputTimeValues;
388 std::vector<double> OutputTimeValues;
389
390 // more time management
392 double CurrentTimeSteps[2];
394
395 // Particle termination after time
398
399 // Particle injection+Reinjection
404
405 // Particle writing to disk
409
410 // The main lists which are held during operation- between time step updates
411 unsigned int NumberOfParticles;
414
415 //
416 // Scalar arrays that are generated as each particle is updated
417 //
430
431 // The output geometry
434
435 // List used for transmitting between processors during parallel operation
437
438 // The velocity interpolator
440
441 // The input datasets which are stored by time step 0 and 1
444
445 // Cache bounds info for each dataset we will use repeatedly
446 struct bounds_t
447 {
448 double b[6];
449 };
450 using bounds = struct bounds_t;
451 std::vector<bounds> CachedBounds[2];
452
453 // utility function we use to test if a point is inside any of our local datasets
454 bool InsideBounds(double point[]);
455
456 // global Id counter used to give particles a stamp
459 // for debugging only;
461
462private:
466 void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField*) {}
467
468private:
470 void operator=(const vtkTemporalStreamTracer&) = delete;
471};
472
473#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:290
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
provides thread-safe access to cells
a simple class to control print indentation
Definition: vtkIndent.h:113
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:149
Composite dataset that organizes datasets into blocks.
Multiprocessing communication superclass.
represent and manipulate 3D points
Definition: vtkPoints.h:143
dynamic, self-adjusting array of signed char
Hold a reference to a vtkObjectBase instance.
Streamline generator.
A helper class for interpolating between times during particle tracing.
A Parallel Particle tracer for unsteady vector fields.
void SetTerminationTimeUnitToTimeUnit()
The units of TerminationTime may be actual 'Time' units as described by the data, or just TimeSteps o...
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.
void RemoveAllSources()
Provide support for multiple see sources.
vtkSmartPointer< vtkFloatArray > ParticleRotation
vtkSmartPointer< vtkPoints > OutputCoordinates
vtkTemporalStreamTracerNamespace::ParticleDataList ParticleHistories
static vtkTemporalStreamTracer * New()
Construct object using 2nd order Runge Kutta.
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.
vtkSetFilePathMacro(ParticleFileName)
Set/Get the filename to be used with the particle writer when dumping particles to disk.
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.
void SetTerminationTimeUnitToStepUnit()
The units of TerminationTime may be actual 'Time' units as described by the data, or just TimeSteps o...
vtkSmartPointer< vtkFloatArray > ParticleAngularVel
void TestParticles(vtkTemporalStreamTracerNamespace::ParticleVector &candidates, vtkTemporalStreamTracerNamespace::ParticleVector &passed, int &count)
inside our data.
vtkGetFilePathMacro(ParticleFileName)
Set/Get the filename to be used with the particle writer when dumping particles to disk.
vtkSmartPointer< vtkCellArray > ParticleCells
vtkSmartPointer< vtkSignedCharArray > ParticleSourceIds
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:52
std::list< ParticleInformation > ParticleDataList
std::vector< ParticleInformation > ParticleVector
ParticleDataList::iterator ParticleListIterator
ParticleVector::iterator ParticleIterator
int vtkTypeBool
Definition: vtkABI.h:69
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_DEPRECATED_IN_9_0_0(reason)
int vtkIdType
Definition: vtkType.h:332