From: Jean-Paul Pelteret Date: Thu, 10 Aug 2017 22:56:32 +0000 (-0600) Subject: Added Vector::get_function_gradients_from_local_dof_values X-Git-Tag: v9.0.0-rc1~1291^2~12 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d6d8b63ea29b1db3c2dce98b1031f09cd56551a;p=dealii.git Added Vector::get_function_gradients_from_local_dof_values --- diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index c6fe38f0d0..724df64752 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -887,6 +887,13 @@ namespace FEValuesViews void get_function_gradients (const InputVector &fe_function, std::vector::type> &gradients) const; + /** + * @copydoc FEValuesViews::Vector::get_function_values_from_local_dof_values() + */ + template + void get_function_gradients_from_local_dof_values (const InputVector &dof_values, + std::vector::gradient_type> &gradients) const; + /** * Return the symmetrized gradients of the selected vector components of * the finite element function characterized by fe_function at diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 3dc2a33af1..dcd5a1086c 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -1553,6 +1553,26 @@ namespace FEValuesViews + template + template + void + Vector:: + get_function_gradients_from_local_dof_values (const InputVector &dof_values, + std::vector::gradient_type> &gradients) const + { + Assert (fe_values->update_flags & update_gradients, + (typename FEValuesBase::ExcAccessToUninitializedField("update_gradients"))); + Assert (fe_values->present_cell.get() != nullptr, + ExcMessage ("FEValues object is not reinit'ed to any cell")); + AssertDimension (dof_values.size(), fe_values->dofs_per_cell); + + internal::do_function_derivatives<1,dim,spacedim> + (make_array_view(dof_values.begin(), dof_values.end()), + fe_values->finite_element_output.shape_gradients, shape_function_data, gradients); + } + + + template template void diff --git a/source/fe/fe_values.inst.in b/source/fe/fe_values.inst.in index f0b789a19c..99b74e3bc1 100644 --- a/source/fe/fe_values.inst.in +++ b/source/fe/fe_values.inst.in @@ -176,6 +176,11 @@ for (VEC : GENERAL_CONTAINER_TYPES; void FEValuesViews::Vector ::get_function_values_from_local_dof_values> (const VEC&, std::vector::value_type>&) const; + + template + void FEValuesViews::Vector + ::get_function_gradients_from_local_dof_values> + (const VEC&, std::vector::gradient_type>&) const; #endif }