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 "vtkPolyDataAlgorithm.h"
89 
90 #include "vtkInitialValueProblemSolver.h" // Needed for constants
91 
93 class vtkDataArray;
94 class vtkDoubleArray;
95 class vtkExecutive;
96 class vtkGenericCell;
97 class vtkIdList;
98 class vtkIntArray;
100 
102 {
103 public:
105  void PrintSelf(ostream& os, vtkIndent indent);
106 
112  static vtkStreamTracer *New();
113 
115 
118  vtkSetVector3Macro(StartPosition, double);
119  vtkGetVector3Macro(StartPosition, double);
121 
123 
125  void SetSource(vtkDataSet *source);
126  vtkDataSet *GetSource();
128 
131  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
132 
133 //BTX
134  // The previously-supported TIME_UNIT is excluded in this current
135  // enumeration definition because the underlying step size is ALWAYS in
136  // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
137  // for steady flows) that a particle actually takes to trave in a single
138  // step is obtained by dividing the arc length by the LOCAL speed. The
139  // overall elapsed time (i.e., the life span) of the particle is the sum
140  // of those individual step-wise time intervals. The arc-length-to-time
141  // convertion only occurs for vorticity computation and for generating a
142  // point data array named 'IntegrationTime'.
143  enum Units
144  {
145  LENGTH_UNIT = 1,
146  CELL_LENGTH_UNIT = 2
147  };
148 
149  enum Solvers
150  {
155  UNKNOWN
156  };
157 
159  {
163  OUT_OF_LENGTH = 4,
164  OUT_OF_STEPS = 5,
165  STAGNATION = 6
166  };
167 //ETX
168 
170 
176  void SetIntegrator(vtkInitialValueProblemSolver *);
177  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
178  void SetIntegratorType(int type);
179  int GetIntegratorType();
181  {this->SetIntegratorType(RUNGE_KUTTA2);};
183  {this->SetIntegratorType(RUNGE_KUTTA4);};
185  {this->SetIntegratorType(RUNGE_KUTTA45);};
187 
190  void SetInterpolatorTypeToDataSetPointLocator();
191 
194  void SetInterpolatorTypeToCellLocator();
195 
197 
198  vtkSetMacro(MaximumPropagation, double);
199  vtkGetMacro(MaximumPropagation, double);
201 
203 
207  void SetIntegrationStepUnit( int unit );
208  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
210 
212 
216  vtkSetMacro(InitialIntegrationStep, double);
217  vtkGetMacro(InitialIntegrationStep, double);
219 
221 
224  vtkSetMacro(MinimumIntegrationStep, double);
225  vtkGetMacro(MinimumIntegrationStep, double);
227 
229 
232  vtkSetMacro(MaximumIntegrationStep, double);
233  vtkGetMacro(MaximumIntegrationStep, double);
235 
237 
239  vtkSetMacro(MaximumError, double);
240  vtkGetMacro(MaximumError, double);
242 
244 
245  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
246  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
248 
250 
252  vtkSetMacro(TerminalSpeed, double);
253  vtkGetMacro(TerminalSpeed, double);
255 
256 //BTX
257  enum
258  {
261  BOTH
262  };
263 
264  enum
265  {
267  INTERPOLATOR_WITH_CELL_LOCATOR
268  };
269 //ETX
270 
272 
274  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
275  vtkGetMacro(IntegrationDirection, int);
277  {this->SetIntegrationDirection(FORWARD);};
279  {this->SetIntegrationDirection(BACKWARD);};
281  {this->SetIntegrationDirection(BOTH);};
283 
285 
287  vtkSetMacro(ComputeVorticity, bool);
288  vtkGetMacro(ComputeVorticity, bool);
290 
292 
294  vtkSetMacro(RotationScale, double);
295  vtkGetMacro(RotationScale, double);
297 
300  void SetInterpolatorPrototype( vtkAbstractInterpolatedVelocityField * ivf );
301 
311  void SetInterpolatorType( int interpType );
312 
313 protected:
314 
315  vtkStreamTracer();
316  ~vtkStreamTracer();
317 
318  // Create a default executive.
320 
321  // hide the superclass' AddInput() from the user and the compiler
323  { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
324 
326  virtual int FillInputPortInformation(int, vtkInformation *);
327 
328  void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
329  vtkDoubleArray* cellVectors, double vorticity[3] );
330  void Integrate(vtkDataSet *input,
331  vtkPolyData* output,
332  vtkDataArray* seedSource,
333  vtkIdList* seedIds,
334  vtkIntArray* integrationDirections,
335  double lastPoint[3],
337  int maxCellSize,
338  const char *vecFieldName,
339  double& propagation,
340  vtkIdType& numSteps);
341  void SimpleIntegrate(double seed[3],
342  double lastPoint[3],
343  double stepSize,
345  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
346  int* maxCellSize);
347  void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
348 
350 
351  // starting from global x-y-z position
352  double StartPosition[3];
353 
354  static const double EPSILON;
356 
358 
359 //BTX
361  {
362  double Interval;
363  int Unit;
364  };
365 
370 
371  void ConvertIntervals( double& step, double& minStep, double& maxStep,
372  int direction, double cellLength );
373  static double ConvertToLength( double interval, int unit, double cellLength );
374  static double ConvertToLength( IntervalInformation& interval, double cellLength );
375 
376 //ETX
377 
378  int SetupOutput(vtkInformation* inInfo,
379  vtkInformation* outInfo);
380  void InitializeSeeds(vtkDataArray*& seeds,
381  vtkIdList*& seedIds,
382  vtkIntArray*& integrationDirections,
383  vtkDataSet *source);
384 
387 
388  // Prototype showing the integrator type to be set by the user.
390 
391  double MaximumError;
393 
396 
398 
400 
401 private:
402  vtkStreamTracer(const vtkStreamTracer&); // Not implemented.
403  void operator=(const vtkStreamTracer&); // Not implemented.
404 };
405 
406 
407 #endif
408 
409