]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Implement the still missing boost::compute_Cuthill_McKee function. Leave a TODO.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 5 Mar 2008 15:23:36 +0000 (15:23 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 5 Mar 2008 15:23:36 +0000 (15:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@15858 0785d39b-7218-0410-832d-ea1e28bc413d

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

index d371bee864190a44d3073bd4c74a3265687410c2..36825e3645c2531fdc99585998c88916013c64d3 100644 (file)
@@ -207,6 +207,26 @@ DoFRenumbering::boost::
 Cuthill_McKee (DH&              dof_handler,
               const bool       reversed_numbering,
               const bool       use_constraints)
+{
+  std::vector<unsigned int> renumbering(dof_handler.n_dofs(),
+                                       DH::invalid_dof_index);
+  compute_Cuthill_McKee(renumbering, dof_handler, reversed_numbering,
+                       use_constraints);
+
+                                  // actually perform renumbering;
+                                  // this is dimension specific and
+                                  // thus needs an own function
+  dof_handler.renumber_dofs (renumbering);
+}
+
+
+template <class DH>
+void
+DoFRenumbering::boost::
+compute_Cuthill_McKee (std::vector<unsigned int>& new_dof_indices,
+                      const DH        &dof_handler,
+                      const bool       reversed_numbering,
+                      const bool       use_constraints)
 {
   types::Graph
     graph(dof_handler.n_dofs());
@@ -230,11 +250,12 @@ Cuthill_McKee (DH&              dof_handler,
                                    get(::boost::vertex_color, graph),
                                    make_degree_map(graph));
     
-  std::vector<unsigned int> perm(num_vertices(graph));
   for (types::size_type c = 0; c != inv_perm.size(); ++c)
-    perm[index_map[inv_perm[c]]] = c;
+    new_dof_indices[index_map[inv_perm[c]]] = c;
 
-  dof_handler.renumber_dofs (perm);
+  Assert (std::find (new_dof_indices.begin(), new_dof_indices.end(),
+                    DH::invalid_dof_index) == new_dof_indices.end(),
+         ExcInternalError());
 }
 
 
@@ -1619,7 +1640,15 @@ compute_subdomain_wise (std::vector<unsigned int> &new_dof_indices,
 
 
 // explicit instantiations
-template void DoFRenumbering::boost::Cuthill_McKee (DoFHandler<deal_II_dimension> &, bool, bool);
+//TODO[WB]: also implement the following boost functions for hp DoFHandlers etc.
+template
+void
+DoFRenumbering::boost::Cuthill_McKee (DoFHandler<deal_II_dimension> &, bool, bool);
+
+template
+void
+DoFRenumbering::boost::compute_Cuthill_McKee (std::vector<unsigned int> &,
+                                             const DoFHandler<deal_II_dimension> &, bool, bool);
 
 
 template

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.