From 4e766872f0d0253544d227312b7489d9a1ddf8d3 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Sun, 28 Feb 2016 02:45:09 +0100 Subject: [PATCH] minor fixes of auxiliary function in vector tools --- .../deal.II/numerics/vector_tools.templates.h | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 5f62a6841c..01316f4d64 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -754,26 +754,26 @@ namespace VectorTools template void invert_mass_matrix(const SparseMatrix &mass_matrix, - const Vector &tmp, - Vector &vec) + const Vector &rhs, + Vector &solution) { // 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); + ReductionControl control(5*rhs.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); + cg.solve (mass_matrix, solution, rhs, prec); } template - void invert_mass_matrix(const SparseMatrix > &mass_matrix, - const Vector > &tmp, - Vector > &vec) + void invert_mass_matrix(const SparseMatrix > &/*mass_matrix*/, + const Vector > &/*rhs*/, + Vector > &/*solution*/) { Assert(false, ExcNotImplemented()); } @@ -2180,7 +2180,7 @@ namespace VectorTools namespace { - // keep first argument is non-reference since we use it + // keep the first argument non-reference since we use it // with 1e-8 * number template bool real_part_bigger_than(const number1 a, @@ -2193,25 +2193,23 @@ namespace VectorTools bool real_part_bigger_than(const std::complex a, const std::complex &b) { - Assert(std::abs(a.imag()) < 1e-15 , ExcInternalError()); - Assert(std::abs(b.imag()) < 1e-15 , ExcInternalError()); + Assert(std::abs(a.imag()) <= 1e-15*std::abs(a) , ExcInternalError()); + Assert(std::abs(b.imag()) <= 1e-15*std::abs(b) , ExcInternalError()); return a.real() > b.real(); } + // this function is needed to get an idea where + // rhs.norm_sqr() is too small for a given type. template - double min_number() - { - return std::numeric_limits::min(); - } - - template - double min_number(const number &dummy) + number min_number(const number &/*dummy*/) { return std::numeric_limits::min(); } + // Sine rhs.norm_sqr() is non-negative real, in complex case we + // take the numeric limits of the underlying type used in std::complex<>. template - double min_number(const std::complex &dummy) + number min_number(const std::complex &/*dummy*/) { return std::numeric_limits::min(); } @@ -2220,7 +2218,7 @@ namespace VectorTools template void invert_mass_matrix(const SparseMatrix &mass_matrix, const FilteredMatrix > &filtered_mass_matrix, - FilteredMatrix > &filtered_precondition, + FilteredMatrix > &filtered_preconditioner, const Vector &rhs, Vector &boundary_projection) { @@ -2233,19 +2231,19 @@ namespace VectorTools PreconditionSSOR > prec; prec.initialize(mass_matrix, 1.2); - filtered_precondition.initialize(prec, true); + filtered_preconditioner.initialize(prec, true); // solve - cg.solve (filtered_mass_matrix, boundary_projection, rhs, filtered_precondition); - filtered_precondition.apply_constraints(boundary_projection, true); - filtered_precondition.clear(); + cg.solve (filtered_mass_matrix, boundary_projection, rhs, filtered_preconditioner); + filtered_preconditioner.apply_constraints(boundary_projection, true); + filtered_preconditioner.clear(); } template - void invert_mass_matrix(const SparseMatrix > &mass_matrix, - const FilteredMatrix > > &filtered_mass_matrix, - FilteredMatrix > > &filtered_precondition, - const Vector > &rhs, - Vector > &boundary_projection) + void invert_mass_matrix(const SparseMatrix > &/*mass_matrix*/, + const FilteredMatrix > > &/*filtered_mass_matrix*/, + FilteredMatrix > > &/*filtered_preconditioner*/, + const Vector > &/*rhs*/, + Vector > &/*boundary_projection*/) { Assert(false, ExcNotImplemented()); } -- 2.39.5