VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "vtkFiltersGenericModule.h" // For export macro
72 #include "vtkPolyDataAlgorithm.h"
73 
74 #include "vtkInitialValueProblemSolver.h" // Needed for constants
75 
76 class vtkDataArray;
77 class vtkGenericAdaptorCell;
78 class vtkIdList;
79 class vtkIntArray;
80 class vtkGenericInterpolatedVelocityField;
81 class vtkDataSet;
82 class vtkGenericAttribute;
83 class vtkGenericDataSet;
84 
85 class VTKFILTERSGENERIC_EXPORT vtkGenericStreamTracer : public vtkPolyDataAlgorithm
86 {
87 public:
88  vtkTypeMacro(vtkGenericStreamTracer,vtkPolyDataAlgorithm);
89  void PrintSelf(ostream& os, vtkIndent indent);
90 
95  static vtkGenericStreamTracer *New();
96 
98 
101  vtkSetVector3Macro(StartPosition, double);
102  vtkGetVector3Macro(StartPosition, double);
104 
106 
107  void SetSourceData(vtkDataSet *source);
108  vtkDataSet *GetSource();
110 
113  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
114 
115  int FillInputPortInformation(int port, vtkInformation* info);
116 
117 //BTX
118  enum Units
119  {
122  CELL_LENGTH_UNIT
123  };
124 
125  enum Solvers
126  {
131  UNKNOWN
132  };
133 
135  {
136  OUT_OF_DOMAIN = vtkInitialValueProblemSolver::OUT_OF_DOMAIN,
137  NOT_INITIALIZED = vtkInitialValueProblemSolver::NOT_INITIALIZED ,
138  UNEXPECTED_VALUE = vtkInitialValueProblemSolver::UNEXPECTED_VALUE,
139  OUT_OF_TIME = 4,
140  OUT_OF_STEPS = 5,
141  STAGNATION = 6
142  };
143 //ETX
144 
146 
152  void SetIntegrator(vtkInitialValueProblemSolver *);
153  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
154  void SetIntegratorType(int type);
155  int GetIntegratorType();
157  {this->SetIntegratorType(RUNGE_KUTTA2);};
159  {this->SetIntegratorType(RUNGE_KUTTA4);};
161  {this->SetIntegratorType(RUNGE_KUTTA45);};
163 
165 
167  void SetMaximumPropagation(int unit, double max);
168  void SetMaximumPropagation(double max);
169  void SetMaximumPropagationUnit(int unit);
170  int GetMaximumPropagationUnit();
171  double GetMaximumPropagation();
173  {this->SetMaximumPropagationUnit(TIME_UNIT);};
175  {this->SetMaximumPropagationUnit(LENGTH_UNIT);};
177  {this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);};
179 
181 
184  void SetMinimumIntegrationStep(int unit, double step);
185  void SetMinimumIntegrationStepUnit(int unit);
186  void SetMinimumIntegrationStep(double step);
187  int GetMinimumIntegrationStepUnit();
188  double GetMinimumIntegrationStep();
190  {this->SetMinimumIntegrationStepUnit(TIME_UNIT);};
192  {this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);};
194  {this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);};
196 
198 
201  void SetMaximumIntegrationStep(int unit, double step);
202  void SetMaximumIntegrationStepUnit(int unit);
203  void SetMaximumIntegrationStep(double step);
204  int GetMaximumIntegrationStepUnit();
205  double GetMaximumIntegrationStep();
207  {this->SetMaximumIntegrationStepUnit(TIME_UNIT);};
209  {this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);};
211  {this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);};
213 
215 
218  void SetInitialIntegrationStep(int unit, double step);
219  void SetInitialIntegrationStepUnit(int unit);
220  void SetInitialIntegrationStep(double step);
221  int GetInitialIntegrationStepUnit();
222  double GetInitialIntegrationStep();
224  {this->SetInitialIntegrationStepUnit(TIME_UNIT);};
226  {this->SetInitialIntegrationStepUnit(LENGTH_UNIT);};
228  {this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);};
230 
232 
235  vtkSetMacro(MaximumError, double);
236  vtkGetMacro(MaximumError, double);
238 
240 
241  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
242  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
244 
246 
248  vtkSetMacro(TerminalSpeed, double);
249  vtkGetMacro(TerminalSpeed, double);
251 
253 
255  void SetIntegrationStepUnit(int unit)
256  {
257  this->SetInitialIntegrationStepUnit(unit);
258  this->SetMinimumIntegrationStepUnit(unit);
259  this->SetMaximumIntegrationStepUnit(unit);
260  }
262 
263 //BTX
264  enum
265  {
268  BOTH
269  };
270 //ETX
271 
273 
275  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
276  vtkGetMacro(IntegrationDirection, int);
278  {this->SetIntegrationDirection(FORWARD);};
280  {this->SetIntegrationDirection(BACKWARD);};
282  {this->SetIntegrationDirection(BOTH);};
284 
286 
288  vtkSetMacro(ComputeVorticity, int);
289  vtkGetMacro(ComputeVorticity, int);
290  vtkBooleanMacro(ComputeVorticity, int);
292 
294 
296  vtkSetMacro(RotationScale, double);
297  vtkGetMacro(RotationScale, double);
299 
301 
304  vtkGetStringMacro(InputVectorsSelection);
305  void SelectInputVectors(const char *fieldName)
306  {this->SetInputVectorsSelection(fieldName);}
308 
310  void AddInputData(vtkGenericDataSet *in);
311 
314  void SetInterpolatorPrototype(vtkGenericInterpolatedVelocityField* ivf);
315 
316 protected:
319 
320  // hide the superclass' AddInput() from the user and the compiler
321  void AddInput(vtkDataObject *)
322  { vtkErrorMacro( << "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject."); };
323 
324  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
325 
327 
332  void CalculateVorticity(vtkGenericAdaptorCell* cell,
333  double pcoords[3],
334  vtkGenericAttribute *attribute,
335  double vorticity[3]);
337 
338  void Integrate(vtkGenericDataSet *input0,
339  vtkPolyData* output,
340  vtkDataArray* seedSource,
341  vtkIdList* seedIds,
342  vtkIntArray* integrationDirections,
343  double lastPoint[3],
344  vtkGenericInterpolatedVelocityField* func);
345  void SimpleIntegrate(double seed[3],
346  double lastPoint[3],
347  double delt,
348  vtkGenericInterpolatedVelocityField* func);
349  int CheckInputs(vtkGenericInterpolatedVelocityField*& func,
350  vtkInformationVector **inputVector);
351  void GenerateNormals(vtkPolyData* output, double* firstNormal);
352 
354 
355  vtkSetStringMacro(InputVectorsSelection);
356  char *InputVectorsSelection;
357 
358 
359  // starting from global x-y-z position
360  double StartPosition[3];
361 
362  static const double EPSILON;
364 
366 
367 //BTX
369  {
370  double Interval;
371  int Unit;
372  };
373 
378 
379  void SetIntervalInformation(int unit, double interval,
380  IntervalInformation& currentValues);
381  void SetIntervalInformation(int unit,IntervalInformation& currentValues);
382  static double ConvertToTime(IntervalInformation& interval,
383  double cellLength, double speed);
384  static double ConvertToLength(IntervalInformation& interval,
385  double cellLength, double speed);
386  static double ConvertToCellLength(IntervalInformation& interval,
387  double cellLength, double speed);
388  static double ConvertToUnit(IntervalInformation& interval, int unit,
389  double cellLength, double speed);
390  void ConvertIntervals(double& step, double& minStep, double& maxStep,
391  int direction, double cellLength, double speed);
392 //ETX
393 
394  void InitializeSeeds(vtkDataArray*& seeds,
395  vtkIdList*& seedIds,
396  vtkIntArray*& integrationDirections);
397 
399 
400  // Prototype showing the integrator type to be set by the user.
401  vtkInitialValueProblemSolver* Integrator;
402 
403  double MaximumError;
405 
408 
409  vtkGenericInterpolatedVelocityField* InterpolatorPrototype;
410 
411 private:
412  vtkGenericStreamTracer(const vtkGenericStreamTracer&); // Not implemented.
413  void operator=(const vtkGenericStreamTracer&); // Not implemented.
414 };
415 
416 #endif
void SelectInputVectors(const char *fieldName)
vtkGenericInterpolatedVelocityField * InterpolatorPrototype
vtkInitialValueProblemSolver * Integrator
void AddInput(vtkDataObject *)
IntervalInformation MinimumIntegrationStep
IntervalInformation MaximumIntegrationStep
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Streamline generator.
IntervalInformation MaximumPropagation
IntervalInformation InitialIntegrationStep