]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fixed a bug in shared::Tria where...
authorDenis Davydov <davydden@gmail.com>
Fri, 30 Oct 2015 22:47:29 +0000 (23:47 +0100)
committerDenis Davydov <davydden@gmail.com>
Fri, 30 Oct 2015 22:47:29 +0000 (23:47 +0100)
true_subdomain_ids_of_cells was not set up for the case
without artificial cells.

source/distributed/shared_tria.cc
source/dofs/dof_tools.cc

index 218cff2ff1f8df625661dc748e4ef4f4e85471c7..b37368918aef46d90ad75af946aa9828ed008983 100644 (file)
@@ -58,10 +58,15 @@ namespace parallel
     {
       dealii::GridTools::partition_triangulation (this->n_subdomains, *this);
 
+      true_subdomain_ids_of_cells.resize(this->n_active_cells());
+
+      // loop over all cells and mark artificial:
+      typename parallel::shared::Triangulation<dim,spacedim>::active_cell_iterator
+      cell = this->begin_active(),
+      endc = this->end();
+
       if (allow_artificial_cells)
         {
-          true_subdomain_ids_of_cells.resize(this->n_active_cells());
-
           // get halo layer of (ghost) cells
           // parallel::shared::Triangulation<dim>::
           std_cxx11::function<bool (const typename parallel::shared::Triangulation<dim,spacedim>::active_cell_iterator &)> predicate
@@ -72,10 +77,6 @@ namespace parallel
           std::set<typename parallel::shared::Triangulation<dim,spacedim>::active_cell_iterator>
           active_halo_layer(active_halo_layer_vector.begin(), active_halo_layer_vector.end());
 
-          // loop over all cells and mark artificial:
-          typename parallel::shared::Triangulation<dim,spacedim>::active_cell_iterator
-          cell = this->begin_active(),
-          endc = this->end();
           for (unsigned int index=0; cell != endc; cell++, index++)
             {
               // store original/true subdomain ids:
@@ -86,6 +87,13 @@ namespace parallel
                 cell->set_subdomain_id(numbers::artificial_subdomain_id);
             }
         }
+      else
+        {
+          // just store true subdomain ids
+          for (unsigned int index=0; cell != endc; cell++, index++)
+            true_subdomain_ids_of_cells[index] = cell->subdomain_id();
+
+        }
     }
 
     template <int dim, int spacedim>
index 9e9506670695a3ff9c493479aca097a2eace112c..205cd6baa459c074577f5fc580acf9b0de3976b0 100644 (file)
@@ -1252,7 +1252,7 @@ namespace DoFTools
                       "This could happen when the function is called before NumberCache is written."));
 
     // In case this function is executed with parallel::shared::Triangulation
-    // with artifical cells, we need to take "true" subdomain IDs (i.e. without
+    // with possibly artifical cells, we need to take "true" subdomain IDs (i.e. without
     // artificial cells). Otherwise we are good to use subdomain_id as stored
     // in cell->subdomain_id().
     std::vector<types::subdomain_id> cell_owners (dof_handler.get_tria().n_active_cells());
@@ -1260,6 +1260,8 @@ namespace DoFTools
           (dynamic_cast<const parallel::shared::Triangulation<DH::dimension, DH::space_dimension>*> (&dof_handler.get_tria ())))
       {
         cell_owners = tr->get_true_subdomain_ids_of_cells();
+        Assert (tr->get_true_subdomain_ids_of_cells().size() == tr->n_active_cells(),
+                ExcInternalError());
       }
     else
       {

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.