bempp.api.utils.helpers

Various helper routines.

Module Contents

Classes

MemProfiler

Context manager to measure mem usage in bytes.

Functions

create_unique_id()

Create a unique id.

align_array(arr, dtype, order)

Make sure that an array is contiguous and aligned with the right type.

assign_parameters(parameters)

Assign a parameter object based on input.

promote_to_double_precision(array)

Convert an array to real or complex double precision.

serialise_list_of_lists(array)

Serialise a list of lists (or other iterable).

get_type(precision)

Return a TypeContainer depending on the given precision.

numba_decorate(fun)

Decorate a function for Numba.

get_mass_matrix(domain, dual_to_range)

Directly get a mass matrix.

get_inverse_mass_matrix(domain, dual_to_range)

Quickly get an inverse mass matrix operator.

Attributes

TypeContainer

bempp.api.utils.helpers.create_unique_id()

Create a unique id.

bempp.api.utils.helpers.align_array(arr, dtype, order)

Make sure that an array is contiguous and aligned with the right type.

If order=’F’ use Fortran order. If order=’C’ use C order.

bempp.api.utils.helpers.assign_parameters(parameters)

Assign a parameter object based on input.

If parameters is None return the global_parameters object. Otherwise, return the parameters object again.

bempp.api.utils.helpers.promote_to_double_precision(array)

Convert an array to real or complex double precision.

bempp.api.utils.helpers.serialise_list_of_lists(array)

Serialise a list of lists (or other iterable).

Returns a tuple (new_array, index_ptr), such that array[j] = new_array[index_ptr[j] : index_ptr[j + 1]]

bempp.api.utils.helpers.TypeContainer
bempp.api.utils.helpers.get_type(precision)

Return a TypeContainer depending on the given precision.

class bempp.api.utils.helpers.MemProfiler

Context manager to measure mem usage in bytes.

__enter__()

Enter.

__exit__(*args)

Exit.

bempp.api.utils.helpers.numba_decorate(fun)

Decorate a function for Numba.

bempp.api.utils.helpers.get_mass_matrix(domain, dual_to_range)

Directly get a mass matrix.

Frequently, operations need a discrete mass matrix. This method provides it and if possible uses the mass matrix attribute from the corresponding function space in order to allow quick caching.

bempp.api.utils.helpers.get_inverse_mass_matrix(domain, dual_to_range)

Quickly get an inverse mass matrix operator.

Uses the cached version from a function space if possible.