in short: it is a bit difficult right now. But I attached a version of
step-40, that does what you want. Obviously I had to change the
problem to a right hand side where I have the analytic solution. The
main part of the code is:
Vector<double> cellwise_errors (triangulation.n_active_cells());
VectorTools::integrate_difference (dof_handler,
locally_relevant_solution,
Coefficient<dim>(),
cellwise_errors,
quadr,
VectorTools::L2_norm);
unsigned int index = 0;
double my_value = 0;
typename DoFHandler<dim>::active_cell_iterator
cell = dof_handler.begin_active(),
endc = dof_handler.end();
for (; cell!=endc; ++cell, ++index)
if (cell->is_locally_owned())
my_value += cellwise_errors(index)*cellwise_errors(index);
double err= std::sqrt(Utilities::MPI::sum(my_value, MPI_COMM_WORLD));
integrate_difference already sets the output vector to zero and only
fills entries that correspond to locally owned cells, so one can
abbreviate this to simply do
double err
= std::sqrt(Utilities::MPI::sum(cellwise_errors * cellwise_errors,
MPI_COMM_WORLD));
But yes, let's see what can be done for the workshop!
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
www: http://www.math.tamu.edu/~bangerth/
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii