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 =========================================================================*/
52 #ifndef vtkStreamer_h
53 #define vtkStreamer_h
54 
55 #include "vtkFiltersFlowPathsModule.h" // For export macro
56 #include "vtkPolyDataAlgorithm.h"
57 
59 class vtkMultiThreader;
60 
61 #define VTK_INTEGRATE_FORWARD 0
62 #define VTK_INTEGRATE_BACKWARD 1
63 #define VTK_INTEGRATE_BOTH_DIRECTIONS 2
64 
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent);
70 
74  void SetStartLocation(vtkIdType cellId, int subId, double pcoords[3]);
75 
77 
80  void SetStartLocation(vtkIdType cellId, int subId, double r, double s,
81  double t);
83 
86  vtkIdType GetStartLocation(int& subId, double pcoords[3]);
87 
91  void SetStartPosition(double x[3]);
92 
96  void SetStartPosition(double x, double y, double z);
97 
99  double *GetStartPosition();
100 
102 
106 
110 
112 
113  vtkSetClampMacro(MaximumPropagationTime,double,0.0,VTK_DOUBLE_MAX);
114  vtkGetMacro(MaximumPropagationTime,double);
116 
118 
119  vtkSetClampMacro(IntegrationDirection,int,
121  vtkGetMacro(IntegrationDirection,int);
123  {this->SetIntegrationDirection(VTK_INTEGRATE_FORWARD);};
125  {this->SetIntegrationDirection(VTK_INTEGRATE_BACKWARD);};
127  {this->SetIntegrationDirection(VTK_INTEGRATE_BOTH_DIRECTIONS);};
128  const char *GetIntegrationDirectionAsString();
130 
132 
134  vtkSetClampMacro(IntegrationStepLength,double,0.0000001,VTK_DOUBLE_MAX);
135  vtkGetMacro(IntegrationStepLength,double);
137 
139 
141  vtkSetMacro(SpeedScalars,int);
142  vtkGetMacro(SpeedScalars,int);
143  vtkBooleanMacro(SpeedScalars,int);
145 
147 
152  vtkSetMacro(OrientationScalars, int);
153  vtkGetMacro(OrientationScalars, int);
154  vtkBooleanMacro(OrientationScalars, int);
156 
158 
160  vtkSetClampMacro(TerminalSpeed,double,0.0,VTK_DOUBLE_MAX);
161  vtkGetMacro(TerminalSpeed,double);
163 
165 
170  vtkSetMacro(Vorticity,int);
171  vtkGetMacro(Vorticity,int);
172  vtkBooleanMacro(Vorticity,int);
174 
175  vtkSetMacro( NumberOfThreads, int );
176  vtkGetMacro( NumberOfThreads, int );
177 
178  vtkSetMacro( SavePointInterval, double );
179  vtkGetMacro( SavePointInterval, double );
180 
182 
189 
191 
193  vtkSetMacro(Epsilon,double);
194  vtkGetMacro(Epsilon,double);
196 
197 protected:
199 
205 
206  // Integrate data
208 
209  // Controls where streamlines start from (either position or location).
211 
212  // Starting from cell location
215  double StartPCoords[3];
216 
217  // starting from global x-y-z position
218  double StartPosition[3];
219 
220  //
221  // Special classes for manipulating data
222  //
223  //BTX - begin tcl exclude
224  //
225  class StreamPoint {
226  public:
227  double x[3]; // position
228  vtkIdType cellId; // cell
229  int subId; // cell sub id
230  double p[3]; // parametric coords in cell
231  double v[3]; // velocity
232  double speed; // velocity norm
233  double s; // scalar value
234  double t; // time travelled so far
235  double d; // distance travelled so far
236  double omega; // stream vorticity, if computed
237  double theta; // rotation angle, if vorticity is computed
238  };
239 
240  class StreamArray;
241  friend class StreamArray;
242  class StreamArray { //;prevent man page generation
243  public:
246  {
247  delete [] this->Array;
248  };
249  vtkIdType GetNumberOfPoints() {return this->MaxId + 1;};
250  StreamPoint *GetStreamPoint(vtkIdType i) {return this->Array + i;};
252  {
253  if ( ++this->MaxId >= this->Size )
254  {
255  this->Resize(this->MaxId);
256  }
257  return this->MaxId; //return offset from array
258  }
259  StreamPoint *Resize(vtkIdType sz); //reallocates data
260  void Reset() {this->MaxId = -1;};
261 
262  StreamPoint *Array; // pointer to data
263  vtkIdType MaxId; // maximum index inserted thus far
264  vtkIdType Size; // allocated size of data
265  vtkIdType Extend; // grow array by this amount
266  double Direction; // integration direction
267  };
268  //ETX
269  //
270 
271  //array of streamers
274 
275  // length of Streamer is generated by time, or by MaximumSteps
277 
278  // integration direction
280 
281  // the length (fraction of cell size) of integration steps
283 
284  // boolean controls whether vorticity is computed
286 
287  // terminal propagation speed
289 
290  // boolean controls whether data scalars or velocity magnitude are used
292 
293  // boolean controls whether data scalars or vorticity orientation are used
295 
296  // Prototype showing the integrator type to be set by the user.
298 
299  // A positive value, as small as possible for numerical comparison.
300  // The initial value is 1E-12.
301  double Epsilon;
302 
303  // Interval with which the stream points will be stored.
304  // Useful in reducing the memory footprint. Since the initial
305  // value is small, by default, it will store all/most points.
307 
309 
311 
313  vtkGetMacro( NumberOfStreamers, vtkIdType );
314  StreamArray *GetStreamers() { return this->Streamers; };
316 
320 
322 
323 private:
324  vtkStreamer(const vtkStreamer&); // Not implemented.
325  void operator=(const vtkStreamer&); // Not implemented.
326 };
327 
329 
331 {
333  {
334  return "IntegrateForward";
335  }
336  else if ( this->IntegrationDirection == VTK_INTEGRATE_BACKWARD )
337  {
338  return "IntegrateBackward";
339  }
340  else
341  {
342  return "IntegrateBothDirections";
343  }
344 }
346 
347 #endif
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkStreamer::StreamPoint::cellId
vtkIdType cellId
Definition: vtkStreamer.h:228
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkStreamer::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkStreamer::StreamPoint::speed
double speed
Definition: vtkStreamer.h:232
vtkStreamer::StreamArray::Array
StreamPoint * Array
Definition: vtkStreamer.h:260
vtkStreamer::StreamPoint::s
double s
Definition: vtkStreamer.h:233
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkStreamer::StreamPoint::theta
double theta
Definition: vtkStreamer.h:237
vtkStreamer::StreamArray::Extend
vtkIdType Extend
Definition: vtkStreamer.h:265
vtkgl::s
GLdouble s
Definition: vtkgl.h:11594
vtkStreamer::SetIntegrationDirectionToBackward
void SetIntegrationDirectionToBackward()
Definition: vtkStreamer.h:124
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
VTK_INTEGRATE_FORWARD
#define VTK_INTEGRATE_FORWARD
Definition: vtkStreamer.h:61
VTKFILTERSFLOWPATHS_EXPORT
#define VTKFILTERSFLOWPATHS_EXPORT
Definition: vtkFiltersFlowPathsModule.h:15
vtkStreamer::OrientationScalars
int OrientationScalars
Definition: vtkStreamer.h:294
vtkFiltersFlowPathsModule.h
vtkgl::v
const GLdouble * v
Definition: vtkgl.h:11595
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkStreamer::StreamArray::Size
vtkIdType Size
Definition: vtkStreamer.h:264
vtkStreamer::NumberOfStreamers
vtkIdType NumberOfStreamers
Definition: vtkStreamer.h:273
vtkStreamer::StreamArray
Definition: vtkStreamer.h:242
vtkgl::input
GLenum GLenum GLenum input
Definition: vtkgl.h:15941
vtkStreamer::SetSourceConnection
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
vtkStreamer::StreamArray::GetStreamPoint
StreamPoint * GetStreamPoint(vtkIdType i)
Definition: vtkStreamer.h:250
vtkStreamer::IntegrationDirection
int IntegrationDirection
Definition: vtkStreamer.h:279
vtkStreamer::GetSource
vtkDataSet * GetSource()
vtkStreamer::StreamArray::~StreamArray
~StreamArray()
Definition: vtkStreamer.h:245
vtkPolyDataAlgorithm.h
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:821
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:94
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkStreamer::SetStartPosition
void SetStartPosition(double x, double y, double z)
vtkStreamer::StreamPoint::subId
int subId
Definition: vtkStreamer.h:229
vtkStreamer::StreamPoint::d
double d
Definition: vtkStreamer.h:235
vtkStreamer::SetSourceData
void SetSourceData(vtkDataSet *source)
vtkStreamer::StreamArray::Direction
double Direction
Definition: vtkStreamer.h:266
vtkStreamer::SetStartLocation
void SetStartLocation(vtkIdType cellId, int subId, double pcoords[3])
vtkStreamer::StreamPoint::t
double t
Definition: vtkStreamer.h:234
vtkStreamer::SpeedScalars
int SpeedScalars
Definition: vtkStreamer.h:291
vtkStreamer::StreamArray::Resize
StreamPoint * Resize(vtkIdType sz)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkStreamer::GetStreamers
StreamArray * GetStreamers()
Definition: vtkStreamer.h:314
vtkStreamer::GetStartLocation
vtkIdType GetStartLocation(int &subId, double pcoords[3])
vtkStreamer::ThreadedIntegrate
static VTK_THREAD_RETURN_TYPE ThreadedIntegrate(void *arg)
vtkStreamer::SavePointInterval
double SavePointInterval
Definition: vtkStreamer.h:306
vtkStreamer::SetIntegrator
void SetIntegrator(vtkInitialValueProblemSolver *)
vtkStreamer::Epsilon
double Epsilon
Definition: vtkStreamer.h:301
vtkStreamer::NumberOfThreads
int NumberOfThreads
Definition: vtkStreamer.h:319
vtkStreamer::StreamPoint::omega
double omega
Definition: vtkStreamer.h:236
vtkStreamer::TerminalSpeed
double TerminalSpeed
Definition: vtkStreamer.h:288
vtkStreamer::vtkStreamer
vtkStreamer()
vtkStreamer::GetIntegrationDirectionAsString
const char * GetIntegrationDirectionAsString()
Definition: vtkStreamer.h:330
vtkStreamer::GetStartPosition
double * GetStartPosition()
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkStreamer::StreamArray::GetNumberOfPoints
vtkIdType GetNumberOfPoints()
Definition: vtkStreamer.h:249
vtkStreamer::MaximumPropagationTime
double MaximumPropagationTime
Definition: vtkStreamer.h:276
VTK_THREAD_RETURN_TYPE
#define VTK_THREAD_RETURN_TYPE
Definition: vtkSystemIncludes.h:132
vtkStreamer::~vtkStreamer
~vtkStreamer()
vtkStreamer::SetStartPosition
void SetStartPosition(double x[3])
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkgl::t
GLdouble GLdouble t
Definition: vtkgl.h:11602
vtkgl::r
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
vtkStreamer::StartCell
vtkIdType StartCell
Definition: vtkStreamer.h:213
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkStreamer::IntegrationStepLength
double IntegrationStepLength
Definition: vtkStreamer.h:282
vtkStreamer::SetIntegrationDirectionToForward
void SetIntegrationDirectionToForward()
Definition: vtkStreamer.h:122
vtkStreamer::Streamers
StreamArray * Streamers
Definition: vtkStreamer.h:272
vtkStreamer::StreamArray::Reset
void Reset()
Definition: vtkStreamer.h:260
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:39
vtkStreamer::Vorticity
int Vorticity
Definition: vtkStreamer.h:285
vtkStreamer::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
VTK_INTEGRATE_BACKWARD
#define VTK_INTEGRATE_BACKWARD
Definition: vtkStreamer.h:62
vtkStreamer::StreamArray::InsertNextStreamPoint
vtkIdType InsertNextStreamPoint()
Definition: vtkStreamer.h:251
vtkStreamer
abstract object implements integration of massless particle through vector field
Definition: vtkStreamer.h:66
vtkStreamer::StartSubId
int StartSubId
Definition: vtkStreamer.h:214
VTK_INTEGRATE_BOTH_DIRECTIONS
#define VTK_INTEGRATE_BOTH_DIRECTIONS
Definition: vtkStreamer.h:63
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
vtkStreamer::Integrate
void Integrate(vtkDataSet *input, vtkDataSet *source)
vtkStreamer::StreamArray::MaxId
vtkIdType MaxId
Definition: vtkStreamer.h:263
vtkInitialValueProblemSolver
Integrate a set of ordinary differential equations (initial value problem) in time.
Definition: vtkInitialValueProblemSolver.h:40
vtkStreamer::StreamArray::StreamArray
StreamArray()
vtkStreamer::InitializeThreadedIntegrate
void InitializeThreadedIntegrate()
vtkStreamer::StartFrom
int StartFrom
Definition: vtkStreamer.h:210
vtkStreamer::StreamPoint
Definition: vtkStreamer.h:225
vtkStreamer::SetIntegrationDirectionToIntegrateBothDirections
void SetIntegrationDirectionToIntegrateBothDirections()
Definition: vtkStreamer.h:126
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:142
vtkStreamer::Integrator
vtkInitialValueProblemSolver * Integrator
Definition: vtkStreamer.h:297
vtkStreamer::Threader
vtkMultiThreader * Threader
Definition: vtkStreamer.h:318
vtkStreamer::SetStartLocation
void SetStartLocation(vtkIdType cellId, int subId, double r, double s, double t)
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:44