Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK VTK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 737
    • Issues 737
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 209
    • Merge requests 209
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #17612

Closed
Open
Created May 30, 2019 by Viktor Leonhardt@leonhardtContributor

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()
Assignee
Assign to
Time tracking