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() override {return VTK_UNIFORM_GRID_AMR;}
46 
47  // Description: // Print internal states
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
50  // Description:
51  // Restore data object to initial
52  void Initialize() 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 nullptr 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.
86  vtkDataObject* dataObj) 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
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) override;
115  void DeepCopy(vtkDataObject *src) override;
116  void CopyStructure(vtkCompositeDataSet *src) override;
117 
118  // Retrieve an instance of this class from an information object.
120  static vtkUniformGridAMR* GetData(vtkInformationVector* v, int i=0);
121 
122 protected:
124  ~vtkUniformGridAMR() override;
125 
126  // Description:
127  // Get/Set the meta AMR meta data
128  vtkGetObjectMacro(AMRData, vtkAMRDataInternals);
129 
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&) = delete;
142  void operator=(const vtkUniformGridAMR&) = delete;
143 
145 };
146 
147 #endif
static vtkDataObject * New()
subclass of vtkCompositeDataIterator with API to get current level and dataset index.
Store vtkAlgorithm input/output information.
superclass for composite data iterators
void Initialize() override
Restore data object to initial state,.
virtual void SetDataSet(vtkCompositeDataIterator *iter, vtkDataObject *dataObj)=0
Sets the data set at the location pointed by the iterator.
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
vtkAMRInformation * AMRInfo
#define VTK_UNIFORM_GRID_AMR
Definition: vtkType.h:120
int GetDataObjectType() override
Return class name of data type (see vtkType.h for definitions).
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
container of vtkUniformGrid for an AMR data set
static vtkCompositeDataSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
#define VTK_NEWINSTANCE
virtual void CopyStructure(vtkCompositeDataSet *input)=0
Copies the tree structure from the input.
image data with blanking
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual vtkDataObject * GetDataSet(vtkCompositeDataIterator *iter)=0
Returns the dataset located at the positiong pointed by the iterator.
Store zero or more vtkInformation instances.
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
general representation of visualization data
Definition: vtkDataObject.h:64
vtkAMRDataInternals * AMRData
virtual vtkCompositeDataIterator * NewIterator()=0
Return a new iterator (the iterator has to be deleted by user).
#define max(a, b)