]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify yet more code.
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 18 Nov 2022 23:03:09 +0000 (16:03 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sun, 20 Nov 2022 01:22:16 +0000 (18:22 -0700)
source/base/data_out_base.cc

index 3eea04099da199ab9975e8aaeb376b560bed191c..30889fd7920a0849d41060930477d6c35d61bad4 100644 (file)
@@ -589,22 +589,37 @@ namespace DataOutBase
     const unsigned int base_entry =
       index * GeometryInfo<dim>::vertices_per_cell;
 
-    internal_add_cell(base_entry + 0, start);
-    if (dim >= 1)
+    switch (dim)
       {
-        internal_add_cell(base_entry + 1, start + d1);
-        if (dim >= 2)
-          {
-            internal_add_cell(base_entry + 2, start + d2 + d1);
-            internal_add_cell(base_entry + 3, start + d2);
-            if (dim >= 3)
-              {
-                internal_add_cell(base_entry + 4, start + d3);
-                internal_add_cell(base_entry + 5, start + d3 + d1);
-                internal_add_cell(base_entry + 6, start + d3 + d2 + d1);
-                internal_add_cell(base_entry + 7, start + d3 + d2);
-              }
-          }
+        case 0:
+          internal_add_cell(base_entry + 0, start);
+          break;
+
+        case 1:
+          internal_add_cell(base_entry + 0, start);
+          internal_add_cell(base_entry + 1, start + d1);
+          break;
+
+        case 2:
+          internal_add_cell(base_entry + 0, start);
+          internal_add_cell(base_entry + 1, start + d1);
+          internal_add_cell(base_entry + 2, start + d2 + d1);
+          internal_add_cell(base_entry + 3, start + d2);
+          break;
+
+        case 3:
+          internal_add_cell(base_entry + 0, start);
+          internal_add_cell(base_entry + 1, start + d1);
+          internal_add_cell(base_entry + 2, start + d2 + d1);
+          internal_add_cell(base_entry + 3, start + d2);
+          internal_add_cell(base_entry + 4, start + d3);
+          internal_add_cell(base_entry + 5, start + d3 + d1);
+          internal_add_cell(base_entry + 6, start + d3 + d2 + d1);
+          internal_add_cell(base_entry + 7, start + d3 + d2);
+          break;
+
+        default:
+          Assert(false, ExcNotImplemented());
       }
   }
 
@@ -3077,6 +3092,8 @@ namespace DataOutBase
     out.flush_cells();
   }
 
+
+
   template <int dim, int spacedim, typename StreamType>
   void
   write_high_order_cells(const std::vector<Patch<dim, spacedim>> &patches,

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.