VTK
dox/Parallel/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 "vtkTemporalDataSetAlgorithm.h"
00034 
00035 class vtkCompositeDataSet;
00036 class vtkDataSet;
00037 class vtkHierarchicalBoxDataSet;
00038 class vtkIntArray;
00039 class vtkRectilinearGrid;
00040 class vtkUniformGrid;
00041 
00042 class VTK_PARALLEL_EXPORT vtkTemporalFractal : public vtkTemporalDataSetAlgorithm
00043 {
00044 public:
00045   static vtkTemporalFractal *New();
00046   vtkTypeMacro(vtkTemporalFractal,vtkTemporalDataSetAlgorithm);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00050 
00052   vtkSetMacro(FractalValue, float);
00053   vtkGetMacro(FractalValue, float);  
00055 
00057 
00060   vtkSetMacro(MaximumLevel, int);
00061   vtkGetMacro(MaximumLevel, int);
00063 
00065 
00066   vtkSetMacro(Dimensions, int);
00067   vtkGetMacro(Dimensions, int);
00069 
00071 
00072   vtkSetMacro(GhostLevels, int);
00073   vtkGetMacro(GhostLevels, int);
00074   vtkBooleanMacro(GhostLevels, int);
00076   
00078 
00080   vtkSetMacro(GenerateRectilinearGrids, int);
00081   vtkGetMacro(GenerateRectilinearGrids, int);
00082   vtkBooleanMacro(GenerateRectilinearGrids, int);
00084 
00086 
00088   vtkSetMacro(DiscreteTimeSteps, int);
00089   vtkGetMacro(DiscreteTimeSteps, int);
00090   vtkBooleanMacro(DiscreteTimeSteps, int);
00092 
00094 
00095   vtkSetMacro(TwoDimensional, int);
00096   vtkGetMacro(TwoDimensional, int);
00097   vtkBooleanMacro(TwoDimensional, int);
00099 
00101 
00103   vtkSetMacro(Asymetric,int);
00104   vtkGetMacro(Asymetric,int);
00106 
00108 
00109   vtkSetMacro(AdaptiveSubdivision, int);
00110   vtkGetMacro(AdaptiveSubdivision, int);
00111   vtkBooleanMacro(AdaptiveSubdivision, int);
00113 
00114 
00115 protected:
00116   vtkTemporalFractal();
00117   ~vtkTemporalFractal();
00118 
00119   int StartBlock;
00120   int EndBlock;
00121   int BlockCount;
00122   
00124 
00126   virtual int RequestInformation(vtkInformation *request, 
00127                                  vtkInformationVector **inputVector, 
00128                                  vtkInformationVector *outputVector);
00130 
00132 
00134   virtual int RequestData(vtkInformation *request, 
00135                           vtkInformationVector **inputVector, 
00136                           vtkInformationVector *outputVector);
00137   virtual int RequestOneTimeStep(vtkCompositeDataSet *output,
00138                                  vtkInformation *request, 
00139                                  vtkInformationVector **inputVector, 
00140                                  vtkInformationVector *outputVector);
00142   
00143   void Traverse(int &blockId, int level, vtkDataObject* output, 
00144                 int x0,int x1, int y0,int y1, int z0,int z1,
00145                 int onFace[6]);
00146 
00147   int LineTest2(float x0, float y0, float z0, 
00148                 float x1, float y1, float z1,
00149                 double bds[6]); 
00150   int LineTest(float x0, float y0, float z0, 
00151                float x1, float y1, float z1,
00152                double bds[6], int level, int target); 
00153 
00154   void SetBlockInfo(vtkUniformGrid *grid, int level, int* ext,int onFace[6]);
00155   void SetRBlockInfo(vtkRectilinearGrid *grid, int level, int* ext,
00156                      int onFace[6]);
00157 
00158 
00159   void AddDataSet(vtkDataObject* output, unsigned int level, int extents[6],
00160     vtkDataSet* dataSet);
00161   
00162   void AddVectorArray(vtkHierarchicalBoxDataSet *output);
00163   void AddTestArray(vtkHierarchicalBoxDataSet *output);
00164   void AddFractalArray(vtkCompositeDataSet* output);
00165   void AddBlockIdArray(vtkHierarchicalBoxDataSet *output);
00166   void AddDepthArray(vtkHierarchicalBoxDataSet *output);
00167   
00168   void AddGhostLevelArray(vtkDataSet *grid,
00169                           int dim[3],
00170                           int onFace[6]);
00171 
00172   int MandelbrotTest(double x, double y);
00173   int TwoDTest(double bds[6], int level, int target);
00174 
00175   void CellExtentToBounds(int level,
00176                           int ext[6],
00177                           double bds[6]);
00178   
00179   void ExecuteRectilinearMandelbrot(vtkRectilinearGrid *grid,
00180                                     double *ptr);
00181   double EvaluateSet(double p[4]);
00182   void GetContinuousIncrements(int extent[6],
00183                                vtkIdType &incX,
00184                                vtkIdType &incY,
00185                                vtkIdType &incZ);
00186   
00187   // Dimensions:
00188   // Specify blocks relative to this top level block.
00189   // For now this has to be set before the blocks are defined.
00190   vtkSetVector3Macro(TopLevelSpacing, double);
00191   vtkGetVector3Macro(TopLevelSpacing, double);
00192   vtkSetVector3Macro(TopLevelOrigin, double);
00193   vtkGetVector3Macro(TopLevelOrigin, double);
00194   
00195   void InternalImageDataCopy(vtkTemporalFractal *src);
00196 
00197   int Asymetric;
00198   int MaximumLevel;
00199   int Dimensions;
00200   float FractalValue;
00201   int GhostLevels;
00202   vtkIntArray *Levels;
00203   int TwoDimensional;
00204   int DiscreteTimeSteps;
00205 
00206   // New method of specifing blocks.
00207   double TopLevelSpacing[3];
00208   double TopLevelOrigin[3];
00209   
00210   int GenerateRectilinearGrids;
00211 
00212   double CurrentTime;
00213   
00214   int AdaptiveSubdivision;
00215 
00216 private:
00217   vtkTemporalFractal(const vtkTemporalFractal&);  // Not implemented.
00218   void operator=(const vtkTemporalFractal&);  // Not implemented.
00219 };
00220 
00221 
00222 #endif