def coefficients(self): """Return coefficient vector.""" if self._coefficients is None: from bempp.api.utils.helpers import get_inverse_mass_matrix op = get_inverse_mass_matrix(self.space, self.dual_space) self._coefficients = op @ self._projections self._representation = "primal" return self._coefficients
def strong_form(self): """Return a discrete operator that maps into the range space.""" from bempp.api.utils.helpers import get_inverse_mass_matrix if self._range_map is None: # This is the most frequent case and we cache the mass # matrix from the space object. self._range_map = get_inverse_mass_matrix(self.range, self.dual_to_range) return self._range_map * self.weak_form()
def juffer_scaled_mass(dirichl_space, ep_in, ep_ex, matrix): from bempp.api.utils.helpers import get_inverse_mass_matrix from bempp.api.assembly.blocked_operator import BlockedDiscreteOperator nrows = len(matrix.range_spaces) range_ops = np.empty((nrows, nrows), dtype="O") for index in range(nrows): range_ops[index, index] = get_inverse_mass_matrix( matrix.range_spaces[index], matrix.dual_to_range_spaces[index]) range_ops[0, 0] = range_ops[0, 0] * (1.0 / (0.5 * (1.0 + (ep_ex / ep_in)))) range_ops[1, 1] = range_ops[1, 1] * (1.0 / (0.5 * (1.0 + (ep_in / ep_ex)))) preconditioner = BlockedDiscreteOperator(range_ops) return preconditioner
def strong_form(self): """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. """ from bempp.api.utils.helpers import get_inverse_mass_matrix if self._range_map is None: nrows = len(self.range_spaces) _range_ops = _np.empty((nrows, nrows), dtype="O") for index in range(nrows): _range_ops[index, index] = get_inverse_mass_matrix( self.range_spaces[index], self.dual_to_range_spaces[index]) self._range_map = BlockedDiscreteOperator(_range_ops) return self._range_map * self.weak_form()