126#ifndef vtkHyperTree_h
127#define vtkHyperTree_h
129#include "vtkCommonDataModelModule.h"
136VTK_ABI_NAMESPACE_BEGIN
140class vtkTypeInt64Array;
183 unsigned char branchFactor,
unsigned char dimension,
unsigned char numberOfChildren);
271 vtkTypeInt64Array* numberOfVerticesPerDepth,
vtkBitArray* descriptor,
282 virtual
vtkHyperTree* Freeze(const
char* vtkNotUsed(mode)) {
return this; };
291 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
292 this->Datas->TreeIndex = treeIndex;
296 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
297 return this->Datas->TreeIndex;
306 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
307 assert(
"post: result_greater_or_equal_to_one" && this->Datas->NumberOfLevels >= 1);
308 return this->Datas->NumberOfLevels;
316 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
317 return this->Datas->NumberOfVertices;
325 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
326 return this->Datas->NumberOfNodes;
334 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
335 return this->Datas->NumberOfVertices - this->Datas->NumberOfNodes;
369 const double* scales,
bool reinitialize =
false);
395 return static_cast<unsigned int>(this->GetActualMemorySizeBytes() / 1024);
436 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
437 return this->Datas->GlobalIndexStart;
510 void SetScales(std::shared_ptr<vtkHyperTreeGridScales> scales) { this->Scales = scales; }
517 bool HasScales()
const {
return (this->Scales !=
nullptr); }
524 std::shared_ptr<vtkHyperTreeGridScales>
GetScales()
const
526 assert(this->Scales !=
nullptr);
552 std::shared_ptr<vtkHyperTreeData>
Datas;
558 std::shared_ptr<vtkHyperTreeGridScales>
Scales;
562 unsigned char branchFactor,
unsigned char dimension,
unsigned char numberOfChildren);
dynamic, self-adjusting array of bits
Dynamic generation of scales for vtkHyperTree.
A data object structured as a tree.
std::shared_ptr< vtkHyperTreeGridScales > Scales
virtual vtkIdType GetGlobalIndexFromLocal(vtkIdType index) const =0
Get the global id of a local node identified by index.
unsigned char BranchFactor
virtual void BuildFromBreadthFirstOrderDescriptor(vtkBitArray *descriptor, vtkIdType numberOfBits, vtkIdType startIndex=0)=0
This method builds the indexing of this tree given a breadth first order descriptor.
virtual const unsigned int * GetElderChildIndexArray(size_t &nbElements) const =0
Return the elder child index array, internals of the tree structure Should be used with great care,...
void GetScale(double s[3]) const
Set/Get scale of the tree in each direction for the ground level (0).
virtual void PrintSelfPrivate(ostream &os, vtkIndent indent)=0
virtual void SubdivideLeaf(vtkIdType index, unsigned int level)=0
Subdivide a vertice, only if its a leaf.
virtual void SetGlobalIndexFromLocal(vtkIdType index, vtkIdType global)=0
Set the mapping between a node index in tree and a explicit global index mapping.
vtkIdType GetNumberOfVertices() const
Return the number of all vertices (coarse and fine) in the tree.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkHyperTree * CreateInstance(unsigned char branchFactor, unsigned char dimension)
Return an instance of an implementation of a hypertree for given branch factor and dimension.
vtkIdType GetGlobalIndexStart() const
Get the start global index for the current tree for implicit global index mapping.
unsigned int GetNumberOfLevels() const
Return the number of levels.
virtual vtkIdType GetElderChildIndex(unsigned int index_parent) const =0
Return the elder child index, local index node of first child, of node, coarse cell,...
double GetScale(unsigned int d) const
Set/Get scale of the tree in each direction for the ground level (0).
std::shared_ptr< vtkHyperTreeGridScales > InitializeScales(const double *scales, bool reinitialize=false)
In an hypertree, all cells are the same size by level.
std::shared_ptr< vtkHyperTreeGridScales > GetScales() const
Return all scales.
virtual void ComputeBreadthFirstOrderDescriptor(unsigned int depthLimiter, vtkBitArray *inputMask, vtkTypeInt64Array *numberOfVerticesPerDepth, vtkBitArray *descriptor, vtkIdList *breadthFirstIdMap)=0
This method computes the breadth first order descriptor of the current tree.
unsigned int GetActualMemorySize()
Return memory used in kibibytes (1024 bytes).
bool HasScales() const
Return the existence scales.
vtkIdType GetNumberOfNodes() const
Return the number of nodes (coarse) in the tree.
int GetBranchFactor() const
Return the branch factor of the tree.
void SetScales(std::shared_ptr< vtkHyperTreeGridScales > scales)
In an hypertree, all cells are the same size by level.
virtual void SetGlobalIndexStart(vtkIdType start)=0
Set the start implicit global index mapping for the first cell in the current tree.
virtual void InitializePrivate()=0
std::shared_ptr< vtkHyperTreeData > Datas
unsigned char NumberOfChildren
void CopyStructure(vtkHyperTree *ht)
Copy the structure by sharing the decomposition description of the tree.
virtual bool IsGlobalIndexImplicit()=0
Return if implicit global index mapping has been used.
virtual bool IsTerminalNode(vtkIdType index) const =0
Return if a vertice identified by index in tree as a terminal node.
virtual void CopyStructurePrivate(vtkHyperTree *ht)=0
vtkIdType GetTreeIndex() const
Set/Get tree index in hypertree grid.
void Initialize(unsigned char branchFactor, unsigned char dimension, unsigned char numberOfChildren)
Restore the initial state: only one vertice is then a leaf: the root cell for the hypertree.
vtkIdType GetNumberOfLeaves() const
Return the number of leaf (fine) in the tree.
int GetDimension() const
Return the spatial dimension of the tree.
~vtkHyperTree() override=default
vtkIdType GetNumberOfChildren() const
Return the number of children per node of the tree.
virtual vtkIdType GetGlobalNodeIndexMax() const =0
Return the maximum value reached by global index mapping (implicit or explicit).
virtual void InitializeForReader(vtkIdType numberOfLevels, vtkIdType nbVertices, vtkIdType nbVerticesOfLastLevel, vtkBitArray *isParent, vtkBitArray *isMasked, vtkBitArray *outIsMasked)=0
Restore a state from read data, without using a cursor Call after create hypertree with initialize.
virtual unsigned long GetActualMemorySizeBytes()=0
Return memory used in bytes.
virtual bool IsLeaf(vtkIdType index) const =0
Return if a vertice identified by index in tree as being leaf.
void SetTreeIndex(vtkIdType treeIndex)
Set/Get tree index in hypertree grid.
list of point or cell ids
a simple class to control print indentation
abstract base class for most VTK objects
unsigned int NumberOfLevels
vtkIdType NumberOfVertices
vtkIdType GlobalIndexStart
#define VTK_DEPRECATED_IN_9_6_0(reason)