Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkStreamTracer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkStreamTracer.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00071 #ifndef __vtkStreamTracer_h
00072 #define __vtkStreamTracer_h
00073 
00074 #include "vtkPolyDataAlgorithm.h"
00075 
00076 #include "vtkInitialValueProblemSolver.h" // Needed for constants
00077 
00078 class vtkDataArray;
00079 class vtkDoubleArray;
00080 class vtkGenericCell;
00081 class vtkIdList;
00082 class vtkIntArray;
00083 class vtkInterpolatedVelocityField;
00084 
00085 class VTK_GRAPHICS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
00086 {
00087 public:
00088   vtkTypeRevisionMacro(vtkStreamTracer,vtkPolyDataAlgorithm);
00089   void PrintSelf(ostream& os, vtkIndent indent);
00090 
00095   static vtkStreamTracer *New();
00096   
00098 
00101   vtkSetVector3Macro(StartPosition, double);
00102   vtkGetVector3Macro(StartPosition, double);
00104 
00106 
00108   void SetSource(vtkDataSet *source);
00109   vtkDataSet *GetSource();
00111 
00114   void SetSourceConnection(vtkAlgorithmOutput* algOutput);
00115 
00116 //BTX
00117   enum Units
00118   {
00119     TIME_UNIT,
00120     LENGTH_UNIT,
00121     CELL_LENGTH_UNIT
00122   };
00123 
00124   enum Solvers
00125   {
00126     RUNGE_KUTTA2,
00127     RUNGE_KUTTA4,
00128     RUNGE_KUTTA45,
00129     NONE,
00130     UNKNOWN
00131   };
00132 
00133   enum ReasonForTermination
00134   {
00135     OUT_OF_DOMAIN = vtkInitialValueProblemSolver::OUT_OF_DOMAIN,
00136     NOT_INITIALIZED = vtkInitialValueProblemSolver::NOT_INITIALIZED ,
00137     UNEXPECTED_VALUE = vtkInitialValueProblemSolver::UNEXPECTED_VALUE,
00138     OUT_OF_TIME = 4,
00139     OUT_OF_STEPS = 5,
00140     STAGNATION = 6
00141   };
00142 //ETX
00143 
00145 
00151   void SetIntegrator(vtkInitialValueProblemSolver *);
00152   vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
00153   void SetIntegratorType(int type);
00154   int GetIntegratorType();
00155   void SetIntegratorTypeToRungeKutta2()
00156     {this->SetIntegratorType(RUNGE_KUTTA2);};
00157   void SetIntegratorTypeToRungeKutta4()
00158     {this->SetIntegratorType(RUNGE_KUTTA4);};
00159   void SetIntegratorTypeToRungeKutta45()
00160     {this->SetIntegratorType(RUNGE_KUTTA45);};
00162 
00164 
00166   void SetMaximumPropagation(int unit, double max);
00167   void SetMaximumPropagation(double max);
00168   void SetMaximumPropagationUnit(int unit);
00169   int GetMaximumPropagationUnit();
00170   double GetMaximumPropagation();
00171   void SetMaximumPropagationUnitToTimeUnit()
00172     {this->SetMaximumPropagationUnit(TIME_UNIT);};
00173   void SetMaximumPropagationUnitToLengthUnit()
00174     {this->SetMaximumPropagationUnit(LENGTH_UNIT);};
00175   void SetMaximumPropagationUnitToCellLengthUnit()
00176     {this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);};          
00178 
00180 
00183   void SetMinimumIntegrationStep(int unit, double step);
00184   void SetMinimumIntegrationStepUnit(int unit);
00185   void SetMinimumIntegrationStep(double step);
00186   int GetMinimumIntegrationStepUnit();
00187   double GetMinimumIntegrationStep();
00188   void SetMinimumIntegrationStepUnitToTimeUnit()
00189     {this->SetMinimumIntegrationStepUnit(TIME_UNIT);};
00190   void SetMinimumIntegrationStepUnitToLengthUnit()
00191     {this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);};
00192   void SetMinimumIntegrationStepUnitToCellLengthUnit()
00193     {this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);};
00195 
00197 
00200   void SetMaximumIntegrationStep(int unit, double step);
00201   void SetMaximumIntegrationStepUnit(int unit);
00202   void SetMaximumIntegrationStep(double step);
00203   int GetMaximumIntegrationStepUnit();
00204   double GetMaximumIntegrationStep();
00205   void SetMaximumIntegrationStepUnitToTimeUnit()
00206     {this->SetMaximumIntegrationStepUnit(TIME_UNIT);};
00207   void SetMaximumIntegrationStepUnitToLengthUnit()
00208     {this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);};
00209   void SetMaximumIntegrationStepUnitToCellLengthUnit()
00210     {this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);};
00212 
00214 
00217   void SetInitialIntegrationStep(int unit, double step);
00218   void SetInitialIntegrationStepUnit(int unit);
00219   void SetInitialIntegrationStep(double step);
00220   int GetInitialIntegrationStepUnit();
00221   double GetInitialIntegrationStep();
00222   void SetInitialIntegrationStepUnitToTimeUnit()
00223     {this->SetInitialIntegrationStepUnit(TIME_UNIT);};
00224   void SetInitialIntegrationStepUnitToLengthUnit()
00225     {this->SetInitialIntegrationStepUnit(LENGTH_UNIT);};
00226   void SetInitialIntegrationStepUnitToCellLengthUnit()
00227     {this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);};
00229 
00231 
00234   vtkSetMacro(MaximumError, double);
00235   vtkGetMacro(MaximumError, double);
00237 
00239 
00240   vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
00241   vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
00243 
00245 
00247   vtkSetMacro(TerminalSpeed, double);
00248   vtkGetMacro(TerminalSpeed, double);
00250 
00251 //BTX
00252   enum
00253   {
00254     FORWARD,
00255     BACKWARD,
00256     BOTH
00257   };
00258 //ETX
00259 
00261 
00263   vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
00264   vtkGetMacro(IntegrationDirection, int);
00265   void SetIntegrationDirectionToForward()
00266     {this->SetIntegrationDirection(FORWARD);};
00267   void SetIntegrationDirectionToBackward()
00268     {this->SetIntegrationDirection(BACKWARD);};
00269   void SetIntegrationDirectionToBoth()
00270     {this->SetIntegrationDirection(BOTH);};  
00272 
00274 
00276   vtkSetMacro(ComputeVorticity, int);
00277   vtkGetMacro(ComputeVorticity, int);
00278   vtkBooleanMacro(ComputeVorticity, int);
00280 
00282 
00284   vtkSetMacro(RotationScale, double);
00285   vtkGetMacro(RotationScale, double);
00287 
00289   void AddInput(vtkDataSet *in);
00290 
00291   void SetInterpolatorPrototype(vtkInterpolatedVelocityField* ivf);
00292 
00293 protected:
00294 
00295   vtkStreamTracer();
00296   ~vtkStreamTracer();
00297 
00298   // hide the superclass' AddInput() from the user and the compiler
00299   void AddInput(vtkDataObject *) 
00300     { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
00301   
00302   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00303   virtual int FillInputPortInformation(int, vtkInformation *);
00304 
00305   void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
00306                            vtkDoubleArray* cellVectors, double vorticity[3] );
00307   void Integrate(vtkDataSet *input,
00308                  vtkPolyData* output,
00309                  vtkDataArray* seedSource, 
00310                  vtkIdList* seedIds,
00311                  vtkIntArray* integrationDirections,
00312                  double lastPoint[3],
00313                  vtkInterpolatedVelocityField* func,
00314                  int maxCellSize,
00315                  const char *vecFieldName);
00316   void SimpleIntegrate(double seed[3], 
00317                        double lastPoint[3], 
00318                        double delt,
00319                        vtkInterpolatedVelocityField* func);
00320   int CheckInputs(vtkInterpolatedVelocityField*& func,
00321                   int* maxCellSize,
00322                   vtkInformationVector **inputVector);
00323   void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
00324 
00325   int GenerateNormalsInIntegrate;
00326 
00327   // starting from global x-y-z position
00328   double StartPosition[3];
00329 
00330   static const double EPSILON;
00331   double TerminalSpeed;
00332 
00333   double LastUsedTimeStep;
00334 
00335 //BTX
00336   struct IntervalInformation
00337   {
00338     double Interval;
00339     int Unit;
00340   };
00341 
00342   IntervalInformation MaximumPropagation;
00343   IntervalInformation MinimumIntegrationStep;
00344   IntervalInformation MaximumIntegrationStep;
00345   IntervalInformation InitialIntegrationStep;
00346 
00347   void SetIntervalInformation(int unit, double interval,
00348                               IntervalInformation& currentValues);
00349   void SetIntervalInformation(int unit,IntervalInformation& currentValues);
00350   static double ConvertToTime(IntervalInformation& interval,
00351                              double cellLength, double speed);
00352   static double ConvertToLength(IntervalInformation& interval,
00353                                double cellLength, double speed);
00354   static double ConvertToCellLength(IntervalInformation& interval,
00355                                    double cellLength, double speed);
00356   static double ConvertToUnit(IntervalInformation& interval, int unit,
00357                              double cellLength, double speed);
00358   void ConvertIntervals(double& step, double& minStep, double& maxStep,
00359                         int direction, double cellLength, double speed);
00360 //ETX
00361 
00362   void InitializeSeeds(vtkDataArray*& seeds,
00363                        vtkIdList*& seedIds,
00364                        vtkIntArray*& integrationDirections,
00365                        vtkDataSet *source);
00366   
00367   int IntegrationDirection;
00368 
00369   // Prototype showing the integrator type to be set by the user.
00370   vtkInitialValueProblemSolver* Integrator;
00371 
00372   double MaximumError;
00373   vtkIdType MaximumNumberOfSteps;
00374 
00375   int ComputeVorticity;
00376   double RotationScale;
00377 
00378   vtkInterpolatedVelocityField* InterpolatorPrototype;
00379 
00380 private:
00381   vtkStreamTracer(const vtkStreamTracer&);  // Not implemented.
00382   void operator=(const vtkStreamTracer&);  // Not implemented.
00383 };
00384 
00385 
00386 #endif
00387 
00388 

Generated on Mon Jan 21 23:07:26 2008 for VTK by  doxygen 1.4.3-20050530