]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Do not remove duplicates before inserting index set elements. 15525/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 21 Jun 2023 15:40:39 +0000 (09:40 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 29 Jun 2023 15:33:54 +0000 (09:33 -0600)
include/deal.II/lac/affine_constraints.templates.h
include/deal.II/lac/sparse_matrix_tools.h
include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h
source/dofs/dof_tools.cc
source/matrix_free/dof_info.cc
source/multigrid/mg_tools.cc
source/multigrid/mg_transfer_internal.cc

index ec2674885e7be9b2703df73aff1ab47914aca993..12fdc5564df9974ab71c6c68110ca32df73ab4f4 100644 (file)
@@ -2613,10 +2613,6 @@ AffineConstraints<number>::distribute(VectorType &vec) const
             if (!vec_owned_elements.is_element(entry.first))
               additional_elements.emplace_back(entry.first);
       std::sort(additional_elements.begin(), additional_elements.end());
-      additional_elements.erase(std::unique(additional_elements.begin(),
-                                            additional_elements.end()),
-                                additional_elements.end());
-
       needed_elements.add_indices(additional_elements.begin(),
                                   additional_elements.end());
 
index 5e30faff48cb6afa6550f368cbc96b4faed0f2ee..9f2c240fe795309dd6966a8723defe40b90b13af 100644 (file)
@@ -499,10 +499,6 @@ namespace SparseMatrixTools
                                   i.end());
 
     std::sort(ghost_indices_vector.begin(), ghost_indices_vector.end());
-    ghost_indices_vector.erase(std::unique(ghost_indices_vector.begin(),
-                                           ghost_indices_vector.end()),
-                               ghost_indices_vector.end());
-
 
     IndexSet locally_active_dofs(std::get<1>(prefix_sum));
     locally_active_dofs.add_indices(ghost_indices_vector.begin(),
index c2084e1341515af29defdd1beae2ea937c94fe8c..b936273c7de64f758d0c44bf674e61196aadbf1e 100644 (file)
@@ -773,9 +773,6 @@ namespace internal
       }
 
       std::sort(ghost_indices.begin(), ghost_indices.end());
-      ghost_indices.erase(std::unique(ghost_indices.begin(),
-                                      ghost_indices.end()),
-                          ghost_indices.end());
 
       this->is_extended_ghosts =
         IndexSet(mg_level_fine == numbers::invalid_unsigned_int ?
@@ -1078,12 +1075,6 @@ namespace internal
 
       std::sort(locally_relevant_dofs_temp.begin(),
                 locally_relevant_dofs_temp.end());
-
-      locally_relevant_dofs_temp.erase(
-        std::unique(locally_relevant_dofs_temp.begin(),
-                    locally_relevant_dofs_temp.end()),
-        locally_relevant_dofs_temp.end());
-
       locally_relevant_dofs.add_indices(locally_relevant_dofs_temp.begin(),
                                         locally_relevant_dofs_temp.end());
 
index d91d71625717c491cacc4cbff35d2e5fef4b87f9..d460e6cd4fccca721751d33dc2cafc7c7a702894 100644 (file)
@@ -1159,11 +1159,9 @@ namespace DoFTools
               dofs_on_ghosts.push_back(dof_index);
         }
 
-    // sort, compress out duplicates, fill into index set
+    // sort and put into an index set
     std::sort(dofs_on_ghosts.begin(), dofs_on_ghosts.end());
-    dof_set.add_indices(dofs_on_ghosts.begin(),
-                        std::unique(dofs_on_ghosts.begin(),
-                                    dofs_on_ghosts.end()));
+    dof_set.add_indices(dofs_on_ghosts.begin(), dofs_on_ghosts.end());
     dof_set.compress();
 
     return dof_set;
@@ -1217,12 +1215,9 @@ namespace DoFTools
             dofs_on_ghosts.push_back(dof_index);
       }
 
-    // sort, compress out duplicates, fill into index set
+    // sort and fill into an index set
     std::sort(dofs_on_ghosts.begin(), dofs_on_ghosts.end());
