]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Clean up code some.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 31 Oct 2008 17:41:23 +0000 (17:41 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 31 Oct 2008 17:41:23 +0000 (17:41 +0000)
git-svn-id: https://svn.dealii.org/trunk@17432 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/dofs/dof_renumbering.cc

index 095d619a914852869dc78f9bd11abf07abc1262c..84ac47df47a4229ad4ee4efda354d68e8dd44e1b 100644 (file)
@@ -500,20 +500,15 @@ namespace DoFRenumbering
                                     // constraints are not needed anymore
     constraints.clear ();
   
-    const unsigned int n_dofs = sparsity.n_rows();
-                                    // store the new dof numbers;
-                                    // invalid_dof_index means that no new
-                                    // number was chosen yet
-    Assert(new_indices.size() == n_dofs,
-          ExcDimensionMismatch(new_indices.size(), n_dofs));
+    Assert(new_indices.size() == n_dofs = sparsity.n_rows(),
+          ExcDimensionMismatch(new_indices.size(),
+                               n_dofs = sparsity.n_rows()));
 
     SparsityTools::reorder_Cuthill_McKee (sparsity, new_indices,
                                          starting_indices);
 
     if (reversed_numbering)
-      for (std::vector<unsigned int>::iterator i=new_indices.begin();
-          i!=new_indices.end(); ++i)
-       *i = n_dofs-*i-1;
+      new_indices = Utilities::reverse_permutation (new_indices);
   }
 
 
@@ -530,17 +525,12 @@ namespace DoFRenumbering
                              dof_handler.max_couplings_between_dofs());
     MGTools::make_sparsity_pattern (dof_handler, sparsity, level);
     
-    const unsigned int n_dofs = sparsity.n_rows();
-                                    // store the new dof numbers; invalid_dof_index means
-                                    // that no new number was chosen yet
-    std::vector<unsigned int> new_indices(n_dofs, DoFHandler<dim>::invalid_dof_index);
-  
+    std::vector<unsigned int> new_indices(sparsity.n_rows());
     SparsityTools::reorder_Cuthill_McKee (sparsity, new_indices,
                                          starting_indices);
 
     if (reversed_numbering)
-      for (std::vector<unsigned int>::iterator i=new_indices.begin(); i!=new_indices.end(); ++i)
-       *i = n_dofs-*i;
+      new_indices = Utilities::reverse_permutation (new_indices);
 
                                     // actually perform renumbering;
                                     // this is dimension specific and

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.