00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00052
#ifndef __vtkStreamer_h
00053
#define __vtkStreamer_h
00054
00055
#include "vtkDataSetToPolyDataFilter.h"
00056
00057
class vtkInitialValueProblemSolver;
00058
class vtkMultiThreader;
00059
00060 #define VTK_INTEGRATE_FORWARD 0
00061 #define VTK_INTEGRATE_BACKWARD 1
00062 #define VTK_INTEGRATE_BOTH_DIRECTIONS 2
00063
00064 class VTK_GRAPHICS_EXPORT vtkStreamer :
public vtkDataSetToPolyDataFilter
00065 {
00066
public:
00067 vtkTypeRevisionMacro(vtkStreamer,
vtkDataSetToPolyDataFilter);
00068
void PrintSelf(ostream& os,
vtkIndent indent);
00069
00073
void SetStartLocation(
vtkIdType cellId,
int subId,
double pcoords[3]);
00074
00076
00079
void SetStartLocation(
vtkIdType cellId,
int subId,
double r,
double s,
00080
double t);
00082
00085
vtkIdType GetStartLocation(
int& subId,
double pcoords[3]);
00086
00090
void SetStartPosition(
double x[3]);
00091
00095
void SetStartPosition(
double x,
double y,
double z);
00096
00098
double *GetStartPosition();
00099
00101
00102
void SetSource(
vtkDataSet *source);
00103
vtkDataSet *GetSource();
00105
00107
00108 vtkSetClampMacro(MaximumPropagationTime,
double,0.0,VTK_DOUBLE_MAX);
00109 vtkGetMacro(MaximumPropagationTime,
double);
00111
00113
00114 vtkSetClampMacro(IntegrationDirection,
int,
00115 VTK_INTEGRATE_FORWARD,VTK_INTEGRATE_BOTH_DIRECTIONS);
00116 vtkGetMacro(IntegrationDirection,
int);
00117 void SetIntegrationDirectionToForward()
00118 {this->SetIntegrationDirection(
VTK_INTEGRATE_FORWARD);};
00119 void SetIntegrationDirectionToBackward()
00120 {this->SetIntegrationDirection(
VTK_INTEGRATE_BACKWARD);};
00121 void SetIntegrationDirectionToIntegrateBothDirections()
00122 {this->SetIntegrationDirection(
VTK_INTEGRATE_BOTH_DIRECTIONS);};
00123
const char *GetIntegrationDirectionAsString();
00125
00127
00129 vtkSetClampMacro(IntegrationStepLength,
double,0.0000001,VTK_DOUBLE_MAX);
00130 vtkGetMacro(IntegrationStepLength,
double);
00132
00134
00136 vtkSetMacro(SpeedScalars,
int);
00137 vtkGetMacro(SpeedScalars,
int);
00138 vtkBooleanMacro(SpeedScalars,
int);
00140
00142
00147 vtkSetMacro(OrientationScalars,
int);
00148 vtkGetMacro(OrientationScalars,
int);
00149 vtkBooleanMacro(OrientationScalars,
int);
00151
00153
00155 vtkSetClampMacro(TerminalSpeed,
double,0.0,VTK_DOUBLE_MAX);
00156 vtkGetMacro(TerminalSpeed,
double);
00158
00160
00165 vtkSetMacro(Vorticity,
int);
00166 vtkGetMacro(Vorticity,
int);
00167 vtkBooleanMacro(Vorticity,
int);
00169
00170 vtkSetMacro( NumberOfThreads,
int );
00171 vtkGetMacro( NumberOfThreads,
int );
00172
00173 vtkSetMacro( SavePointInterval,
double );
00174 vtkGetMacro( SavePointInterval,
double );
00175
00177
00181
void SetIntegrator(
vtkInitialValueProblemSolver *);
00182 vtkGetObjectMacro ( Integrator,
vtkInitialValueProblemSolver );
00184
00185
protected:
00187
00190 vtkStreamer();
00191 ~vtkStreamer();
00193
00194
00195
void Integrate();
00196
00197
00198
void ComputeVorticity();
00199
00200
00201 int StartFrom;
00202
00203
00204 vtkIdType StartCell;
00205 int StartSubId;
00206 double StartPCoords[3];
00207
00208
00209 double StartPosition[3];
00210
00211
00212
00213
00214
00215
00216 class StreamPoint {
00217
public:
00218 double x[3];
00219 vtkIdType cellId;
00220 int subId;
00221 double p[3];
00222 double v[3];
00223 double speed;
00224 double s;
00225 double t;
00226 double d;
00227 double omega;
00228 double theta;
00229 };
00230
00231
class StreamArray;
00232
friend class StreamArray;
00233 class StreamArray {
00234
public:
00235
StreamArray();
00236 ~
StreamArray()
00237 {
00238
if (this->Array)
00239 {
00240
delete [] this->Array;
00241 }
00242 };
00243 vtkIdType GetNumberOfPoints() {
return this->MaxId + 1;};
00244 StreamPoint *GetStreamPoint(
vtkIdType i) {
return this->Array + i;};
00245 vtkIdType InsertNextStreamPoint()
00246 {
00247
if ( ++this->MaxId >= this->Size )
00248 {
00249 this->Resize(this->MaxId);
00250 }
00251
return this->MaxId;
00252 }
00253
StreamPoint *Resize(
vtkIdType sz);
00254 void Reset() {this->MaxId = -1;};
00255
00256 StreamPoint *Array;
00257 vtkIdType MaxId;
00258 vtkIdType Size;
00259 vtkIdType Extend;
00260 double Direction;
00261 };
00262
00263
00264
00265
00266 StreamArray *Streamers;
00267 vtkIdType NumberOfStreamers;
00268
00269
00270 double MaximumPropagationTime;
00271
00272
00273 int IntegrationDirection;
00274
00275
00276 double IntegrationStepLength;
00277
00278
00279 int Vorticity;
00280
00281
00282 double TerminalSpeed;
00283
00284
00285 int SpeedScalars;
00286
00287
00288 int OrientationScalars;
00289
00290
00291 vtkInitialValueProblemSolver* Integrator;
00292
00293
00294
00295
00296 double SavePointInterval;
00297
00298
static VTK_THREAD_RETURN_TYPE ThreadedIntegrate(
void *arg );
00299
00301
00303 vtkGetMacro( NumberOfStreamers,
int );
00304 StreamArray *GetStreamers() {
return this->Streamers; };
00306
00307
void InitializeThreadedIntegrate();
00308 vtkMultiThreader *Threader;
00309 int NumberOfThreads;
00310
00311
private:
00312 vtkStreamer(
const vtkStreamer&);
00313
void operator=(
const vtkStreamer&);
00314 };
00315
00317 inline const char *
vtkStreamer::GetIntegrationDirectionAsString(
void)
00318 {
00319
if ( this->
IntegrationDirection ==
VTK_INTEGRATE_FORWARD )
00320 {
00321
return "IntegrateForward";
00322 }
00323
else if ( this->
IntegrationDirection ==
VTK_INTEGRATE_BACKWARD )
00324 {
00325
return "IntegrateBackward";
00326 }
00327
else
00328 {
00329
return "IntegrateBothDirections";
00330 }
00331 }
00332
00333
#endif
00334
00335