def vector_eval(self): F_array = assemble(f).get_local() F_array[[0, 1, min_dof_0_2pi, max_dof_0_2pi ]] = F_array[[min_dof_0_2pi, max_dof_0_2pi, 0, 1]] F = Vector(*F_array.shape) F[:] = F_array return F
def residual_eval(self, solution): self._solution_from_dense_to_sparse(solution) residual_array = assemble(r).get_local() residual_array[[0, 1, min_dof_0_2pi, max_dof_0_2pi]] = residual_array[[min_dof_0_2pi, max_dof_0_2pi, 0, 1]] residual = Vector(*residual_array.shape) residual[:] = residual_array return residual