From 6fc9cbc24f719bf58a7b9163f56e5680a712f9db Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Fri, 15 Jan 2016 09:23:34 +0100 Subject: [PATCH] make sure vectors passed to EPSSetInitialSpace() are nonzero --- include/deal.II/lac/slepc_solver.h | 2 ++ source/lac/slepc_solver.cc | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/deal.II/lac/slepc_solver.h b/include/deal.II/lac/slepc_solver.h index ecb5cbf329..47c46eaa8e 100644 --- a/include/deal.II/lac/slepc_solver.h +++ b/include/deal.II/lac/slepc_solver.h @@ -791,6 +791,8 @@ namespace SLEPcWrappers for (unsigned int i = 0; i < this_initial_space.size(); i++) { + Assert(this_initial_space[i].l2_norm()>0.0, + ExcMessage("Initial vectors should be nonzero.")); vecs[i] = this_initial_space[i]; } diff --git a/source/lac/slepc_solver.cc b/source/lac/slepc_solver.cc index 1a1d9ab707..d6495ac469 100644 --- a/source/lac/slepc_solver.cc +++ b/source/lac/slepc_solver.cc @@ -100,6 +100,9 @@ namespace SLEPcWrappers void SolverBase::set_initial_vector (const PETScWrappers::VectorBase &this_initial_vector) { + Assert(this_initial_vector.l2_norm()>0.0, + ExcMessage("Initial vector should be nonzero.")); + int ierr; Vec vec = this_initial_vector; #if DEAL_II_PETSC_VERSION_LT(3,1,0) -- 2.39.5