vtkHyperTreeGrid initialization of Cursors using GetIndexFromLevelZeroCoordinates fails in python
During the execution of the following example, the following assertion is thrown:
Assertion failed: (k < this->CellDims[2]), function GetLevelZeroCoordinatesFromIndex, file /vtk/Common/DataModel/vtkHyperTreeGrid.cxx, line 1315.
Equivalent code in c++ works fine.
from vtk import *
htg = vtkHyperTreeGrid()
htg.Initialize()
htg.SetDimensions([3,4,5])
htg.SetBranchFactor(2)
coords = vtkDoubleArray()
coords.SetNumberOfValues(3)
coords.SetValue(0, 1.)
coords.SetValue(1, 2.)
coords.SetValue(2, 3.)
htg.SetXCoordinates(coords)
coords = vtkDoubleArray()
coords.SetNumberOfValues(4)
coords.SetValue(0, 1.)
coords.SetValue(1, 2.)
coords.SetValue(2, 3.)
coords.SetValue(3, 4.)
htg.SetYCoordinates(coords)
coords = vtkDoubleArray()
coords.SetNumberOfValues(5)
coords.SetValue(0, 1.)
coords.SetValue(1, 2.)
coords.SetValue(2, 3.)
coords.SetValue(3, 4.)
coords.SetValue(4, 5.)
htg.SetZCoordinates(coords)
offsetIndex = 0
cursor = vtkHyperTreeGridNonOrientedCursor()
treeId = reference(0)
for i in range(3):
for j in range(4):
for k in range(5):
htg.GetIndexFromLevelZeroCoordinates(treeId, i, j, k)
htg.InitializeNonOrientedCursor(cursor, treeId, True)
cursor.SetGlobalIndexStart(offsetIndex)
# just subdivide once
cursor.SubdivideLeaf()
offsetIndex += cursor.GetTree().GetNumberOfVertices()