]> https://gitweb.dealii.org/ - dealii.git/commitdiff
MappingFE + ReferenceCell: make tangent vectors work in 1d.
authorDavid Wells <drwells@email.unc.edu>
Thu, 26 Jun 2025 03:24:13 +0000 (23:24 -0400)
committerDavid Wells <drwells@email.unc.edu>
Fri, 27 Jun 2025 15:20:10 +0000 (11:20 -0400)
include/deal.II/fe/mapping_fe.h
include/deal.II/grid/reference_cell.h

index 4171d5f1a6ef131807c819469d3fdf50daf3b00b..5b8366b5f0bffebda06c92d5b88d49553405d317 100644 (file)
@@ -323,7 +323,7 @@ public:
      * Filled once.
      */
     std::array<std::vector<Tensor<1, dim>>,
-               GeometryInfo<dim>::faces_per_cell *(dim - 1)>
+               ReferenceCells::max_n_faces<dim>() * 2>
       unit_tangentials;
 
     /**
index 9546a4930fd30069e80b990e79d75989206dc7d1..2ae54ea49565a3108bdb67bfce9260f1644e9345 100644 (file)
@@ -3261,12 +3261,21 @@ inline Tensor<1, dim>
 ReferenceCell::face_tangent_vector(const unsigned int face_no,
                                    const unsigned int i) const
 {
+  AssertIndexRange(face_no, n_faces());
   Assert(dim == get_dimension(),
          ExcMessage("You can only call this function with arguments for "
                     "which 'dim' equals the dimension of the space in which "
                     "the current reference cell lives. You have dim=" +
                     std::to_string(dim) + " but the reference cell is " +
                     std::to_string(get_dimension()) + " dimensional."));
+
+  // Simplify the 1d case by setting tangents (which are used for boundary forms
+  // and thus Jacobians) equal to the unit vector
+  if constexpr (dim == 1)
+    {
+      return Tensor<1, dim>{{1.0}};
+    }
+
   AssertIndexRange(i, dim - 1);
 
   switch (this->kind)

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.