]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
attempt to fix failing multigrid tests (is_locally_owned only works with active cells...
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 1 Jun 2013 19:10:23 +0000 (19:10 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 1 Jun 2013 19:10:23 +0000 (19:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@29719 0785d39b-7218-0410-832d-ea1e28bc413d

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

index fce9f3fb95f7304140c8b63b0fde860b81b5baf4..0b750d627a4be9da9da31c24e360602a9413f3d5 100644 (file)
@@ -821,7 +821,8 @@ namespace DoFRenumbering
   compute_component_wise (std::vector<unsigned int> &new_dof_indices,
                           const ITERATOR &start,
                           const ENDITERATOR &end,
-                          const std::vector<unsigned int> &target_component);
+                          const std::vector<unsigned int> &target_component,
+                          bool is_level_operation);
 
   /**
    * @}
index 8295743bfa0ccdfe770b6b78eef9fc2b9d16b659..30281f1ea26ce9f83193cff1cffe5e014bcc567f 100644 (file)
@@ -475,7 +475,7 @@ namespace DoFRenumbering
       compute_component_wise<dim,spacedim,
       typename DoFHandler<dim,spacedim>::active_cell_iterator,
       typename DoFHandler<dim,spacedim>::level_cell_iterator>
-      (renumbering, start, end, component_order_arg);
+      (renumbering, start, end, component_order_arg, false);
     if (result == 0)
       return;
 
@@ -531,7 +531,7 @@ namespace DoFRenumbering
       compute_component_wise<hp::DoFHandler<dim>::dimension,hp::DoFHandler<dim>::space_dimension,
       typename hp::DoFHandler<dim>::active_cell_iterator,
       typename hp::DoFHandler<dim>::level_cell_iterator>
-      (renumbering, start, end, component_order_arg);
+      (renumbering, start, end, component_order_arg, false);
 
     if (result == 0) return;
 
@@ -561,7 +561,7 @@ namespace DoFRenumbering
     const unsigned int result =
       compute_component_wise<DH::dimension, DH::space_dimension,
       typename DH::level_cell_iterator, typename DH::level_cell_iterator>
-      (renumbering, start, end, component_order_arg);
+      (renumbering, start, end, component_order_arg, true);
 
     if (result == 0) return;
 
@@ -579,7 +579,8 @@ namespace DoFRenumbering
   compute_component_wise (std::vector<unsigned int> &new_indices,
                           const ITERATOR    &start,
                           const ENDITERATOR &end,
-                          const std::vector<unsigned int> &component_order_arg)
+                          const std::vector<unsigned int> &component_order_arg,
+                          bool is_level_operation)
   {
     const hp::FECollection<dim,spacedim>
     fe_collection (start->get_dof_handler().get_fe ());
@@ -660,20 +661,32 @@ namespace DoFRenumbering
     std::vector<std::vector<unsigned int> >
     component_to_dof_map (fe_collection.n_components());
     for (ITERATOR cell=start; cell!=end; ++cell)
-      if (cell->is_locally_owned())
-        {
-          // on each cell: get dof indices
-          // and insert them into the global
-          // list using their component
-          const unsigned int fe_index = cell->active_fe_index();
-          const unsigned int dofs_per_cell = fe_collection[fe_index].dofs_per_cell;
-          local_dof_indices.resize (dofs_per_cell);
-          cell->get_active_or_mg_dof_indices (local_dof_indices);
-          for (unsigned int i=0; i<dofs_per_cell; ++i)
-            if (start->get_dof_handler().locally_owned_dofs().is_element(local_dof_indices[i]))
-              component_to_dof_map[component_list[fe_index][i]].
-              push_back (local_dof_indices[i]);
-        }
+      {
+        if (is_level_operation)
+          {
+            //we are dealing with mg dofs, skip foreign level cells:
+            if (cell->level_subdomain_id()!=start->get_dof_handler().get_tria().locally_owned_subdomain())
+              continue;
+          }
+        else
+          {
+            //we are dealing with active dofs, skip the loop if not locally
+            // owned:
+            if (!cell->active() || !cell->is_locally_owned())
+              continue;
+          }
+        // on each cell: get dof indices
+        // and insert them into the global
+        // list using their component
+        const unsigned int fe_index = cell->active_fe_index();
+        const unsigned int dofs_per_cell = fe_collection[fe_index].dofs_per_cell;
+        local_dof_indices.resize (dofs_per_cell);
+        cell->get_active_or_mg_dof_indices (local_dof_indices);
+        for (unsigned int i=0; i<dofs_per_cell; ++i)
+          if (start->get_dof_handler().locally_owned_dofs().is_element(local_dof_indices[i]))
+            component_to_dof_map[component_list[fe_index][i]].
+            push_back (local_dof_indices[i]);
+      }
 
     // now we've got all indices sorted
     // into buckets labeled by their

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.