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
58
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
68class VTKFILTERSFLOWPATHS_EXPORT vtkStreamer : public vtkPolyDataAlgorithm
69{
70public:
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
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
230protected:
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 //
259 public:
260 double x[3]; // position
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
358private:
359 vtkStreamer(const vtkStreamer&) VTK_DELETE_FUNCTION;
360 void operator=(const vtkStreamer&) VTK_DELETE_FUNCTION;
361};
362
364
368{
370 {
371 return "IntegrateForward";
372 }
374 {
375 return "IntegrateBackward";
376 }
377 else
378 {
379 return "IntegrateBothDirections";
380 }
381}
383
384#endif // VTK_LEGACY_REMOVE
385#endif
Proxy object to connect input/output ports.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
a simple class to control print indentation
Definition: vtkIndent.h:40
Store vtkAlgorithm input/output information.
Integrate a set of ordinary differential equations (initial value problem) in time.
A class for performing multithreaded execution.
Superclass for algorithms that produce only polydata as output.
vtkIdType InsertNextStreamPoint()
Definition: vtkStreamer.h:284
vtkIdType GetNumberOfPoints()
Definition: vtkStreamer.h:282
StreamPoint * Resize(vtkIdType sz)
StreamPoint * GetStreamPoint(vtkIdType i)
Definition: vtkStreamer.h:283
abstract object implements integration of massless particle through vector field
Definition: vtkStreamer.h:69
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
int OrientationScalars
Definition: vtkStreamer.h:327
void SetIntegrationDirectionToForward()
Definition: vtkStreamer.h:140
double * GetStartPosition()
Get the start position in global x-y-z coordinates.
int SpeedScalars
Definition: vtkStreamer.h:324
double IntegrationStepLength
Definition: vtkStreamer.h:315
vtkIdType GetStartLocation(int &subId, double pcoords[3])
Get the starting location of the streamline in the cell coordinate system.
void SetStartLocation(vtkIdType cellId, int subId, double r, double s, double t)
Specify the start of the streamline in the cell coordinate system.
void SetIntegrator(vtkInitialValueProblemSolver *)
Set/get the integrator type to be used in the stream line calculation.
void SetStartPosition(double x[3])
Specify the start of the streamline in the global coordinate system.
void InitializeThreadedIntegrate()
double TerminalSpeed
Definition: vtkStreamer.h:321
vtkMultiThreader * Threader
Definition: vtkStreamer.h:353
vtkInitialValueProblemSolver * Integrator
Definition: vtkStreamer.h:330
vtkIdType StartCell
Definition: vtkStreamer.h:248
vtkStreamer()
Construct object to start from position (0,0,0); integrate forward; terminal speed 0....
int IntegrationDirection
Definition: vtkStreamer.h:312
static VTK_THREAD_RETURN_TYPE ThreadedIntegrate(void *arg)
void SetSourceData(vtkDataSet *source)
Specify the source object used to generate starting points.
double MaximumPropagationTime
Definition: vtkStreamer.h:309
void SetIntegrationDirectionToIntegrateBothDirections()
Definition: vtkStreamer.h:144
const char * GetIntegrationDirectionAsString()
Return the integration direction as a character string.
Definition: vtkStreamer.h:367
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the source object used to generate starting points by making a pipeline connection.
void SetStartLocation(vtkIdType cellId, int subId, double pcoords[3])
Specify the start of the streamline in the cell coordinate system.
StreamArray * GetStreamers()
Definition: vtkStreamer.h:349
int NumberOfThreads
Definition: vtkStreamer.h:354
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkDataSet * GetSource()
void Integrate(vtkDataSet *input, vtkDataSet *source)
vtkIdType NumberOfStreamers
Definition: vtkStreamer.h:306
StreamArray * Streamers
Definition: vtkStreamer.h:305
double Epsilon
Definition: vtkStreamer.h:334
void SetStartPosition(double x, double y, double z)
Specify the start of the streamline in the global coordinate system.
void SetIntegrationDirectionToBackward()
Definition: vtkStreamer.h:142
double SavePointInterval
Definition: vtkStreamer.h:339
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_INTEGRATE_BACKWARD
Definition: vtkStreamer.h:65
#define VTK_INTEGRATE_FORWARD
Definition: vtkStreamer.h:64
#define VTK_INTEGRATE_BOTH_DIRECTIONS
Definition: vtkStreamer.h:66
#define VTK_THREAD_RETURN_TYPE
int vtkIdType
Definition: vtkType.h:287
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163