- // 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];
+template <int dim, int spacedim>
+inline
+const boost::any &
+FEValuesBase<dim,spacedim>::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_derivative<this->shape_nth_derivatives.size(),
+ ExcIndexRange (nth_derivative, 0, this->shape_nth_derivatives.size()));
+ Assert (i<this->shape_nth_derivatives[nth_derivative].size(),
+ ExcIndexRange (i, 0, this->shape_nth_derivatives[nth_derivative].size()));
+ Assert (j<this->shape_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
- // 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];
- }
++ {
++ // 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 <int dim, int spacedim>
+inline
+boost::any
+FEValuesBase<dim,spacedim>::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()));
+
++ // 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 <int dim, int spacedim>
inline
const FiniteElement<dim,spacedim> &