]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Replace iterated if-else's by a switch statement.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 23 Oct 2003 16:27:51 +0000 (16:27 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 23 Oct 2003 16:27:51 +0000 (16:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@8143 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/fe/mapping_q.cc

index 6117836c10283ef778990fccdb4174807117cbac..848af86bd5b2b70fbffda399be83a8abb1cd1baf 100644 (file)
@@ -430,27 +430,37 @@ MappingQ<dim>::set_laplace_on_quad_vector(Table<2,double> &loqvs) const
                                   // precomputed the values for some
                                   // polynomial degree
   double const *loqv_ptr=0;
-  if (degree==2)
-    {
-      static const double loqv2[1*8]
-       ={1/16., 1/16., 1/16., 1/16., 3/16., 3/16., 3/16., 3/16.};
-      loqv_ptr=&loqv2[0];
-    }
-  else if (degree==3)
+  switch (degree)
     {
-      static const double loqv3[4*12]
-       ={80/1053., 1/81., 11/1053., 1/81., 25/117., 44/351.,
-         7/117., 16/351., 7/117., 16/351., 25/117., 44/351.,
-         1/81., 80/1053., 1/81., 11/1053., 44/351., 25/117.,
-         25/117., 44/351., 16/351., 7/117., 7/117., 16/351.,
-         1/81., 11/1053., 1/81., 80/1053., 7/117., 16/351.,
-         16/351., 7/117., 25/117., 44/351., 44/351., 25/117.,
-         11/1053., 1/81., 80/1053., 1/81., 16/351., 7/117.,
-         44/351., 25/117., 44/351., 25/117., 16/351., 7/117.};
-      
-      loqv_ptr=&loqv3[0];
-    }
+      case 2:
+      {
+       static const double loqv2[1*8]
+         ={1/16., 1/16., 1/16., 1/16., 3/16., 3/16., 3/16., 3/16.};
+       loqv_ptr=&loqv2[0];
+       
+       break;
+      }
 
+      case 3:
+      {
+       static const double loqv3[4*12]
+         ={80/1053., 1/81., 11/1053., 1/81., 25/117., 44/351.,
+           7/117., 16/351., 7/117., 16/351., 25/117., 44/351.,
+           1/81., 80/1053., 1/81., 11/1053., 44/351., 25/117.,
+           25/117., 44/351., 16/351., 7/117., 7/117., 16/351.,
+           1/81., 11/1053., 1/81., 80/1053., 7/117., 16/351.,
+           16/351., 7/117., 25/117., 44/351., 44/351., 25/117.,
+           11/1053., 1/81., 80/1053., 1/81., 16/351., 7/117.,
+           44/351., 25/117., 44/351., 25/117., 16/351., 7/117.};
+       loqv_ptr=&loqv3[0];
+       
+       break;
+      }
+
+                                      // no other cases implemented,
+                                      // so simply fall through
+    }
+  
   if (loqv_ptr!=0)
     {
                                       // precomputed. copy values to

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.