VTK
dox/Filters/Hybrid/vtkTemporalFractal.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   ParaView
00004   Module:    vtkTemporalFractal.h
00005 
00006   Copyright (c) Kitware, Inc.
00007   All rights reserved.
00008   See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
00030 #ifndef __vtkTemporalFractal_h
00031 #define __vtkTemporalFractal_h
00032 
00033 #include "vtkFiltersHybridModule.h" // For export macro
00034 #include "vtkAlgorithm.h"
00035 #include "vtkSmartPointer.h" //for ivars
00036 
00037 class vtkCompositeDataSet;
00038 class vtkDataSet;
00039 class vtkHierarchicalBoxDataSet;
00040 class vtkIntArray;
00041 class vtkRectilinearGrid;
00042 class vtkUniformGrid;
00043 class TemporalFractalOutputUtil;
00044 
00045 class VTKFILTERSHYBRID_EXPORT vtkTemporalFractal: public vtkAlgorithm
00046 {
00047 public:
00048   static vtkTemporalFractal *New();
00049   vtkTypeMacro(vtkTemporalFractal,vtkAlgorithm);
00050   void PrintSelf(ostream& os, vtkIndent indent);
00051 
00053 
00055   vtkSetMacro(FractalValue, float);
00056   vtkGetMacro(FractalValue, float);
00058 
00060 
00063   vtkSetMacro(MaximumLevel, int);
00064   vtkGetMacro(MaximumLevel, int);
00066 
00068 
00069   vtkSetMacro(Dimensions, int);
00070   vtkGetMacro(Dimensions, int);
00072 
00074 
00075   vtkSetMacro(GhostLevels, int);
00076   vtkGetMacro(GhostLevels, int);
00077   vtkBooleanMacro(GhostLevels, int);
00079 
00081 
00083   vtkSetMacro(GenerateRectilinearGrids, int);
00084   vtkGetMacro(GenerateRectilinearGrids, int);
00085   vtkBooleanMacro(GenerateRectilinearGrids, int);
00087 
00089 
00091   vtkSetMacro(DiscreteTimeSteps, int);
00092   vtkGetMacro(DiscreteTimeSteps, int);
00093   vtkBooleanMacro(DiscreteTimeSteps, int);
00095 
00097 
00098   vtkSetMacro(TwoDimensional, int);
00099   vtkGetMacro(TwoDimensional, int);
00100   vtkBooleanMacro(TwoDimensional, int);
00102 
00104 
00106   vtkSetMacro(Asymetric,int);
00107   vtkGetMacro(Asymetric,int);
00109 
00111 
00112   vtkSetMacro(AdaptiveSubdivision, int);
00113   vtkGetMacro(AdaptiveSubdivision, int);
00114   vtkBooleanMacro(AdaptiveSubdivision, int);
00116 
00117 
00118 protected:
00119   vtkTemporalFractal();
00120   ~vtkTemporalFractal();
00121 
00122   virtual int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info);
00123 
00124   int StartBlock;
00125   int EndBlock;
00126   int BlockCount;
00127 
00129 
00130   virtual int ProcessRequest(vtkInformation* request,
00131                              vtkInformationVector** inputVector,
00132                              vtkInformationVector* outputVector);
00134 
00136 
00138   virtual int RequestDataObject(vtkInformation*,
00139                                 vtkInformationVector**,
00140                                 vtkInformationVector*);
00142 
00144 
00146   virtual int RequestInformation(vtkInformation *request,
00147                                  vtkInformationVector **inputVector,
00148                                  vtkInformationVector *outputVector);
00150 
00152 
00154   virtual int RequestData(vtkInformation *request,
00155                           vtkInformationVector **inputVector,
00156                           vtkInformationVector *outputVector);
00157   virtual int RequestOneTimeStep(vtkCompositeDataSet *output,
00158                                  vtkInformation *request,
00159                                  vtkInformationVector **inputVector,
00160                                  vtkInformationVector *outputVector);
00162 
00163   void Traverse(int &blockId, int level, vtkDataObject* output,
00164                 int x0,int x1, int y0,int y1, int z0,int z1,
00165                 int onFace[6]);
00166 
00167   int LineTest2(float x0, float y0, float z0,
00168                 float x1, float y1, float z1,
00169                 double bds[6]);
00170   int LineTest(float x0, float y0, float z0,
00171                float x1, float y1, float z1,
00172                double bds[6], int level, int target);
00173 
00174   void SetBlockInfo(vtkUniformGrid *grid, int level, int* ext,int onFace[6]);
00175   void SetRBlockInfo(vtkRectilinearGrid *grid, int level, int* ext,
00176                      int onFace[6]);
00177 
00178   void AddVectorArray(vtkHierarchicalBoxDataSet *output);
00179   void AddTestArray(vtkHierarchicalBoxDataSet *output);
00180   void AddFractalArray(vtkCompositeDataSet* output);
00181   void AddBlockIdArray(vtkHierarchicalBoxDataSet *output);
00182   void AddDepthArray(vtkHierarchicalBoxDataSet *output);
00183 
00184   void AddGhostLevelArray(vtkDataSet *grid,
00185                           int dim[3],
00186                           int onFace[6]);
00187 
00188   int MandelbrotTest(double x, double y);
00189   int TwoDTest(double bds[6], int level, int target);
00190 
00191   void CellExtentToBounds(int level,
00192                           int ext[6],
00193                           double bds[6]);
00194 
00195   void ExecuteRectilinearMandelbrot(vtkRectilinearGrid *grid,
00196                                     double *ptr);
00197   double EvaluateSet(double p[4]);
00198   void GetContinuousIncrements(int extent[6],
00199                                vtkIdType &incX,
00200                                vtkIdType &incY,
00201                                vtkIdType &incZ);
00202 
00203   // Dimensions:
00204   // Specify blocks relative to this top level block.
00205   // For now this has to be set before the blocks are defined.
00206   vtkSetVector3Macro(TopLevelSpacing, double);
00207   vtkGetVector3Macro(TopLevelSpacing, double);
00208   vtkSetVector3Macro(TopLevelOrigin, double);
00209   vtkGetVector3Macro(TopLevelOrigin, double);
00210 
00211   void InternalImageDataCopy(vtkTemporalFractal *src);
00212 
00213   int Asymetric;
00214   int MaximumLevel;
00215   int Dimensions;
00216   float FractalValue;
00217   int GhostLevels;
00218   vtkIntArray *Levels;
00219   int TwoDimensional;
00220   int DiscreteTimeSteps;
00221 
00222   // New method of specifing blocks.
00223   double TopLevelSpacing[3];
00224   double TopLevelOrigin[3];
00225 
00226   int GenerateRectilinearGrids;
00227 
00228   double CurrentTime;
00229 
00230   int AdaptiveSubdivision;
00231   vtkSmartPointer<TemporalFractalOutputUtil> OutputUtil;
00232 
00233 private:
00234   vtkTemporalFractal(const vtkTemporalFractal&);  // Not implemented.
00235   void operator=(const vtkTemporalFractal&);  // Not implemented.
00236 };
00237 
00238 
00239 #endif