From: wolf Date: Wed, 18 Sep 2002 15:02:02 +0000 (+0000) Subject: Make compute_2nd aware of non-primitive elements. Small other fixes. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc8a0584ddd78b65eea8d63a74ceed9d643db338;p=dealii-svn.git Make compute_2nd aware of non-primitive elements. Small other fixes. git-svn-id: https://svn.dealii.org/trunk@6454 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 c296ef9317..cc08011d62 100644 --- a/deal.II/deal.II/source/fe/fe.cc +++ b/deal.II/deal.II/source/fe/fe.cc @@ -24,6 +24,7 @@ #include #include +#include // if necessary try to work around a bug in the IBM xlC compiler @@ -409,7 +410,13 @@ compute_2nd (const Mapping &mapping, Assert ((fe_internal.update_each | fe_internal.update_once) & update_second_derivatives, ExcInternalError()); - Assert (data.shape_2nd_derivatives.n_rows() == this->dofs_per_cell, + + const unsigned int total_nonzero_components + = std::accumulate (n_nonzero_components_table.begin(), + n_nonzero_components_table.end(), + 0U); + + Assert (data.shape_2nd_derivatives.n_rows() == total_nonzero_components, ExcInternalError()); // Number of quadrature points const unsigned int n_q_points = data.shape_2nd_derivatives.n_cols(); @@ -430,51 +437,84 @@ compute_2nd (const Mapping &mapping, Table<2,Tensor<1,dim> > diff_quot (dim, n_q_points); std::vector > diff_quot2 (n_q_points); - // for all shape functions at all + // for all nonzero components of + // all shape functions at all // quadrature points and difference // quotients in all directions: - for (unsigned int shape=0; shapedofs_per_cell; ++shape) - { - for (unsigned int d1=0; d1& right - = fe_internal.differences[d1]->shape_grad(shape, q); - const Tensor<1,dim>& left - = fe_internal.differences[d1+dim]->shape_grad(shape, q); - - // compute the second - // derivative from a - // symmetric difference - // approximation - for (unsigned int d=0; ddofs_per_cell; ++shape_index) + for (unsigned int n=0; n 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); + } + else + { + // get the + // component index + // of the n-th + // nonzero + // compoment + unsigned int component=0; + for (unsigned int k=0; k<=n; ++k) + while (nonzero_components[shape_index][component] == false) + ++component; + Assert (component < n_components(), ExcInternalError()); + + right = fe_internal.differences[d1] + ->shape_grad_component(shape_index, q, component); + left = fe_internal.differences[d1+dim] + ->shape_grad_component(shape_index, q, component); + }; + + // compute the second + // derivative from a + // symmetric difference + // approximation + for (unsigned int d=0; d