From d7e664f0c83842ead86b7efe04d0a07bd3f93f05 Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 15 Jan 2010 18:38:08 +0000 Subject: [PATCH] Add a few missing include files. git-svn-id: https://svn.dealii.org/trunk@20373 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/numerics/newton.templates.h | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/deal.II/deal.II/include/numerics/newton.templates.h b/deal.II/deal.II/include/numerics/newton.templates.h index bd433f1419..410b0d0281 100644 --- a/deal.II/deal.II/include/numerics/newton.templates.h +++ b/deal.II/deal.II/include/numerics/newton.templates.h @@ -11,6 +11,11 @@ //--------------------------------------------------------------------------- #include + +#include +#include +#include + #include @@ -40,7 +45,7 @@ namespace Algorithms param.declare_entry("Stepsize iterations", "21", Patterns::Integer()); param.declare_entry("Debug level", "0", Patterns::Integer()); param.declare_entry("Debug vectors", "false", Patterns::Bool()); - param.leave_subsection(); + param.leave_subsection(); } template @@ -54,7 +59,7 @@ namespace Algorithms debug_vectors = param.get_bool("Debug vectors"); param.leave_subsection (); } - + template void @@ -63,8 +68,8 @@ namespace Algorithms residual->notify(e); inverse_derivative->notify(e); } - - + + template void Newton::operator() (NamedData& out, const NamedData& in) @@ -73,14 +78,14 @@ namespace Algorithms deallog.push ("Newton"); VECTOR& u = *out(0); - + if (debug>2) deallog << "u: " << u.l2_norm() << std::endl; GrowingVectorMemory mem; typename VectorMemory::Pointer Du(mem); typename VectorMemory::Pointer res(mem); - + res->reinit(u); NamedData src1; NamedData src2; @@ -95,21 +100,21 @@ namespace Algorithms p = Du; NamedData out2; out2.add(p, "Update"); - + unsigned int step = 0; // fill res with (f(u), v) (*residual)(out1, src1); double resnorm = res->l2_norm(); double old_residual = resnorm / assemble_threshold + 1; - + while (control.check(step++, resnorm) == SolverControl::iterate) { // assemble (Df(u), v) if (resnorm/old_residual >= assemble_threshold) inverse_derivative->notify (Events::bad_derivative); - + Du->reinit(u); - try + try { (*inverse_derivative)(out2, src2); } @@ -119,12 +124,12 @@ namespace Algorithms << e.last_step << " steps with residual " << e.last_residual << std::endl; } - + u.add(-1., *Du); old_residual = resnorm; (*residual)(out1, src1); resnorm = res->l2_norm(); - + // Step size control unsigned int step_size = 0; while (resnorm >= old_residual) @@ -142,7 +147,7 @@ namespace Algorithms (*residual)(out1, src1); resnorm = res->l2_norm(); } - + if (debug_vectors) { std::ostringstream streamOut; @@ -151,11 +156,11 @@ namespace Algorithms NamedData out; out.add(&u, "solution"); out.add(Du, "update"); - out.add(res, "residual"); + out.add(res, "residual"); //TODO: Implement! // app->data_out(name, out); } - } + } deallog.pop(); // in case of failure: throw -- 2.39.5