vtkGenericStreamer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00062 #ifndef __vtkGenericStreamer_h
00063 #define __vtkGenericStreamer_h
00064
00065 #include "vtkGenericDataSetToPolyDataFilter.h"
00066
00067 class vtkInitialValueProblemSolver;
00068 class vtkMultiThreader;
00069 class vtkDataSet;
00070
00071 #define VTK_INTEGRATE_FORWARD 0
00072 #define VTK_INTEGRATE_BACKWARD 1
00073 #define VTK_INTEGRATE_BOTH_DIRECTIONS 2
00074
00075 class VTK_GENERIC_FILTERING_EXPORT vtkGenericStreamer : public vtkGenericDataSetToPolyDataFilter
00076 {
00077 public:
00078 vtkTypeRevisionMacro(vtkGenericStreamer,vtkGenericDataSetToPolyDataFilter);
00079 void PrintSelf(ostream& os, vtkIndent indent);
00080
00084 void SetStartLocation(vtkIdType cellId, int subId, double pcoords[3]);
00085
00087
00090 void SetStartLocation(vtkIdType cellId, int subId, double r, double s,
00091 double t);
00093
00096 vtkIdType GetStartLocation(int& subId, double pcoords[3]);
00097
00101 void SetStartPosition(double x[3]);
00102
00106 void SetStartPosition(double x, double y, double z);
00107
00109 double *GetStartPosition();
00110
00112
00113 void SetSource(vtkDataSet *source);
00114 vtkDataSet *GetSource();
00116
00118
00119 vtkSetClampMacro(MaximumPropagationTime,double,0.0,VTK_DOUBLE_MAX);
00120 vtkGetMacro(MaximumPropagationTime,double);
00122
00124
00125 vtkSetClampMacro(IntegrationDirection,int,
00126 VTK_INTEGRATE_FORWARD,VTK_INTEGRATE_BOTH_DIRECTIONS);
00127 vtkGetMacro(IntegrationDirection,int);
00128 void SetIntegrationDirectionToForward()
00129 {this->SetIntegrationDirection(VTK_INTEGRATE_FORWARD);};
00130 void SetIntegrationDirectionToBackward()
00131 {this->SetIntegrationDirection(VTK_INTEGRATE_BACKWARD);};
00132 void SetIntegrationDirectionToIntegrateBothDirections()
00133 {this->SetIntegrationDirection(VTK_INTEGRATE_BOTH_DIRECTIONS);};
00134 const char *GetIntegrationDirectionAsString();
00136
00138
00140 vtkSetClampMacro(IntegrationStepLength,double,0.0000001,VTK_DOUBLE_MAX);
00141 vtkGetMacro(IntegrationStepLength,double);
00143
00145
00147 vtkSetMacro(SpeedScalars,int);
00148 vtkGetMacro(SpeedScalars,int);
00149 vtkBooleanMacro(SpeedScalars,int);
00151
00153
00158 vtkSetMacro(OrientationScalars, int);
00159 vtkGetMacro(OrientationScalars, int);
00160 vtkBooleanMacro(OrientationScalars, int);
00162
00164
00166 vtkSetClampMacro(TerminalSpeed,double,0.0,VTK_DOUBLE_MAX);
00167 vtkGetMacro(TerminalSpeed,double);
00169
00171
00176 vtkSetMacro(Vorticity,int);
00177 vtkGetMacro(Vorticity,int);
00178 vtkBooleanMacro(Vorticity,int);
00180
00181 vtkSetMacro( NumberOfThreads, int );
00182 vtkGetMacro( NumberOfThreads, int );
00183
00184 vtkSetMacro( SavePointInterval, double );
00185 vtkGetMacro( SavePointInterval, double );
00186
00188
00192 void SetIntegrator(vtkInitialValueProblemSolver *);
00193 vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
00195
00196 protected:
00198
00201 vtkGenericStreamer();
00202 ~vtkGenericStreamer();
00204
00205
00206 void Integrate();
00207
00208
00209 int StartFrom;
00210
00211
00212 vtkIdType StartCell;
00213 int StartSubId;
00214 double StartPCoords[3];
00215
00216
00217 double StartPosition[3];
00218
00219
00220
00221
00222
00223
00224 class StreamPoint {
00225 public:
00226 double x[3];
00227 vtkIdType cellId;
00228 int subId;
00229 double p[3];
00230 double v[3];
00231 double speed;
00232 double s;
00233 double t;
00234 double d;
00235 double omega;
00236 double theta;
00237 };
00238
00239 class StreamArray;
00240 friend class StreamArray;
00241 class StreamArray {
00242 public:
00243 StreamArray();
00244 ~StreamArray()
00245 {
00246 if (this->Array)
00247 {
00248 delete [] this->Array;
00249 }
00250 };
00251 vtkIdType GetNumberOfPoints() {return this->MaxId + 1;};
00252 StreamPoint *GetStreamPoint(vtkIdType i) {return this->Array + i;};
00253 vtkIdType InsertNextStreamPoint()
00254 {
00255 if ( ++this->MaxId >= this->Size )
00256 {
00257 this->Resize(this->MaxId);
00258 }
00259 return this->MaxId;
00260 }
00261 StreamPoint *Resize(vtkIdType sz);
00262 void Reset() {this->MaxId = -1;};
00263
00264 StreamPoint *Array;
00265 vtkIdType MaxId;
00266 vtkIdType Size;
00267 vtkIdType Extend;
00268 double Direction;
00269 };
00270
00271
00272
00273
00274 StreamArray *Streamers;
00275 vtkIdType NumberOfStreamers;
00276
00277
00278 double MaximumPropagationTime;
00279
00280
00281 int IntegrationDirection;
00282
00283
00284 double IntegrationStepLength;
00285
00286
00287 int Vorticity;
00288
00289
00290 double TerminalSpeed;
00291
00292
00293 int SpeedScalars;
00294
00295
00296 int OrientationScalars;
00297
00298
00299 vtkInitialValueProblemSolver* Integrator;
00300
00301
00302
00303
00304 double SavePointInterval;
00305
00306 static VTK_THREAD_RETURN_TYPE ThreadedIntegrate( void *arg );
00307
00309
00311 vtkGetMacro( NumberOfStreamers, int );
00312 StreamArray *GetStreamers() { return this->Streamers; };
00314
00315 void InitializeThreadedIntegrate();
00316 vtkMultiThreader *Threader;
00317 int NumberOfThreads;
00318
00319 private:
00320 vtkGenericStreamer(const vtkGenericStreamer&);
00321 void operator=(const vtkGenericStreamer&);
00322 };
00323
00325 inline const char *vtkGenericStreamer::GetIntegrationDirectionAsString()
00326 {
00327 if ( this->IntegrationDirection == VTK_INTEGRATE_FORWARD )
00328 {
00329 return "IntegrateForward";
00330 }
00331 else if ( this->IntegrationDirection == VTK_INTEGRATE_BACKWARD )
00332 {
00333 return "IntegrateBackward";
00334 }
00335 else
00336 {
00337 return "IntegrateBothDirections";
00338 }
00339 }
00340
00341 #endif
00342
00343