basix.numba_helpers

Helper functions for writing DOLFINx custom kernels using Numba.

Functions

apply_dof_transformation(tdim, edge_count, ...)

Apply dof transformations to some data.

apply_dof_transformation_hexahedron(...)

Apply dof transformations to some data on a hexahedron.

apply_dof_transformation_interval(...)

Apply dof transformations to some data on an interval.

apply_dof_transformation_prism(...)

Apply dof transformations to some data on an prism.

apply_dof_transformation_pyramid(...)

Apply dof transformations to some data on an prism.

apply_dof_transformation_quadrilateral(...)

Apply dof transformations to some data on an quadrilateral.

apply_dof_transformation_tetrahedron(...)

Apply dof transformations to some data on a tetrahedron.

apply_dof_transformation_to_transpose(tdim, ...)

Apply dof transformations to some transposed data.

apply_dof_transformation_to_transpose_hexahedron(...)

Apply dof transformations to some transposed data on a hexahedron.

apply_dof_transformation_to_transpose_interval(...)

Apply dof transformations to some transposed data on an interval.

apply_dof_transformation_to_transpose_prism(...)

Apply dof transformations to some transposed data on an prism.

apply_dof_transformation_to_transpose_pyramid(...)

Apply dof transformations to some transposed data on an prism.

apply_dof_transformation_to_transpose_quadrilateral(...)

Apply dof transformations to some transposed data on an quadrilateral.

apply_dof_transformation_to_transpose_tetrahedron(...)

Apply dof transformations to some transposed data on a tetrahedron.

apply_dof_transformation_to_transpose_triangle(...)

Apply dof transformations to some transposed data on a triangle.

apply_dof_transformation_triangle(...)

Apply dof transformations to some data on a triangle.

class basix.numba_helpers.List(*args, lsttype=None, meminfo=None, allocated=0, **kwargs)

Bases: collections.abc.MutableSequence, Generic[numba.typed.typedlist.T]

A typed-list usable in Numba compiled functions.

Implements the MutableSequence interface.

For users, the constructor does not take any parameters. The keyword arguments are for internal use only.

Parameters
  • args (iterable) – The iterable to intialize the list from

  • lsttype (numba.core.types.ListType; keyword-only) – Used internally for the list type.

  • meminfo (MemInfo; keyword-only) – Used internally to pass the MemInfo object when boxing.

  • allocated (int; keyword-only) – Used internally to pre-allocate space for items

append(item: numba.typed.typedlist.T) None

S.append(value) – append value to the end of the sequence

clear() None -- remove all items from S
copy()
count(value) integer -- return number of occurrences of value
classmethod empty_list(item_type, allocated=0)

Create a new empty List.

Parameters
  • item_type (Numba type) – type of the list item.

  • allocated (int) – number of items to pre-allocate

extend(iterable: numba.typed.typedlist._Sequence[numba.typed.typedlist.T]) None

S.extend(iterable) – extend sequence by appending elements from the iterable

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(i: int, item: numba.typed.typedlist.T) None

S.insert(index, value) – insert value before index

pop([index]) item -- remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

remove(item: numba.typed.typedlist.T) None

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()

S.reverse() – reverse IN PLACE

sort(key=None, reverse=False)

Sort the list inplace.

See also list.sort()

basix.numba_helpers.apply_dof_transformation(tdim, edge_count, face_count, entity_transformations, entity_dofs, data, cell_info, face_types)

Apply dof transformations to some data.

Parameters
  • tdim (int) – The topological dimension of the cell.

  • edge_cout (int) – The number of edges the cell has.

  • face_count (int) – The number of faces the cell has.

  • entity_transformations (list) – The DOF transformations for each entity.

  • entity_dofs (list) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

  • face_types (list) – A list of strings giving the shapes of the faces of the cell.

basix.numba_helpers.apply_dof_transformation_hexahedron(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some data on a hexahedron.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_interval(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some data on an interval.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_prism(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some data on an prism.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_pyramid(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some data on an prism.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_quadrilateral(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some data on an quadrilateral.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_tetrahedron(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some data on a tetrahedron.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_to_transpose(tdim, edge_count, face_count, entity_transformations, entity_dofs, data, cell_info, face_types)

Apply dof transformations to some transposed data.

Parameters
  • tdim (int) – The topological dimension of the cell.

  • edge_cout (int) – The number of edges the cell has.

  • face_count (int) – The number of faces the cell has.

  • entity_transformations (list) – The DOF transformations for each entity.

  • entity_dofs (list) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

  • face_types (list) – A list of strings giving the shapes of the faces of the cell.

basix.numba_helpers.apply_dof_transformation_to_transpose_hexahedron(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some transposed data on a hexahedron.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_to_transpose_interval(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some transposed data on an interval.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_to_transpose_prism(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some transposed data on an prism.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_to_transpose_pyramid(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some transposed data on an prism.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_to_transpose_quadrilateral(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some transposed data on an quadrilateral.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_to_transpose_tetrahedron(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some transposed data on a tetrahedron.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_to_transpose_triangle(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some transposed data on a triangle.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.

basix.numba_helpers.apply_dof_transformation_triangle(entity_transformations, entity_dofs, data, cell_info)

Apply dof transformations to some data on a triangle.

Parameters
  • entity_transformations (Dict(ndarray(float64))) – The DOF transformations for each entity.

  • entity_dofs (Dict(ndarray(int32))) – The number of DOFs on each entity.

  • data (np.array) – The data. This will be changed by this function.

  • cell_info (int) – An integer representing the orientations of the subentities of the cell.