From: Wolfgang Bangerth Date: Fri, 10 Feb 2006 18:13:09 +0000 (+0000) Subject: Make program work with correct exact solution. X-Git-Tag: v8.0.0~12376 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d576b2cb59143cd3f5e2f59028612cb01b6ffff;p=dealii.git Make program work with correct exact solution. git-svn-id: https://svn.dealii.org/trunk@12304 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-20/step-20.cc b/deal.II/examples/step-20/step-20.cc index 9186a912cb..d7795426a8 100644 --- a/deal.II/examples/step-20/step-20.cc +++ b/deal.II/examples/step-20/step-20.cc @@ -182,8 +182,8 @@ class ExactSolution : public Function public: ExactSolution () : Function(dim+1) {}; - virtual double value (const Point &p, - const unsigned int component = 0) const; + virtual void vector_value (const Point &p, + Vector &value) const; }; @@ -223,17 +223,31 @@ double RightHandSide::value (const Point &p, template -double ExactSolution::value (const Point &p, - const unsigned int /*component*/) const +void +ExactSolution::vector_value (const Point &p, + Vector &values) const { - double return_value = 1; - for (unsigned int i=0; i void LaplaceProblem::make_grid_and_dofs () { GridGenerator::hyper_cube (triangulation, 0, 1); - triangulation.refine_global (5); + triangulation.refine_global (2); std::cout << " Number of active cells: " << triangulation.n_active_cells() @@ -668,22 +682,22 @@ void LaplaceProblem::compute_errors () const tmp.l2_norm() * tmp.l2_norm()); } - double u_h1_error = 0; - for (unsigned int d=0; d mask(d, 1., dim+1); - VectorTools::integrate_difference (dof_handler, solution, exact_solution, - tmp, QGauss(degree+1), - VectorTools::H1_seminorm, - &mask); - u_h1_error = std::sqrt (u_h1_error*u_h1_error + - tmp.l2_norm() * tmp.l2_norm()); - } +// double u_h1_error = 0; +// for (unsigned int d=0; d mask(d, 1., dim+1); +// VectorTools::integrate_difference (dof_handler, solution, exact_solution, +// tmp, QGauss(degree+1), +// VectorTools::H1_seminorm, +// &mask); +// u_h1_error = std::sqrt (u_h1_error*u_h1_error + +// tmp.l2_norm() * tmp.l2_norm()); +// } std::cout << "Errors: ||e_p||_L2 = " << p_l2_error << ", ||e_u||_L2 = " << u_l2_error - << ", |e_u|_H1 = " << u_h1_error +// << ", |e_u|_H1 = " << u_h1_error << std::endl; }