arrays

add_array

PVGeo._helpers.arrays.add_array(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

copy_arrays_to_point_data

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

Copies 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

get_all_array_names

PVGeo._helpers.arrays.get_all_array_names(dataset, field)[source]

get_numpy_array

PVGeo._helpers.arrays.get_numpy_array(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

get_selected_array

PVGeo._helpers.arrays.get_selected_array(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

get_selected_array_field

PVGeo._helpers.arrays.get_selected_array_field(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

get_selected_array_name

PVGeo._helpers.arrays.get_selected_array_name(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

get_vtk_array

PVGeo._helpers.arrays.get_vtk_array(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

search_for_array

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