]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add one more forgotten simplification. 17049/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 20 May 2024 19:58:15 +0000 (13:58 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 21 May 2024 01:31:05 +0000 (19:31 -0600)
include/deal.II/fe/fe_tools.templates.h

index 851bc31ae784ff1ee61f08f3f09dfe601304f512..33d25c70adb9447b8accd77eaefcd096a75922e0 100644 (file)
@@ -223,20 +223,20 @@ namespace FETools
                          const FiniteElement<dim, spacedim> *fe5,
                          const unsigned int                  N5)
     {
-      std::vector<const FiniteElement<dim, spacedim> *> fes;
-      fes.push_back(fe1);
-      fes.push_back(fe2);
-      fes.push_back(fe3);
-      fes.push_back(fe4);
-      fes.push_back(fe5);
-
-      std::vector<unsigned int> mult;
-      mult.push_back(N1);
-      mult.push_back(N2);
-      mult.push_back(N3);
-      mult.push_back(N4);
-      mult.push_back(N5);
-      return multiply_dof_numbers(fes, mult);
+      std::vector<const FiniteElement<dim, spacedim> *> fe_list = {
+        fe1, fe2, fe3, fe4, fe5};
+      std::vector<unsigned int> multiplicities = {N1, N2, N3, N4, N5};
+
+      // This function is occasionally called with nullptr values for the
+      // finite elements. Drop those again.
+      while ((fe_list.size() > 0) && (fe_list.back() == nullptr))
+        {
+          Assert(multiplicities.back() == 0, ExcInternalError());
+          fe_list.pop_back();
+          multiplicities.pop_back();
+        }
+
+      return multiply_dof_numbers(fe_list, multiplicities);
     }
 
 

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.