From: bangerth Date: Wed, 5 Mar 2008 15:23:36 +0000 (+0000) Subject: Implement the still missing boost::compute_Cuthill_McKee function. Leave a TODO. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=398ff46a08a3f65118fcdcfd4b19bca0a1fc94d0;p=dealii-svn.git Implement the still missing boost::compute_Cuthill_McKee function. Leave a TODO. git-svn-id: https://svn.dealii.org/trunk@15858 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/dofs/dof_renumbering.cc b/deal.II/deal.II/source/dofs/dof_renumbering.cc index d371bee864..36825e3645 100644 --- a/deal.II/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/deal.II/source/dofs/dof_renumbering.cc @@ -207,6 +207,26 @@ DoFRenumbering::boost:: Cuthill_McKee (DH& dof_handler, const bool reversed_numbering, const bool use_constraints) +{ + std::vector 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 +void +DoFRenumbering::boost:: +compute_Cuthill_McKee (std::vector& 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 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 &new_dof_indices, // explicit instantiations -template void DoFRenumbering::boost::Cuthill_McKee (DoFHandler &, bool, bool); +//TODO[WB]: also implement the following boost functions for hp DoFHandlers etc. +template +void +DoFRenumbering::boost::Cuthill_McKee (DoFHandler &, bool, bool); + +template +void +DoFRenumbering::boost::compute_Cuthill_McKee (std::vector &, + const DoFHandler &, bool, bool); template