]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
A small experiment shows that much better code is generated if local unchanging array...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 28 Oct 2003 15:10:47 +0000 (15:10 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 28 Oct 2003 15:10:47 +0000 (15:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@8170 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/geometry_info.h
deal.II/deal.II/source/grid/geometry_info.cc
deal.II/deal.II/source/grid/tria_accessor.cc

index fe10fd3ca87f313c126e4085863b444ec834c25e..0c06597f590ab38179dd99d57bfb066335b9a1b5 100644 (file)
@@ -1404,7 +1404,7 @@ GeometryInfo<2>::vertices_adjacent_to_line (const unsigned int line,
   Assert (vertex < vertices_per_cell,
          ExcIndexRange (vertex, 0, 2));
 
-  const unsigned int vertex_indices[lines_per_cell][2] =
+  static const unsigned int vertex_indices[lines_per_cell][2] =
     { {0, 1}, {1, 2}, {3, 2}, {0, 3} };
 
   return vertex_indices[line][vertex];
@@ -1422,7 +1422,7 @@ GeometryInfo<3>::vertices_adjacent_to_line (const unsigned int line,
   Assert (vertex < vertices_per_cell,
          ExcIndexRange (vertex, 0, 2));
 
-  const unsigned int vertex_indices[lines_per_cell][2] =
+  static const unsigned int vertex_indices[lines_per_cell][2] =
     { {0, 1}, {1, 2}, {3, 2}, {0, 3},
       {4, 5}, {5, 6}, {7, 6}, {4, 7},
       {0, 4}, {1, 5}, {2, 6}, {3, 7}  };
index a4b13425ae5329620afcbe3aa3fd3b602ceac2e9..03c1728aa0a3210d1f32f8f0e5ce5e696d1b2d09 100644 (file)
@@ -88,10 +88,11 @@ GeometryInfo<2>::child_cell_on_face (const unsigned int face,
   Assert (face<faces_per_cell, ExcIndexRange(face, 0, faces_per_cell));
   Assert (subface<subfaces_per_face, ExcIndexRange(subface, 0, subfaces_per_face));
   
-  const unsigned subcells[faces_per_cell][subfaces_per_face] = {{0,1},
-                                                               {1,2},
-                                                               {3,2},
-                                                               {0,3}};
+  static const unsigned
+    subcells[faces_per_cell][subfaces_per_face] = {{0,1},
+                                                   {1,2},
+                                                   {3,2},
+                                                   {0,3}};
   return subcells[face][subface];
 }
 
@@ -105,11 +106,12 @@ GeometryInfo<3>::child_cell_on_face (const unsigned int face,
   Assert (face<faces_per_cell, ExcIndexRange(face, 0, faces_per_cell));
   Assert (subface<subfaces_per_face, ExcIndexRange(subface, 0, subfaces_per_face));
   
-  const unsigned subcells[faces_per_cell][subfaces_per_face] = {{0, 1, 2, 3},
-                                                               {4, 5, 6, 7},
-                                                               {0, 1, 5, 4},
-                                                               {1, 5, 6, 2},
-                                                               {3, 2, 6, 7},
-                                                               {0, 4, 7, 3}};
+  static const unsigned
+    subcells[faces_per_cell][subfaces_per_face] = {{0, 1, 2, 3},
+                                                   {4, 5, 6, 7},
+                                                   {0, 1, 5, 4},
+                                                   {1, 5, 6, 2},
+                                                   {3, 2, 6, 7},
+                                                   {0, 4, 7, 3}};
   return subcells[face][subface];
 }
index 3c097da21f840ab5596e2c6d05be406ce1af3307..e453c62305abb0a300b59a89b8685091f2a5c41c 100644 (file)
@@ -265,7 +265,7 @@ int TriaObjectAccessor<2, dim>::vertex_index (const unsigned int corner) const
 {
   Assert (corner<4, ExcIndexRange(corner,0,4));
 
-  const int corner_convention[4] = { 0,0,1,1 };
+  static const int corner_convention[4] = { 0,0,1,1 };
   return line(corner)->vertex_index(corner_convention[corner]);
 }
 

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.