Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
Graphics/vtkStreamer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00070 #ifndef __vtkStreamer_h
00071 #define __vtkStreamer_h
00072
00073 #include "vtkDataSetToPolyDataFilter.h"
00074
00075 class vtkInitialValueProblemSolver;
00076 class vtkMultiThreader;
00077
00078 #define VTK_INTEGRATE_FORWARD 0
00079 #define VTK_INTEGRATE_BACKWARD 1
00080 #define VTK_INTEGRATE_BOTH_DIRECTIONS 2
00081
00082 class VTK_GRAPHICS_EXPORT vtkStreamer : public vtkDataSetToPolyDataFilter
00083 {
00084 public:
00085 vtkTypeRevisionMacro(vtkStreamer,vtkDataSetToPolyDataFilter);
00086 void PrintSelf(ostream& os, vtkIndent indent);
00087
00091 void SetStartLocation(vtkIdType cellId, int subId, float pcoords[3]);
00092
00094
00097 void SetStartLocation(vtkIdType cellId, int subId, float r, float s,
00098 float t);
00100
00103 vtkIdType GetStartLocation(int& subId, float pcoords[3]);
00104
00108 void SetStartPosition(float x[3]);
00109
00113 void SetStartPosition(float x, float y, float z);
00114
00116 float *GetStartPosition();
00117
00119
00120 void SetSource(vtkDataSet *source);
00121 vtkDataSet *GetSource();
00123
00125
00126 vtkSetClampMacro(MaximumPropagationTime,float,0.0,VTK_LARGE_FLOAT);
00127 vtkGetMacro(MaximumPropagationTime,float);
00129
00131
00132 vtkSetClampMacro(IntegrationDirection,int,
00133 VTK_INTEGRATE_FORWARD,VTK_INTEGRATE_BOTH_DIRECTIONS);
00134 vtkGetMacro(IntegrationDirection,int);
00135 void SetIntegrationDirectionToForward()
00136 {this->SetIntegrationDirection(VTK_INTEGRATE_FORWARD);};
00137 void SetIntegrationDirectionToBackward()
00138 {this->SetIntegrationDirection(VTK_INTEGRATE_BACKWARD);};
00139 void SetIntegrationDirectionToIntegrateBothDirections()
00140 {this->SetIntegrationDirection(VTK_INTEGRATE_BOTH_DIRECTIONS);};
00141 const char *GetIntegrationDirectionAsString();
00143
00145
00147 vtkSetClampMacro(IntegrationStepLength,float,0.0000001,VTK_LARGE_FLOAT);
00148 vtkGetMacro(IntegrationStepLength,float);
00150
00152
00154 vtkSetMacro(SpeedScalars,int);
00155 vtkGetMacro(SpeedScalars,int);
00156 vtkBooleanMacro(SpeedScalars,int);
00158
00160
00165 vtkSetMacro(OrientationScalars, int);
00166 vtkGetMacro(OrientationScalars, int);
00167 vtkBooleanMacro(OrientationScalars, int);
00169
00171
00173 vtkSetClampMacro(TerminalSpeed,float,0.0,VTK_LARGE_FLOAT);
00174 vtkGetMacro(TerminalSpeed,float);
00176
00178
00183 vtkSetMacro(Vorticity,int);
00184 vtkGetMacro(Vorticity,int);
00185 vtkBooleanMacro(Vorticity,int);
00187
00188 vtkSetMacro( NumberOfThreads, int );
00189 vtkGetMacro( NumberOfThreads, int );
00190
00191 vtkSetMacro( SavePointInterval, float );
00192 vtkGetMacro( SavePointInterval, float );
00193
00195
00199 void SetIntegrator(vtkInitialValueProblemSolver *);
00200 vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
00202
00203 protected:
00205
00208 vtkStreamer();
00209 ~vtkStreamer();
00211
00212
00213 void Integrate();
00214
00215
00216 void ComputeVorticity();
00217
00218
00219 int StartFrom;
00220
00221
00222 vtkIdType StartCell;
00223 int StartSubId;
00224 float StartPCoords[3];
00225
00226
00227 float StartPosition[3];
00228
00229
00230
00231
00232
00233
00234 class StreamPoint {
00235 public:
00236 float x[3];
00237 vtkIdType cellId;
00238 int subId;
00239 float p[3];
00240 float v[3];
00241 float speed;
00242 float s;
00243 float t;
00244 float d;
00245 float omega;
00246 float theta;
00247 };
00248
00249 class StreamArray;
00250 friend class StreamArray;
00251 class StreamArray {
00252 public:
00253 StreamArray();
00254 ~StreamArray()
00255 {
00256 if (this->Array)
00257 {
00258 delete [] this->Array;
00259 }
00260 };
00261 vtkIdType GetNumberOfPoints() {return this->MaxId + 1;};
00262 StreamPoint *GetStreamPoint(vtkIdType i) {return this->Array + i;};
00263 vtkIdType InsertNextStreamPoint()
00264 {
00265 if ( ++this->MaxId >= this->Size )
00266 {
00267 this->Resize(this->MaxId);
00268 }
00269 return this->MaxId;
00270 }
00271 StreamPoint *Resize(vtkIdType sz);
00272 void Reset() {this->MaxId = -1;};
00273
00274 StreamPoint *Array;
00275 vtkIdType MaxId;
00276 vtkIdType Size;
00277 vtkIdType Extend;
00278 float Direction;
00279 };
00280
00281
00282
00283
00284 StreamArray *Streamers;
00285 vtkIdType NumberOfStreamers;
00286
00287
00288 float MaximumPropagationTime;
00289
00290
00291 int IntegrationDirection;
00292
00293
00294 float IntegrationStepLength;
00295
00296
00297 int Vorticity;
00298
00299
00300 float TerminalSpeed;
00301
00302
00303 int SpeedScalars;
00304
00305
00306 int OrientationScalars;
00307
00308
00309 vtkInitialValueProblemSolver* Integrator;
00310
00311
00312
00313
00314 float SavePointInterval;
00315
00316 static VTK_THREAD_RETURN_TYPE ThreadedIntegrate( void *arg );
00317
00319
00321 vtkGetMacro( NumberOfStreamers, int );
00322 StreamArray *GetStreamers() { return this->Streamers; };
00324
00325 void InitializeThreadedIntegrate();
00326 vtkMultiThreader *Threader;
00327 int NumberOfThreads;
00328
00329 private:
00330 vtkStreamer(const vtkStreamer&);
00331 void operator=(const vtkStreamer&);
00332 };
00333
00335 inline const char *vtkStreamer::GetIntegrationDirectionAsString(void)
00336 {
00337 if ( this->IntegrationDirection == VTK_INTEGRATE_FORWARD )
00338 {
00339 return "IntegrateForward";
00340 }
00341 else if ( this->IntegrationDirection == VTK_INTEGRATE_BACKWARD )
00342 {
00343 return "IntegrateBackward";
00344 }
00345 else
00346 {
00347 return "IntegrateBothDirections";
00348 }
00349 }
00350
00351 #endif
00352
00353