def action_ProjectedEmpiciralInterpolatedOperator(self, op, dim_range=None, dim_source=None): if not isinstance(op.projected_collateral_basis.space, NumpyVectorSpace): raise NotImplementedError restricted_operator = op.restricted_operator old_pcb = op.projected_collateral_basis projected_collateral_basis = NumpyVectorSpace.make_array( old_pcb.data[:, :dim_range], old_pcb.space.id) old_sbd = op.source_basis_dofs source_basis_dofs = NumpyVectorSpace.make_array( old_sbd.data[:dim_source]) return ProjectedEmpiciralInterpolatedOperator( restricted_operator, op.interpolation_matrix, source_basis_dofs, projected_collateral_basis, op.triangular, op.source.id, solver_options=op.solver_options, name=op.name)
def action_EmpiricalInterpolatedOperator(self, op, range_basis, source_basis, product=None): if len(op.interpolation_dofs) == 0: return self.apply(ZeroOperator(op.source, op.range, op.name), range_basis, source_basis, product) elif not hasattr(op, 'restricted_operator') or source_basis is None: raise RuleNotMatchingError( 'Has no restricted operator or source_basis is None') else: if range_basis is not None: if product is None: projected_collateral_basis = NumpyVectorSpace.make_array( op.collateral_basis.dot(range_basis), op.range.id) else: projected_collateral_basis = NumpyVectorSpace.make_array( product.apply2(op.collateral_basis, range_basis), op.range.id) else: projected_collateral_basis = op.collateral_basis return ProjectedEmpiciralInterpolatedOperator( op.restricted_operator, op.interpolation_matrix, NumpyVectorSpace.make_array( source_basis.components(op.source_dofs)), projected_collateral_basis, op.triangular, op.source.id, None, op.name)