]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix some GCC11 warnings. 12255/head
authorDavid Wells <drwells@email.unc.edu>
Wed, 19 May 2021 17:00:24 +0000 (13:00 -0400)
committerDavid Wells <drwells@email.unc.edu>
Wed, 19 May 2021 17:00:24 +0000 (13:00 -0400)
source/fe/fe_nedelec.cc
source/fe/fe_nedelec_sz.cc

index 687aa2139ae272c02d0f416acece497e419c5969..8677b5dbad71d373e6c8e64d38ade00afcda3def 100644 (file)
@@ -2060,20 +2060,21 @@ template <int dim>
 std::vector<unsigned int>
 FE_Nedelec<dim>::get_dpo_vector(const unsigned int degree, bool dg)
 {
-  std::vector<unsigned int> dpo(dim + 1);
+  std::vector<unsigned int> dpo;
 
   if (dg)
     {
+      dpo.resize(dim + 1);
       dpo[dim] = PolynomialsNedelec<dim>::n_polynomials(degree);
     }
   else
     {
-      dpo[0] = 0;
-      dpo[1] = degree + 1;
-      dpo[2] = 2 * degree * (degree + 1);
-
-      if (dim == 3)
-        dpo[3] = 3 * degree * degree * (degree + 1);
+      dpo.push_back(0);
+      dpo.push_back(degree + 1);
+      if (dim > 1)
+        dpo.push_back(2 * degree * (degree + 1));
+      if (dim > 2)
+        dpo.push_back(3 * degree * degree * (degree + 1));
     }
 
   return dpo;
index 96d8751457f51a1313fbb09037b920d1d3aec5ac..32e141c3419a003868c7502a02af0f440599f279 100644 (file)
@@ -2240,14 +2240,15 @@ FE_NedelecSZ<dim, spacedim>::get_dpo_vector(const unsigned int degree)
   // 1 = edge
   // 2 = face (which is a cell in 2D)
   // 3 = cell
-  std::vector<unsigned int> dpo(dim + 1);
-  dpo[0] = 0;
-  dpo[1] = degree + 1;
-  dpo[2] = 2 * degree * (degree + 1);
-  if (dim == 3)
-    {
-      dpo[3] = 3 * degree * degree * (degree + 1);
-    }
+  std::vector<unsigned int> dpo;
+
+  dpo.push_back(0);
+  dpo.push_back(degree + 1);
+  if (dim > 1)
+    dpo.push_back(2 * degree * (degree + 1));
+  if (dim > 2)
+    dpo.push_back(3 * degree * degree * (degree + 1));
+
   return dpo;
 }
 

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.