From: hartmann Date: Fri, 2 Jul 1999 15:09:54 +0000 (+0000) Subject: additional weight function argument in #integrate_difference# for systems X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f78a10bf76e20b4773e764bc432821367d2258ba;p=dealii-svn.git additional weight function argument in #integrate_difference# for systems git-svn-id: https://svn.dealii.org/trunk@1531 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/vectors.h b/deal.II/deal.II/include/numerics/vectors.h index ed21e2dafe..95fda10a0e 100644 --- a/deal.II/deal.II/include/numerics/vectors.h +++ b/deal.II/deal.II/include/numerics/vectors.h @@ -447,13 +447,27 @@ class VectorTools // /** * Compute the error for the solution of a system. * See the other #integrate_difference#. + * + * The additional argument #weight# allows + * to evaluate weighted norms. This is useful + * for weighting the error of different parts + * differently. A special use is + * to have #weight=0# in some parts of the + * domain, e.g. at + * the location of a shock and #weight=1# + * elsewhere. This allows convergence tests + * in smooth parts of in general discontinuous + * solutions. + * By default, no weighting function is given, + * i.e. weight=1 in the whole domain. */ static void integrate_difference (const DoFHandler &dof, const Vector &fe_function, const VectorFunction&exact_solution, Vector &difference, const Quadrature &q, - const NormType &norm); + const NormType &norm, + const Function *weight=0); /** diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index 9ed65f0b1b..1c20446e0f 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -878,7 +878,8 @@ VectorTools::integrate_difference (const DoFHandler &dof, const VectorFunction&exact_solution, Vector &difference, const Quadrature &q, - const NormType &norm) + const NormType &norm, + const Function *weight) { Assert(norm != mean , ExcNotUseful()); @@ -958,10 +959,21 @@ VectorTools::integrate_difference (const DoFHandler &dof, Assert (false, ExcNotImplemented()); }; + // now weight the values + // at the quadrature points due + // to the weighting function + if (weight) + { + vector w(n_q_points); + weight->value_list(fe_values.get_quadrature_points(),w); + for (unsigned int q=0; q::integrate_difference (const DoFHandler &dof, for (unsigned int k=0; k w(n_q_points); + weight->value_list(fe_values.get_quadrature_points(),w); + for (unsigned int q=0; q