From: Guido Kanschat Date: Fri, 28 Apr 2006 18:56:16 +0000 (+0000) Subject: fixed problem with 2nd derivatives on faces X-Git-Tag: v8.0.0~11840 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3efeeebf657bc05ca7916e7902ccc00a60e2734;p=dealii.git fixed problem with 2nd derivatives on faces git-svn-id: https://svn.dealii.org/trunk@12935 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/fe/fe.cc b/deal.II/deal.II/source/fe/fe.cc index 29f656b918..59081535ef 100644 --- a/deal.II/deal.II/source/fe/fe.cc +++ b/deal.II/deal.II/source/fe/fe.cc @@ -684,15 +684,14 @@ FiniteElement::memory_consumption () const template void -FiniteElement:: -compute_2nd (const Mapping &mapping, - const typename Triangulation::cell_iterator &cell, - const unsigned int, - typename Mapping::InternalDataBase &mapping_internal, - InternalDataBase &fe_internal, - FEValuesData &data) const -{ -//TODO[GK]: This function presently has a flaw: it ignores the offset parameter. This means that if it is called for faces or subfaces, it computes the data for _all_ faces or subfaces, even though we only need to have this for one of them. given that computing second derivatives is expensive, this is significant. What should be done is to honor the offset parameter and of course only compute what we actually need +FiniteElement::compute_2nd ( + const Mapping &mapping, + const typename Triangulation::cell_iterator &cell, + const unsigned int offset, + typename Mapping::InternalDataBase &mapping_internal, + InternalDataBase &fe_internal, + FEValuesData &data) const +{ Assert ((fe_internal.update_each | fe_internal.update_once) & update_second_derivatives, ExcInternalError()); @@ -713,6 +712,9 @@ compute_2nd (const Mapping &mapping, { fe_internal.differences[d]->reinit(cell); fe_internal.differences[d+dim]->reinit(cell); + Assert(offset <= fe_internal.differences[d]->n_quadrature_points - n_q_points, + ExcIndexRange(offset, 0, fe_internal.differences[d]->n_quadrature_points + - n_q_points)); } // collection of difference @@ -752,8 +754,8 @@ compute_2nd (const Mapping &mapping, Tensor<1,dim> right, left; if (is_primitive(shape_index)) { - right = fe_internal.differences[d1]->shape_grad(shape_index, q); - left = fe_internal.differences[d1+dim]->shape_grad(shape_index, q); + right = fe_internal.differences[d1]->shape_grad(shape_index, q+offset); + left = fe_internal.differences[d1+dim]->shape_grad(shape_index, q+offset); } else { @@ -789,9 +791,9 @@ compute_2nd (const Mapping &mapping, ExcInternalError()); right = fe_internal.differences[d1] - ->shape_grad_component(shape_index, q, component); + ->shape_grad_component(shape_index, q+offset, component); left = fe_internal.differences[d1+dim] - ->shape_grad_component(shape_index, q, component); + ->shape_grad_component(shape_index, q+offset, component); }; // compute the second diff --git a/deal.II/doc/news/changes.html b/deal.II/doc/news/changes.html index 6fc545e3ac..9c4dc4d662 100644 --- a/deal.II/doc/news/changes.html +++ b/deal.II/doc/news/changes.html @@ -635,6 +635,13 @@ inconvenience this causes.

deal.II

    + +
  1. Fixed: second derivatives where not computed correctly in FEFaceValuesBase. +
    + (GK 2006/04/28) +

    +
  2. New: The functions Triangulation::clear_user_flags_line, Triangulation::clear_user_flags_quad, and