From 7a1d80d0b1d69e930fdf61f1860cbe70d942e106 Mon Sep 17 00:00:00 2001 From: Wyatt Smith Date: Sat, 7 Jun 2025 08:41:51 -0600 Subject: [PATCH] added shape_grad in FEInterfaceValues Gets the value of the gradient of the shape function on either side of a face, using the same logic as shape_value() --- include/deal.II/fe/fe_interface_values.h | 40 +++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/include/deal.II/fe/fe_interface_values.h b/include/deal.II/fe/fe_interface_values.h index bc4a39d00e..e7d74645ff 100644 --- a/include/deal.II/fe/fe_interface_values.h +++ b/include/deal.II/fe/fe_interface_values.h @@ -1743,7 +1743,7 @@ public: */ /** - * @name Access to shape functions + * @name Access to shape functions and their derivatives * @{ */ @@ -1774,6 +1774,21 @@ public: const unsigned int q_point, const unsigned int component = 0) const; + /** + * Return component @p component of the gradient of the shape function + * with interface dof index @p interface_dof_index in + * quadrature point @p q_point. + * + * Similar to @p shape_value() , the argument @p here_or_there selects between + * the gradient on cell 0 (here, @p true) and cell 1 (there, @p false) + * at this quadrature point. + */ + Tensor<1, spacedim> + shape_grad(const bool here_or_there, + const unsigned int interface_dof_index, + const unsigned int q_point, + const unsigned int component = 0) const; + /** * @} */ @@ -2958,6 +2973,29 @@ FEInterfaceValues::shape_value( } +template +Tensor<1, spacedim> +FEInterfaceValues::shape_grad( + const bool here_or_there, + const unsigned int interface_dof_index, + const unsigned int q_point, + const unsigned int component) const +{ + const auto dof_pair = dofmap[interface_dof_index]; + + Tensor<1, dim> value; + + if (here_or_there && dof_pair[0] != numbers::invalid_unsigned_int) + value = get_fe_face_values(0).shape_grad_component(dof_pair[0], + q_point, + component); + if (!here_or_there && dof_pair[1] != numbers::invalid_unsigned_int) + value = get_fe_face_values(1).shape_grad_component(dof_pair[1], + q_point, + component); + + return value; +} template double -- 2.39.5