#!/usr/bin/env python import vtk htg = vtk.vtkHyperTreeGrid() htg.Initialize() scalarArray = vtk.vtkDoubleArray() scalarArray.SetName('scalar') scalarArray.SetNumberOfValues(0) htg.GetPointData().AddArray(scalarArray) htg.GetPointData().SetActiveScalars('scalar') htg.SetDimensions([4, 3, 3]) htg.SetBranchFactor(2) # Rectilinear grid coordinates xValues = vtk.vtkDoubleArray() xValues.SetNumberOfValues(4) xValues.SetValue(0, -1) xValues.SetValue(1, 0) xValues.SetValue(2, 1) xValues.SetValue(3, 2) htg.SetXCoordinates(xValues); yValues = vtk.vtkDoubleArray() yValues.SetNumberOfValues(3) yValues.SetValue(0, -1) yValues.SetValue(1, 0) yValues.SetValue(2, 1) htg.SetYCoordinates(yValues);
#!/usr/bin/env python import vtk htg = vtk.vtkHyperTreeGrid() htg.Initialize() scalarArray = vtk.vtkDoubleArray() scalarArray.SetName('scalar') scalarArray.SetNumberOfValues(0) htg.GetPointData().AddArray(scalarArray) htg.GetPointData().SetActiveScalars('scalar') htg.SetDimensions([4, 3, 3]) htg.SetBranchFactor(2) # Rectilinear grid coordinates xValues = vtk.vtkDoubleArray() xValues.SetNumberOfValues(4) xValues.SetValue(0, -1) xValues.SetValue(1, 0) xValues.SetValue(2, 1) xValues.SetValue(3, 2) htg.SetXCoordinates(xValues) yValues = vtk.vtkDoubleArray() yValues.SetNumberOfValues(3) yValues.SetValue(0, -1) yValues.SetValue(1, 0) yValues.SetValue(2, 1) htg.SetYCoordinates(yValues)