* accuracy of the #double# data type is
* used.
*
- * See the general documentation of this
- * class for more information.
- */
- static void integrate_difference (const DoFHandler<dim> &dof,
- const Vector<double> &fe_function,
- const Function<dim> &exact_solution,
- Vector<float> &difference,
- const Quadrature<dim> &q,
- const NormType &norm);
-
- /**
- * 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
* solutions.
* By default, no weighting function is given,
* i.e. weight=1 in the whole domain.
+ *
+ * See the general documentation of this
+ * class for more information.
+ */
+ static void integrate_difference (const DoFHandler<dim> &dof,
+ const Vector<double> &fe_function,
+ const Function<dim> &exact_solution,
+ Vector<float> &difference,
+ const Quadrature<dim> &q,
+ const NormType &norm,
+ const Function<dim> *weight=0);
+
+ /**
+ * Compute the error for the solution of a system.
+ * See the other #integrate_difference#.
*/
static void integrate_difference (const DoFHandler<dim> &dof,
const Vector<double> &fe_function,
const Function<dim> &exact_solution,
Vector<float> &difference,
const Quadrature<dim> &q,
- const NormType &norm) {
+ const NormType &norm,
+ const Function<dim> *weight=0)
+{
const FiniteElement<dim> &fe = dof.get_fe();
difference.reinit (dof.get_tria().n_active_cells());
Assert (false, ExcNotImplemented());
};
+ // now weight the values
+ // at the quadrature points due
+ // to the weighting function
+ if (weight)
+ {
+ vector<double> w(n_q_points);
+ weight->value_list(fe_values.get_quadrature_points(),w);
+ for (unsigned int q=0; q<n_q_points; ++q)
+ psi[q]*=w[q];
+ }
+
// ok, now we have the integrand,
// let's compute the integral,
// which is
for (unsigned int i=0; i<n_q_points; ++i)
psi_square[i] = sqr_point(psi[i]);
+ // now weight the values
+ // at the quadrature points due
+ // to the weighting function
+ if (weight)
+ {
+ vector<double> w(n_q_points);
+ weight->value_list(fe_values.get_quadrature_points(),w);
+ for (unsigned int q=0; q<n_q_points; ++q)
+ psi_square[q]*=w[q];
+ }
+
// add seminorm to L_2 norm or
// to zero
diff += inner_product (psi_square.begin(), psi_square.end(),