VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
126  void SetSourceData(vtkDataSet *source);
127  vtkDataSet *GetSource();
129 
132  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
133 
134 //BTX
135  // The previously-supported TIME_UNIT is excluded in this current
136  // enumeration definition because the underlying step size is ALWAYS in
137  // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
138  // for steady flows) that a particle actually takes to trave in a single
139  // step is obtained by dividing the arc length by the LOCAL speed. The
140  // overall elapsed time (i.e., the life span) of the particle is the sum
141  // of those individual step-wise time intervals. The arc-length-to-time
142  // conversion only occurs for vorticity computation and for generating a
143  // point data array named 'IntegrationTime'.
144  enum Units
145  {
146  LENGTH_UNIT = 1,
147  CELL_LENGTH_UNIT = 2
148  };
149 
150  enum Solvers
151  {
156  UNKNOWN
157  };
158 
160  {
164  OUT_OF_LENGTH = 4,
165  OUT_OF_STEPS = 5,
166  STAGNATION = 6
167  };
168 //ETX
169 
171 
177  void SetIntegrator(vtkInitialValueProblemSolver *);
179  void SetIntegratorType(int type);
180  int GetIntegratorType();
182  {this->SetIntegratorType(RUNGE_KUTTA2);};
184  {this->SetIntegratorType(RUNGE_KUTTA4);};
186  {this->SetIntegratorType(RUNGE_KUTTA45);};
188 
191  void SetInterpolatorTypeToDataSetPointLocator();
192 
195  void SetInterpolatorTypeToCellLocator();
196 
198 
199  vtkSetMacro(MaximumPropagation, double);
200  vtkGetMacro(MaximumPropagation, double);
202 
204 
208  void SetIntegrationStepUnit( int unit );
209  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
211 
213 
217  vtkSetMacro(InitialIntegrationStep, double);
218  vtkGetMacro(InitialIntegrationStep, double);
220 
222 
225  vtkSetMacro(MinimumIntegrationStep, double);
226  vtkGetMacro(MinimumIntegrationStep, double);
228 
230 
233  vtkSetMacro(MaximumIntegrationStep, double);
234  vtkGetMacro(MaximumIntegrationStep, double);
236 
238 
240  vtkSetMacro(MaximumError, double);
241  vtkGetMacro(MaximumError, double);
243 
245 
246  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
247  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
249 
251 
253  vtkSetMacro(TerminalSpeed, double);
254  vtkGetMacro(TerminalSpeed, double);
256 
257 //BTX
258  enum
259  {
262  BOTH
263  };
264 
265  enum
266  {
268  INTERPOLATOR_WITH_CELL_LOCATOR
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, bool);
289  vtkGetMacro(ComputeVorticity, bool);
291 
293 
295  vtkSetMacro(RotationScale, double);
296  vtkGetMacro(RotationScale, double);
298 
301  void SetInterpolatorPrototype( vtkAbstractInterpolatedVelocityField * ivf );
302 
312  void SetInterpolatorType( int interpType );
313 
314 protected:
315 
316  vtkStreamTracer();
317  ~vtkStreamTracer();
318 
319  // Create a default executive.
321 
322  // hide the superclass' AddInput() from the user and the compiler
324  { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
325 
327  virtual int FillInputPortInformation(int, vtkInformation *);
328 
329  void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
330  vtkDoubleArray* cellVectors, double vorticity[3] );
331  void Integrate(vtkPointData *inputData,
332  vtkPolyData* output,
333  vtkDataArray* seedSource,
334  vtkIdList* seedIds,
335  vtkIntArray* integrationDirections,
336  double lastPoint[3],
338  int maxCellSize,
339  int vecType,
340  const char *vecFieldName,
341  double& propagation,
342  vtkIdType& numSteps);
343  void SimpleIntegrate(double seed[3],
344  double lastPoint[3],
345  double stepSize,
347  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
348  int* maxCellSize);
349  void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
350 
352 
353  // starting from global x-y-z position
354  double StartPosition[3];
355 
356  static const double EPSILON;
358 
360 
361 //BTX
363  {
364  double Interval;
365  int Unit;
366  };
367 
372 
373  void ConvertIntervals( double& step, double& minStep, double& maxStep,
374  int direction, double cellLength );
375  static double ConvertToLength( double interval, int unit, double cellLength );
376  static double ConvertToLength( IntervalInformation& interval, double cellLength );
377 
378 //ETX
379 
380  int SetupOutput(vtkInformation* inInfo,
381  vtkInformation* outInfo);
382  void InitializeSeeds(vtkDataArray*& seeds,
383  vtkIdList*& seedIds,
384  vtkIntArray*& integrationDirections,
385  vtkDataSet *source);
386 
389 
390  // Prototype showing the integrator type to be set by the user.
392 
393  double MaximumError;
395 
398 
400 
402  bool HasMatchingPointAttributes; //does the point data in the multiblocks have the same attributes?
403 
404  friend class PStreamTracerUtils;
405 
406 private:
407  vtkStreamTracer(const vtkStreamTracer&); // Not implemented.
408  void operator=(const vtkStreamTracer&); // Not implemented.
409 };
410 
411 
412 #endif
#define VTKFILTERSFLOWPATHS_EXPORT
void SetIntegrationDirectionToBoth()
static const double EPSILON
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
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:60
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
An abstract class for obtaining the interpolated velocity values at a point.
void AddInput(vtkDataObject *)
bool GenerateNormalsInIntegrate
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
vtkCompositeDataSet * InputData
int vtkIdType
Definition: vtkType.h:268
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:48
double MinimumIntegrationStep
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
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:45
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:53
void SetIntegratorTypeToRungeKutta4()
#define vtkGetVector3Macro(name, type)
Definition: vtkSetGet.h:294
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
double MaximumIntegrationStep
GLenum func
Definition: vtkgl.h:11980
void SetIntegratorTypeToRungeKutta2()
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void SetIntegratorTypeToRungeKutta45()
#define vtkErrorMacro(x)
Definition: vtkSetGet.h:468
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
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:277
Integrate a set of ordinary differential equations (initial value problem) in time.
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69