From 02429804afd0d0eed1e297232656f56e8fbf1ab5 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Thu, 10 Aug 2017 16:57:58 -0600 Subject: [PATCH] Added Vector::get_function_divergences_from_local_dof_values --- include/deal.II/fe/fe_values.h | 7 +++++++ source/fe/fe_values.cc | 27 +++++++++++++++++++++++++-- source/fe/fe_values.inst.in | 5 +++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index 895543894b..45b8dd9463 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -952,6 +952,13 @@ namespace FEValuesViews void get_function_divergences (const InputVector &fe_function, std::vector::type> &divergences) const; + /** + * @copydoc FEValuesViews::Vector::get_function_values_from_local_dof_values() + */ + template + void get_function_divergences_from_local_dof_values (const InputVector &dof_values, + std::vector::divergence_type> &divergences) const; + /** * Return the curl of the selected vector components of the finite element * function characterized by fe_function at the quadrature points diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 8a3289b105..9650c53a6f 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -716,14 +716,15 @@ namespace FEValuesViews do_function_divergences (const ArrayView &dof_values, const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, - std::vector::type> &divergences) + std::vector::template OutputType::divergence_type> &divergences) { const unsigned int dofs_per_cell = dof_values.size(); const unsigned int n_quadrature_points = dofs_per_cell > 0 ? shape_gradients[0].size() : divergences.size(); AssertDimension (divergences.size(), n_quadrature_points); - std::fill (divergences.begin(), divergences.end(), typename ProductType::type()); + std::fill (divergences.begin(), divergences.end(), + typename Vector::template OutputType::divergence_type()); for (unsigned int shape_function=0; shape_functionfinite_element_output.shape_gradients, shape_function_data, divergences); } + + + template + template + void + Vector:: + get_function_divergences_from_local_dof_values(const InputVector &dof_values, + std::vector::divergence_type> &divergences) 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_divergences + (make_array_view(dof_values.begin(), dof_values.end()), + fe_values->finite_element_output.shape_gradients, shape_function_data, divergences); + } + + + template template void diff --git a/source/fe/fe_values.inst.in b/source/fe/fe_values.inst.in index b0b722db57..8d3ab27c5b 100644 --- a/source/fe/fe_values.inst.in +++ b/source/fe/fe_values.inst.in @@ -186,6 +186,11 @@ for (VEC : GENERAL_CONTAINER_TYPES; void FEValuesViews::Vector ::get_function_symmetric_gradients_from_local_dof_values> (const VEC&, std::vector::symmetric_gradient_type>&) const; + + template + void FEValuesViews::Vector + ::get_function_divergences_from_local_dof_values> + (const VEC&, std::vector::divergence_type>&) const; #endif } -- 2.39.5