VTK
vtkStreamTracer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStreamTracer.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 =========================================================================*/
80 #ifndef vtkStreamTracer_h
81 #define vtkStreamTracer_h
82 
83 #include "vtkFiltersFlowPathsModule.h" // For export macro
84 #include "vtkPolyDataAlgorithm.h"
85 
86 #include "vtkInitialValueProblemSolver.h" // Needed for constants
87 
89 class vtkDataArray;
90 class vtkDoubleArray;
91 class vtkExecutive;
92 class vtkGenericCell;
93 class vtkIdList;
94 class vtkIntArray;
96 
97 class VTKFILTERSFLOWPATHS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
98 {
99 public:
101  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
102 
110  static vtkStreamTracer *New();
111 
113 
118  vtkSetVector3Macro(StartPosition, double);
119  vtkGetVector3Macro(StartPosition, double);
121 
123 
129  void SetSourceData(vtkDataSet *source);
130  vtkDataSet *GetSource();
132 
137  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
138 
139  // The previously-supported TIME_UNIT is excluded in this current
140  // enumeration definition because the underlying step size is ALWAYS in
141  // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
142  // for steady flows) that a particle actually takes to trave in a single
143  // step is obtained by dividing the arc length by the LOCAL speed. The
144  // overall elapsed time (i.e., the life span) of the particle is the sum
145  // of those individual step-wise time intervals. The arc-length-to-time
146  // conversion only occurs for vorticity computation and for generating a
147  // point data array named 'IntegrationTime'.
148  enum Units
149  {
150  LENGTH_UNIT = 1,
151  CELL_LENGTH_UNIT = 2
152  };
153 
154  enum Solvers
155  {
160  UNKNOWN
161  };
162 
164  {
168  OUT_OF_LENGTH = 4,
169  OUT_OF_STEPS = 5,
170  STAGNATION = 6
171  };
172 
174 
184  void SetIntegrator(vtkInitialValueProblemSolver *);
185  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
186  void SetIntegratorType(int type);
187  int GetIntegratorType();
189  {this->SetIntegratorType(RUNGE_KUTTA2);};
191  {this->SetIntegratorType(RUNGE_KUTTA4);};
193  {this->SetIntegratorType(RUNGE_KUTTA45);};
195 
200  void SetInterpolatorTypeToDataSetPointLocator();
201 
206  void SetInterpolatorTypeToCellLocator();
207 
209 
212  vtkSetMacro(MaximumPropagation, double);
213  vtkGetMacro(MaximumPropagation, double);
215 
222  void SetIntegrationStepUnit( int unit );
223  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
224 
226 
233  vtkSetMacro(InitialIntegrationStep, double);
234  vtkGetMacro(InitialIntegrationStep, double);
236 
238 
244  vtkSetMacro(MinimumIntegrationStep, double);
245  vtkGetMacro(MinimumIntegrationStep, double);
247 
249 
255  vtkSetMacro(MaximumIntegrationStep, double);
256  vtkGetMacro(MaximumIntegrationStep, double);
258 
260 
263  vtkSetMacro(MaximumError, double);
264  vtkGetMacro(MaximumError, double);
266 
268 
271  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
272  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
274 
276 
279  vtkSetMacro(TerminalSpeed, double);
280  vtkGetMacro(TerminalSpeed, double);
282 
284 
287  vtkGetMacro(SurfaceStreamlines, bool);
288  vtkSetMacro(SurfaceStreamlines, bool);
289  vtkBooleanMacro(SurfaceStreamlines, bool);
291 
292  enum
293  {
296  BOTH
297  };
298 
299  enum
300  {
302  INTERPOLATOR_WITH_CELL_LOCATOR
303  };
304 
306 
310  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
311  vtkGetMacro(IntegrationDirection, int);
313  {this->SetIntegrationDirection(FORWARD);};
315  {this->SetIntegrationDirection(BACKWARD);};
317  {this->SetIntegrationDirection(BOTH);};
319 
321 
326  vtkSetMacro(ComputeVorticity, bool);
327  vtkGetMacro(ComputeVorticity, bool);
329 
331 
335  vtkSetMacro(RotationScale, double);
336  vtkGetMacro(RotationScale, double);
338 
343  void SetInterpolatorPrototype( vtkAbstractInterpolatedVelocityField * ivf );
344 
354  void SetInterpolatorType( int interpType );
355 
356 protected:
357 
358  vtkStreamTracer();
359  ~vtkStreamTracer() VTK_OVERRIDE;
360 
361  // Create a default executive.
362  vtkExecutive* CreateDefaultExecutive() VTK_OVERRIDE;
363 
364  // hide the superclass' AddInput() from the user and the compiler
365  void AddInput(vtkDataObject *)
366  { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
367 
369  int FillInputPortInformation(int, vtkInformation *) VTK_OVERRIDE;
370 
371  void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
372  vtkDoubleArray* cellVectors, double vorticity[3] );
373  void Integrate(vtkPointData *inputData,
374  vtkPolyData* output,
375  vtkDataArray* seedSource,
376  vtkIdList* seedIds,
377  vtkIntArray* integrationDirections,
378  double lastPoint[3],
380  int maxCellSize,
381  int vecType,
382  const char *vecFieldName,
383  double& propagation,
384  vtkIdType& numSteps,
385  double& integrationTime);
386  double SimpleIntegrate(double seed[3],
387  double lastPoint[3],
388  double stepSize,
390  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
391  int* maxCellSize);
392  void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
393 
395 
396  // starting from global x-y-z position
397  double StartPosition[3];
398 
399  static const double EPSILON;
401 
403 
405  {
406  double Interval;
407  int Unit;
408  };
409 
414 
415  void ConvertIntervals( double& step, double& minStep, double& maxStep,
416  int direction, double cellLength );
417  static double ConvertToLength( double interval, int unit, double cellLength );
418  static double ConvertToLength( IntervalInformation& interval, double cellLength );
419 
420  int SetupOutput(vtkInformation* inInfo,
421  vtkInformation* outInfo);
422  void InitializeSeeds(vtkDataArray*& seeds,
423  vtkIdList*& seedIds,
424  vtkIntArray*& integrationDirections,
425  vtkDataSet *source);
426 
429 
430  // Prototype showing the integrator type to be set by the user.
432 
433  double MaximumError;
435 
438 
439  // Compute streamlines only on surface.
441 
443 
445  bool HasMatchingPointAttributes; //does the point data in the multiblocks have the same attributes?
446 
447  friend class PStreamTracerUtils;
448 
449 private:
450  vtkStreamTracer(const vtkStreamTracer&) VTK_DELETE_FUNCTION;
451  void operator=(const vtkStreamTracer&) VTK_DELETE_FUNCTION;
452 };
453 
454 
455 #endif
void SetIntegrationDirectionToBoth()
Specify whether the streamline is integrated in the upstream or downstream direction.
static const double EPSILON
represent and manipulate point attribute data
Definition: vtkPointData.h:31
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
An abstract class for obtaining the interpolated velocity values at a point.
bool GenerateNormalsInIntegrate
vtkCompositeDataSet * InputData
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
double MinimumIntegrationStep
provides thread-safe access to cells
vtkIdType MaximumNumberOfSteps
Proxy object to connect input/output ports.
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
void SetIntegrationDirectionToForward()
Specify whether the streamline is integrated in the upstream or downstream direction.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
abstract superclass for composite (multi-block or AMR) datasets
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:33
int GetIntegrationStepUnit()
list of point or cell ids
Definition: vtkIdList.h:30
vtkInitialValueProblemSolver * Integrator
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
void SetIntegratorTypeToRungeKutta4()
Set/get the integrator type to be used for streamline generation.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
double MaximumIntegrationStep
void SetIntegratorTypeToRungeKutta2()
Set/get the integrator type to be used for streamline generation.
boost::graph_traits< vtkGraph *>::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void SetIntegratorTypeToRungeKutta45()
Set/get the integrator type to be used for streamline generation.
double InitialIntegrationStep
vtkAbstractInterpolatedVelocityField * InterpolatorPrototype
Streamline generator.
void SetIntegrationDirectionToBackward()
Specify whether the streamline is integrated in the upstream or downstream direction.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
bool HasMatchingPointAttributes
general representation of visualization data
Definition: vtkDataObject.h:58
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Integrate a set of ordinary differential equations (initial value problem) in time.