dox/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
00056 #ifndef __vtkStreamer_h
00057 #define __vtkStreamer_h
00058
00059 #include "vtkDataSetToPolyDataFilter.h"
00060
00061 class vtkInitialValueProblemSolver;
00062 class vtkMultiThreader;
00063
00064 #define VTK_INTEGRATE_FORWARD 0
00065 #define VTK_INTEGRATE_BACKWARD 1
00066 #define VTK_INTEGRATE_BOTH_DIRECTIONS 2
00067
00068 class VTK_GRAPHICS_EXPORT vtkStreamer : public vtkDataSetToPolyDataFilter
00069 {
00070 public:
00071 vtkTypeRevisionMacro(vtkStreamer,vtkDataSetToPolyDataFilter);
00072 void PrintSelf(ostream& os, vtkIndent indent);
00073
00077 void SetStartLocation(vtkIdType cellId, int subId, float pcoords[3]);
00078
00080
00083 void SetStartLocation(vtkIdType cellId, int subId, float r, float s,
00084 float t);
00086
00089 vtkIdType GetStartLocation(int& subId, float pcoords[3]);
00090
00094 void SetStartPosition(float x[3]);
00095
00099 void SetStartPosition(float x, float y, float z);
00100
00102 float *GetStartPosition();
00103
00105
00106 void SetSource(vtkDataSet *source);
00107 vtkDataSet *GetSource();
00109
00111
00112 vtkSetClampMacro(MaximumPropagationTime,float,0.0,VTK_LARGE_FLOAT);
00113 vtkGetMacro(MaximumPropagationTime,float);
00115
00117
00118 vtkSetClampMacro(IntegrationDirection,int,
00119 VTK_INTEGRATE_FORWARD,VTK_INTEGRATE_BOTH_DIRECTIONS);
00120 vtkGetMacro(IntegrationDirection,int);
00121 void SetIntegrationDirectionToForward()
00122 {this->SetIntegrationDirection(VTK_INTEGRATE_FORWARD);};
00123 void SetIntegrationDirectionToBackward()
00124 {this->SetIntegrationDirection(VTK_INTEGRATE_BACKWARD);};
00125 void SetIntegrationDirectionToIntegrateBothDirections()
00126 {this->SetIntegrationDirection(VTK_INTEGRATE_BOTH_DIRECTIONS);};
00127 const char *GetIntegrationDirectionAsString();
00129
00131
00133 vtkSetClampMacro(IntegrationStepLength,float,0.0000001,VTK_LARGE_FLOAT);
00134 vtkGetMacro(IntegrationStepLength,float);
00136
00138
00140 vtkSetMacro(SpeedScalars,int);
00141 vtkGetMacro(SpeedScalars,int);
00142 vtkBooleanMacro(SpeedScalars,int);
00144
00146
00151 vtkSetMacro(OrientationScalars, int);
00152 vtkGetMacro(OrientationScalars, int);
00153 vtkBooleanMacro(OrientationScalars, int);
00155
00157
00159 vtkSetClampMacro(TerminalSpeed,float,0.0,VTK_LARGE_FLOAT);
00160 vtkGetMacro(TerminalSpeed,float);
00162
00164
00169 vtkSetMacro(Vorticity,int);
00170 vtkGetMacro(Vorticity,int);
00171 vtkBooleanMacro(Vorticity,int);
00173
00174 vtkSetMacro( NumberOfThreads, int );
00175 vtkGetMacro( NumberOfThreads, int );
00176
00177 vtkSetMacro( SavePointInterval, float );
00178 vtkGetMacro( SavePointInterval, float );
00179
00181
00185 void SetIntegrator(vtkInitialValueProblemSolver *);
00186 vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
00188
00189 protected:
00191
00194 vtkStreamer();
00195 ~vtkStreamer();
00197
00198
00199 void Integrate();
00200
00201
00202 void ComputeVorticity();
00203
00204
00205 int StartFrom;
00206
00207
00208 vtkIdType StartCell;
00209 int StartSubId;
00210 float StartPCoords[3];
00211
00212
00213 float StartPosition[3];
00214
00215
00216
00217
00218
00219
00220 class StreamPoint {
00221 public:
00222 float x[3];
00223 vtkIdType cellId;
00224 int subId;
00225 float p[3];
00226 float v[3];
00227 float speed;
00228 float s;
00229 float t;
00230 float d;
00231 float omega;
00232 float theta;
00233 };
00234
00235 class StreamArray;
00236 friend class StreamArray;
00237 class StreamArray {
00238 public:
00239 StreamArray();
00240 ~StreamArray()
00241 {
00242 if (this->Array)
00243 {
00244 delete [] this->Array;
00245 }
00246 };
00247 vtkIdType GetNumberOfPoints() {return this->MaxId + 1;};
00248 StreamPoint *GetStreamPoint(vtkIdType i) {return this->Array + i;};
00249 vtkIdType InsertNextStreamPoint()
00250 {
00251 if ( ++this->MaxId >= this->Size )
00252 {
00253 this->Resize(this->MaxId);
00254 }
00255 return this->MaxId;
00256 }
00257 StreamPoint *Resize(vtkIdType sz);
00258 void Reset() {this->MaxId = -1;};
00259
00260 StreamPoint *Array;
00261 vtkIdType MaxId;
00262 vtkIdType Size;
00263 vtkIdType Extend;
00264 float Direction;
00265 };
00266
00267
00268
00269
00270 StreamArray *Streamers;
00271 vtkIdType NumberOfStreamers;
00272
00273
00274 float MaximumPropagationTime;
00275
00276
00277 int IntegrationDirection;
00278
00279
00280 float IntegrationStepLength;
00281
00282
00283 int Vorticity;
00284
00285
00286 float TerminalSpeed;
00287
00288
00289 int SpeedScalars;
00290
00291
00292 int OrientationScalars;
00293
00294
00295 vtkInitialValueProblemSolver* Integrator;
00296
00297
00298
00299
00300 float SavePointInterval;
00301
00302 static VTK_THREAD_RETURN_TYPE ThreadedIntegrate( void *arg );
00303
00305
00307 vtkGetMacro( NumberOfStreamers, int );
00308 StreamArray *GetStreamers() { return this->Streamers; };
00310
00311 void InitializeThreadedIntegrate();
00312 vtkMultiThreader *Threader;
00313 int NumberOfThreads;
00314
00315 private:
00316 vtkStreamer(const vtkStreamer&);
00317 void operator=(const vtkStreamer&);
00318 };
00319
00321 inline const char *vtkStreamer::GetIntegrationDirectionAsString(void)
00322 {
00323 if ( this->IntegrationDirection == VTK_INTEGRATE_FORWARD )
00324 {
00325 return "IntegrateForward";
00326 }
00327 else if ( this->IntegrationDirection == VTK_INTEGRATE_BACKWARD )
00328 {
00329 return "IntegrateBackward";
00330 }
00331 else
00332 {
00333 return "IntegrateBothDirections";
00334 }
00335 }
00336
00337 #endif
00338
00339