VTK
vtkGenericStreamTracer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGenericStreamTracer.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 =========================================================================*/
68 #ifndef __vtkGenericStreamTracer_h
69 #define __vtkGenericStreamTracer_h
70 
71 #include "vtkPolyDataAlgorithm.h"
72 
73 #include "vtkInitialValueProblemSolver.h" // Needed for constants
74 
75 class vtkDataArray;
77 class vtkIdList;
78 class vtkIntArray;
80 class vtkDataSet;
82 class vtkGenericDataSet;
83 
85 {
86 public:
88  void PrintSelf(ostream& os, vtkIndent indent);
89 
94  static vtkGenericStreamTracer *New();
95 
97 
100  vtkSetVector3Macro(StartPosition, double);
101  vtkGetVector3Macro(StartPosition, double);
103 
105 
106  void SetSource(vtkDataSet *source);
107  vtkDataSet *GetSource();
109 
111 
112 //BTX
113  enum Units
114  {
117  CELL_LENGTH_UNIT
118  };
119 
120  enum Solvers
121  {
126  UNKNOWN
127  };
128 
130  {
134  OUT_OF_TIME = 4,
135  OUT_OF_STEPS = 5,
136  STAGNATION = 6
137  };
138 //ETX
139 
141 
147  void SetIntegrator(vtkInitialValueProblemSolver *);
148  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
149  void SetIntegratorType(int type);
150  int GetIntegratorType();
151  void SetIntegratorTypeToRungeKutta2()
152  {this->SetIntegratorType(RUNGE_KUTTA2);};
153  void SetIntegratorTypeToRungeKutta4()
154  {this->SetIntegratorType(RUNGE_KUTTA4);};
155  void SetIntegratorTypeToRungeKutta45()
156  {this->SetIntegratorType(RUNGE_KUTTA45);};
158 
160 
162  void SetMaximumPropagation(int unit, double max);
163  void SetMaximumPropagation(double max);
164  void SetMaximumPropagationUnit(int unit);
165  int GetMaximumPropagationUnit();
166  double GetMaximumPropagation();
167  void SetMaximumPropagationUnitToTimeUnit()
168  {this->SetMaximumPropagationUnit(TIME_UNIT);};
169  void SetMaximumPropagationUnitToLengthUnit()
170  {this->SetMaximumPropagationUnit(LENGTH_UNIT);};
171  void SetMaximumPropagationUnitToCellLengthUnit()
172  {this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);};
174 
176 
179  void SetMinimumIntegrationStep(int unit, double step);
180  void SetMinimumIntegrationStepUnit(int unit);
181  void SetMinimumIntegrationStep(double step);
182  int GetMinimumIntegrationStepUnit();
183  double GetMinimumIntegrationStep();
184  void SetMinimumIntegrationStepUnitToTimeUnit()
185  {this->SetMinimumIntegrationStepUnit(TIME_UNIT);};
186  void SetMinimumIntegrationStepUnitToLengthUnit()
187  {this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);};
188  void SetMinimumIntegrationStepUnitToCellLengthUnit()
189  {this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);};
191 
193 
196  void SetMaximumIntegrationStep(int unit, double step);
197  void SetMaximumIntegrationStepUnit(int unit);
198  void SetMaximumIntegrationStep(double step);
199  int GetMaximumIntegrationStepUnit();
200  double GetMaximumIntegrationStep();
201  void SetMaximumIntegrationStepUnitToTimeUnit()
202  {this->SetMaximumIntegrationStepUnit(TIME_UNIT);};
203  void SetMaximumIntegrationStepUnitToLengthUnit()
204  {this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);};
205  void SetMaximumIntegrationStepUnitToCellLengthUnit()
206  {this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);};
208 
210 
213  void SetInitialIntegrationStep(int unit, double step);
214  void SetInitialIntegrationStepUnit(int unit);
215  void SetInitialIntegrationStep(double step);
216  int GetInitialIntegrationStepUnit();
217  double GetInitialIntegrationStep();
218  void SetInitialIntegrationStepUnitToTimeUnit()
219  {this->SetInitialIntegrationStepUnit(TIME_UNIT);};
220  void SetInitialIntegrationStepUnitToLengthUnit()
221  {this->SetInitialIntegrationStepUnit(LENGTH_UNIT);};
222  void SetInitialIntegrationStepUnitToCellLengthUnit()
223  {this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);};
225 
227 
230  vtkSetMacro(MaximumError, double);
231  vtkGetMacro(MaximumError, double);
233 
235 
236  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
237  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
239 
241 
243  vtkSetMacro(TerminalSpeed, double);
244  vtkGetMacro(TerminalSpeed, double);
246 
247 //BTX
248  enum
249  {
252  BOTH
253  };
254 //ETX
255 
257 
259  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
260  vtkGetMacro(IntegrationDirection, int);
261  void SetIntegrationDirectionToForward()
262  {this->SetIntegrationDirection(FORWARD);};
263  void SetIntegrationDirectionToBackward()
264  {this->SetIntegrationDirection(BACKWARD);};
265  void SetIntegrationDirectionToBoth()
266  {this->SetIntegrationDirection(BOTH);};
268 
270 
272  vtkSetMacro(ComputeVorticity, int);
273  vtkGetMacro(ComputeVorticity, int);
274  vtkBooleanMacro(ComputeVorticity, int);
276 
278 
280  vtkSetMacro(RotationScale, double);
281  vtkGetMacro(RotationScale, double);
283 
285 
288  vtkGetStringMacro(InputVectorsSelection);
289  void SelectInputVectors(const char *fieldName)
290  {this->SetInputVectorsSelection(fieldName);}
292 
294  void AddInput(vtkGenericDataSet *in);
295 
298  void SetInterpolatorPrototype(vtkGenericInterpolatedVelocityField* ivf);
299 
300 protected:
303 
304  // hide the superclass' AddInput() from the user and the compiler
306  { vtkErrorMacro( << "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject."); };
307 
309 
311 
316  void CalculateVorticity(vtkGenericAdaptorCell* cell,
317  double pcoords[3],
318  vtkGenericAttribute *attribute,
319  double vorticity[3]);
321 
322  void Integrate(vtkGenericDataSet *input0,
323  vtkPolyData* output,
324  vtkDataArray* seedSource,
325  vtkIdList* seedIds,
326  vtkIntArray* integrationDirections,
327  double lastPoint[3],
329  void SimpleIntegrate(double seed[3],
330  double lastPoint[3],
331  double delt,
333  int CheckInputs(vtkGenericInterpolatedVelocityField*& func,
334  vtkInformationVector **inputVector);
335  void GenerateNormals(vtkPolyData* output, double* firstNormal);
336 
338 
339  vtkSetStringMacro(InputVectorsSelection);
340  char *InputVectorsSelection;
341 
342 
343  // starting from global x-y-z position
344  double StartPosition[3];
345 
346  static const double EPSILON;
348 
350 
351 //BTX
353  {
354  double Interval;
355  int Unit;
356  };
357 
362 
363  void SetIntervalInformation(int unit, double interval,
364  IntervalInformation& currentValues);
365  void SetIntervalInformation(int unit,IntervalInformation& currentValues);
366  static double ConvertToTime(IntervalInformation& interval,
367  double cellLength, double speed);
368  static double ConvertToLength(IntervalInformation& interval,
369  double cellLength, double speed);
370  static double ConvertToCellLength(IntervalInformation& interval,
371  double cellLength, double speed);
372  static double ConvertToUnit(IntervalInformation& interval, int unit,
373  double cellLength, double speed);
374  void ConvertIntervals(double& step, double& minStep, double& maxStep,
375  int direction, double cellLength, double speed);
376 //ETX
377 
378  void InitializeSeeds(vtkDataArray*& seeds,
379  vtkIdList*& seedIds,
380  vtkIntArray*& integrationDirections);
381 
383 
384  // Prototype showing the integrator type to be set by the user.
386 
387  double MaximumError;
389 
392 
394 
395 private:
396  vtkGenericStreamTracer(const vtkGenericStreamTracer&); // Not implemented.
397  void operator=(const vtkGenericStreamTracer&); // Not implemented.
398 };
399 
400 #endif