def nonOrientedGeometryCursor(htg, waited): nb = 0 cursor = vtk.vtkHyperTreeGridNonOrientedGeometryCursor() for treeId in range(htg.GetMaxNumberOfTrees()): htg.InitializeNonOrientedGeometryCursor(cursor, treeId) if not cursor.IsMasked(): nb += recursive(cursor) print('nb: ', nb) if waited and nb != waited: print('ERROR Not corresponding waited value') return nb
def nonOrientedGeometryCursor( htg, waited ): nb = 0 cursor = vtk.vtkHyperTreeGridNonOrientedGeometryCursor() for treeId in range(htg.GetMaxNumberOfTrees()): htg.InitializeNonOrientedGeometryCursor( cursor, treeId ) if not cursor.IsMasked(): nb += recursive( cursor ) print('nb: ', nb) if waited and nb != waited: print('ERROR Not corresponding waited value') return nb
if shouldRefine(cursor.GetLevel(), cellBounds): cursor.SubdivideLeaf() handleNode(cursor, sideArray, mask) else: for childIdx in range(cursor.GetNumberOfChildren()): cursor.ToChild(childIdx) handleNode(cursor, sideArray, mask) cursor.ToParent() # ----------------------------------------------------------------------------- # Create Simple HTG # ----------------------------------------------------------------------------- geoCursor = vtk.vtkHyperTreeGridNonOrientedGeometryCursor() htg = vtk.vtkHyperTreeGrid() htg.Initialize() htg.SetDimensions( [ROOT_SPLIT + 1, ROOT_SPLIT + 1, 2]) # nb cells, not nb points : GridCell [ROOT_SPLIT, ROOT_SPLIT, 1] htg.SetBranchFactor(2) sideArray = vtk.vtkUnsignedCharArray() sideArray.SetName('sideArray') sideArray.SetNumberOfValues(0) sideArray.SetNumberOfComponents(1) htg.GetPointData().AddArray(sideArray) #quand je mets cela je n'ai plus rien d'affiche
if shouldRefine(cursor.GetLevel(), cellBounds): cursor.SubdivideLeaf() handleNode(cursor, sideArray, mask) else: for childIdx in range( cursor.GetNumberOfChildren() ): cursor.ToChild(childIdx) handleNode(cursor, sideArray, mask) cursor.ToParent() # ----------------------------------------------------------------------------- # Create Simple HTG # ----------------------------------------------------------------------------- geoCursor = vtk.vtkHyperTreeGridNonOrientedGeometryCursor() htg = vtk.vtkHyperTreeGrid() htg.Initialize() htg.SetDimensions([ROOT_SPLIT+1, ROOT_SPLIT+1, 2]) # nb cells, not nb points : GridCell [ROOT_SPLIT, ROOT_SPLIT, 1] htg.SetBranchFactor(2) sideArray = vtk.vtkUnsignedCharArray() sideArray.SetName('sideArray') sideArray.SetNumberOfValues(0) sideArray.SetNumberOfComponents(1) htg.GetPointData().AddArray(sideArray) #quand je mets cela je n'ai plus rien d'affiche #htg.GetPointData().SetScalars(levels) #htg.GetPointData().AddArray(sideArray)