From: wolf Date: Tue, 28 Oct 2003 15:10:47 +0000 (+0000) Subject: A small experiment shows that much better code is generated if local unchanging array... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb8c2a7c8ca427b197c00844f8b0b09d8253e58a;p=dealii-svn.git A small experiment shows that much better code is generated if local unchanging arrays are made static. git-svn-id: https://svn.dealii.org/trunk@8170 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/geometry_info.h b/deal.II/deal.II/include/grid/geometry_info.h index fe10fd3ca8..0c06597f59 100644 --- a/deal.II/deal.II/include/grid/geometry_info.h +++ b/deal.II/deal.II/include/grid/geometry_info.h @@ -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} }; diff --git a/deal.II/deal.II/source/grid/geometry_info.cc b/deal.II/deal.II/source/grid/geometry_info.cc index a4b13425ae..03c1728aa0 100644 --- a/deal.II/deal.II/source/grid/geometry_info.cc +++ b/deal.II/deal.II/source/grid/geometry_info.cc @@ -88,10 +88,11 @@ GeometryInfo<2>::child_cell_on_face (const unsigned int face, Assert (face::child_cell_on_face (const unsigned int face, Assert (face::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]); }