VTK
vtkStreamer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStreamer.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 =========================================================================*/
53 #ifndef vtkStreamer_h
54 #define vtkStreamer_h
55 
56 #include "vtkFiltersFlowPathsModule.h" // For export macro
57 #include "vtkPolyDataAlgorithm.h"
58 
60 class vtkMultiThreader;
61 
62 #ifndef VTK_LEGACY_REMOVE
63 
64 #define VTK_INTEGRATE_FORWARD 0
65 #define VTK_INTEGRATE_BACKWARD 1
66 #define VTK_INTEGRATE_BOTH_DIRECTIONS 2
67 
68 class VTKFILTERSFLOWPATHS_EXPORT vtkStreamer : public vtkPolyDataAlgorithm
69 {
70 public:
72  void PrintSelf(ostream& os, vtkIndent indent);
73 
78  void SetStartLocation(vtkIdType cellId, int subId, double pcoords[3]);
79 
84  void SetStartLocation(vtkIdType cellId, int subId, double r, double s,
85  double t);
86 
90  vtkIdType GetStartLocation(int& subId, double pcoords[3]);
91 
97  void SetStartPosition(double x[3]);
98 
104  void SetStartPosition(double x, double y, double z);
105 
109  double *GetStartPosition();
110 
112 
118 
124 
126 
129  vtkSetClampMacro(MaximumPropagationTime,double,0.0,VTK_DOUBLE_MAX);
130  vtkGetMacro(MaximumPropagationTime,double);
132 
134 
137  vtkSetClampMacro(IntegrationDirection,int,
139  vtkGetMacro(IntegrationDirection,int);
141  {this->SetIntegrationDirection(VTK_INTEGRATE_FORWARD);};
143  {this->SetIntegrationDirection(VTK_INTEGRATE_BACKWARD);};
145  {this->SetIntegrationDirection(VTK_INTEGRATE_BOTH_DIRECTIONS);};
146  const char *GetIntegrationDirectionAsString();
148 
150 
154  vtkSetClampMacro(IntegrationStepLength,double,0.0000001,VTK_DOUBLE_MAX);
155  vtkGetMacro(IntegrationStepLength,double);
157 
159 
163  vtkSetMacro(SpeedScalars,int);
164  vtkGetMacro(SpeedScalars,int);
165  vtkBooleanMacro(SpeedScalars,int);
167 
169 
176  vtkSetMacro(OrientationScalars, int);
177  vtkGetMacro(OrientationScalars, int);
178  vtkBooleanMacro(OrientationScalars, int);
180 
182 
186  vtkSetClampMacro(TerminalSpeed,double,0.0,VTK_DOUBLE_MAX);
187  vtkGetMacro(TerminalSpeed,double);
189 
191 
198  vtkSetMacro(Vorticity,int);
199  vtkGetMacro(Vorticity,int);
200  vtkBooleanMacro(Vorticity,int);
202 
203  vtkSetMacro( NumberOfThreads, int );
204  vtkGetMacro( NumberOfThreads, int );
205 
206  vtkSetMacro( SavePointInterval, double );
207  vtkGetMacro( SavePointInterval, double );
208 
210 
218  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
220 
222 
226  vtkSetMacro(Epsilon,double);
227  vtkGetMacro(Epsilon,double);
229 
230 protected:
232 
240 
241  // Integrate data
243 
244  // Controls where streamlines start from (either position or location).
246 
247  // Starting from cell location
250  double StartPCoords[3];
251 
252  // starting from global x-y-z position
253  double StartPosition[3];
254 
255  //
256  // Special classes for manipulating data
257  //
258  class StreamPoint {
259  public:
260  double x[3]; // position
261  vtkIdType cellId; // cell
262  int subId; // cell sub id
263  double p[3]; // parametric coords in cell
264  double v[3]; // velocity
265  double speed; // velocity norm
266  double s; // scalar value
267  double t; // time travelled so far
268  double d; // distance travelled so far
269  double omega; // stream vorticity, if computed
270  double theta; // rotation angle, if vorticity is computed
271  };
272 
273  class StreamArray;
274  friend class StreamArray;
275  class StreamArray { //;prevent man page generation
276  public:
279  {
280  delete [] this->Array;
281  };
282  vtkIdType GetNumberOfPoints() {return this->MaxId + 1;};
283  StreamPoint *GetStreamPoint(vtkIdType i) {return this->Array + i;};
285  {
286  if ( ++this->MaxId >= this->Size )
287  {
288  this->Resize(this->MaxId);
289  }
290  return this->MaxId; //return offset from array
291  }
292  StreamPoint *Resize(vtkIdType sz); //reallocates data
293  void Reset() {this->MaxId = -1;};
294 
295  StreamPoint *Array; // pointer to data
296  vtkIdType MaxId; // maximum index inserted thus far
297  vtkIdType Size; // allocated size of data
298  vtkIdType Extend; // grow array by this amount
299  double Direction; // integration direction
300  };
301 
302  //
303 
304  //array of streamers
307 
308  // length of Streamer is generated by time, or by MaximumSteps
310 
311  // integration direction
313 
314  // the length (fraction of cell size) of integration steps
316 
317  // boolean controls whether vorticity is computed
319 
320  // terminal propagation speed
322 
323  // boolean controls whether data scalars or velocity magnitude are used
325 
326  // boolean controls whether data scalars or vorticity orientation are used
328 
329  // Prototype showing the integrator type to be set by the user.
331 
332  // A positive value, as small as possible for numerical comparison.
333  // The initial value is 1E-12.
334  double Epsilon;
335 
336  // Interval with which the stream points will be stored.
337  // Useful in reducing the memory footprint. Since the initial
338  // value is small, by default, it will store all/most points.
340 
342 
344 
348  vtkGetMacro( NumberOfStreamers, vtkIdType );
349  StreamArray *GetStreamers() { return this->Streamers; };
351 
355 
357 
358 private:
359  vtkStreamer(const vtkStreamer&) VTK_DELETE_FUNCTION;
360  void operator=(const vtkStreamer&) VTK_DELETE_FUNCTION;
361 };
362 
364 
368 {
370  {
371  return "IntegrateForward";
372  }
373  else if ( this->IntegrationDirection == VTK_INTEGRATE_BACKWARD )
374  {
375  return "IntegrateBackward";
376  }
377  else
378  {
379  return "IntegrateBothDirections";
380  }
381 }
383 
384 #endif // VTK_LEGACY_REMOVE
385 #endif
vtkStreamer::StreamPoint::cellId
vtkIdType cellId
Definition: vtkStreamer.h:261
vtkStreamer::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkStreamer::StreamPoint::speed
double speed
Definition: vtkStreamer.h:265
vtkStreamer::StreamArray::Array
StreamPoint * Array
Definition: vtkStreamer.h:293
vtkStreamer::StreamPoint::s
double s
Definition: vtkStreamer.h:266
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkStreamer::StreamPoint::theta
double theta
Definition: vtkStreamer.h:270
vtkStreamer::StreamArray::Extend
vtkIdType Extend
Definition: vtkStreamer.h:298
vtkStreamer::SetIntegrationDirectionToBackward
void SetIntegrationDirectionToBackward()
Definition: vtkStreamer.h:142
VTK_INTEGRATE_FORWARD
#define VTK_INTEGRATE_FORWARD
Definition: vtkStreamer.h:64
vtkStreamer::OrientationScalars
int OrientationScalars
Definition: vtkStreamer.h:327
vtkStreamer::StreamArray::Size
vtkIdType Size
Definition: vtkStreamer.h:297
vtkStreamer::NumberOfStreamers
vtkIdType NumberOfStreamers
Definition: vtkStreamer.h:306
vtkStreamer::StreamArray
Definition: vtkStreamer.h:275
vtkStreamer::SetSourceConnection
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the source object used to generate starting points by making a pipeline connection.
vtkStreamer::StreamArray::GetStreamPoint
StreamPoint * GetStreamPoint(vtkIdType i)
Definition: vtkStreamer.h:283
vtkStreamer::IntegrationDirection
int IntegrationDirection
Definition: vtkStreamer.h:312
vtkStreamer::GetSource
vtkDataSet * GetSource()
vtkStreamer::StreamArray::~StreamArray
~StreamArray()
Definition: vtkStreamer.h:278
vtkPolyDataAlgorithm.h
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:822
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:97
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkStreamer::SetStartPosition
void SetStartPosition(double x, double y, double z)
Specify the start of the streamline in the global coordinate system.
vtkStreamer::StreamPoint::subId
int subId
Definition: vtkStreamer.h:262
vtkStreamer::StreamPoint::d
double d
Definition: vtkStreamer.h:268
vtkStreamer::SetSourceData
void SetSourceData(vtkDataSet *source)
Specify the source object used to generate starting points.
vtkStreamer::StreamArray::Direction
double Direction
Definition: vtkStreamer.h:299
vtkStreamer::SetStartLocation
void SetStartLocation(vtkIdType cellId, int subId, double pcoords[3])
Specify the start of the streamline in the cell coordinate system.
vtkStreamer::StreamPoint::t
double t
Definition: vtkStreamer.h:267
vtkStreamer::SpeedScalars
int SpeedScalars
Definition: vtkStreamer.h:324
vtkStreamer::StreamArray::Resize
StreamPoint * Resize(vtkIdType sz)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkStreamer::GetStreamers
StreamArray * GetStreamers()
Definition: vtkStreamer.h:349
vtkStreamer::GetStartLocation
vtkIdType GetStartLocation(int &subId, double pcoords[3])
Get the starting location of the streamline in the cell coordinate system.
vtkStreamer::ThreadedIntegrate
static VTK_THREAD_RETURN_TYPE ThreadedIntegrate(void *arg)
vtkStreamer::SavePointInterval
double SavePointInterval
Definition: vtkStreamer.h:339
vtkStreamer::SetIntegrator
void SetIntegrator(vtkInitialValueProblemSolver *)
Set/get the integrator type to be used in the stream line calculation.
vtkStreamer::Epsilon
double Epsilon
Definition: vtkStreamer.h:334
vtkStreamer::NumberOfThreads
int NumberOfThreads
Definition: vtkStreamer.h:354
vtkStreamer::StreamPoint::omega
double omega
Definition: vtkStreamer.h:269
vtkStreamer::TerminalSpeed
double TerminalSpeed
Definition: vtkStreamer.h:321
vtkStreamer::vtkStreamer
vtkStreamer()
Construct object to start from position (0,0,0); integrate forward; terminal speed 0....
vtkStreamer::GetIntegrationDirectionAsString
const char * GetIntegrationDirectionAsString()
Return the integration direction as a character string.
Definition: vtkStreamer.h:367
vtkStreamer::GetStartPosition
double * GetStartPosition()
Get the start position in global x-y-z coordinates.
vtkStreamer::StreamArray::GetNumberOfPoints
vtkIdType GetNumberOfPoints()
Definition: vtkStreamer.h:282
vtkStreamer::MaximumPropagationTime
double MaximumPropagationTime
Definition: vtkStreamer.h:309
VTK_THREAD_RETURN_TYPE
#define VTK_THREAD_RETURN_TYPE
Definition: vtkSystemIncludes.h:136
vtkStreamer::~vtkStreamer
~vtkStreamer()
vtkStreamer::SetStartPosition
void SetStartPosition(double x[3])
Specify the start of the streamline in the global coordinate system.
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkStreamer::StartCell
vtkIdType StartCell
Definition: vtkStreamer.h:248
vtkStreamer::IntegrationStepLength
double IntegrationStepLength
Definition: vtkStreamer.h:315
vtkStreamer::SetIntegrationDirectionToForward
void SetIntegrationDirectionToForward()
Definition: vtkStreamer.h:140
vtkStreamer::Streamers
StreamArray * Streamers
Definition: vtkStreamer.h:305
vtkStreamer::StreamArray::Reset
void Reset()
Definition: vtkStreamer.h:293
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:40
vtkStreamer::Vorticity
int Vorticity
Definition: vtkStreamer.h:318
vtkStreamer::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
VTK_INTEGRATE_BACKWARD
#define VTK_INTEGRATE_BACKWARD
Definition: vtkStreamer.h:65
vtkStreamer::StreamArray::InsertNextStreamPoint
vtkIdType InsertNextStreamPoint()
Definition: vtkStreamer.h:284
vtkStreamer
abstract object implements integration of massless particle through vector field
Definition: vtkStreamer.h:69
vtkStreamer::StartSubId
int StartSubId
Definition: vtkStreamer.h:249
VTK_INTEGRATE_BOTH_DIRECTIONS
#define VTK_INTEGRATE_BOTH_DIRECTIONS
Definition: vtkStreamer.h:66
vtkStreamer::Integrate
void Integrate(vtkDataSet *input, vtkDataSet *source)
vtkStreamer::StreamArray::MaxId
vtkIdType MaxId
Definition: vtkStreamer.h:296
vtkInitialValueProblemSolver
Integrate a set of ordinary differential equations (initial value problem) in time.
Definition: vtkInitialValueProblemSolver.h:41
vtkStreamer::StreamArray::StreamArray
StreamArray()
vtkStreamer::InitializeThreadedIntegrate
void InitializeThreadedIntegrate()
vtkStreamer::StartFrom
int StartFrom
Definition: vtkStreamer.h:245
vtkStreamer::StreamPoint
Definition: vtkStreamer.h:258
vtkStreamer::SetIntegrationDirectionToIntegrateBothDirections
void SetIntegrationDirectionToIntegrateBothDirections()
Definition: vtkStreamer.h:144
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163
vtkStreamer::Integrator
vtkInitialValueProblemSolver * Integrator
Definition: vtkStreamer.h:330
vtkStreamer::Threader
vtkMultiThreader * Threader
Definition: vtkStreamer.h:353
vtkStreamer::SetStartLocation
void SetStartLocation(vtkIdType cellId, int subId, double r, double s, double t)
Specify the start of the streamline in the cell coordinate system.
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:45