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
00071 #ifndef __vtkStreamer_h
00072 #define __vtkStreamer_h
00073
00074 #include "vtkDataSetToPolyDataFilter.h"
00075
00076 class vtkInitialValueProblemSolver;
00077 class vtkMultiThreader;
00078
00079 #define VTK_INTEGRATE_FORWARD 0
00080 #define VTK_INTEGRATE_BACKWARD 1
00081 #define VTK_INTEGRATE_BOTH_DIRECTIONS 2
00082
00083 class VTK_GRAPHICS_EXPORT vtkStreamer : public vtkDataSetToPolyDataFilter
00084 {
00085 public:
00086 vtkTypeRevisionMacro(vtkStreamer,vtkDataSetToPolyDataFilter);
00087 void PrintSelf(ostream& os, vtkIndent indent);
00088
00092 void SetStartLocation(vtkIdType cellId, int subId, float pcoords[3]);
00093
00095
00098 void SetStartLocation(vtkIdType cellId, int subId, float r, float s,
00099 float t);
00101
00104 vtkIdType GetStartLocation(int& subId, float pcoords[3]);
00105
00109 void SetStartPosition(float x[3]);
00110
00114 void SetStartPosition(float x, float y, float z);
00115
00117 float *GetStartPosition();
00118
00120
00121 void SetSource(vtkDataSet *source);
00122 vtkDataSet *GetSource();
00124
00126
00127 vtkSetClampMacro(MaximumPropagationTime,float,0.0,VTK_LARGE_FLOAT);
00128 vtkGetMacro(MaximumPropagationTime,float);
00130
00132
00133 vtkSetClampMacro(IntegrationDirection,int,
00134 VTK_INTEGRATE_FORWARD,VTK_INTEGRATE_BOTH_DIRECTIONS);
00135 vtkGetMacro(IntegrationDirection,int);
00136 void SetIntegrationDirectionToForward()
00137 {this->SetIntegrationDirection(VTK_INTEGRATE_FORWARD);};
00138 void SetIntegrationDirectionToBackward()
00139 {this->SetIntegrationDirection(VTK_INTEGRATE_BACKWARD);};
00140 void SetIntegrationDirectionToIntegrateBothDirections()
00141 {this->SetIntegrationDirection(VTK_INTEGRATE_BOTH_DIRECTIONS);};
00142 const char *GetIntegrationDirectionAsString();
00144
00146
00148 vtkSetClampMacro(IntegrationStepLength,float,0.0000001,VTK_LARGE_FLOAT);
00149 vtkGetMacro(IntegrationStepLength,float);
00151
00153
00155 vtkSetMacro(SpeedScalars,int);
00156 vtkGetMacro(SpeedScalars,int);
00157 vtkBooleanMacro(SpeedScalars,int);
00159
00161
00166 vtkSetMacro(OrientationScalars, int);
00167 vtkGetMacro(OrientationScalars, int);
00168 vtkBooleanMacro(OrientationScalars, int);
00170
00172
00174 vtkSetClampMacro(TerminalSpeed,float,0.0,VTK_LARGE_FLOAT);
00175 vtkGetMacro(TerminalSpeed,float);
00177
00179
00184 vtkSetMacro(Vorticity,int);
00185 vtkGetMacro(Vorticity,int);
00186 vtkBooleanMacro(Vorticity,int);
00188
00189 vtkSetMacro( NumberOfThreads, int );
00190 vtkGetMacro( NumberOfThreads, int );
00191
00192 vtkSetMacro( SavePointInterval, float );
00193 vtkGetMacro( SavePointInterval, float );
00194
00196
00200 void SetIntegrator(vtkInitialValueProblemSolver *);
00201 vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
00203
00204 protected:
00206
00209 vtkStreamer();
00210 ~vtkStreamer();
00212
00213
00214 void Integrate();
00215
00216
00217 void ComputeVorticity();
00218
00219
00220 int StartFrom;
00221
00222
00223 vtkIdType StartCell;
00224 int StartSubId;
00225 float StartPCoords[3];
00226
00227
00228 float StartPosition[3];
00229
00230
00231
00232
00233
00234
00235 class StreamPoint {
00236 public:
00237 float x[3];
00238 vtkIdType cellId;
00239 int subId;
00240 float p[3];
00241 float v[3];
00242 float speed;
00243 float s;
00244 float t;
00245 float d;
00246 float omega;
00247 float theta;
00248 };
00249
00250 class StreamArray;
00251 friend class StreamArray;
00252 class StreamArray {
00253 public:
00254 StreamArray();
00255 ~StreamArray()
00256 {
00257 if (this->Array)
00258 {
00259 delete [] this->Array;
00260 }
00261 };
00262 vtkIdType GetNumberOfPoints() {return this->MaxId + 1;};
00263 StreamPoint *GetStreamPoint(vtkIdType i) {return this->Array + i;};
00264 vtkIdType InsertNextStreamPoint()
00265 {
00266 if ( ++this->MaxId >= this->Size )
00267 {
00268 this->Resize(this->MaxId);
00269 }
00270 return this->MaxId;
00271 }
00272 StreamPoint *Resize(vtkIdType sz);
00273 void Reset() {this->MaxId = -1;};
00274
00275 StreamPoint *Array;
00276 vtkIdType MaxId;
00277 vtkIdType Size;
00278 vtkIdType Extend;
00279 float Direction;
00280 };
00281
00282
00283
00284
00285 StreamArray *Streamers;
00286 vtkIdType NumberOfStreamers;
00287
00288
00289 float MaximumPropagationTime;
00290
00291
00292 int IntegrationDirection;
00293
00294
00295 float IntegrationStepLength;
00296
00297
00298 int Vorticity;
00299
00300
00301 float TerminalSpeed;
00302
00303
00304 int SpeedScalars;
00305
00306
00307 int OrientationScalars;
00308
00309
00310 vtkInitialValueProblemSolver* Integrator;
00311
00312
00313
00314
00315 float SavePointInterval;
00316
00317 static VTK_THREAD_RETURN_TYPE ThreadedIntegrate( void *arg );
00318
00320
00322 vtkGetMacro( NumberOfStreamers, int );
00323 StreamArray *GetStreamers() { return this->Streamers; };
00325
00326 void InitializeThreadedIntegrate();
00327 vtkMultiThreader *Threader;
00328 int NumberOfThreads;
00329
00330 private:
00331 vtkStreamer(const vtkStreamer&);
00332 void operator=(const vtkStreamer&);
00333 };
00334
00336 inline const char *vtkStreamer::GetIntegrationDirectionAsString(void)
00337 {
00338 if ( this->IntegrationDirection == VTK_INTEGRATE_FORWARD )
00339 {
00340 return "IntegrateForward";
00341 }
00342 else if ( this->IntegrationDirection == VTK_INTEGRATE_BACKWARD )
00343 {
00344 return "IntegrateBackward";
00345 }
00346 else
00347 {
00348 return "IntegrateBothDirections";
00349 }
00350 }
00351
00352 #endif
00353
00354