]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
fixed the same bug in MGTools::count_dofs_per_block as occured in DoFTools::count_dof...
authorjanssen <janssen@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 5 Jan 2010 15:58:02 +0000 (15:58 +0000)
committerjanssen <janssen@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 5 Jan 2010 15:58:02 +0000 (15:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@20294 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/multigrid/mg_dof_tools.cc

index 6f6f18fcd53fa1089111bb2254ddd7c4d41db5c0..1ebfe6fb2c888cbae7b879b187d74aaaf1a5fac0 100644 (file)
@@ -1033,10 +1033,7 @@ MGTools::count_dofs_per_block (
   dofs_per_block.resize (n_levels);
   
   for (unsigned int l=0;l<n_levels;++l)
-    {
-      dofs_per_block[l].resize(n_blocks);
-      std::fill (dofs_per_block[l].begin(), dofs_per_block[l].end(), 0U);
-    }
+    std::fill (dofs_per_block[l].begin(), dofs_per_block[l].end(), 0U);
                                   // If the empty vector was given as
                                   // default argument, set up this
                                   // vector as identity.
@@ -1046,10 +1043,18 @@ MGTools::count_dofs_per_block (
       for (unsigned int i=0;i<n_blocks;++i)
        target_block[i] = i;
     }
-  
+  else
   Assert(target_block.size()==n_blocks,
         ExcDimensionMismatch(target_block.size(),n_blocks));
 
+  const unsigned int max_block
+    = *std::max_element (target_block.begin(),
+                        target_block.end());
+  const unsigned int n_target_blocks = max_block + 1;
+
+  for (unsigned int l=0;l<n_levels;++l)
+    AssertDimension (dofs_per_block[l].size(), n_target_blocks);
+
                                   // special case for only one
                                   // block. treat this first
                                   // since it does not require any

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.