From: bangerth Date: Tue, 25 Sep 2012 12:52:56 +0000 (+0000) Subject: Merge from mainline. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d715ce1208a3aaa87bb319efa6340e0e6c7ca8a8;p=dealii-svn.git Merge from mainline. git-svn-id: https://svn.dealii.org/branches/branch_higher_derivatives@26720 0785d39b-7218-0410-832d-ea1e28bc413d --- d715ce1208a3aaa87bb319efa6340e0e6c7ca8a8 diff --cc deal.II/include/deal.II/fe/fe.h index de47dcf476,62bf4a2db6..1ab2d2e649 --- a/deal.II/include/deal.II/fe/fe.h +++ b/deal.II/include/deal.II/fe/fe.h @@@ -15,9 -15,10 +15,12 @@@ #include #include #include + #include + #include + #include +#include + DEAL_II_NAMESPACE_OPEN diff --cc deal.II/include/deal.II/fe/fe_values.h index 69e9bde9d6,1f43711b02..e0c51ce64a --- a/deal.II/include/deal.II/fe/fe_values.h +++ b/deal.II/include/deal.II/fe/fe_values.h @@@ -5023,112 -4719,6 +4811,81 @@@ FEValuesBase::shape_2nd_d +template +inline +const boost::any & +FEValuesBase::shape_nth_derivative (const unsigned int i, + const unsigned int j, + const unsigned int nth_derivative) const +{ + Assert (i < fe->dofs_per_cell, + ExcIndexRange (i, 0, fe->dofs_per_cell)); + Assert (this->update_flags & update_nth_derivatives(nth_derivative), + ExcAccessToUninitializedField()); + Assert (fe->is_primitive (i), + ExcShapeFunctionNotPrimitive(i)); + Assert (nth_derivativeshape_nth_derivatives.size(), + ExcIndexRange (nth_derivative, 0, this->shape_nth_derivatives.size())); + Assert (ishape_nth_derivatives[nth_derivative].size(), + ExcIndexRange (i, 0, this->shape_nth_derivatives[nth_derivative].size())); + Assert (jshape_nth_derivatives[nth_derivative][0].size(), + ExcIndexRange (j, 0, this->shape_nth_derivatives[nth_derivative][0].size())); + + // if the entire FE is primitive, + // then we can take a short-cut: + if (fe->is_primitive()) + return this->shape_nth_derivatives[nth_derivative][i][j]; + else - // otherwise, use the mapping - // between shape function numbers - // and rows. note that by the - // assertions above, we know that - // this particular shape function - // is primitive, so there is no - // question to which vector - // component the call of this - // function refers - return this->shape_nth_derivatives[nth_derivative][this->shape_function_to_row_table[i]][j]; ++ { ++ // otherwise, use the mapping ++ // between shape function ++ // numbers and rows. note that ++ // by the assertions above, we ++ // know that this particular ++ // shape function is primitive, ++ // so we can call ++ // system_to_component_index ++ const unsigned int ++ row = this->shape_function_to_row_table[i * fe->n_components() + fe->system_to_component_index(i).first]; ++ return this->shape_nth_derivatives[nth_derivative][row][j]; ++ } +} + + + + +template +inline +boost::any +FEValuesBase::shape_nth_derivative_component (const unsigned int i, + const unsigned int j, + const unsigned int component, + const unsigned int nth_derivative) const +{ + Assert (i < fe->dofs_per_cell, + ExcIndexRange (i, 0, fe->dofs_per_cell)); + Assert (this->update_flags & update_nth_derivatives(nth_derivative), + ExcAccessToUninitializedField()); + Assert (component < fe->n_components(), + ExcIndexRange(component, 0, fe->n_components())); + - // if this particular shape - // function is primitive, then we - // can take a short-cut by checking - // whether the requested component - // is the only non-zero one (note - // that calling - // system_to_component_table only - // works if the shape function is - // primitive): - if (fe->is_primitive(i)) - { - if (component == fe->system_to_component_index(i).first) - return this->shape_nth_derivatives[nth_derivative][this->shape_function_to_row_table[i]][j]; - else - return boost::any (); - } - else - { - // no, this shape function is - // not primitive. then we have - // to loop over its components - // to find the corresponding - // row in the arrays of this - // object. before that check - // whether the shape function - // is non-zero at all within - // this component: - if (fe->get_nonzero_components(i)[component] == false) - return boost::any (); - - // count how many non-zero - // component the shape function - // has before the one we are - // looking for, and add this to - // the offset of the first - // non-zero component of this - // shape function in the arrays - // we index presently: - const unsigned int - row = (this->shape_function_to_row_table[i] - + - std::count (fe->get_nonzero_components(i).begin(), - fe->get_nonzero_components(i).begin()+component, - true)); - return this->shape_nth_derivatives[nth_derivative][row][j]; - } ++ // check whether the shape function ++ // is non-zero at all within ++ // this component: ++ if (fe->get_nonzero_components(i)[component] == false) ++ return boost::any(); ++ ++ // look up the right row in the ++ // table and take the data from ++ // there ++ const unsigned int ++ row = this->shape_function_to_row_table[i * fe->n_components() + component]; ++ return this->shape_nth_derivatives[nth_derivative][row][j]; +} + + + + template inline const FiniteElement & diff --cc deal.II/source/fe/fe_poly_tensor.cc index 0d428a0b77,9e717442a3..79b1bfae89 --- a/deal.II/source/fe/fe_poly_tensor.cc +++ b/deal.II/source/fe/fe_poly_tensor.cc @@@ -545,7 -395,9 +545,8 @@@ FE_PolyTensor::fill_ for (unsigned int i=0; idofs_per_cell; ++i) { - const unsigned int first = data.shape_function_to_row_table[i]; + const unsigned int first = data.shape_function_to_row_table[i * this->n_components() + + this->get_nonzero_components(i).first_selected_component()]; - if (flags & update_values && cell_similarity != CellSimilarity::translation) switch (mapping_type) {