• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Graphics/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 =========================================================================*/
00068 #ifndef __vtkStreamTracer_h
00069 #define __vtkStreamTracer_h
00070 
00071 #include "vtkPolyDataAlgorithm.h"
00072 
00073 #include "vtkInitialValueProblemSolver.h" // Needed for constants
00074 
00075 class vtkCompositeDataSet;
00076 class vtkDataArray;
00077 class vtkDoubleArray;
00078 class vtkExecutive;
00079 class vtkGenericCell;
00080 class vtkIdList;
00081 class vtkIntArray;
00082 class vtkInterpolatedVelocityField;
00083 
00084 class VTK_GRAPHICS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
00085 {
00086 public:
00087   vtkTypeRevisionMacro(vtkStreamTracer,vtkPolyDataAlgorithm);
00088   void PrintSelf(ostream& os, vtkIndent indent);
00089 
00094   static vtkStreamTracer *New();
00095   
00097 
00100   vtkSetVector3Macro(StartPosition, double);
00101   vtkGetVector3Macro(StartPosition, double);
00103 
00105 
00107   void SetSource(vtkDataSet *source);
00108   vtkDataSet *GetSource();
00110 
00113   void SetSourceConnection(vtkAlgorithmOutput* algOutput);
00114 
00115 //BTX
00116   enum Units
00117   {
00118     TIME_UNIT,
00119     LENGTH_UNIT,
00120     CELL_LENGTH_UNIT
00121   };
00122 
00123   enum Solvers
00124   {
00125     RUNGE_KUTTA2,
00126     RUNGE_KUTTA4,
00127     RUNGE_KUTTA45,
00128     NONE,
00129     UNKNOWN
00130   };
00131 
00132   enum ReasonForTermination
00133   {
00134     OUT_OF_DOMAIN = vtkInitialValueProblemSolver::OUT_OF_DOMAIN,
00135     NOT_INITIALIZED = vtkInitialValueProblemSolver::NOT_INITIALIZED ,
00136     UNEXPECTED_VALUE = vtkInitialValueProblemSolver::UNEXPECTED_VALUE,
00137     OUT_OF_TIME = 4,
00138     OUT_OF_STEPS = 5,
00139     STAGNATION = 6
00140   };
00141 //ETX
00142 
00144 
00150   void SetIntegrator(vtkInitialValueProblemSolver *);
00151   vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
00152   void SetIntegratorType(int type);
00153   int GetIntegratorType();
00154   void SetIntegratorTypeToRungeKutta2()
00155     {this->SetIntegratorType(RUNGE_KUTTA2);};
00156   void SetIntegratorTypeToRungeKutta4()
00157     {this->SetIntegratorType(RUNGE_KUTTA4);};
00158   void SetIntegratorTypeToRungeKutta45()
00159     {this->SetIntegratorType(RUNGE_KUTTA45);};
00161 
00163 
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 
00290   void SetInterpolatorPrototype(vtkInterpolatedVelocityField* ivf);
00291 
00292 protected:
00293 
00294   vtkStreamTracer();
00295   ~vtkStreamTracer();
00296 
00297   // Create a default executive.
00298   virtual vtkExecutive* CreateDefaultExecutive();
00299 
00300   // hide the superclass' AddInput() from the user and the compiler
00301   void AddInput(vtkDataObject *) 
00302     { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
00303   
00304   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00305   virtual int FillInputPortInformation(int, vtkInformation *);
00306 
00307   void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
00308                            vtkDoubleArray* cellVectors, double vorticity[3] );
00309   void Integrate(vtkDataSet *input,
00310                  vtkPolyData* output,
00311                  vtkDataArray* seedSource, 
00312                  vtkIdList* seedIds,
00313                  vtkIntArray* integrationDirections,
00314                  double lastPoint[3],
00315                  vtkInterpolatedVelocityField* func,
00316                  int maxCellSize,
00317                  const char *vecFieldName,
00318                  double& propagation,
00319                  vtkIdType& numSteps);
00320   void SimpleIntegrate(double seed[3], 
00321                        double lastPoint[3], 
00322                        double delt,
00323                        vtkInterpolatedVelocityField* func);
00324   int CheckInputs(vtkInterpolatedVelocityField*& func,
00325                   int* maxCellSize);
00326   void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
00327 
00328   int GenerateNormalsInIntegrate;
00329 
00330   // starting from global x-y-z position
00331   double StartPosition[3];
00332 
00333   static const double EPSILON;
00334   double TerminalSpeed;
00335 
00336   double LastUsedTimeStep;
00337 
00338 //BTX
00339   struct IntervalInformation
00340   {
00341     double Interval;
00342     int Unit;
00343   };
00344 
00345   IntervalInformation MaximumPropagation;
00346   IntervalInformation MinimumIntegrationStep;
00347   IntervalInformation MaximumIntegrationStep;
00348   IntervalInformation InitialIntegrationStep;
00349 
00350   void SetIntervalInformation(int unit, double interval,
00351                               IntervalInformation& currentValues);
00352   void SetIntervalInformation(int unit,IntervalInformation& currentValues);
00353   static double ConvertToTime(IntervalInformation& interval,
00354                              double cellLength, double speed);
00355   static double ConvertToLength(IntervalInformation& interval,
00356                                double cellLength, double speed);
00357   static double ConvertToCellLength(IntervalInformation& interval,
00358                                    double cellLength, double speed);
00359   static double ConvertToUnit(IntervalInformation& interval, int unit,
00360                              double cellLength, double speed);
00361   void ConvertIntervals(double& step, double& minStep, double& maxStep,
00362                         int direction, double cellLength, double speed);
00363 //ETX
00364 
00365   int SetupOutput(vtkInformation* inInfo, 
00366                   vtkInformation* outInfo);
00367   void InitializeSeeds(vtkDataArray*& seeds,
00368                        vtkIdList*& seedIds,
00369                        vtkIntArray*& integrationDirections,
00370                        vtkDataSet *source);
00371   
00372   int IntegrationDirection;
00373 
00374   // Prototype showing the integrator type to be set by the user.
00375   vtkInitialValueProblemSolver* Integrator;
00376 
00377   double MaximumError;
00378   vtkIdType MaximumNumberOfSteps;
00379 
00380   int ComputeVorticity;
00381   double RotationScale;
00382 
00383   vtkInterpolatedVelocityField* InterpolatorPrototype;
00384 
00385   vtkCompositeDataSet* InputData;
00386 
00387 private:
00388   vtkStreamTracer(const vtkStreamTracer&);  // Not implemented.
00389   void operator=(const vtkStreamTracer&);  // Not implemented.
00390 };
00391 
00392 
00393 #endif
00394 
00395 

Generated by  doxygen 1.7.1