]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix normal_hessian n_comp
authorAndreas Ritthaler <andreas.ritthaler@tum.de>
Tue, 17 Sep 2024 13:13:12 +0000 (15:13 +0200)
committerAndreas Ritthaler <andreas.ritthaler@tum.de>
Tue, 17 Sep 2024 13:21:47 +0000 (15:21 +0200)
include/deal.II/matrix_free/fe_evaluation.h

index 5246d5ac29c0ce289cc917d9deb904d2ddcef100..6ce0b9b6462a24c910770f127b3b2ce24b443301 100644 (file)
@@ -4888,18 +4888,23 @@ FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
                 DEAL_II_NOT_IMPLEMENTED();
             }
         }
-
-      if constexpr (n_components == 1)
-        return hessian_out[0];
-      else
-        return hessian_out;
     }
   // cell with general Jacobian
   else
     {
-      const auto normal = this->normal_vector(q_point);
-      return get_hessian(q_point) * normal * normal;
+      const auto normal  = this->normal_vector(q_point);
+      const auto hessian = get_hessian(q_point);
+
+      if constexpr (n_components == 1)
+        hessian_out[0] = hessian * normal * normal;
+      else
+        for (unsigned int comp = 0; comp < n_components; ++comp)
+          hessian_out[comp] = hessian[comp] * normal * normal;
     }
+  if constexpr (n_components == 1)
+    return hessian_out[0];
+  else
+    return hessian_out;
 }
 
 
@@ -5626,8 +5631,12 @@ FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
       if constexpr (n_components == 1)
         submit_hessian(normal_hessian_in * normal_projector, q_point);
       else
-        submit_hessian(outer_product(normal_hessian_in, normal_projector),
-                       q_point);
+        {
+          hessian_type tmp;
+          for (unsigned int comp = 0; comp < n_components; ++comp)
+            tmp[comp] = normal_hessian_in[comp] * normal_projector;
+          submit_hessian(tmp, q_point);
+        }
     }
 }
 

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.