:py:mod:`bempp.api.assembly.blocked_operator` ============================================= .. py:module:: bempp.api.assembly.blocked_operator .. autoapi-nested-parse:: Definition of blocked operator structures. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: bempp.api.assembly.blocked_operator.BlockedOperatorBase bempp.api.assembly.blocked_operator.BlockedOperator bempp.api.assembly.blocked_operator.GeneralizedBlockedOperator bempp.api.assembly.blocked_operator.MultitraceOperatorFromAssembler bempp.api.assembly.blocked_operator.SumBlockedOperator bempp.api.assembly.blocked_operator.ProductBlockedOperator bempp.api.assembly.blocked_operator.ScaledBlockedOperator bempp.api.assembly.blocked_operator.GeneralizedDiscreteBlockedOperator bempp.api.assembly.blocked_operator.BlockedDiscreteOperator Functions ~~~~~~~~~ .. autoapisummary:: bempp.api.assembly.blocked_operator._sum bempp.api.assembly.blocked_operator._prod bempp.api.assembly.blocked_operator.coefficients_from_grid_functions_list bempp.api.assembly.blocked_operator.projections_from_grid_functions_list bempp.api.assembly.blocked_operator.grid_function_list_from_coefficients bempp.api.assembly.blocked_operator.grid_function_list_from_projections .. py:function:: _sum(op1, op2) Sum of two operators, allowing for one of them to be None. .. py:function:: _prod(op1, op2) Product of two operators, allowing for one of them to be None. .. py:class:: BlockedOperatorBase Bases: :py:obj:`object` Base class for blocked operators. .. py:property:: ndims Return number of block rows and block columns. .. py:property:: range_spaces :abstractmethod: Return a list of range spaces of the blocked operator. .. py:property:: dual_to_range_spaces :abstractmethod: Return a list of dual to range spaces of the blocked operator. .. py:property:: domain_spaces :abstractmethod: Return a list of domain spaces of the blocked operator. .. py:method:: weak_form() Return cached weak form (assemble if necessary). .. py:method:: strong_form() Return a discrete operator that maps into the range space. Parameters ---------- recompute : bool Usually the strong form is cached. If this parameter is set to `true` the strong form is recomputed. .. py:method:: __add__(other) Add two blocked operators. .. py:method:: __neg__() Multiply the blocked operator with -1. .. py:method:: __sub__(other) Subtract another blocked operator from this blocked operator. .. py:method:: __mul__(other) Multiply two blocked operators. .. py:method:: __matmul__(other) Multiply two operators. .. py:method:: __rmul__(other) Multiply two operators. .. py:class:: BlockedOperator(m, n) Bases: :py:obj:`BlockedOperatorBase` Construct an m x n blocked boundary operator. .. py:property:: range_spaces Return the list of range spaces. .. py:property:: dual_to_range_spaces Return the list of dual_to_range spaces. .. py:property:: domain_spaces Return the list of domain spaces. .. py:method:: __getitem__(key) Return a component operator with a key of the form (i, j). .. py:method:: __setitem__(key, operator) Set a component operator with a key of the form (i, j). .. py:method:: _fill_complete() Check if each row and column contain at least one operator. .. py:method:: _assemble() Implement the weak form. .. py:class:: GeneralizedBlockedOperator(array) Bases: :py:obj:`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 .. py:property:: range_spaces Return the list of range spaces. .. py:property:: dual_to_range_spaces Return the list of dual_to_range spaces. .. py:property:: domain_spaces Return the list of domain spaces. .. py:method:: _assemble() Implement the weak form. .. py:class:: MultitraceOperatorFromAssembler(domain_spaces, range_spaces, dual_to_range_spaces, assembler, multitrace_operator_descriptor) Bases: :py:obj:`BlockedOperatorBase` A multitrace operator from an assembler. .. py:property:: range_spaces Return a list of range spaces of the blocked operator. .. py:property:: dual_to_range_spaces Return a list of dual to range spaces of the blocked operator. .. py:property:: domain_spaces Return a list of domain spaces of the blocked operator. .. py:method:: _assemble(*args, **kwargs) Assemble the operator. .. py:class:: SumBlockedOperator(op1, op2) Bases: :py:obj:`BlockedOperatorBase` Represents the sum of two blocked boundary operators. .. py:property:: range_spaces Return the list of range spaces. .. py:property:: dual_to_range_spaces Return the list of dual_to_range spaces. .. py:property:: domain_spaces Return the list of domain spaces. .. py:method:: _assemble() .. py:class:: ProductBlockedOperator(op1, op2) Bases: :py:obj:`BlockedOperatorBase` Represents the Product of two blocked boundary operators. .. py:property:: range_spaces Return the list of range spaces. .. py:property:: dual_to_range_spaces Return the list of dual_to_range spaces. .. py:property:: domain_spaces Return the list of domain spaces. .. py:method:: _assemble() .. py:class:: ScaledBlockedOperator(op, alpha) Bases: :py:obj:`BlockedOperatorBase` Represents the scalar multiplication of a blocked operator. .. py:property:: range_spaces Return the list of range spaces. .. py:property:: dual_to_range_spaces Return the list of dual_to_range spaces. .. py:property:: domain_spaces Return the list of domain spaces. .. py:method:: _assemble() Assemble operator. .. py:class:: GeneralizedDiscreteBlockedOperator(operators) Bases: :py:obj:`bempp.api.assembly.discrete_boundary_operator._DiscreteOperatorBase` A discrete generalized blocked operator. .. py:method:: to_dense() Return dense matrix. .. py:method:: _matmat(other) Implement the matrix/vector product. .. py:class:: BlockedDiscreteOperator(ops) Bases: :py:obj:`bempp.api.assembly.discrete_boundary_operator._DiscreteOperatorBase` Implementation of a discrete blocked boundary operator. .. py:attribute:: row_dimensions .. py:attribute:: column_dimensions .. py:method:: __getitem__(key) Return the object at position (i, j). .. py:method:: _fill_complete() .. py:method:: _matvec(x) .. py:method:: _matmat(x) .. py:method:: _get_row_dimensions() .. py:method:: _get_column_dimensions() .. py:method:: to_dense() Return dense matrix. .. py:method:: _transpose() :abstractmethod: Implement the transpose. .. py:method:: _adjoint() :abstractmethod: Implement the adjoint. .. py:function:: 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_funs : list of GridFunction objects A list containing the grid functions .. py:function:: 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_funs : list of GridFunction objects A list containing the grid functions projection_spaces : list of projection spaces A list of projection spaces. Must have the same length as grid_funs. .. py:function:: grid_function_list_from_coefficients(coefficients, spaces) Create a list of grid functions from a long vector of coefficients. Parameters ---------- coefficients : np.ndarray One-dimensional array of coefficients spaces : list of Space objects The sum of the global dofs of the spaces must be equal to the length of the coefficients vector. .. py:function:: grid_function_list_from_projections(projections, spaces, dual_spaces=None) Create a list of grid functions from a long vector of projections. Parameters ---------- coefficients : np.ndarray One-dimensional array of coefficients spaces : list of Space objects The sum of the global dofs of the spaces must be equal to the length of the coefficients vector. dual_spaces : list of Space objects The associated dual spaces. If None use the spaces as dual spaces.