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 =========================================================================*/
85 #ifndef vtkStreamTracer_h
86 #define vtkStreamTracer_h
87 
88 #include "vtkFiltersFlowPathsModule.h" // For export macro
89 #include "vtkPolyDataAlgorithm.h"
90 
91 #include "vtkInitialValueProblemSolver.h" // Needed for constants
92 
94 class vtkDataArray;
95 class vtkDoubleArray;
96 class vtkExecutive;
97 class vtkGenericCell;
98 class vtkIdList;
99 class vtkIntArray;
101 
103 {
104 public:
106  void PrintSelf(ostream& os, vtkIndent indent);
107 
113  static vtkStreamTracer *New();
114 
116 
119  vtkSetVector3Macro(StartPosition, double);
120  vtkGetVector3Macro(StartPosition, double);
122 
124 
128  void SetSourceData(vtkDataSet *source);
129  vtkDataSet *GetSource();
131 
134  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
135 
136 //BTX
137  // The previously-supported TIME_UNIT is excluded in this current
138  // enumeration definition because the underlying step size is ALWAYS in
139  // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
140  // for steady flows) that a particle actually takes to trave in a single
141  // step is obtained by dividing the arc length by the LOCAL speed. The
142  // overall elapsed time (i.e., the life span) of the particle is the sum
143  // of those individual step-wise time intervals. The arc-length-to-time
144  // conversion only occurs for vorticity computation and for generating a
145  // point data array named 'IntegrationTime'.
146  enum Units
147  {
148  LENGTH_UNIT = 1,
149  CELL_LENGTH_UNIT = 2
150  };
151 
152  enum Solvers
153  {
158  UNKNOWN
159  };
160 
162  {
166  OUT_OF_LENGTH = 4,
167  OUT_OF_STEPS = 5,
168  STAGNATION = 6
169  };
170 //ETX
171 
173 
179  void SetIntegrator(vtkInitialValueProblemSolver *);
180  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
181  void SetIntegratorType(int type);
182  int GetIntegratorType();
184  {this->SetIntegratorType(RUNGE_KUTTA2);};
186  {this->SetIntegratorType(RUNGE_KUTTA4);};
188  {this->SetIntegratorType(RUNGE_KUTTA45);};
190 
193  void SetInterpolatorTypeToDataSetPointLocator();
194 
197  void SetInterpolatorTypeToCellLocator();
198 
200 
201  vtkSetMacro(MaximumPropagation, double);
202  vtkGetMacro(MaximumPropagation, double);
204 
206 
210  void SetIntegrationStepUnit( int unit );
211  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
213 
215 
219  vtkSetMacro(InitialIntegrationStep, double);
220  vtkGetMacro(InitialIntegrationStep, double);
222 
224 
227  vtkSetMacro(MinimumIntegrationStep, double);
228  vtkGetMacro(MinimumIntegrationStep, double);
230 
232 
235  vtkSetMacro(MaximumIntegrationStep, double);
236  vtkGetMacro(MaximumIntegrationStep, double);
238 
240 
242  vtkSetMacro(MaximumError, double);
243  vtkGetMacro(MaximumError, double);
245 
247 
248  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
249  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
251 
253 
255  vtkSetMacro(TerminalSpeed, double);
256  vtkGetMacro(TerminalSpeed, double);
258 
260 
261  vtkGetMacro(SurfaceStreamlines, bool);
262  vtkSetMacro(SurfaceStreamlines, bool);
263  vtkBooleanMacro(SurfaceStreamlines, bool);
265 
266 //BTX
267  enum
268  {
271  BOTH
272  };
273 
274  enum
275  {
277  INTERPOLATOR_WITH_CELL_LOCATOR
278  };
279 //ETX
280 
282 
284  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
285  vtkGetMacro(IntegrationDirection, int);
287  {this->SetIntegrationDirection(FORWARD);};
289  {this->SetIntegrationDirection(BACKWARD);};
291  {this->SetIntegrationDirection(BOTH);};
293 
295 
297  vtkSetMacro(ComputeVorticity, bool);
298  vtkGetMacro(ComputeVorticity, bool);
300 
302 
304  vtkSetMacro(RotationScale, double);
305  vtkGetMacro(RotationScale, double);
307 
310  void SetInterpolatorPrototype( vtkAbstractInterpolatedVelocityField * ivf );
311 
321  void SetInterpolatorType( int interpType );
322 
323 protected:
324 
325  vtkStreamTracer();
326  ~vtkStreamTracer();
327 
328  // Create a default executive.
330 
331  // hide the superclass' AddInput() from the user and the compiler
333  { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
334 
336  virtual int FillInputPortInformation(int, vtkInformation *);
337 
338  void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
339  vtkDoubleArray* cellVectors, double vorticity[3] );
340  void Integrate(vtkPointData *inputData,
341  vtkPolyData* output,
342  vtkDataArray* seedSource,
343  vtkIdList* seedIds,
344  vtkIntArray* integrationDirections,
345  double lastPoint[3],
347  int maxCellSize,
348  int vecType,
349  const char *vecFieldName,
350  double& propagation,
351  vtkIdType& numSteps);
352  void SimpleIntegrate(double seed[3],
353  double lastPoint[3],
354  double stepSize,
356  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
357  int* maxCellSize);
358  void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
359 
361 
362  // starting from global x-y-z position
363  double StartPosition[3];
364 
365  static const double EPSILON;
367 
369 
370 //BTX
372  {
373  double Interval;
374  int Unit;
375  };
376 
381 
382  void ConvertIntervals( double& step, double& minStep, double& maxStep,
383  int direction, double cellLength );
384  static double ConvertToLength( double interval, int unit, double cellLength );
385  static double ConvertToLength( IntervalInformation& interval, double cellLength );
386 
387 //ETX
388 
389  int SetupOutput(vtkInformation* inInfo,
390  vtkInformation* outInfo);
391  void InitializeSeeds(vtkDataArray*& seeds,
392  vtkIdList*& seedIds,
393  vtkIntArray*& integrationDirections,
394  vtkDataSet *source);
395 
398 
399  // Prototype showing the integrator type to be set by the user.
401 
402  double MaximumError;
404 
407 
408  // Compute streamlines only on surface.
410 
412 
414  bool HasMatchingPointAttributes; //does the point data in the multiblocks have the same attributes?
415 
416  friend class PStreamTracerUtils;
417 
418 private:
419  vtkStreamTracer(const vtkStreamTracer&); // Not implemented.
420  void operator=(const vtkStreamTracer&); // Not implemented.
421 };
422 
423 
424 #endif
#define VTKFILTERSFLOWPATHS_EXPORT
void SetIntegrationDirectionToBoth()
static const double EPSILON
virtual int FillInputPortInformation(int port, vtkInformation *info)
represent and manipulate point attribute data
Definition: vtkPointData.h:36
virtual vtkExecutive * CreateDefaultExecutive()
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
An abstract class for obtaining the interpolated velocity values at a point.
void AddInput(vtkDataObject *)
bool GenerateNormalsInIntegrate
vtkCompositeDataSet * InputData
int vtkIdType
Definition: vtkType.h:275
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:51
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 PrintSelf(ostream &os, vtkIndent indent)
void SetIntegrationDirectionToForward()
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
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:38
int GetIntegrationStepUnit()
list of point or cell ids
Definition: vtkIdList.h:35
vtkInitialValueProblemSolver * Integrator
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
void SetIntegratorTypeToRungeKutta4()
double MaximumIntegrationStep
void SetIntegratorTypeToRungeKutta2()
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void SetIntegratorTypeToRungeKutta45()
double InitialIntegrationStep
vtkAbstractInterpolatedVelocityField * InterpolatorPrototype
Streamline generator.
void SetIntegrationDirectionToBackward()
Store zero or more vtkInformation instances.
bool HasMatchingPointAttributes
general representation of visualization data
Definition: vtkDataObject.h:64
Integrate a set of ordinary differential equations (initial value problem) in time.