bempp_cl.api.assembly.blocked_operator

Definition of blocked operator structures.

Classes

BlockedOperatorBase

Base class for blocked operators.

BlockedOperator

Construct an m x n blocked boundary operator.

GeneralizedBlockedOperator

Construct a generalized blocked operator.

MultitraceOperatorFromAssembler

A multitrace operator from an assembler.

SumBlockedOperator

Represents the sum of two blocked boundary operators.

ProductBlockedOperator

Represents the Product of two blocked boundary operators.

ScaledBlockedOperator

Represents the scalar multiplication of a blocked operator.

GeneralizedDiscreteBlockedOperator

A discrete generalized blocked operator.

BlockedDiscreteOperator

Implementation of a discrete blocked boundary operator.

Functions

_sum(op1, op2)

Sum of two operators, allowing for one of them to be None.

_prod(op1, op2)

Product of two operators, allowing for one of them to be None.

coefficients_from_grid_functions_list(grid_funs)

Return a vector of coefficients of a list of grid functions.

projections_from_grid_functions_list(grid_funs, ...)

Return a vector of projections of a list of grid functions.

grid_function_list_from_coefficients(coefficients, spaces)

Create a list of grid functions from a long vector of coefficients.

grid_function_list_from_projections(projections, spaces)

Create a list of grid functions from a long vector of projections.

Module Contents

bempp_cl.api.assembly.blocked_operator._sum(op1, op2)

Sum of two operators, allowing for one of them to be None.

bempp_cl.api.assembly.blocked_operator._prod(op1, op2)

Product of two operators, allowing for one of them to be None.

class bempp_cl.api.assembly.blocked_operator.BlockedOperatorBase

Bases: object

Base class for blocked operators.

_weak_form = None
_range_map = None
_cached = None
weak_form()

Return cached weak form (assemble if necessary).

strong_form()

Return a discrete operator that maps into the range space.

Parameters

recomputebool

Usually the strong form is cached. If this parameter is set to true the strong form is recomputed.

property ndims

Return number of block rows and block columns.

abstract property range_spaces

Return a list of range spaces of the blocked operator.

abstract property dual_to_range_spaces

Return a list of dual to range spaces of the blocked operator.

abstract property domain_spaces

Return a list of domain spaces of the blocked operator.

__add__(other)

Add two blocked operators.

__neg__()

Multiply the blocked operator with -1.

__sub__(other)

Subtract another blocked operator from this blocked operator.

__mul__(other)

Multiply two blocked operators.

__matmul__(other)

Multiply two operators.

__rmul__(other)

Multiply two operators.

class bempp_cl.api.assembly.blocked_operator.BlockedOperator(m, n)

Bases: BlockedOperatorBase

Construct an m x n blocked boundary operator.

_operators
_rows
_cols
_dual_to_range_spaces
_range_spaces
_domain_spaces
__getitem__(key)

Return a component operator with a key of the form (i, j).

__setitem__(key, operator)

Set a component operator with a key of the form (i, j).

_fill_complete()

Check if each row and column contain at least one operator.

_assemble()

Implement the weak form.

property range_spaces

Return the list of range spaces.

property dual_to_range_spaces

Return the list of dual_to_range spaces.

property domain_spaces

Return the list of domain spaces.

class bempp_cl.api.assembly.blocked_operator.GeneralizedBlockedOperator(array)

Bases: BlockedOperatorBase

Construct a generalized blocked operator.

A generalized blocked operator has as components either

  • Simple operators

  • Blocked operators

  • Generalized blocked operators

  • Arrays of simple/blocked/generalized blocked operators

_ops = []
_components_per_row = None
_components_per_column = None
_assemble()

Implement the weak form.

property range_spaces

Return the list of range spaces.

property dual_to_range_spaces

Return the list of dual_to_range spaces.

property domain_spaces

Return the list of domain spaces.

class bempp_cl.api.assembly.blocked_operator.MultitraceOperatorFromAssembler(domain_spaces, range_spaces, dual_to_range_spaces, assembler, multitrace_operator_descriptor)

Bases: BlockedOperatorBase

A multitrace operator from an assembler.

