VTK
vtkUniformGridAMR.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHierarchicalBoxDataSet.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm 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 =========================================================================*/
15 //
16 // .SECTION Description
17 // vtkUniformGridAMR is a concrete implementation of
18 // vtkCompositeDataSet. The dataset type is restricted to
19 // vtkUniformGrid.
20 
21 
22 #ifndef vtkUniformGridAMR_h
23 #define vtkUniformGridAMR_h
24 
25 #include "vtkCommonDataModelModule.h" // For export macro
26 #include "vtkCompositeDataSet.h"
27 
29 class vtkUniformGrid;
30 class vtkAMRInformation;
32 
33 class VTKCOMMONDATAMODEL_EXPORT vtkUniformGridAMR: public vtkCompositeDataSet
34 {
35 public:
36  static vtkUniformGridAMR *New();
38 
39  // Description:
40  // Return a new iterator (the iterator has to be deleted by the user).
42 
43  // Description:
44  // Return class name of data type (see vtkType.h for definitions).
45  int GetDataObjectType() VTK_OVERRIDE {return VTK_UNIFORM_GRID_AMR;}
46 
47  // Description: // Print internal states
48  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
49 
50  // Description:
51  // Restore data object to initial
52  void Initialize() VTK_OVERRIDE;
53 
54  // Description:
55  // Initialize the AMR.
56  virtual void Initialize(int numLevels, const int * blocksPerLevel);
57 
58  // Description:
59  // Set/Get the data description of this uniform grid instance,
60  // e.g. VTK_XYZ_GRID
61  void SetGridDescription(int gridDescription);
62  int GetGridDescription();
63 
64  // Description:
65  // Return the number of levels
66  unsigned int GetNumberOfLevels();
67 
68  // Description:
69  // Return the total number of blocks, including NULL blocks
70  virtual unsigned int GetTotalNumberOfBlocks();
71 
72  // Description:
73  // Returns the number of datasets at the given level, including null blocks
74  unsigned int GetNumberOfDataSets(const unsigned int level);
75 
76  // Description:
77  // Retrieve the bounds of the AMR domain
78  void GetBounds(double bounds[6]);
79  const double* GetBounds();
80  void GetMin(double min[3]);
81  void GetMax(double max[3]);
82 
83  // Description:
84  // Unhiding superclass method.
85  void SetDataSet(vtkCompositeDataIterator* iter,
86  vtkDataObject* dataObj) VTK_OVERRIDE;
87 
88  // Description:
89  // At the passed in level, set grid as the idx'th block at that level.
90  // idx must be less than the number of data sets at that level.
91  virtual void SetDataSet(unsigned int level, unsigned int idx, vtkUniformGrid *grid);
92 
93  // Description:
94  // Return the data set pointed to by iter
95  vtkDataObject* GetDataSet(vtkCompositeDataIterator* iter) VTK_OVERRIDE;
96 
97  // Description:
98  // Get the data set using the index pair
99  vtkUniformGrid* GetDataSet(unsigned int level, unsigned int idx);
100 
101  // Description:
102  // Retrieves the composite index associated with the data at the given
103  // (level,index) pair.
104  int GetCompositeIndex( const unsigned int level, const unsigned int index );
105 
106  // Description:
107  // Givenes the composite Idx (as set by SetCompositeIdx) this method returns the
108  // corresponding level and dataset index within the level.
109  void GetLevelAndIndex(
110  const unsigned int compositeIdx, unsigned int &level, unsigned int &idx );
111 
112  // Description:
113  // Override ShallowCopy/DeepCopy and CopyStructure
114  void ShallowCopy(vtkDataObject *src) VTK_OVERRIDE;
115  void DeepCopy(vtkDataObject *src) VTK_OVERRIDE;
116  void CopyStructure(vtkCompositeDataSet *src) VTK_OVERRIDE;
117 
118  // Retrieve an instance of this class from an information object.
119  static vtkUniformGridAMR* GetData(vtkInformation* info);
120  static vtkUniformGridAMR* GetData(vtkInformationVector* v, int i=0);
121 
122 protected:
124  ~vtkUniformGridAMR() VTK_OVERRIDE;
125 
126  // Description:
127  // Get/Set the meta AMR meta data
128  vtkGetObjectMacro(AMRData, vtkAMRDataInternals);
129 
130  vtkAMRInformation* AMRInfo;
131  vtkAMRDataInternals* AMRData;
132  double Bounds[6];
133 
134  // Description:
135  // Get/Set the meta AMR meta data
136  vtkGetObjectMacro(AMRInfo, vtkAMRInformation);
137  virtual void SetAMRInfo(vtkAMRInformation*);
138 
139 
140 private:
141  vtkUniformGridAMR(const vtkUniformGridAMR&) VTK_DELETE_FUNCTION;
142  void operator=(const vtkUniformGridAMR&) VTK_DELETE_FUNCTION;
143 
145 };
146 
147 #endif
virtual VTK_NEWINSTANCE vtkCompositeDataIterator * NewIterator()=0
Return a new iterator (the iterator has to be deleted by user).
static vtkDataObject * New()
subclass of vtkCompositeDataIterator with API to get current level and dataset index.
Store vtkAlgorithm input/output information.
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
superclass for composite data iterators
void Initialize() override
Restore data object to initial state,.
abstract superclass for composite (multi-block or AMR) datasets
Meta data that describes the structure of an AMR data set.
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_UNIFORM_GRID_AMR
Definition: vtkType.h:116
container of vtkUniformGrid for an AMR data set
#define VTK_NEWINSTANCE
image data with blanking
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:64
#define max(a, b)