121#ifndef vtkHyperTree_h
122#define vtkHyperTree_h
124#include "vtkCommonDataModelModule.h"
130VTK_ABI_NAMESPACE_BEGIN
134class vtkTypeInt64Array;
184 bool Initialize(
unsigned char branchFactor,
unsigned char dimension);
272 vtkTypeInt64Array* numberOfVerticesPerDepth,
vtkBitArray* descriptor,
289 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
290 this->Datas->TreeIndex = treeIndex;
294 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
295 return this->Datas->TreeIndex;
304 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
305 assert(
"post: result_greater_or_equal_to_one" && this->Datas->NumberOfLevels >= 1);
306 return this->Datas->NumberOfLevels;
314 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
315 return this->Datas->NumberOfVertices;
323 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
324 return this->Datas->NumberOfNodes;
332 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
333 return this->Datas->NumberOfVertices - this->Datas->NumberOfNodes;
367 const double* scales,
bool reinitialize =
false);
423 assert(
"pre: datas_non_nullptr" && this->Datas !=
nullptr);
424 return this->Datas->GlobalIndexStart;
497 void SetScales(std::shared_ptr<vtkHyperTreeGridScales> scales) { this->Scales = scales; }
504 bool HasScales()
const {
return (this->Scales !=
nullptr); }
511 std::shared_ptr<vtkHyperTreeGridScales>
GetScales()
const
513 assert(this->Scales !=
nullptr);
526 bool IsChildLeaf(
vtkIdType index_parent,
unsigned int ichild)
const;
536 void ComputeBreadthFirstOrderDescriptorImpl(
unsigned int depthLimiter,
vtkBitArray* inputMask,
537 unsigned int depth,
vtkIdType index, std::vector<std::vector<bool>>& descriptorPerDepth,
538 std::vector<std::vector<vtkIdType>>& breadthFirstOrderIdMapPerDepth);
543 unsigned char BranchFactor;
546 unsigned char Dimension;
549 unsigned char NumberOfChildren;
552 std::shared_ptr<vtkHyperTreeData> Datas;
558 std::shared_ptr<vtkHyperTreeGridScales> Scales;
dynamic, self-adjusting array of bits
Dynamic generation of scales for vtkHyperTree.
virtual vtkIdType GetGlobalNodeIndexMax() const
Return the maximum value reached by global index mapping (implicit or explicit).
void GetScale(double s[3]) const
Set/Get scale of the tree in each direction for the ground level (0).
virtual bool IsTerminalNode(vtkIdType index) const
Return if a vertice identified by index in tree as a terminal node.
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.
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.
double GetScale(unsigned int d) const
Set/Get scale of the tree in each direction for the ground level (0).
virtual void SubdivideLeaf(vtkIdType index, unsigned int level)
Subdivide a vertice, only if its a leaf.
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 bool IsLeaf(vtkIdType index) const
Return if a vertice identified by index in tree as being leaf.
virtual vtkIdType GetElderChildIndex(unsigned int index_parent) const
Return the elder child index, local index node of first child, of node, coarse cell,...
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 BuildFromBreadthFirstOrderDescriptor(vtkBitArray *descriptor, vtkIdType numberOfBits, vtkIdType startIndex=0)
This method builds the indexing of this tree given a breadth first order descriptor.
virtual const unsigned int * GetElderChildIndexArray(size_t &nbElements) const
Return the elder child index array, internals of the tree structure Should be used with great care,...
void CopyStructure(vtkHyperTree *ht)
Copy the structure by sharing the decomposition description of the tree.
virtual vtkIdType GetGlobalIndexFromLocal(vtkIdType index) const
Get the global id of a local node identified by index.
vtkIdType GetTreeIndex() const
Set/Get tree index in hypertree grid.
virtual void ComputeBreadthFirstOrderDescriptor(unsigned int depthLimiter, vtkBitArray *inputMask, vtkTypeInt64Array *numberOfVerticesPerDepth, vtkBitArray *descriptor, vtkIdList *breadthFirstIdMap)
This method computes the breadth first order descriptor of the current tree.
virtual void SetGlobalIndexStart(vtkIdType start)
Set the start implicit global index mapping for the first cell in the current tree.
vtkIdType GetNumberOfLeaves() const
Return the number of leaf (fine) in the tree.
int GetDimension() const
Return the spatial dimension of the tree.
virtual void SetGlobalIndexFromLocal(vtkIdType index, vtkIdType global)
Set the mapping between a node index in tree and a explicit global index mapping.
~vtkHyperTree() override=default
static vtkHyperTree * New()
vtkIdType GetNumberOfChildren() const
Return the number of children per node of the tree.
virtual bool IsGlobalIndexImplicit()
Return if implicit global index mapping has been used.
virtual void InitializeForReader(vtkIdType numberOfLevels, vtkIdType nbVertices, vtkIdType nbVerticesOfLastLevel, vtkBitArray *isParent, vtkBitArray *isMasked, vtkBitArray *outIsMasked)
Restore a state from read data, without using a cursor Call after create hypertree with initialize.
void SetTreeIndex(vtkIdType treeIndex)
Set/Get tree index in hypertree grid.
bool Initialize(unsigned char branchFactor, unsigned char dimension)
Restore the initial state: only one vertice is then a leaf: the root cell for the hypertree.
virtual unsigned long GetActualMemorySizeBytes()
Return memory used in bytes.
list of point or cell ids
a simple class to control print indentation
unsigned int NumberOfLevels
vtkIdType NumberOfVertices
std::vector< vtkIdType > GlobalIndexTable
std::vector< unsigned int > ParentToElderChild
vtkIdType GlobalIndexStart