From ed2a4a3cede00eb5f3486fa22b5ff0487160b478 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Thu, 10 Aug 2017 16:50:15 -0600 Subject: [PATCH] Added Scalar::get_function_gradients_from_local_dof_values --- include/deal.II/fe/fe_values.h | 7 +++++++ source/fe/fe_values.cc | 20 ++++++++++++++++++++ source/fe/fe_values.inst.in | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index 3e747687d2..77a6639005 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -374,6 +374,13 @@ namespace FEValuesViews void get_function_gradients (const InputVector &fe_function, std::vector::type> &gradients) const; + /** + * @copydoc FEValuesViews::Scalar::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 Hessians of the selected scalar component of the finite * element function characterized by fe_function at the diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 039a7cec74..c890974cf6 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -1332,6 +1332,26 @@ namespace FEValuesViews + template + template + void + Scalar:: + 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 90f24d926a..ae54b4cd4b 100644 --- a/source/fe/fe_values.inst.in +++ b/source/fe/fe_values.inst.in @@ -149,6 +149,11 @@ for (VEC : GENERAL_CONTAINER_TYPES; void FEValuesViews::Scalar ::get_function_values_from_local_dof_values> (const VEC&, std::vector::value_type>&) const; + + template + void FEValuesViews::Scalar + ::get_function_gradients_from_local_dof_values> + (const VEC&, std::vector::gradient_type>&) const; #endif } -- 2.39.5