From b014626fc29537db115cc49721f310c68684c411 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Thu, 10 Aug 2017 17:02:06 -0600 Subject: [PATCH] Added SymmetricTensor::get_function_divergences_from_local_dof_values --- include/deal.II/fe/fe_values.h | 7 +++++++ source/fe/fe_values.cc | 26 ++++++++++++++++++++++++-- source/fe/fe_values.inst.in | 5 +++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index 060a02dfa0..91f1df7b71 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -1336,6 +1336,13 @@ namespace FEValuesViews void get_function_divergences (const InputVector &fe_function, std::vector::type> &divergences) const; + /** + * @copydoc FEValuesViews::SymmetricTensor<2,dim,spacedim>::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; + private: /** * A pointer to the FEValuesBase object we operate on. diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 7a074e468f..7ad5950c78 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -1067,7 +1067,7 @@ 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 ? @@ -1075,7 +1075,7 @@ namespace FEValuesViews AssertDimension (divergences.size(), n_quadrature_points); std::fill (divergences.begin(), divergences.end(), - typename ProductType >::type()); + typename SymmetricTensor<2,dim,spacedim>::template OutputType::divergence_type()); for (unsigned int shape_function=0; shape_functionfinite_element_output.shape_gradients, shape_function_data, divergences); } + + + template + template + void + SymmetricTensor<2, dim, spacedim>:: + 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 4d700e47f1..514ebd6834 100644 --- a/source/fe/fe_values.inst.in +++ b/source/fe/fe_values.inst.in @@ -218,6 +218,11 @@ for (VEC : GENERAL_CONTAINER_TYPES; void FEValuesViews::SymmetricTensor<2,deal_II_dimension, deal_II_space_dimension> ::get_function_values_from_local_dof_values> (const VEC&, std::vector::value_type>&) const; + + template + void FEValuesViews::SymmetricTensor<2,deal_II_dimension, deal_II_space_dimension> + ::get_function_divergences_from_local_dof_values> + (const VEC&, std::vector::divergence_type>&) const; #endif } -- 2.39.5