From 8a7d55c934c889d9b9f0a0e4ee7f1383285400d8 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Sat, 27 Feb 2016 21:12:59 +0100 Subject: [PATCH] extend do_project() for complex numbers with ExcNotImplemented() for solver --- .../deal.II/numerics/vector_tools.templates.h | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index af58c55d22..5f62a6841c 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -752,6 +752,32 @@ namespace VectorTools return true; } + template + void invert_mass_matrix(const SparseMatrix &mass_matrix, + const Vector &tmp, + Vector &vec) + { + // Allow for a maximum of 5*n steps to reduce the residual by 10^-12. n + // steps may not be sufficient, since roundoff errors may accumulate for + // badly conditioned matrices + ReductionControl control(5*tmp.size(), 0., 1e-12, false, false); + GrowingVectorMemory > memory; + SolverCG > cg(control,memory); + + PreconditionSSOR > prec; + prec.initialize(mass_matrix, 1.2); + + cg.solve (mass_matrix, vec, tmp, prec); + } + + template + void invert_mass_matrix(const SparseMatrix > &mass_matrix, + const Vector > &tmp, + Vector > &vec) + { + Assert(false, ExcNotImplemented()); + } + /** * Generic implementation of the project() function @@ -825,18 +851,7 @@ namespace VectorTools constraints.condense(mass_matrix, tmp); } - // Allow for a maximum of 5*n steps to reduce the residual by 10^-12. n - // steps may not be sufficient, since roundoff errors may accumulate for - // badly conditioned matrices - ReductionControl control(5*tmp.size(), 0., 1e-12, false, false); - GrowingVectorMemory > memory; - SolverCG > cg(control,memory); - - PreconditionSSOR > prec; - prec.initialize(mass_matrix, 1.2); - - cg.solve (mass_matrix, vec, tmp, prec); - + invert_mass_matrix(mass_matrix,tmp,vec); constraints.distribute (vec); // copy vec into vec_result. we can't use vec_result itself above, since -- 2.39.5