_domain_spaces
_range_spaces
_dual_to_range_spaces
_assembler
_descriptor
_assemble(*args, **kwargs)

Assemble the operator.

property range_spaces

Return a list of range spaces of the blocked operator.

property dual_to_range_spaces

Return a list of dual to range spaces of the blocked operator.

property domain_spaces

Return a list of domain spaces of the blocked operator.

class bempp_cl.api.assembly.blocked_operator.SumBlockedOperator(op1, op2)

Bases: BlockedOperatorBase

Represents the sum of two blocked boundary operators.

_op1
_op2
_assemble()
property range_spaces

Return the list of range spaces.

property dual_to_range_spaces

Return the list of dual_to_range spaces.

property domain_spaces

Return the list of domain spaces.

class bempp_cl.api.assembly.blocked_operator.ProductBlockedOperator(op1, op2)

Bases: BlockedOperatorBase

Represents the Product of two blocked boundary operators.

_op1
_op2
_assemble()
property range_spaces

Return the list of range spaces.

property dual_to_range_spaces

Return the list of dual_to_range spaces.

property domain_spaces

Return the list of domain spaces.

class bempp_cl.api.assembly.blocked_operator.ScaledBlockedOperator(op, alpha)

Bases: BlockedOperatorBase

Represents the scalar multiplication of a blocked operator.

_op
_alpha
_assemble()

Assemble operator.

property range_spaces

Return the list of range spaces.

property dual_to_range_spaces

Return the list of dual_to_range spaces.

property domain_spaces

Return the list of domain spaces.

class bempp_cl.api.assembly.blocked_operator.GeneralizedDiscreteBlockedOperator(operators)

Bases: bempp_cl.api.assembly.discrete_boundary_operator._DiscreteOperatorBase

A discrete generalized blocked operator.

_operators
to_dense()

Return dense matrix.

_matmat(other)

Implement the matrix/vector product.

class bempp_cl.api.assembly.blocked_operator.BlockedDiscreteOperator(ops)

Bases: bempp_cl.api.assembly.discrete_boundary_operator._DiscreteOperatorBase

Implementation of a discrete blocked boundary operator.

_ndims
_operators
_rows
_cols
__getitem__(key)

Return the object at position (i, j).

_fill_complete()
_matvec(x)
_matmat(x)
_get_row_dimensions()
_get_column_dimensions()
to_dense()

Return dense matrix.

abstractmethod _transpose()

Implement the transpose.

abstractmethod _adjoint()

Implement the adjoint.

row_dimensions
column_dimensions
bempp_cl.api.assembly.blocked_operator.coefficients_from_grid_functions_list(grid_funs)

Return a vector of coefficients of a list of grid functions.

Given a list [f0, f1, f2, …] this function returns a single Numpy vector containing [f1.coefficients, f2.coefficients, …].

Parameters

grid_funslist of GridFunction objects

A list containing the grid functions

bempp_cl.api.assembly.blocked_operator.projections_from_grid_functions_list(grid_funs, projection_spaces)

Return a vector of projections of a list of grid functions.

Given a list [f0, f1, f2, …] this function returns a single Numpy vector containing [f0.projections(projection_spaces[0]),

f1.projections(projection_spaces[1])], …].

Parameters

grid_funslist of GridFunction objects

A list containing the grid functions

projection_spaceslist of projection spaces

A list of projection spaces. Must have the same length as grid_funs.

bempp_cl.api.assembly.blocked_operator.grid_function_list_from_coefficients(coefficients, spaces)

Create a list of grid functions from a long vector of coefficients.

Parameters

coefficientsnp.ndarray

One-dimensional array of coefficients

spaceslist of Space objects

The sum of the global dofs of the spaces must be equal to the length of the coefficients vector.

bempp_cl.api.assembly.blocked_operator.grid_function_list_from_projections(projections, spaces, dual_spaces=None)

Create a list of grid functions from a long vector of projections.

Parameters

coefficientsnp.ndarray

One-dimensional array of coefficients

spaceslist of Space objects

The sum of the global dofs of the spaces must be equal to the length of the coefficients vector.

dual_spaceslist of Space objects

The associated dual spaces. If None use the spaces as dual spaces.