VTK  9.3.20240423
vtkBSPCuts.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3// SPDX-License-Identifier: BSD-3-Clause
4
21#ifndef vtkBSPCuts_h
22#define vtkBSPCuts_h
23
24#include "vtkCommonDataModelModule.h" // For export macro
25#include "vtkDataObject.h"
26
27VTK_ABI_NAMESPACE_BEGIN
28class vtkKdNode;
29
30class VTKCOMMONDATAMODEL_EXPORT vtkBSPCuts : public vtkDataObject
31{
32public:
33 static vtkBSPCuts* New();
34 vtkTypeMacro(vtkBSPCuts, vtkDataObject);
35 void PrintSelf(ostream& os, vtkIndent indent) override;
36
40 int GetDataObjectType() override { return VTK_BSP_CUTS; }
41
59 void CreateCuts(double* bounds, int ncuts, int* dim, double* coord, int* lower, int* upper,
60 double* lowerDataCoord, double* upperDataCoord, int* npoints);
61
67
73 vtkKdNode* GetKdNodeTree() { return this->Top; }
74
80 vtkGetMacro(NumberOfCuts, int);
81
86 int GetArrays(int len, int* dim, double* coord, int* lower, int* upper, double* lowerDataCoord,
87 double* upperDataCoord, int* npoints);
88
93 int Equals(vtkBSPCuts* other, double tolerance = 0.0);
94
95 void PrintTree();
97
99
105
109 void Initialize() override;
110
112
116 void ShallowCopy(vtkDataObject* src) override;
117 void DeepCopy(vtkDataObject* src) override;
119
120protected:
122 ~vtkBSPCuts() override;
123
125
126 static int CountNodes(vtkKdNode* kd);
127 static void SetMinMaxId(vtkKdNode* kd);
128 static void PrintTree_(vtkKdNode* kd, int depth);
129
130 void BuildTree(vtkKdNode* kd, int idx);
131 int WriteArray(vtkKdNode* kd, int loc);
132
134 void AllocateArrays(int size);
135
137
138 // required cut information
139
140 int NumberOfCuts; // number of cuts, also length of each array
141 int* Dim; // dimension (x/y/z - 0/1/2) where cut occurs
142 double* Coord; // location of cut along axis
143 int* Lower; // location in arrays of left (lower) child info
144 int* Upper; // location in arrays of right (lower) child info
145
146 // optional cut information
147
148 double* LowerDataCoord; // coordinate of uppermost data in lower half
149 double* UpperDataCoord; // coordinate of lowermost data in upper half
150 int* Npoints; // number of data values in partition
151
152 double Bounds[6];
153
154 vtkBSPCuts(const vtkBSPCuts&) = delete;
155 void operator=(const vtkBSPCuts&) = delete;
156};
157
158VTK_ABI_NAMESPACE_END
159#endif
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition vtkBSPCuts.h:31
int * Lower
Definition vtkBSPCuts.h:143
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double * LowerDataCoord
Definition vtkBSPCuts.h:148
int WriteArray(vtkKdNode *kd, int loc)
void PrintArrays()
void BuildTree(vtkKdNode *kd, int idx)
void PrintTree()
vtkKdNode * GetKdNodeTree()
Return a tree of vtkKdNode's representing the cuts specified in this object.
Definition vtkBSPCuts.h:73
void ShallowCopy(vtkDataObject *src) override
Shallow copy.
int * Upper
Definition vtkBSPCuts.h:144
static int CountNodes(vtkKdNode *kd)
static void SetMinMaxId(vtkKdNode *kd)
int NumberOfCuts
Definition vtkBSPCuts.h:140
void DeepCopy(vtkDataObject *src) override
Shallow copy.
double * UpperDataCoord
Definition vtkBSPCuts.h:149
double * Coord
Definition vtkBSPCuts.h:142
static vtkBSPCuts * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
int GetDataObjectType() override
Returns VTK_BSP_CUTS.
Definition vtkBSPCuts.h:40
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.
void Initialize() override
Restore data object to initial state,.
void operator=(const vtkBSPCuts &)=delete
static void PrintTree_(vtkKdNode *kd, int depth)
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.
static vtkBSPCuts * New()
vtkBSPCuts(const vtkBSPCuts &)=delete
static void DeleteAllDescendants(vtkKdNode *kd)
void ResetArrays()
int * Npoints
Definition vtkBSPCuts.h:150
static vtkBSPCuts * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkKdNode * Top
Definition vtkBSPCuts.h:136
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.
void AllocateArrays(int size)
general representation of visualization data
a simple class to control print indentation
Definition vtkIndent.h:108
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:32
#define VTK_BSP_CUTS
Definition vtkType.h:111