vtkStreamer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00066 #ifndef __vtkStreamer_h
00067 #define __vtkStreamer_h
00068
00069 #include "vtkDataSetToPolyDataFilter.h"
00070
00071 class vtkInitialValueProblemSolver;
00072 class vtkMultiThreader;
00073
00074 #define VTK_INTEGRATE_FORWARD 0
00075 #define VTK_INTEGRATE_BACKWARD 1
00076 #define VTK_INTEGRATE_BOTH_DIRECTIONS 2
00077
00078 class VTK_GRAPHICS_EXPORT vtkStreamer : public vtkDataSetToPolyDataFilter
00079 {
00080 public:
00081 vtkTypeRevisionMacro(vtkStreamer,vtkDataSetToPolyDataFilter);
00082 void PrintSelf(ostream& os, vtkIndent indent);
00083
00087 void SetStartLocation(vtkIdType cellId, int subId, double pcoords[3]);
00088
00090
00093 void SetStartLocation(vtkIdType cellId, int subId, double r, double s,
00094 double t);
00096
00099 vtkIdType GetStartLocation(int& subId, double pcoords[3]);
00100
00104 void SetStartPosition(double x[3]);
00105
00109 void SetStartPosition(double x, double y, double z);
00110
00112 double *GetStartPosition();
00113
00115
00116 void SetSource(vtkDataSet *source);
00117 vtkDataSet *GetSource();
00119
00121
00122 vtkSetClampMacro(MaximumPropagationTime,double,0.0,VTK_DOUBLE_MAX);
00123 vtkGetMacro(MaximumPropagationTime,double);
00125
00127
00128 vtkSetClampMacro(IntegrationDirection,int,
00129 VTK_INTEGRATE_FORWARD,VTK_INTEGRATE_BOTH_DIRECTIONS);
00130 vtkGetMacro(IntegrationDirection,int);
00131 void SetIntegrationDirectionToForward()
00132 {this->SetIntegrationDirection(VTK_INTEGRATE_FORWARD);};
00133 void SetIntegrationDirectionToBackward()
00134 {this->SetIntegrationDirection(VTK_INTEGRATE_BACKWARD);};
00135 void SetIntegrationDirectionToIntegrateBothDirections()
00136 {this->SetIntegrationDirection(VTK_INTEGRATE_BOTH_DIRECTIONS);};
00137 const char *GetIntegrationDirectionAsString();
00139
00141
00143 vtkSetClampMacro(IntegrationStepLength,double,0.0000001,VTK_DOUBLE_MAX);
00144 vtkGetMacro(IntegrationStepLength,double);
00146
00148
00150 vtkSetMacro(SpeedScalars,int);
00151 vtkGetMacro(SpeedScalars,int);
00152 vtkBooleanMacro(SpeedScalars,int);
00154
00156
00161 vtkSetMacro(OrientationScalars, int);
00162 vtkGetMacro(OrientationScalars, int);
00163 vtkBooleanMacro(OrientationScalars, int);
00165
00167
00169 vtkSetClampMacro(TerminalSpeed,double,0.0,VTK_DOUBLE_MAX);
00170 vtkGetMacro(TerminalSpeed,double);
00172
00174
00179 vtkSetMacro(Vorticity,int);
00180 vtkGetMacro(Vorticity,int);
00181 vtkBooleanMacro(Vorticity,int);
00183
00184 vtkSetMacro( NumberOfThreads, int );
00185 vtkGetMacro( NumberOfThreads, int );
00186
00187 vtkSetMacro( SavePointInterval, double );
00188 vtkGetMacro( SavePointInterval, double );
00189
00191
00195 void SetIntegrator(vtkInitialValueProblemSolver *);
00196 vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
00198
00199 protected:
00201
00204 vtkStreamer();
00205 ~vtkStreamer();
00207
00208
00209 void Integrate();
00210
00211
00212 int StartFrom;
00213
00214
00215 vtkIdType StartCell;
00216 int StartSubId;
00217 double StartPCoords[3];
00218
00219
00220 double StartPosition[3];
00221
00222
00223
00224
00225
00226
00227 class StreamPoint {
00228 public:
00229 double x[3];
00230 vtkIdType cellId;
00231 int subId;
00232 double p[3];
00233 double v[3];
00234 double speed;
00235 double s;
00236 double t;
00237 double d;
00238 double omega;
00239 double theta;
00240 };
00241
00242 class StreamArray;
00243 friend class StreamArray;
00244 class StreamArray {
00245 public:
00246 StreamArray();
00247 ~StreamArray()
00248 {
00249 if (this->Array)
00250 {
00251 delete [] this->Array;
00252 }
00253 };
00254 vtkIdType GetNumberOfPoints() {return this->MaxId + 1;};
00255 StreamPoint *GetStreamPoint(vtkIdType i) {return this->Array + i;};
00256 vtkIdType InsertNextStreamPoint()
00257 {
00258 if ( ++this->MaxId >= this->Size )
00259 {
00260 this->Resize(this->MaxId);
00261 }
00262 return this->MaxId;
00263 }
00264 StreamPoint *Resize(vtkIdType sz);
00265 void Reset() {this->MaxId = -1;};
00266
00267 StreamPoint *Array;
00268 vtkIdType MaxId;
00269 vtkIdType Size;
00270 vtkIdType Extend;
00271 double Direction;
00272 };
00273
00274
00275
00276
00277 StreamArray *Streamers;
00278 vtkIdType NumberOfStreamers;
00279
00280
00281 double MaximumPropagationTime;
00282
00283
00284 int IntegrationDirection;
00285
00286
00287 double IntegrationStepLength;
00288
00289
00290 int Vorticity;
00291
00292
00293 double TerminalSpeed;
00294
00295
00296 int SpeedScalars;
00297
00298
00299 int OrientationScalars;
00300
00301
00302 vtkInitialValueProblemSolver* Integrator;
00303
00304
00305
00306
00307 double SavePointInterval;
00308
00309 static VTK_THREAD_RETURN_TYPE ThreadedIntegrate( void *arg );
00310
00312
00314 vtkGetMacro( NumberOfStreamers, int );
00315 StreamArray *GetStreamers() { return this->Streamers; };
00317
00318 void InitializeThreadedIntegrate();
00319 vtkMultiThreader *Threader;
00320 int NumberOfThreads;
00321
00322 private:
00323 vtkStreamer(const vtkStreamer&);
00324 void operator=(const vtkStreamer&);
00325 };
00326
00328 inline const char *vtkStreamer::GetIntegrationDirectionAsString()
00329 {
00330 if ( this->IntegrationDirection == VTK_INTEGRATE_FORWARD )
00331 {
00332 return "IntegrateForward";
00333 }
00334 else if ( this->IntegrationDirection == VTK_INTEGRATE_BACKWARD )
00335 {
00336 return "IntegrateBackward";
00337 }
00338 else
00339 {
00340 return "IntegrateBothDirections";
00341 }
00342 }
00343
00344 #endif
00345
00346