bempp.api.assembly.grid_function
¶
Definition of Grid functions in Bempp.
Documentation of the functionality of this module and examples can be found at https://bempp.com/handbook/api/grid_functions.html
Module Contents¶
Classes¶
Representation of functions on a grid. |
Functions¶
|
Wrap a callable for Bempp. |
|
Wrap function as a real Numba callable. |
|
Wrap function as a complex Numba callable. |
|
Integrate a grid function over a grid. |
|
Return vectorized version of quad_points, normals and domain_indices. |
|
Project a Numba callable onto a grid. |
|
Project a Numba callable onto a grid. |
- bempp.api.assembly.grid_function.callable(*args, complex=False, jit=True, parameterized=False, vectorized=False)¶
Wrap a callable for Bempp.
- bempp.api.assembly.grid_function.real_callable(*args, jit=True)¶
Wrap function as a real Numba callable.
- bempp.api.assembly.grid_function.complex_callable(*args, jit=True)¶
Wrap function as a complex Numba callable.
- class bempp.api.assembly.grid_function.GridFunction(space, dual_space=None, fun=None, coefficients=None, projections=None, parameters=None, function_parameters=None)¶
Bases:
object
Representation of functions on a grid.
Attributes¶
- coefficientsnp.ndarray
Return or set the vector of coefficients.
- component_countint
Return the number of components of the grid function values.
- spacebemp.api.space.Space
Return the space over which the GridFunction is defined.
- gridbempp.api.grid.Grid
Return the underlying grid.
- parametersbempp.api.ParameterList
Return the set of parameters.
- representationstring
Return ‘primal’ if the coefficients of the Gridfunction are known. Return ‘dual’ if only the coefficients in the dual space are known.
- property space¶
Return space.
- property dtype¶
Return type.
- property parameters¶
Return parameters.
- property dual_space¶
Return dual space.
- property representation¶
Return the representation of the grid function.
If the grid function is given in terms of coefficients in the domain space return ‘primal’. If the function is given by its projections return ‘dual’.
- property coefficients¶
Return coefficient vector.
- property grid_coefficients¶
Return grid coefficients.
- property real¶
Return a new grid function consisting of the real part of this function.
- property imag¶
Return a new grid function consisting of the imaginary part of this function.
- property component_count¶
Return number of components.
- projections(dual_space=None)¶
Compute the vector of projections onto the given dual space.
Parameters¶
- dual_spacebempp.api.space.Space
A representation of the dual space. If not specified then fun.dual_space is used.
Returns¶
- outnp.ndarray
A vector of projections onto the dual space.
- project_to_space(space)¶
Return an L^2 projection on another space.
- plot(mode=None, transformation=None)¶
Plot the grid function.
Attributes¶
- modestring
One of ‘element’ or ‘node’. If ‘element’ is chosen the color is determined by the mid-point of the faces of the grid. For ‘vertices’ the vertex values are chosen
- transformationstring or object
One of ‘real’, ‘imag’, ‘abs’, ‘log_abs’ or ‘abs_squared’ or a callable object. Describes the data transformation before plotting. For functions with vector values only ‘abs’, ‘log_abs’ or ‘abs_squared’ are allowed. If a callable object is given this is applied instead. It is important that the callable returns numpy arrays with the same number of dimensions as before.
- evaluate(element_index, local_coordinates)¶
Evaluate grid function on a single element.
- evaluate_on_element_centers()¶
Evaluate the grid function on all element centers.
- evaluate_on_vertices()¶
Evaluate the grid function on all vertices.
If a function is discontinuous across elements a weighted average of the element values at the vertices is taken.
- integrate()¶
Integrate grid function over a grid.
- l2_norm()¶
Calculate the L^2 norm of the function.
- __add__(other)¶
Add two grid functions.
- __mul__(alpha)¶
Multiply a grid function.
- __rmul__(alpha)¶
Multiply a grid function.
- __div__(alpha)¶
Divide a grid function.
- __truediv__(alpha)¶
Divide a grid function.
- __neg__()¶
Negate a grid function.
- __sub__(other)¶
Subtract grid functions.
- classmethod from_random(space)¶
Create a random grid function normalized to unit norm.
- classmethod from_ones(space)¶
Create a grid function with all coefficients set to one.
- classmethod from_zeros(space)¶
Create a grid function with all coefficients set to one.
- bempp.api.assembly.grid_function._integrate(coefficients, grid_data, support_elements, local2global, local_multipliers, normal_multipliers, evaluate_on_element, shapeset_evaluate, points, weights, codomain_dimension, number_of_shape_functions)¶
Integrate a grid function over a grid.
- bempp.api.assembly.grid_function.get_function_quadrature_information(grid_data, support_elements, normal_multipliers, quad_points)¶
Return vectorized version of quad_points, normals and domain_indices.
- bempp.api.assembly.grid_function._project_function(fun, grid_data, support_elements, local2global, local_multipliers, normal_multipliers, evaluate_on_element, shapeset_evaluate, points, weights, codomain_dimension, projections, function_parameters)¶
Project a Numba callable onto a grid.
- bempp.api.assembly.grid_function._project_function_vectorized(function_data, grid_data, support_elements, local2global, local_multipliers, normal_multipliers, evaluate_on_element, shapeset_evaluate, points, weights, codomain_dimension, projections, function_parameters)¶
Project a Numba callable onto a grid.