Extracts variable "varname" from vtk datastructure "data'.
22 '''Extracts variable "varname" from vtk datastructure "data"''' 23 if attribute_mode ==
'cell':
24 vtk_values = data.GetCellData().GetArray(varname)
25 elif attribute_mode ==
'point':
26 if data.GetPointData().GetNumberOfArrays() > 0:
27 vtk_values = data.GetPointData().GetArray(varname)
30 c2p = v.vtkCellDataToPointData()
32 pointdata=c2p.GetOutput()
34 vtk_values = pointdata.GetPointData().GetScalars(varname)
35 elif attribute_mode ==
'topoint':
36 c2p = v.vtkCellDataToPointData()
38 pointdata=c2p.GetOutput()
40 vtk_values = pointdata.GetPointData().GetScalars(varname)
42 print(
"attribute_mode is either 'cell' or 'point'")
44 return ah.vtk2array(vtk_values)