bempp.api.space.space
¶
Generic access to spaces.
Module Contents¶
Classes¶
Configure and builds a space object. |
|
Main class for function spaces. |
Functions¶
|
Initialize a function space. |
Return representation of spaces on same grid. |
|
|
Return true if two spaces are compatible. |
|
Return mapper from grid coeffs to point evaluations. |
|
Run Numba accelerated computational parts for point map. |
|
Process information from support_elements and segments vars. |
|
Obtain the global to local dof map from the local to global map. |
|
Return the associated localised space. |
|
Copy a space to a worker. |
|
Evaluate the basis on an element. |
- bempp.api.space.space.function_space(grid, kind, degree, scatter=True, **kwargs)¶
Initialize a function space.
Parameters¶
- gridbempp.Grid
The grid that the space is defined on.
- kindstr
The space type
- degreeint
The polynomial degree of the space
- support_elementsnp.array
The element indices of elements that make up the part of the mesh on which the space is defined.
- segmentslist
The segment numbers of the part of the mesh on which the space is defined.
- swapped_normalsbool
TODO
- scatterbool
TODO
- include_boundary_dofsbool
Should degrees of freedom on the boundary of the grid segments be included?
- truncate_at_segment_edgebool
Should basis functions be truncated at the edge of the grid segment? If this is set to true, continuous spaces will no longer be continuous across the segment edge.
- class bempp.api.space.space.SpaceBuilder(grid)¶
Bases:
object
Configure and builds a space object.
- set_codomain_dimension(codomain_dimension)¶
Set the codomain dimension.
- set_support(support)¶
Set the support.
- set_normal_multipliers(normal_multipliers)¶
Set normal multipliers.
- set_order(order)¶
Set the order of the space.
- set_shapeset(shapeset)¶
Set the shapeset string.
- set_local2global(local2global)¶
Set the local2global map.
- set_global2local(global2local)¶
Set the global2local map.
- set_local_multipliers(local_multipliers)¶
Set the local multipliers.
- set_identifier(identifier)¶
Set the identifier.
- set_is_localised(is_localised)¶
Set to true if space is localised.
- set_dof_transformation(dof_transformation)¶
Set the dof transformation.
- set_is_barycentric(is_barycentric)¶
Call to define space as barycentric.
- set_numba_evaluator(basis_evaluator)¶
Hand over Numba method that evaluates the basis.
- set_numba_surface_gradient(surface_gradient)¶
Hand over Numba method that evaluates surface gradient.
- set_numba_surface_curl(surface_curl)¶
Hand over Numba method that evaluates surface curl.
- set_barycentric_representation(barycentric_representation)¶
Set barycentric representation.
- set_collocation_points(collocation_points)¶
Define the collocation points.
- build()¶
Build a space object.
- class bempp.api.space.space.FunctionSpace(grid, codomain_dimension, order, shapeset, local2global_map, global2local_map, local_multipliers, identifier, is_localised, support, normal_multipliers, requires_dof_transformation, is_barycentric, barycentric_representation, dof_transformation, numba_evaluator, numba_surface_gradient, numba_surface_curl, collocation_points)¶
Bases:
object
Main class for function spaces.
This class is not meant to be initialized on its own. Rather there are functions for each type of space that configure this object through a builder pattern.
- property grid¶
Return the grid.
- property grid_id¶
Return id of base grid.
- property codomain_dimension¶
Return the codomain dimension.
- property global_dof_count¶
Return the global dof count.
- property grid_dof_count¶
Return the grid dof count.
- property order¶
Return order of the space.
- property local2global¶
Return local to global map.
- property local_multipliers¶
Return the multipliers for each local dof.
- property normal_multipliers¶
Return the normal multipliers for each grid element.
- property global2local¶
Return global to local map.
- property number_of_shape_functions¶
Return the number of shape functions on each element.
- property number_of_support_elements¶
Return the number of elements that form the support.
- property support_elements¶
Return the list of elements on which space is supported.
- property identifier¶
Return the identifier.
- property support¶
Return support of the space.
- property id¶
Return id string of the space.
- property shapeset¶
Return the shapeset.
- property localised_space¶
Return the elementwise defined space.
- property is_localised¶
Return true if space is localised.
- property color_map¶
Return a coloring of the grid associated with the space.
The coloring is defined such that if two elements have the same color then their associated global degrees of freedom do not intersect. This is important for the efficient summation of global dofs during the assembly.
- property map_to_localised_space¶
Return a sparse matrix that maps dofs to localised space.
- property map_to_full_grid¶
Return a sparse matrix that maps dofs to localised space on full grid.
- property dof_transformation¶
Return transformation from global dofs to space dofs.
- property requires_dof_transformation¶
Return true if the dof transformation matrix is not the identity.
- property is_barycentric¶
Return true if space is defined over barycentric grid.
- property hash¶
Return hash string for space comparison.
- property numba_evaluate¶
Return the basis evaluator.
- property numba_surface_gradient¶
Return the surface gradient evaluator.
- property numba_surface_curl¶
Return the surface curl evaluator.
- property has_surface_gradient¶
Return True if surface gradient is defined.
- property has_surface_curl¶
Return True if surface curl is defined.
- property collocation_points¶
Return collocation points.
- cell_dofs(cell_index)¶
Return the DOF numbers associated with the cell.
- barycentric_representation()¶
Return barycentric_representation if it exists.
- map_to_points(quadrature_order=None, return_transpose=False)¶
Return a map from function space coefficients to point evaluations.
Creates a mapping from function space coefficients to Green’s fct. coefficients. Needed mainly for FMM evaluations. The point definition is the quadrature order of the underlying quadrature rule. If ‘return_transpose’ is true then then transpose of the operator is returned.
- get_elements_by_color()¶
Return color sorted elements and their index positions.
This method returns a tuple (sorted_indices, indexptr) so that all element indices with color i are contained in sorted_indices[indexptr[i]:indexptr[i+1]].
- evaluate(element_index, local_coordinates)¶
Evaluate the basis on an element.
Returns an array of the form (codomain_dimension, number_of_shape_functions, number_of_eval_points) that contains the basis functions evaluated at the given points.
- surface_gradient(element_index, local_coordinates)¶
Return the surface gradient.
- surface_curl(element_index, element, local_coordinates)¶
Return the surface gradient.
- mass_matrix()¶
Return the mass matrix associated with this space.
- inverse_mass_matrix()¶
Return the inverse mass matrix for this space.
- _generate_hash()¶
Generate a hash for the space object.
- is_compatible(other)¶
Check if space is compatible with other space.
- _set_id(new_id)¶
Assign a new id string to the space.
- _compute_color_map()¶
Compute the color map.
- _sort_elements_by_color()¶
Implement elements by color computation.
- __eq__(other)¶
Check if spaces are compatible.
- bempp.api.space.space.return_compatible_representation(*args)¶
Return representation of spaces on same grid.
- bempp.api.space.space.check_if_compatible(space1, space2)¶
Return true if two spaces are compatible.
- bempp.api.space.space.map_space_to_points(space, quadrature_order=None, return_transpose=False)¶
Return mapper from grid coeffs to point evaluations.
- bempp.api.space.space.map_space_to_points_impl(grid_data, local2global, local_multipliers, normal_multipliers, support_elements, numba_evaluate, shape_fun, local_points, weights, number_of_shape_functions)¶
Run Numba accelerated computational parts for point map.
- bempp.api.space.space._process_segments(grid, support_elements, segments, swapped_normals)¶
Process information from support_elements and segments vars.
- bempp.api.space.space.invert_local2global(local2global_map, local_multipliers)¶
Obtain the global to local dof map from the local to global map.
- bempp.api.space.space.make_localised_space(space)¶
Return the associated localised space.
- bempp.api.space.space._space_scatter_worker(grid_id, space_id, kind, degree, kwargs)¶
Copy a space to a worker.
- bempp.api.space.space._numba_evaluate(element_index, shapeset_evaluate, local_coordinates, grid_data, local_multipliers, normal_multipliers)¶
Evaluate the basis on an element.