From: Denis Davydov Date: Sat, 27 Feb 2016 20:12:59 +0000 (+0100) Subject: extend do_project() for complex numbers with ExcNotImplemented() for solver X-Git-Tag: v8.5.0-rc1~1277^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a7d55c934c889d9b9f0a0e4ee7f1383285400d8;p=dealii.git extend do_project() for complex numbers with ExcNotImplemented() for solver --- 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