bempp.api.assembly.blocked_operator

Definition of blocked operator structures.

Module Contents

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.

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

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

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

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

class bempp.api.assembly.blocked_operator.BlockedOperatorBase

Bases: object

Base class for blocked operators.

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.

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.

__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.api.assembly.blocked_operator.BlockedOperator(m, n)

Bases: BlockedOperatorBase

Construct an m x n blocked boundary 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.

__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.

class bempp.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

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.

_assemble()

Implement the weak form.

class bempp.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.

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.

_assemble(*args, **kwargs)

Assemble the operator.

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

Bases: BlockedOperatorBase

Represents the sum of two blocked boundary operators.

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.

_assemble()
class bempp.api.assembly.blocked_operator.ProductBlockedOperator(op1, op2)

Bases: BlockedOperatorBase

Represents the Product of two blocked boundary operators.

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.

_assemble()
class bempp.api.assembly.blocked_operator.ScaledBlockedOperator(op, alpha)

Bases: BlockedOperatorBase

Represents the scalar multiplication of a blocked 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.

_assemble()

Assemble operator.

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

Bases: bempp.api.assembly.discrete_boundary_operator._DiscreteOperatorBase

A discrete generalized blocked operator.

to_dense()

Return dense matrix.

_matmat(other)

Implement the matrix/vector product.

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

Bases: bempp.api.assembly.discrete_boundary_operator._DiscreteOperatorBase

Implementation of a discrete blocked boundary operator.

row_dimensions
column_dimensions
__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.

abstract _transpose()

Implement the transpose.

abstract _adjoint()

Implement the adjoint.

bempp.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.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.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.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.