arrays

addArray

PVGeo._helpers.arrays.addArray(pdo, field, vtkArray)[source]

Adds an array to a vtkDataObject given its field association.

Parameters:
  • pdo (vtkDataObject) – the output data object
  • field (int or str) – the field type id or name
  • vtkArray (vtkDataArray) – the data array to add to the output
Returns:

the output data object with the data array added

Return type:

vtkDataObject

copyArraysToPointData

PVGeo._helpers.arrays.copyArraysToPointData(pdi, pdo, field)[source]

Copys arrays from an input to an ouput’s point data.

Parameters:
  • pdi (vtkDataObject) – The input data object to copy from
  • pdo (vtkDataObject) – The output data object to copy over to
  • field (int or str) – the field type id or name
Returns:

returns the output data object parameter

Return type:

vtkDataObject

getNumPyArray

PVGeo._helpers.arrays.getNumPyArray(wpdi, field, name)[source]

Grabs an array from vtkDataObject given its name and field association.

Parameters:
  • wpdi (wrapped vtkDataObject) – the input data object wrapped using vtk dataset adapter
  • field (int or str) – the field type id or name
  • name (str) – the name of the input array for the given index
Returns:

a wrapped vtkDataArray for NumPy

Return type:

numpy.array

getSelectedArray

PVGeo._helpers.arrays.getSelectedArray(algorithm, wpdi, idx)[source]

Gets selectected array at index idx wrapped for NumPy

Parameters:
  • algorithm (vtkAlgorithm) – A vtkAlgorithm class instantiation
  • wpdi (wrapped vtkDataObject) – the input data object wrapped using vtk dataset adapter
  • idx (int) – the input array index
Returns:

a wrapped vtkDataArray for NumPy

Return type:

numpy.array

getSelectedArrayField

PVGeo._helpers.arrays.getSelectedArrayField(algorithm, idx)[source]

Gets the field of the input array for a given index on a VTK algorithm

Parameters:
  • algorithm (vtkAlgorithm) – A vtkAlgorithm class instantiation
  • idx (int) – the input array index
Returns:

the field type of the input array for the given index

Return type:

int

getSelectedArrayName

PVGeo._helpers.arrays.getSelectedArrayName(algorithm, idx)[source]

Gets the name of the input array for a given index on a VTK algorithm

Parameters:
  • algorithm (vtkAlgorithm) – A vtkAlgorithm class instantiation
  • idx (int) – the input array index
Returns:

the name of the input array for the given index

Return type:

str

getVTKArray

PVGeo._helpers.arrays.getVTKArray(pdi, field, name)[source]

Grabs an array from vtkDataObject given its name and field association.

Parameters:
  • pdi (vtkDataObject) – the input data object
  • field (int or str) – the field type id or name
  • name (str) – the name of the input array for the given index
Returns:

the array from input field and name

Return type:

vtkDataArray

searchForArray

PVGeo._helpers.arrays.searchForArray(pdi, name)[source]