-    dof_set.add_indices(dofs_on_ghosts.begin(),
-                        std::unique(dofs_on_ghosts.begin(),
-                                    dofs_on_ghosts.end()));
-
+    dof_set.add_indices(dofs_on_ghosts.begin(), dofs_on_ghosts.end());
     dof_set.compress();
 
     return dof_set;
@@ -1690,13 +1685,8 @@ namespace DoFTools
                                    local_dof_indices.begin(),
                                    local_dof_indices.end());
         }
-    // sort indices and remove duplicates
+    // sort indices and put into an index set:
     std::sort(subdomain_indices.begin(), subdomain_indices.end());
-    subdomain_indices.erase(std::unique(subdomain_indices.begin(),
-                                        subdomain_indices.end()),
-                            subdomain_indices.end());
-
-    // insert into IndexSet
     index_set.add_indices(subdomain_indices.begin(), subdomain_indices.end());
     index_set.compress();
 
index d6f12cd6fb6ff157154dc5dd99cc44f971428f27..fd86229c5ea57b2e9c2ab61bf9267d66ee685d21 100644 (file)
@@ -930,9 +930,6 @@ namespace internal
                   part.local_to_global(plain_dof_indices[i]));
           }
         std::sort(ghost_indices.begin(), ghost_indices.end());
-        ghost_indices.erase(std::unique(ghost_indices.begin(),
-                                        ghost_indices.end()),
-                            ghost_indices.end());
         IndexSet compressed_set(part.size());
         compressed_set.add_indices(ghost_indices.begin(), ghost_indices.end());
         compressed_set.subtract_set(part.locally_owned_range());
@@ -1084,9 +1081,6 @@ namespace internal
                                          part.get_mpi_communicator()) != 0;
 
               std::sort(ghost_indices.begin(), ghost_indices.end());
-              ghost_indices.erase(std::unique(ghost_indices.begin(),
-                                              ghost_indices.end()),
-                                  ghost_indices.end());
               IndexSet compressed_set(part.size());
               compressed_set.add_indices(ghost_indices.begin(),
                                          ghost_indices.end());
@@ -1161,9 +1155,6 @@ namespace internal
                   }
               });
               std::sort(ghost_indices.begin(), ghost_indices.end());
-              ghost_indices.erase(std::unique(ghost_indices.begin(),
-                                              ghost_indices.end()),
-                                  ghost_indices.end());
               IndexSet compressed_set(part.size());
               compressed_set.add_indices(ghost_indices.begin(),
                                          ghost_indices.end());
index ae4d802c059e1dea1128a88a9374e61dfd99a033..011a9cb9bb6404eb3e38a1a95cd745767b249029 100644 (file)
@@ -1432,10 +1432,8 @@ namespace MGTools
          ++level)
       {
         std::sort(dofs_by_level[level].begin(), dofs_by_level[level].end());
-        boundary_indices[level].add_indices(
-          dofs_by_level[level].begin(),
-          std::unique(dofs_by_level[level].begin(),
-                      dofs_by_level[level].end()));
+        boundary_indices[level].add_indices(dofs_by_level[level].begin(),
+                                            dofs_by_level[level].end());
       }
   }
 
@@ -1521,8 +1519,7 @@ namespace MGTools
         interface_dofs[l].clear();
         std::sort(tmp_interface_dofs[l].begin(), tmp_interface_dofs[l].end());
         interface_dofs[l].add_indices(tmp_interface_dofs[l].begin(),
-                                      std::unique(tmp_interface_dofs[l].begin(),
-                                                  tmp_interface_dofs[l].end()));
+                                      tmp_interface_dofs[l].end());
         interface_dofs[l].compress();
       }
   }
index 8bcced916af2c896af0ef2c33768855830fcb9be..7d4be4e0207a90a4c0049f4c3b1a6509eeb44a5a 100644 (file)
@@ -407,8 +407,7 @@ namespace internal
       std::sort(ghosted_level_dofs.begin(), ghosted_level_dofs.end());
       IndexSet ghosted_dofs(locally_owned.size());
       ghosted_dofs.add_indices(ghosted_level_dofs.begin(),
-                               std::unique(ghosted_level_dofs.begin(),
-                                           ghosted_level_dofs.end()));
+                               ghosted_level_dofs.end());
       ghosted_dofs.compress();
 
       // Add possible ghosts from the previous content in the vector

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.