From: wolf Date: Sun, 28 Feb 1999 19:29:00 +0000 (+0000) Subject: Safety update in initialize: the loops terminated more or less by chance, the only... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a2f66d29d42d2ecab8e0e8b92738062797fd2e3;p=dealii-svn.git Safety update in initialize: the loops terminated more or less by chance, the only reason was the initialization of the loop variable to zero, so the initial test failed. The loop condition was ill-designed, though, since comparing an unsigned int to be smaller with something that may be zero asks for problems. The patch clarifies why the loop worked anyway, and since this computation is done at compile time, it does not even impose a penalty to the user. git-svn-id: https://svn.dealii.org/trunk@928 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/fe/fe_system.cc b/deal.II/deal.II/source/fe/fe_system.cc index 4415ea60f7..5aa717b8e4 100644 --- a/deal.II/deal.II/source/fe/fe_system.cc +++ b/deal.II/deal.II/source/fe/fe_system.cc @@ -60,7 +60,8 @@ void FESystem::initialize () } // 2. Lines - for (unsigned line_number= 0 ; line_number < GeometryInfo::lines_per_cell ; + for (unsigned line_number= 0 ; ((line_number < GeometryInfo::lines_per_cell) && + (GeometryInfo::lines_per_cell > 0)); ++line_number) { unsigned comp_start = 0; @@ -85,7 +86,8 @@ void FESystem::initialize () } // 3. Quads - for (unsigned quad_number= 0 ; quad_number < GeometryInfo::quads_per_cell ; + for (unsigned quad_number= 0 ; ((quad_number < GeometryInfo::quads_per_cell) && + (GeometryInfo::quads_per_cell > 0)); ++quad_number) { unsigned comp_start = 0; @@ -110,7 +112,8 @@ void FESystem::initialize () } // 4. Hex - for (unsigned hex_number= 0 ; hex_number < GeometryInfo::hexes_per_cell ; + for (unsigned hex_number= 0 ; ((hex_number < GeometryInfo::hexes_per_cell) && + (GeometryInfo::hexes_per_cell > 0)); ++hex_number) { unsigned comp_start = 0;