BHAC Python tools
Classes | Functions | Variables
read Namespace Reference

Classes

class  ensemble
 Load particle ensemble .csv files. More...
 
class  load
 Loader class for vtu and pvtu files. More...
 
class  loadcsv
 Load 1D comma separated list from a cut. More...
 
class  loadvti
 Loader class for vti data. More...
 
class  particles
 Load binary particles data. More...
 
class  postrad
 Load binary postrad data. More...
 

Functions

def extract (data, varname, attribute_mode='cell')
 Extracts variable "varname" from vtk datastructure "data'. More...
 

Variables

 default_timer = time.clock
 

Function Documentation

◆ extract()

def read.extract (   data,
  varname,
  attribute_mode = 'cell' 
)

Extracts variable "varname" from vtk datastructure "data'.

Definition at line 22 of file read.py.

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)
28  else:
29  # Convert to pointdata first
30  c2p = v.vtkCellDataToPointData()
31  c2p.SetInput(data)
32  pointdata=c2p.GetOutput()
33  pointdata.Update()
34  vtk_values = pointdata.GetPointData().GetScalars(varname)
35  elif attribute_mode == 'topoint':
36  c2p = v.vtkCellDataToPointData()
37  c2p.SetInput(data)
38  pointdata=c2p.GetOutput()
39  pointdata.Update()
40  vtk_values = pointdata.GetPointData().GetScalars(varname)
41  else:
42  print("attribute_mode is either 'cell' or 'point'")
43 
44  return ah.vtk2array(vtk_values)
45 
46 #=============================================================================

Variable Documentation

◆ default_timer

read.default_timer = time.clock

Definition at line 14 of file read.py.