ParaView
vtkHierarchicalFractal.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkHierarchicalFractal.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef vtkHierarchicalFractal_h
29 #define vtkHierarchicalFractal_h
30 
31 #include "vtkCompositeDataSetAlgorithm.h"
32 #include "vtkPVVTKExtensionsDefaultModule.h" //needed for exports
33 #include "vtkSmartPointer.h" //for ivars
34 
35 class vtkIntArray;
36 class vtkUniformGrid;
37 class vtkRectilinearGrid;
38 class vtkDataSet;
39 class vtkHierarchicalBoxDataSet;
40 class HierarchicalFractalOutputUtil;
41 
42 class VTKPVVTKEXTENSIONSDEFAULT_EXPORT vtkHierarchicalFractal : public vtkCompositeDataSetAlgorithm
43 {
44 public:
45  static vtkHierarchicalFractal* New();
46 
47  vtkTypeMacro(vtkHierarchicalFractal, vtkCompositeDataSetAlgorithm);
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
51 
56  vtkSetMacro(FractalValue, float);
57  vtkGetMacro(FractalValue, float);
59 
61 
66  vtkSetMacro(MaximumLevel, int);
67  vtkGetMacro(MaximumLevel, int);
69 
71 
74  vtkSetMacro(Dimensions, int);
75  vtkGetMacro(Dimensions, int);
77 
79 
82  vtkSetMacro(GhostLevels, int);
83  vtkGetMacro(GhostLevels, int);
84  vtkBooleanMacro(GhostLevels, int);
86 
88 
91  vtkSetMacro(TimeStep, int);
92  vtkGetMacro(TimeStep, int);
93  vtkGetVector2Macro(TimeStepRange, int);
95 
97 
101  vtkSetMacro(GenerateRectilinearGrids, int);
102  vtkGetMacro(GenerateRectilinearGrids, int);
103  vtkBooleanMacro(GenerateRectilinearGrids, int);
105 
107 
110  vtkSetMacro(TwoDimensional, int);
111  vtkGetMacro(TwoDimensional, int);
112  vtkBooleanMacro(TwoDimensional, int);
114 
116 
120  vtkSetMacro(Asymetric, int);
121  vtkGetMacro(Asymetric, int);
123 
125 
129  vtkSetMacro(Overlap, int);
130  vtkGetMacro(Overlap, int);
132 
133 protected:
136 
138  int EndBlock;
140  int TimeStep;
141  int TimeStepRange[2];
142 
143  // Create either vtkHierarchicalBoxDataSet or vtkMultiBlockDataSet based on
144  // the GenerateRectilinearGrids flag.
145  virtual int RequestDataObject(
146  vtkInformation* req, vtkInformationVector** inV, vtkInformationVector* outV);
147 
152  virtual int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
153  vtkInformationVector* outputVector);
154 
159  virtual int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
160  vtkInformationVector* outputVector);
161 
162  void Traverse(int& blockId, int level, vtkCompositeDataSet* output, int x0, int x1, int y0,
163  int y1, int z0, int z1, int onFace[6]);
164 
165  int LineTest2(float x0, float y0, float z0, float x1, float y1, float z1, double bds[6]);
166  int LineTest(float x0, float y0, float z0, float x1, float y1, float z1, double bds[6], int level,
167  int target);
168 
169  void SetBlockInfo(vtkUniformGrid* grid, int level, int* ext, int onFace[6]);
170  void SetRBlockInfo(vtkRectilinearGrid* grid, int level, int* ext, int onFace[6]);
171 
172  void AddVectorArray(vtkCompositeDataSet* output);
173  void AddTestArray(vtkCompositeDataSet* output);
174  void AddFractalArray(vtkCompositeDataSet* output);
175  void AddBlockIdArray(vtkCompositeDataSet* output);
176  void AddDepthArray(vtkHierarchicalBoxDataSet* output);
177 
178  void AddGhostLevelArray(vtkDataSet* grid, int dim[3], int onFace[6]);
179 
180  int MandelbrotTest(double x, double y);
181  int TwoDTest(double bds[6], int level, int target);
182 
183  void CellExtentToBounds(int level, int ext[6], double bds[6]);
184 
185  void ExecuteRectilinearMandelbrot(vtkRectilinearGrid* grid, double* ptr);
186  double EvaluateSet(double p[4]);
187  void GetContinuousIncrements(int extent[6], vtkIdType& incX, vtkIdType& incY, vtkIdType& incZ);
188 
189  // Dimensions:
190  // Specify blocks relative to this top level block.
191  // For now this has to be set before the blocks are defined.
192  vtkSetVector3Macro(TopLevelSpacing, double);
193  vtkGetVector3Macro(TopLevelSpacing, double);
194  vtkSetVector3Macro(TopLevelOrigin, double);
195  vtkGetVector3Macro(TopLevelOrigin, double);
196 
197  void InternalImageDataCopy(vtkHierarchicalFractal* src);
198 
199  int Overlap;
205  vtkIntArray* Levels;
207 
208  // New method of specifing blocks.
209  double TopLevelSpacing[3];
210  double TopLevelOrigin[3];
211 
213 
214  vtkSmartPointer<HierarchicalFractalOutputUtil>
215  OutputUtil; // convenient class to create composite output
216 
217 private:
218  vtkHierarchicalFractal(const vtkHierarchicalFractal&) VTK_DELETE_FUNCTION;
219  void operator=(const vtkHierarchicalFractal&) VTK_DELETE_FUNCTION;
220 };
221 
222 #endif
vtkSmartPointer< HierarchicalFractalOutputUtil > OutputUtil
A source to test AMR data object.