]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move things into place, rather than swap. 16187/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 24 Oct 2023 23:17:06 +0000 (17:17 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 24 Oct 2023 23:17:06 +0000 (17:17 -0600)
source/fe/fe_dgq.cc
source/fe/fe_q_base.cc
source/fe/fe_raviart_thomas_nodal.cc
source/fe/fe_simplex_p.cc
source/fe/fe_system.cc

index ade082048e1176694b560d1f43e3489ec80e029f..b07c9daad9d50b2b6977abaa5204690498a84b03 100644 (file)
@@ -448,8 +448,8 @@ FE_DGQ<dim, spacedim>::get_prolongation_matrix(
             FETools::compute_embedding_matrices(FE_DGQ<dim>(this->degree),
                                                 isotropic_matrices,
                                                 true);
-          this_nonconst.prolongation[refinement_case - 1].swap(
-            isotropic_matrices.back());
+          this_nonconst.prolongation[refinement_case - 1] =
+            std::move(isotropic_matrices.back());
         }
       else
         {
@@ -524,8 +524,8 @@ FE_DGQ<dim, spacedim>::get_restriction_matrix(
             FETools::compute_projection_matrices(FE_DGQ<dim>(this->degree),
                                                  isotropic_matrices,
                                                  true);
-          this_nonconst.restriction[refinement_case - 1].swap(
-            isotropic_matrices.back());
+          this_nonconst.restriction[refinement_case - 1] =
+            std::move(isotropic_matrices.back());
         }
       else
         {
index 09e453e41adb659db2e6bb316266ae4759e33b69..bf43bb22d4cf426ab1fc95efc59f3bf8f1977931 100644 (file)
@@ -1438,9 +1438,9 @@ FE_Q_Base<dim, spacedim>::get_prolongation_matrix(
         }
 #  endif
 
-      // swap matrices
-      prolongate.swap(const_cast<FullMatrix<double> &>(
-        this->prolongation[refinement_case - 1][child]));
+      // move result into place
+      const_cast<FullMatrix<double> &>(
+        this->prolongation[refinement_case - 1][child]) = std::move(prolongate);
     }
 
   // finally return the matrix
@@ -1581,10 +1581,10 @@ FE_Q_Base<dim, spacedim>::get_restriction_matrix(
                      RefinementCase<dim>(refinement_case));
         }
 
-      // swap the just computed restriction matrix into the
-      // element of the vector stored in the base class
-      my_restriction.swap(const_cast<FullMatrix<double> &>(
-        this->restriction[refinement_case - 1][child]));
+      // move result into place
+      const_cast<FullMatrix<double> &>(
+        this->restriction[refinement_case - 1][child]) =
+        std::move(my_restriction);
     }
 
   return this->restriction[refinement_case - 1][child];
index f00b69c3958214019cba9f7437b16e22a397800b..5e27b599719db9ab41a38994068f424c72d9f813 100644 (file)
@@ -703,8 +703,8 @@ FE_RaviartThomasNodal<dim>::get_prolongation_matrix(
             FullMatrix<double>(this->n_dofs_per_cell(),
                                this->n_dofs_per_cell()));
           FETools::compute_embedding_matrices(*this, isotropic_matrices, true);
-          this_nonconst.prolongation[refinement_case - 1].swap(
-            isotropic_matrices.back());
+          this_nonconst.prolongation[refinement_case - 1] =
+            std::move(isotropic_matrices.back());
         }
       else
         {
@@ -761,8 +761,8 @@ FE_RaviartThomasNodal<dim>::get_restriction_matrix(
             FullMatrix<double>(this->n_dofs_per_cell(),
                                this->n_dofs_per_cell()));
           FETools::compute_projection_matrices(*this, isotropic_matrices, true);
-          this_nonconst.restriction[refinement_case - 1].swap(
-            isotropic_matrices.back());
+          this_nonconst.restriction[refinement_case - 1] =
+            std::move(isotropic_matrices.back());
         }
       else
         {
index 767d5b1ab503a5e98ad13903221c671955d97b15..27641d01c57ba0d13a320c30b99090434051edcf 100644 (file)
@@ -385,8 +385,8 @@ FE_SimplexPoly<dim, spacedim>::get_prolongation_matrix(
 
       FETools::compute_embedding_matrices(*this, isotropic_matrices, true);
 
-      this_nonconst.prolongation[refinement_case - 1].swap(
-        isotropic_matrices.back());
+      this_nonconst.prolongation[refinement_case - 1] =
+        std::move(isotropic_matrices.back());
     }
 
   // finally return the matrix
@@ -427,8 +427,8 @@ FE_SimplexPoly<dim, spacedim>::get_restriction_matrix(
 
       FETools::compute_projection_matrices(*this, isotropic_matrices, true);
 
-      this_nonconst.restriction[refinement_case - 1].swap(
-        isotropic_matrices.back());
+      this_nonconst.restriction[refinement_case - 1] =
+        std::move(isotropic_matrices.back());
     }
 
   // finally return the matrix
index 0b7599476443d5d867e366f89aa7bbddfa313770..da84c7809fd40f9f8316f953e84e4aa53ba3aec4 100644 (file)
@@ -2616,7 +2616,8 @@ FESystem<dim, spacedim>::get_constant_modes() const
           for (unsigned int r = 0; r < comp; ++r)
             for (unsigned int c = 0; c < this->n_dofs_per_cell(); ++c)
               new_constant_modes(r, c) = constant_modes(r, c);
-          constant_modes.swap(new_constant_modes);
+
+          constant_modes = std::move(new_constant_modes);
         }
 
       // next, fill the constant modes from the individual components as well

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.