]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use an intermediate CompressedSimpleSP when generating boost's graphs. Reduces the...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Apr 2009 12:35:02 +0000 (12:35 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Apr 2009 12:35:02 +0000 (12:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@18654 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 9826b460d9bda79af6c642d7f187880329c974dc..4435682ef75a9914390d87121c948fc32b71631f 100644 (file)
@@ -174,22 +174,23 @@ namespace DoFRenumbering
                         types::property_map<types::Graph,types::vertex_degree_t>::type &graph_degree)
       {
        Assert (use_constraints == false, ExcNotImplemented());
-    
-       std::vector<unsigned int> dofs_on_this_cell;
-       dofs_on_this_cell.reserve (DoFTools::max_dofs_per_cell(dof_handler));
-       typename DH::active_cell_iterator cell = dof_handler.begin_active(),
-                                         endc = dof_handler.end();
-       for (; cell!=endc; ++cell) 
-         {
-           const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell;
-           dofs_on_this_cell.resize (dofs_per_cell);
-           cell->get_dof_indices (dofs_on_this_cell);
-
-           for (unsigned int i=0; i<dofs_per_cell; ++i)
-             for (unsigned int j=0; j<dofs_per_cell; ++j)
-               add_edge(dofs_on_this_cell[i], dofs_on_this_cell[j], graph);
-         }
-
+       {
+                                  // create intermediate sparsity pattern
+                                  // (faster than directly submitting
+                                  // indices)
+         ConstraintMatrix constraints;
+         if (use_constraints) 
+           DoFTools::make_hanging_node_constraints (dof_handler, constraints);
+         constraints.close ();
+         CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(),
+                                              dof_handler.n_dofs());
+         DoFTools::make_sparsity_pattern (dof_handler, csp, constraints);
+
+                                  // submit the entries to the boost graph
+         for (unsigned int row=0;row<csp.n_rows(); ++row)
+           for (unsigned int col=0; col < csp.row_length(row); ++col)
+             add_edge (row, csp.column_number (row, col), graph);
+       }
 
        types::graph_traits<types::Graph>::vertex_iterator ui, ui_end;
 

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.