From 5d6d8b63ea29b1db3c2dce98b1031f09cd56551a Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Thu, 10 Aug 2017 16:56:32 -0600 Subject: [PATCH] Added Vector::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 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 } -- 2.39.5