]> https://gitweb.dealii.org/ - dealii.git/commitdiff
1 fix-intel-17-1
authorDavid Wells <drwells@email.unc.edu>
Tue, 4 May 2021 21:08:12 +0000 (17:08 -0400)
committerDavid Wells <drwells@email.unc.edu>
Tue, 4 May 2021 21:08:12 +0000 (17:08 -0400)
source/base/data_out_base.cc

index 860b01c4703d46dd1831b80a39d8703b1a7b3570..9db07c9d200cabcb804c7b2343e298619c7b2189 100644 (file)
@@ -1427,6 +1427,74 @@ namespace
 
 
 
+  // Separate these out to avoid an internal compiler error with intel 17
+  namespace internal
+  {
+    template <int dim>
+    std::array<unsigned int, GeometryInfo<dim>::vertices_per_cell>
+    order_cell( unsigned int /*start*/,
+                        unsigned int /*d1*/,
+                        unsigned int /*d2*/,
+                        unsigned int /*d3*/)
+    {
+       Assert(false, ExcInternalError());
+       return {};
+    }
+
+    template <>
+    std::array<unsigned int, GeometryInfo<1>::vertices_per_cell>
+    order_cell<1>(
+                        unsigned int start,
+                        unsigned int d1,
+                        unsigned int /*d2*/,
+                        unsigned int /*d3*/)
+                        
+    {
+    std::array<unsigned int, GeometryInfo<1>::vertices_per_cell> nodes;
+    nodes[0] = start;
+    nodes[1] = start + d1;
+return nodes;
+    }
+
+    template <>
+    std::array<unsigned int, GeometryInfo<2>::vertices_per_cell>
+    order_cell<2>(
+                        unsigned int start,
+                        unsigned int d1,
+                        unsigned int d2,
+                        unsigned int /*d3*/)
+                        
+    {
+    std::array<unsigned int, GeometryInfo<2>::vertices_per_cell> nodes;
+    nodes[0] = start;
+    nodes[1] = start + d1;
+    nodes[2] = start + d2;
+    nodes[3] = start + d2 + d1;
+return nodes;
+    }
+
+    template <>
+    std::array<unsigned int, GeometryInfo<3>::vertices_per_cell>
+    order_cell<3>( unsigned int start,
+                        unsigned int d1,
+                        unsigned int d2,
+                        unsigned int d3)
+    {
+    std::array<unsigned int, GeometryInfo<3>::vertices_per_cell> nodes;
+    nodes[0] = start;
+    nodes[1] = start + d1;
+    nodes[2] = start + d2;
+    nodes[3] = start + d2 + d1;
+    nodes[4] = start + d3;
+    nodes[5] = start + d3 + d1;
+    nodes[6] = start + d3 + d2;
+    nodes[7] = start + d3 + d2 + d1;
+return nodes;
+    }
+  }
+
+
+
   template <int dim>
   void
   DXStream::write_cell(unsigned int,
@@ -1435,36 +1503,16 @@ namespace
                        unsigned int d2,
                        unsigned int d3)
   {
-    int nodes[1 << dim];
-    nodes[GeometryInfo<dim>::dx_to_deal[0]] = start;
-    if (dim >= 1)
-      {
-        nodes[GeometryInfo<dim>::dx_to_deal[1]] = start + d1;
-        if (dim >= 2)
-          {
-            // Add shifted line in y direction
-            nodes[GeometryInfo<dim>::dx_to_deal[2]] = start + d2;
-            nodes[GeometryInfo<dim>::dx_to_deal[3]] = start + d2 + d1;
-            if (dim >= 3)
-              {
-                // Add shifted quad in z direction
-                nodes[GeometryInfo<dim>::dx_to_deal[4]] = start + d3;
-                nodes[GeometryInfo<dim>::dx_to_deal[5]] = start + d3 + d1;
-                nodes[GeometryInfo<dim>::dx_to_deal[6]] = start + d3 + d2;
-                nodes[GeometryInfo<dim>::dx_to_deal[7]] = start + d3 + d2 + d1;
-              }
-          }
-      }
+    auto nodes = internal::order_cell<dim>(start, d1, d2, d3);
 
     if (flags.int_binary)
-      stream.write(reinterpret_cast<const char *>(nodes),
-                   (1 << dim) * sizeof(*nodes));
+      stream.write(reinterpret_cast<const char *>(nodes.data()),
+                   nodes.size() * sizeof(nodes[0]));
     else
       {
-        const unsigned int final = (1 << dim) - 1;
-        for (unsigned int i = 0; i < final; ++i)
-          stream << nodes[i] << '\t';
-        stream << nodes[final] << '\n';
+        for (unsigned int i = 0; i < nodes.size() - 1; ++i)
+          stream << nodes[GeometryInfo<dim>::dx_to_deal[i]] << '\t';
+        stream << nodes.back() << '\n';
       }
   }
 
@@ -1613,32 +1661,12 @@ namespace
                         unsigned int d2,
                         unsigned int d3)
   {
-    int nodes[1 << dim];
-    nodes[GeometryInfo<dim>::ucd_to_deal[0]] = start;
-    if (dim >= 1)
-      {
-        nodes[GeometryInfo<dim>::ucd_to_deal[1]] = start + d1;
-        if (dim >= 2)
-          {
-            // Add shifted line in y direction
-            nodes[GeometryInfo<dim>::ucd_to_deal[2]] = start + d2;
-            nodes[GeometryInfo<dim>::ucd_to_deal[3]] = start + d2 + d1;
-            if (dim >= 3)
-              {
-                // Add shifted quad in z direction
-                nodes[GeometryInfo<dim>::ucd_to_deal[4]] = start + d3;
-                nodes[GeometryInfo<dim>::ucd_to_deal[5]] = start + d3 + d1;
-                nodes[GeometryInfo<dim>::ucd_to_deal[6]] = start + d3 + d2;
-                nodes[GeometryInfo<dim>::ucd_to_deal[7]] = start + d3 + d2 + d1;
-              }
-          }
-      }
+    auto nodes = internal::order_cell<dim>(start, d1, d2, d3);
 
     // Write out all cells and remember that all indices must be shifted by one.
     stream << index + 1 << "\t0 " << ucd_cell_type[dim];
-    const unsigned int final = (1 << dim);
-    for (unsigned int i = 0; i < final; ++i)
-      stream << '\t' << nodes[i] + 1;
+    for (unsigned int i = 0; i < nodes.size(); ++i)
+      stream << '\t' << nodes[GeometryInfo<dim>::ucd_to_deal[i]] + 1;
     stream << '\n';
   }
 

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.