]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
fixed some white spaces and indentation branch_sharedtria
authordenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 11 Jul 2014 21:32:23 +0000 (21:32 +0000)
committerdenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 11 Jul 2014 21:32:23 +0000 (21:32 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@33139 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/dofs/dof_handler_policy.cc
deal.II/source/dofs/dof_tools.cc

index 462e3372dba678076bc3e6f243aa743eaa6abe62..9fce8e113616d4fb46dca54f82493fb32c3820c9 100644 (file)
@@ -1022,6 +1022,8 @@ namespace internal
              const unsigned int this_process =
                  Utilities::MPI::this_mpi_process (tr->get_communicator ());
              std::vector<types::global_dof_index> gathered_new_numbers (dof_handler.n_dofs (), 0);
+             Assert(this_process == dof_handler.get_tria ().locally_owned_subdomain (),
+                    ExcInternalError())
 
              //debug (TODO: remove when everything works):
              if (renumber_debug)
@@ -1057,15 +1059,18 @@ namespace internal
                  for (unsigned int i = 0; i < n_cpu; i++)
                    {
                      displs[i]  = shift;
+                     //rcounts[i] = dof_handler.n_locally_owned_dofs_per_processor()[i];
                      rcounts[i] = number_cache_current.n_locally_owned_dofs_per_processor[i];
                      shift     += rcounts[i];
                    }
+                 Assert(((int)new_numbers_copy.size()) == rcounts[this_process],
+                        ExcInternalError());
                  MPI_Allgatherv (&new_numbers_copy[0],     new_numbers_copy.size (),
                                  DEAL_II_DOF_INDEX_MPI_TYPE,
                                  &gathered_new_numbers[0], &rcounts[0],
                                  &displs[0],
                                  DEAL_II_DOF_INDEX_MPI_TYPE,
-                                tr->get_communicator ());
+                                 tr->get_communicator ());
                }
 
              //debug (TODO: remove when everything works):
@@ -1117,9 +1122,9 @@ namespace internal
                  shift += iset.n_elements ();
                }
 
-             Assert(*max_element(flag_1.begin(), flag_1.end()) == 1,
+             Assert(*std::max_element(flag_1.begin(), flag_1.end()) == 1,
                     ExcInternalError());
-             Assert(*min_element(flag_1.begin(), flag_1.end()) == 1,
+             Assert(*std::min_element(flag_1.begin(), flag_1.end()) == 1,
                     ExcInternalError());
              Assert((*std::max_element(flag_2.begin(), flag_2.end())) == 1,
                     ExcInternalError());
index 0b43671c1385e78423e11406fbeb49f7c0bd69ac..160d0cde746a2d1bdbe3d479c2b6bbe76e0b00d4 100644 (file)
@@ -1079,41 +1079,49 @@ namespace DoFTools
   std::vector<IndexSet>
   locally_owned_dofs_with_subdomain (const DH  &dof_handler)
   {
-         //the following is a random process (flip of a coin), thus should be called once only.
-         std::vector< types::subdomain_id > subdomain_association(dof_handler.n_dofs());
-         DoFTools::get_subdomain_association(dof_handler,subdomain_association);
+    //the following is a random process (flip of a coin), thus should be called once only.
+    std::vector< dealii::types::subdomain_id > subdomain_association (dof_handler.n_dofs ());
+    dealii::DoFTools::get_subdomain_association (dof_handler, subdomain_association);
 
-         const unsigned int num_subdomains = 1 + (*max_element(subdomain_association.begin(), subdomain_association.end()));
+    const unsigned int n_subdomains = 1 + (*std::max_element (subdomain_association.begin (),
+                                                              subdomain_association.end ()   ));
 
-         std::vector<IndexSet> index_sets (num_subdomains,IndexSet(dof_handler.n_dofs()));
+    std::vector<dealii::IndexSet> index_sets (n_subdomains,dealii::IndexSet(dof_handler.n_dofs()));
 
-         //loop over subdomain_association
-         //and populate IndexSet when
-         //a change in subdomain ID is found
-         types::global_dof_index i_min = 0;
-         types::global_dof_index cur_subdomain = subdomain_association[0];
-         for (types::global_dof_index ind = 1; ind < subdomain_association.size(); ind++)
-         {
-                 //found index different from the current one
-                 if (subdomain_association[ind] != cur_subdomain)
-                 {
-                         index_sets[cur_subdomain].add_range(i_min,ind);
-                         i_min = ind;
-                         cur_subdomain = subdomain_association[ind];
-                 }
-         }
-         //the very last element is of different index
-         if (i_min == subdomain_association.size()-1)
-         {
-                 index_sets[cur_subdomain].add_index(i_min);
-         }
-         else //there are at least two different indices
+    // loop over subdomain_association and populate IndexSet when a
+    // change in subdomain ID is found
+    dealii::types::global_dof_index i_min          = 0;
+    dealii::types::global_dof_index this_subdomain = subdomain_association[0];
+
+    for (dealii::types::global_dof_index index = 1;
+       index < subdomain_association.size (); ++index)
+      {
+       //found index different from the current one
+       if (subdomain_association[index] != this_subdomain)
          {
-                 index_sets[cur_subdomain].add_range(i_min,subdomain_association.size());
+           index_sets[this_subdomain].add_range (i_min, index);
+           i_min = index;
+           this_subdomain = subdomain_association[index];
          }
-         for (unsigned int i = 0;i< num_subdomains; i++)
-                 index_sets[i].compress();
-         return index_sets;
+      }
+
+    // the very last element is of different index
+    if (i_min == subdomain_association.size () - 1)
+      {
+       index_sets[this_subdomain].add_index (i_min);
+      }
+
+    // otherwise there are at least two different indices
+    else
+      {
+       index_sets[this_subdomain].add_range (
+           i_min, subdomain_association.size ());
+      }
+
+    for (unsigned int i = 0; i < n_subdomains; i++)
+      index_sets[i].compress ();
+
+    return index_sets;
   }
 
   template <class DH>

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.