From: Wolfgang Bangerth Date: Tue, 24 Oct 2023 23:17:06 +0000 (-0600) Subject: Move things into place, rather than swap. X-Git-Tag: relicensing~359^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16187%2Fhead;p=dealii.git Move things into place, rather than swap. --- diff --git a/source/fe/fe_dgq.cc b/source/fe/fe_dgq.cc index ade082048e..b07c9daad9 100644 --- a/source/fe/fe_dgq.cc +++ b/source/fe/fe_dgq.cc @@ -448,8 +448,8 @@ FE_DGQ::get_prolongation_matrix( FETools::compute_embedding_matrices(FE_DGQ(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::get_restriction_matrix( FETools::compute_projection_matrices(FE_DGQ(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 { diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 09e453e41a..bf43bb22d4 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -1438,9 +1438,9 @@ FE_Q_Base::get_prolongation_matrix( } # endif - // swap matrices - prolongate.swap(const_cast &>( - this->prolongation[refinement_case - 1][child])); + // move result into place + const_cast &>( + this->prolongation[refinement_case - 1][child]) = std::move(prolongate); } // finally return the matrix @@ -1581,10 +1581,10 @@ FE_Q_Base::get_restriction_matrix( RefinementCase(refinement_case)); } - // swap the just computed restriction matrix into the - // element of the vector stored in the base class - my_restriction.swap(const_cast &>( - this->restriction[refinement_case - 1][child])); + // move result into place + const_cast &>( + this->restriction[refinement_case - 1][child]) = + std::move(my_restriction); } return this->restriction[refinement_case - 1][child]; diff --git a/source/fe/fe_raviart_thomas_nodal.cc b/source/fe/fe_raviart_thomas_nodal.cc index f00b69c395..5e27b59971 100644 --- a/source/fe/fe_raviart_thomas_nodal.cc +++ b/source/fe/fe_raviart_thomas_nodal.cc @@ -703,8 +703,8 @@ FE_RaviartThomasNodal::get_prolongation_matrix( FullMatrix(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::get_restriction_matrix( FullMatrix(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 { diff --git a/source/fe/fe_simplex_p.cc b/source/fe/fe_simplex_p.cc index 767d5b1ab5..27641d01c5 100644 --- a/source/fe/fe_simplex_p.cc +++ b/source/fe/fe_simplex_p.cc @@ -385,8 +385,8 @@ FE_SimplexPoly::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::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 diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index 0b75994764..da84c7809f 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -2616,7 +2616,8 @@ FESystem::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