VTK  9.0.1
vtkBSPCuts.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBSPCuts.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  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
36 #ifndef vtkBSPCuts_h
37 #define vtkBSPCuts_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkDataObject.h"
41 
42 class vtkKdNode;
43 
44 class VTKCOMMONDATAMODEL_EXPORT vtkBSPCuts : public vtkDataObject
45 {
46 public:
47  static vtkBSPCuts* New();
48  vtkTypeMacro(vtkBSPCuts, vtkDataObject);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
68  void CreateCuts(double* bounds, int ncuts, int* dim, double* coord, int* lower, int* upper,
69  double* lowerDataCoord, double* upperDataCoord, int* npoints);
70 
75  void CreateCuts(vtkKdNode* kd);
76 
82  vtkKdNode* GetKdNodeTree() { return this->Top; }
83 
89  vtkGetMacro(NumberOfCuts, int);
90 
95  int GetArrays(int len, int* dim, double* coord, int* lower, int* upper, double* lowerDataCoord,
96  double* upperDataCoord, int* npoints);
97 
102  int Equals(vtkBSPCuts* other, double tolerance = 0.0);
103 
104  void PrintTree();
105  void PrintArrays();
106 
108 
112  static vtkBSPCuts* GetData(vtkInformationVector* v, int i = 0);
114 
118  void Initialize() override;
119 
121 
125  void ShallowCopy(vtkDataObject* src) override;
126  void DeepCopy(vtkDataObject* src) override;
128 
129 protected:
131  ~vtkBSPCuts() override;
132 
133  static void DeleteAllDescendants(vtkKdNode* kd);
134 
135  static int CountNodes(vtkKdNode* kd);
136  static void SetMinMaxId(vtkKdNode* kd);
137  static void _PrintTree(vtkKdNode* kd, int depth);
138 
139  void BuildTree(vtkKdNode* kd, int idx);
140  int WriteArray(vtkKdNode* kd, int loc);
141 
142  void ResetArrays();
143  void AllocateArrays(int size);
144 
146 
147  // required cut information
148 
149  int NumberOfCuts; // number of cuts, also length of each array
150  int* Dim; // dimension (x/y/z - 0/1/2) where cut occurs
151  double* Coord; // location of cut along axis
152  int* Lower; // location in arrays of left (lower) child info
153  int* Upper; // location in arrays of right (lower) child info
154 
155  // optional cut information
156 
157  double* LowerDataCoord; // coordinate of uppermost data in lower half
158  double* UpperDataCoord; // coordinate of lowermost data in upper half
159  int* Npoints; // number of data values in partition
160 
161  double Bounds[6];
162 
163  vtkBSPCuts(const vtkBSPCuts&) = delete;
164  void operator=(const vtkBSPCuts&) = delete;
165 };
166 
167 #endif
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:45
int * Lower
Definition: vtkBSPCuts.h:152
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double * LowerDataCoord
Definition: vtkBSPCuts.h:157
int WriteArray(vtkKdNode *kd, int loc)
void PrintArrays()
void BuildTree(vtkKdNode *kd, int idx)
void PrintTree()
static vtkBSPCuts * GetData(vtkInformationVector *v, int i=0)
void ShallowCopy(vtkDataObject *src) override
Shallow copy.
int * Upper
Definition: vtkBSPCuts.h:153
static int CountNodes(vtkKdNode *kd)
static void _PrintTree(vtkKdNode *kd, int depth)
static void SetMinMaxId(vtkKdNode *kd)
int NumberOfCuts
Definition: vtkBSPCuts.h:149
void DeepCopy(vtkDataObject *src) override
double * UpperDataCoord
Definition: vtkBSPCuts.h:158
int * Dim
Definition: vtkBSPCuts.h:150
double * Coord
Definition: vtkBSPCuts.h:151
int Equals(vtkBSPCuts *other, double tolerance=0.0)
Compare these cuts with those of the other tree.
~vtkBSPCuts() override
void CreateCuts(vtkKdNode *kd)
Initialize the cuts from a tree of vtkKdNode's.
static vtkBSPCuts * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
void Initialize() override
Restore data object to initial state,.
void operator=(const vtkBSPCuts &)=delete
int GetArrays(int len, int *dim, double *coord, int *lower, int *upper, double *lowerDataCoord, double *upperDataCoord, int *npoints)
Get the arrays representing the cuts in the partitioning.
vtkBSPCuts(const vtkBSPCuts &)=delete
static vtkBSPCuts * New()
static void DeleteAllDescendants(vtkKdNode *kd)
void ResetArrays()
int * Npoints
Definition: vtkBSPCuts.h:159
vtkKdNode * Top
Definition: vtkBSPCuts.h:145
void CreateCuts(double *bounds, int ncuts, int *dim, double *coord, int *lower, int *upper, double *lowerDataCoord, double *upperDataCoord, int *npoints)
Initialize the cuts with arrays of information.
vtkKdNode * GetKdNodeTree()
Return a tree of vtkKdNode's representing the cuts specified in this object.
Definition: vtkBSPCuts.h:82
void AllocateArrays(int size)
general representation of visualization data
Definition: vtkDataObject.h:60
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning.
Definition: vtkKdNode.h:43
@ info
Definition: vtkX3D.h:382
@ size
Definition: vtkX3D.h:259