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 "vtkFiltersGenericModule.h" // For export macro
72 #include "vtkPolyDataAlgorithm.h"
73 
74 #include "vtkInitialValueProblemSolver.h" // Needed for constants
75 
76 class vtkDataArray;
78 class vtkIdList;
79 class vtkIntArray;
81 class vtkDataSet;
83 class vtkGenericDataSet;
84 
86 {
87 public:
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 
116 
117 //BTX
118  enum Units
119  {
122  CELL_LENGTH_UNIT
123  };
124 
125  enum Solvers
126  {
131  UNKNOWN
132  };
133 
135  {
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 
311 
314  void SetInterpolatorPrototype(vtkGenericInterpolatedVelocityField* ivf);
315 
316 protected:
319 
320  // hide the superclass' AddInput() from the user and the compiler
322  { vtkErrorMacro( << "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject."); };
323 
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],
345  void SimpleIntegrate(double seed[3],
346  double lastPoint[3],
347  double delt,
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.
402 
403  double MaximumError;
405 
408 
410 
411 private:
412  vtkGenericStreamTracer(const vtkGenericStreamTracer&); // Not implemented.
413  void operator=(const vtkGenericStreamTracer&); // Not implemented.
414 };
415 
416 #endif
virtual int FillInputPortInformation(int port, vtkInformation *info)
void SelectInputVectors(const char *fieldName)
vtkGenericInterpolatedVelocityField * InterpolatorPrototype
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void AddInputData(vtkDataObject *)
#define VTKFILTERSGENERIC_EXPORT
vtkInitialValueProblemSolver * Integrator
int vtkIdType
Definition: vtkType.h:247
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
abstract class defined API for attribute data
void AddInput(vtkDataObject *)
IntervalInformation MinimumIntegrationStep
Proxy object to connect input/output ports.
static vtkPolyDataAlgorithm * New()
defines cell interface
void PrintSelf(ostream &os, vtkIndent indent)
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:38
list of point or cell ids
Definition: vtkIdList.h:35
IntervalInformation MaximumIntegrationStep
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Streamline generator.
IntervalInformation MaximumPropagation
Store zero or more vtkInformation instances.
defines dataset interface
IntervalInformation InitialIntegrationStep
general representation of visualization data
Definition: vtkDataObject.h:64
#define max(a, b)
Interface for obtaining interpolated velocity values.
Integrate a set of ordinary differential equations (initial value problem) in time.