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 =========================================================================*/
86 #ifndef vtkStreamTracer_h
87 #define vtkStreamTracer_h
88 
89 #include "vtkFiltersFlowPathsModule.h" // For export macro
90 #include "vtkPolyDataAlgorithm.h"
91 
92 #include "vtkInitialValueProblemSolver.h" // Needed for constants
93 
95 class vtkDataArray;
96 class vtkDoubleArray;
97 class vtkExecutive;
98 class vtkGenericCell;
99 class vtkIdList;
100 class vtkIntArray;
102 
103 class VTKFILTERSFLOWPATHS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
104 {
105 public:
107  void PrintSelf(ostream& os, vtkIndent indent);
108 
116  static vtkStreamTracer *New();
117 
119 
124  vtkSetVector3Macro(StartPosition, double);
125  vtkGetVector3Macro(StartPosition, double);
127 
129 
135  void SetSourceData(vtkDataSet *source);
136  vtkDataSet *GetSource();
138 
143  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
144 
145  // The previously-supported TIME_UNIT is excluded in this current
146  // enumeration definition because the underlying step size is ALWAYS in
147  // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
148  // for steady flows) that a particle actually takes to trave in a single
149  // step is obtained by dividing the arc length by the LOCAL speed. The
150  // overall elapsed time (i.e., the life span) of the particle is the sum
151  // of those individual step-wise time intervals. The arc-length-to-time
152  // conversion only occurs for vorticity computation and for generating a
153  // point data array named 'IntegrationTime'.
154  enum Units
155  {
156  LENGTH_UNIT = 1,
157  CELL_LENGTH_UNIT = 2
158  };
159 
160  enum Solvers
161  {
166  UNKNOWN
167  };
168 
170  {
174  OUT_OF_LENGTH = 4,
175  OUT_OF_STEPS = 5,
176  STAGNATION = 6
177  };
178 
180 
190  void SetIntegrator(vtkInitialValueProblemSolver *);
191  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
192  void SetIntegratorType(int type);
193  int GetIntegratorType();
195  {this->SetIntegratorType(RUNGE_KUTTA2);};
197  {this->SetIntegratorType(RUNGE_KUTTA4);};
199  {this->SetIntegratorType(RUNGE_KUTTA45);};
201 
206  void SetInterpolatorTypeToDataSetPointLocator();
207 
212  void SetInterpolatorTypeToCellLocator();
213 
215 
218  vtkSetMacro(MaximumPropagation, double);
219  vtkGetMacro(MaximumPropagation, double);
221 
228  void SetIntegrationStepUnit( int unit );
229  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
230 
232 
239  vtkSetMacro(InitialIntegrationStep, double);
240  vtkGetMacro(InitialIntegrationStep, double);
242 
244 
250  vtkSetMacro(MinimumIntegrationStep, double);
251  vtkGetMacro(MinimumIntegrationStep, double);
253 
255 
261  vtkSetMacro(MaximumIntegrationStep, double);
262  vtkGetMacro(MaximumIntegrationStep, double);
264 
266 
269  vtkSetMacro(MaximumError, double);
270  vtkGetMacro(MaximumError, double);
272 
274 
277  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
278  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
280 
282 
285  vtkSetMacro(TerminalSpeed, double);
286  vtkGetMacro(TerminalSpeed, double);
288 
290 
293  vtkGetMacro(SurfaceStreamlines, bool);
294  vtkSetMacro(SurfaceStreamlines, bool);
295  vtkBooleanMacro(SurfaceStreamlines, bool);
297 
298  enum
299  {
302  BOTH
303  };
304 
305  enum
306  {
308  INTERPOLATOR_WITH_CELL_LOCATOR
309  };
310 
312 
316  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
317  vtkGetMacro(IntegrationDirection, int);
319  {this->SetIntegrationDirection(FORWARD);};
321  {this->SetIntegrationDirection(BACKWARD);};
323  {this->SetIntegrationDirection(BOTH);};
325 
327 
332  vtkSetMacro(ComputeVorticity, bool);
333  vtkGetMacro(ComputeVorticity, bool);
335 
337 
341  vtkSetMacro(RotationScale, double);
342  vtkGetMacro(RotationScale, double);
344 
349  void SetInterpolatorPrototype( vtkAbstractInterpolatedVelocityField * ivf );
350 
360  void SetInterpolatorType( int interpType );
361 
362 protected:
363 
364  vtkStreamTracer();
365  ~vtkStreamTracer();
366 
367  // Create a default executive.
369 
370  // hide the superclass' AddInput() from the user and the compiler
372  { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
373 
375  virtual int FillInputPortInformation(int, vtkInformation *);
376 
377  void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
378  vtkDoubleArray* cellVectors, double vorticity[3] );
379  void Integrate(vtkPointData *inputData,
380  vtkPolyData* output,
381  vtkDataArray* seedSource,
382  vtkIdList* seedIds,
383  vtkIntArray* integrationDirections,
384  double lastPoint[3],
386  int maxCellSize,
387  int vecType,
388  const char *vecFieldName,
389  double& propagation,
390  vtkIdType& numSteps,
391  double& integrationTime);
392  double SimpleIntegrate(double seed[3],
393  double lastPoint[3],
394  double stepSize,
396  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
397  int* maxCellSize);
398  void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
399 
401 
402  // starting from global x-y-z position
403  double StartPosition[3];
404 
405  static const double EPSILON;
407 
409 
411  {
412  double Interval;
413  int Unit;
414  };
415 
420 
421  void ConvertIntervals( double& step, double& minStep, double& maxStep,
422  int direction, double cellLength );
423  static double ConvertToLength( double interval, int unit, double cellLength );
424  static double ConvertToLength( IntervalInformation& interval, double cellLength );
425 
426  int SetupOutput(vtkInformation* inInfo,
427  vtkInformation* outInfo);
428  void InitializeSeeds(vtkDataArray*& seeds,
429  vtkIdList*& seedIds,
430  vtkIntArray*& integrationDirections,
431  vtkDataSet *source);
432 
435 
436  // Prototype showing the integrator type to be set by the user.
438 
439  double MaximumError;
441 
444 
445  // Compute streamlines only on surface.
447 
449 
451  bool HasMatchingPointAttributes; //does the point data in the multiblocks have the same attributes?
452 
453  friend class PStreamTracerUtils;
454 
455 private:
456  vtkStreamTracer(const vtkStreamTracer&) VTK_DELETE_FUNCTION;
457  void operator=(const vtkStreamTracer&) VTK_DELETE_FUNCTION;
458 };
459 
460 
461 #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:37
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
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.
void AddInput(vtkDataObject *)
bool GenerateNormalsInIntegrate
vtkCompositeDataSet * InputData
int vtkIdType
Definition: vtkType.h:287
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
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:45
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:39
int GetIntegrationStepUnit()
list of point or cell ids
Definition: vtkIdList.h:36
vtkInitialValueProblemSolver * Integrator
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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:64
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.