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

vtkGenericStreamTracer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkGenericStreamTracer.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 =========================================================================*/
00068 #ifndef __vtkGenericStreamTracer_h
00069 #define __vtkGenericStreamTracer_h
00070 
00071 #include "vtkPolyDataAlgorithm.h"
00072 
00073 #include "vtkInitialValueProblemSolver.h" // Needed for constants
00074 
00075 class vtkDataArray;
00076 class vtkGenericAdaptorCell;
00077 class vtkIdList;
00078 class vtkIntArray;
00079 class vtkGenericInterpolatedVelocityField;
00080 class vtkDataSet;
00081 class vtkGenericAttribute;
00082 class vtkGenericDataSet;
00083 
00084 class VTK_GENERIC_FILTERING_EXPORT vtkGenericStreamTracer : public vtkPolyDataAlgorithm
00085 {
00086 public:
00087   vtkTypeRevisionMacro(vtkGenericStreamTracer,vtkPolyDataAlgorithm);
00088   void PrintSelf(ostream& os, vtkIndent indent);
00089 
00094   static vtkGenericStreamTracer *New();
00095   
00097 
00100   vtkSetVector3Macro(StartPosition, double);
00101   vtkGetVector3Macro(StartPosition, double);
00103 
00105 
00106   void SetSource(vtkDataSet *source);
00107   vtkDataSet *GetSource();
00109   
00110 //BTX
00111 #if VTK_MAJOR_VERSION>4 || (VTK_MAJOR_VERSION==4 && VTK_MINOR_VERSION>4)
00112   int FillInputPortInformation(int port, vtkInformation* info);
00113 #endif
00114   
00115   enum Units
00116   {
00117     TIME_UNIT,
00118     LENGTH_UNIT,
00119     CELL_LENGTH_UNIT
00120   };
00121 
00122   enum Solvers
00123   {
00124     RUNGE_KUTTA2,
00125     RUNGE_KUTTA4,
00126     RUNGE_KUTTA45,
00127     NONE,
00128     UNKNOWN
00129   };
00130 
00131   enum ReasonForTermination
00132   {
00133     OUT_OF_DOMAIN = vtkInitialValueProblemSolver::OUT_OF_DOMAIN,
00134     NOT_INITIALIZED = vtkInitialValueProblemSolver::NOT_INITIALIZED ,
00135     UNEXPECTED_VALUE = vtkInitialValueProblemSolver::UNEXPECTED_VALUE,
00136     OUT_OF_TIME = 4,
00137     OUT_OF_STEPS = 5,
00138     STAGNATION = 6
00139   };
00140 //ETX
00141 
00143 
00149   void SetIntegrator(vtkInitialValueProblemSolver *);
00150   vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
00151   void SetIntegratorType(int type);
00152   int GetIntegratorType();
00153   void SetIntegratorTypeToRungeKutta2()
00154     {this->SetIntegratorType(RUNGE_KUTTA2);};
00155   void SetIntegratorTypeToRungeKutta4()
00156     {this->SetIntegratorType(RUNGE_KUTTA4);};
00157   void SetIntegratorTypeToRungeKutta45()
00158     {this->SetIntegratorType(RUNGE_KUTTA45);};
00160 
00162 
00164   void SetMaximumPropagation(int unit, double max);
00165   void SetMaximumPropagation(double max);
00166   void SetMaximumPropagationUnit(int unit);
00167   int GetMaximumPropagationUnit();
00168   double GetMaximumPropagation();
00169   void SetMaximumPropagationUnitToTimeUnit()
00170     {this->SetMaximumPropagationUnit(TIME_UNIT);};
00171   void SetMaximumPropagationUnitToLengthUnit()
00172     {this->SetMaximumPropagationUnit(LENGTH_UNIT);};
00173   void SetMaximumPropagationUnitToCellLengthUnit()
00174     {this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);};          
00176 
00178 
00181   void SetMinimumIntegrationStep(int unit, double step);
00182   void SetMinimumIntegrationStepUnit(int unit);
00183   void SetMinimumIntegrationStep(double step);
00184   int GetMinimumIntegrationStepUnit();
00185   double GetMinimumIntegrationStep();
00186   void SetMinimumIntegrationStepUnitToTimeUnit()
00187     {this->SetMinimumIntegrationStepUnit(TIME_UNIT);};
00188   void SetMinimumIntegrationStepUnitToLengthUnit()
00189     {this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);};
00190   void SetMinimumIntegrationStepUnitToCellLengthUnit()
00191     {this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);};
00193 
00195 
00198   void SetMaximumIntegrationStep(int unit, double step);
00199   void SetMaximumIntegrationStepUnit(int unit);
00200   void SetMaximumIntegrationStep(double step);
00201   int GetMaximumIntegrationStepUnit();
00202   double GetMaximumIntegrationStep();
00203   void SetMaximumIntegrationStepUnitToTimeUnit()
00204     {this->SetMaximumIntegrationStepUnit(TIME_UNIT);};
00205   void SetMaximumIntegrationStepUnitToLengthUnit()
00206     {this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);};
00207   void SetMaximumIntegrationStepUnitToCellLengthUnit()
00208     {this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);};
00210 
00212 
00215   void SetInitialIntegrationStep(int unit, double step);
00216   void SetInitialIntegrationStepUnit(int unit);
00217   void SetInitialIntegrationStep(double step);
00218   int GetInitialIntegrationStepUnit();
00219   double GetInitialIntegrationStep();
00220   void SetInitialIntegrationStepUnitToTimeUnit()
00221     {this->SetInitialIntegrationStepUnit(TIME_UNIT);};
00222   void SetInitialIntegrationStepUnitToLengthUnit()
00223     {this->SetInitialIntegrationStepUnit(LENGTH_UNIT);};
00224   void SetInitialIntegrationStepUnitToCellLengthUnit()
00225     {this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);};
00227 
00229 
00232   vtkSetMacro(MaximumError, double);
00233   vtkGetMacro(MaximumError, double);
00235 
00237 
00238   vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
00239   vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
00241 
00243 
00245   vtkSetMacro(TerminalSpeed, double);
00246   vtkGetMacro(TerminalSpeed, double);
00248 
00249 //BTX
00250   enum
00251   {
00252     FORWARD,
00253     BACKWARD,
00254     BOTH
00255   };
00256 //ETX
00257 
00259 
00261   vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
00262   vtkGetMacro(IntegrationDirection, int);
00263   void SetIntegrationDirectionToForward()
00264     {this->SetIntegrationDirection(FORWARD);};
00265   void SetIntegrationDirectionToBackward()
00266     {this->SetIntegrationDirection(BACKWARD);};
00267   void SetIntegrationDirectionToBoth()
00268     {this->SetIntegrationDirection(BOTH);};  
00270 
00272 
00274   vtkSetMacro(ComputeVorticity, int);
00275   vtkGetMacro(ComputeVorticity, int);
00276   vtkBooleanMacro(ComputeVorticity, int);
00278 
00280 
00282   vtkSetMacro(RotationScale, double);
00283   vtkGetMacro(RotationScale, double);
00285 
00287 
00290   vtkGetStringMacro(InputVectorsSelection);
00291   void SelectInputVectors(const char *fieldName) 
00292     {this->SetInputVectorsSelection(fieldName);}
00294   
00296   void AddInput(vtkGenericDataSet *in);
00297 
00298   void SetInterpolatorPrototype(vtkGenericInterpolatedVelocityField* ivf);
00299 
00300 protected:
00301 
00302   vtkGenericStreamTracer();
00303   ~vtkGenericStreamTracer();
00304 
00305   // hide the superclass' AddInput() from the user and the compiler
00306   void AddInput(vtkDataObject *) 
00307     { vtkErrorMacro( << "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject."); };
00308   
00309   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00310 
00312 
00317   void CalculateVorticity(vtkGenericAdaptorCell* cell, 
00318                           double pcoords[3],
00319                           vtkGenericAttribute *attribute,
00320                           double vorticity[3]);
00322 
00323   void Integrate(vtkGenericDataSet *input0,
00324                  vtkPolyData* output,
00325                  vtkDataArray* seedSource, 
00326                  vtkIdList* seedIds,
00327                  vtkIntArray* integrationDirections,
00328                  double lastPoint[3],
00329                  vtkGenericInterpolatedVelocityField* func);
00330   void SimpleIntegrate(double seed[3], 
00331                        double lastPoint[3], 
00332                        double delt,
00333                        vtkGenericInterpolatedVelocityField* func);
00334   int CheckInputs(vtkGenericInterpolatedVelocityField*& func,
00335     vtkInformationVector **inputVector);
00336   void GenerateNormals(vtkPolyData* output, double* firstNormal);
00337 
00338   int GenerateNormalsInIntegrate;
00339 
00340   vtkSetStringMacro(InputVectorsSelection);
00341   char *InputVectorsSelection;
00342 
00343 
00344   // starting from global x-y-z position
00345   double StartPosition[3];
00346 
00347   static const double EPSILON;
00348   double TerminalSpeed;
00349 
00350   double LastUsedTimeStep;
00351 
00352 //BTX
00353   struct IntervalInformation
00354   {
00355     double Interval;
00356     int Unit;
00357   };
00358 
00359   IntervalInformation MaximumPropagation;
00360   IntervalInformation MinimumIntegrationStep;
00361   IntervalInformation MaximumIntegrationStep;
00362   IntervalInformation InitialIntegrationStep;
00363 
00364   void SetIntervalInformation(int unit, double interval,
00365                               IntervalInformation& currentValues);
00366   void SetIntervalInformation(int unit,IntervalInformation& currentValues);
00367   static double ConvertToTime(IntervalInformation& interval,
00368                              double cellLength, double speed);
00369   static double ConvertToLength(IntervalInformation& interval,
00370                                double cellLength, double speed);
00371   static double ConvertToCellLength(IntervalInformation& interval,
00372                                    double cellLength, double speed);
00373   static double ConvertToUnit(IntervalInformation& interval, int unit,
00374                              double cellLength, double speed);
00375   void ConvertIntervals(double& step, double& minStep, double& maxStep,
00376                         int direction, double cellLength, double speed);
00377 //ETX
00378 
00379   void InitializeSeeds(vtkDataArray*& seeds,
00380                        vtkIdList*& seedIds,
00381                        vtkIntArray*& integrationDirections);
00382   
00383   int IntegrationDirection;
00384 
00385   // Prototype showing the integrator type to be set by the user.
00386   vtkInitialValueProblemSolver* Integrator;
00387 
00388   double MaximumError;
00389   vtkIdType MaximumNumberOfSteps;
00390 
00391   int ComputeVorticity;
00392   double RotationScale;
00393 
00394   vtkGenericInterpolatedVelocityField* InterpolatorPrototype;
00395 
00396 private:
00397   vtkGenericStreamTracer(const vtkGenericStreamTracer&);  // Not implemented.
00398   void operator=(const vtkGenericStreamTracer&);  // Not implemented.
00399 };
00400 
00401 #endif

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