]> https://gitweb.dealii.org/ - dealii.git/commitdiff
added shape_grad in FEInterfaceValues
authorWyatt Smith <wsmith97@tamu.edu>
Sat, 7 Jun 2025 14:41:51 +0000 (08:41 -0600)
committerWyatt Smith <wsmith97@tamu.edu>
Sat, 7 Jun 2025 14:46:28 +0000 (08:46 -0600)
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

index bc4a39d00ee9e2fc98dc09ecad96f8d989489626..e7d74645ff7e62ab4087552b9c177fa809ff01e5 100644 (file)
@@ -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<dim, spacedim>::shape_value(
 }
 
 
+template <int dim, int spacedim>
+Tensor<1, spacedim>
+FEInterfaceValues<dim, spacedim>::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 <int dim, int spacedim>
 double

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.