diff --git a/Src/Base/AMReX_Any.H b/Src/Base/AMReX_Any.H index 2b9edc084b7..87196c9bf4d 100644 --- a/Src/Base/AMReX_Any.H +++ b/Src/Base/AMReX_Any.H @@ -88,7 +88,7 @@ private: struct innards final : innards_base // NOLINT(cppcoreguidelines-special-member-functions) { innards (MF && mf) - : m_mf(std::forward(mf)) + : m_mf(std::move(mf)) {} ~innards () final = default; diff --git a/Src/Base/AMReX_BoxArray.cpp b/Src/Base/AMReX_BoxArray.cpp index 9413f5ae5c1..e5b41d6b9d3 100644 --- a/Src/Base/AMReX_BoxArray.cpp +++ b/Src/Base/AMReX_BoxArray.cpp @@ -61,7 +61,7 @@ BARef::BARef (const BoxList& bl) } BARef::BARef (BoxList&& bl) noexcept - : m_abox(std::move(bl.data())) + : m_abox(std::move(std::move(bl).data())) { #ifdef AMREX_MEM_PROFILING updateMemoryUsage_box(1); @@ -170,7 +170,7 @@ BARef::define (BoxList&& bl) noexcept #ifdef AMREX_MEM_PROFILING updateMemoryUsage_box(-1); #endif - m_abox = std::move(bl.data()); + m_abox = std::move(std::move(bl).data()); #ifdef AMREX_MEM_PROFILING updateMemoryUsage_box(1); #endif diff --git a/Src/Base/AMReX_GpuElixir.H b/Src/Base/AMReX_GpuElixir.H index c61f5678a2b..4c006e18c53 100644 --- a/Src/Base/AMReX_GpuElixir.H +++ b/Src/Base/AMReX_GpuElixir.H @@ -34,7 +34,7 @@ public: return *this; } - void append (Elixir && rhs) noexcept + void append (Elixir rhs) noexcept { m_pa.insert(m_pa.end(), rhs.m_pa.begin(), rhs.m_pa.end()); rhs.m_pa.clear(); diff --git a/Src/Base/AMReX_PODVector.H b/Src/Base/AMReX_PODVector.H index 0f10dfb94ef..7800fb145ed 100644 --- a/Src/Base/AMReX_PODVector.H +++ b/Src/Base/AMReX_PODVector.H @@ -423,7 +423,7 @@ namespace amrex iterator insert (const_iterator a_pos, T&& a_item) { // This is *POD* vector after all - return insert(a_pos, 1, a_item); + return insert(a_pos, 1, std::move(a_item)); } iterator insert (const_iterator a_pos, diff --git a/Src/Base/AMReX_ParallelDescriptor.H b/Src/Base/AMReX_ParallelDescriptor.H index 39c17b520e5..26d92c7b9e2 100644 --- a/Src/Base/AMReX_ParallelDescriptor.H +++ b/Src/Base/AMReX_ParallelDescriptor.H @@ -455,11 +455,11 @@ while ( false ) ReduceRealSum (T* rvar, int cnt); // Having this for backward compatibility - void ReduceRealSum (Vector >&& rvar); + void ReduceRealSum (Vector > const& rvar); // template typename std::enable_if::value>::type - ReduceRealSum (Vector >&& rvar); + ReduceRealSum (Vector > const& rvar); //! Real sum reduction to specified cpu. template @@ -471,11 +471,11 @@ while ( false ) ReduceRealSum (T* rvar, int cnt, int cpu); // Having this for backward compatibility - void ReduceRealSum (Vector >&& rvar, int cpu); + void ReduceRealSum (Vector > const& rvar, int cpu); // template typename std::enable_if::value>::type - ReduceRealSum (Vector >&& rvar, int cpu); + ReduceRealSum (Vector > const& rvar, int cpu); //! Real max reduction. template @@ -487,11 +487,11 @@ while ( false ) ReduceRealMax (T* rvar, int cnt); // Having this for backward compatibility - void ReduceRealMax (Vector >&& rvar); + void ReduceRealMax (Vector > const& rvar); // template typename std::enable_if::value>::type - ReduceRealMax (Vector >&& rvar); + ReduceRealMax (Vector > const& rvar); //! Real max reduction to specified cpu. template @@ -503,11 +503,11 @@ while ( false ) ReduceRealMax (T* rvar, int cnt, int cpu); // Having this for backward compatibility - void ReduceRealMax (Vector >&& rvar, int cpu); + void ReduceRealMax (Vector > const& rvar, int cpu); // template typename std::enable_if::value>::type - ReduceRealMax (Vector >&& rvar, int cpu); + ReduceRealMax (Vector > const& rvar, int cpu); //! Real min reduction. template @@ -519,11 +519,11 @@ while ( false ) ReduceRealMin (T* rvar, int cnt); // Having this for backward compatibility - void ReduceRealMin (Vector >&& rvar); + void ReduceRealMin (Vector > const& rvar); // template typename std::enable_if::value>::type - ReduceRealMin (Vector >&& rvar); + ReduceRealMin (Vector > const& rvar); //! Real min reduction to specified cpu. template @@ -535,74 +535,74 @@ while ( false ) ReduceRealMin (T* rvar, int cnt, int cpu); // Having this for backward compatibility - void ReduceRealMin (Vector >&& rvar, int cpu); + void ReduceRealMin (Vector > const& rvar, int cpu); // template typename std::enable_if::value>::type - ReduceRealMin (Vector >&& rvar, int cpu); + ReduceRealMin (Vector > const& rvar, int cpu); //! Integer sum reduction. void ReduceIntSum (int& rvar); void ReduceIntSum (int* rvar, int cnt); - void ReduceIntSum (Vector >&& rvar); + void ReduceIntSum (Vector > const& rvar); //! Integer sum reduction to specified cpu. void ReduceIntSum (int& rvar, int cpu); void ReduceIntSum (int* rvar, int cnt, int cpu); - void ReduceIntSum (Vector >&& rvar, int cpu); + void ReduceIntSum (Vector > const& rvar, int cpu); //! Integer max reduction. void ReduceIntMax (int& rvar); void ReduceIntMax (int* rvar, int cnt); - void ReduceIntMax (Vector >&& rvar); + void ReduceIntMax (Vector > const& rvar); //! Integer max reduction to specified cpu. void ReduceIntMax (int& rvar, int cpu); void ReduceIntMax (int* rvar, int cnt, int cpu); - void ReduceIntMax (Vector >&& rvar, int cpu); + void ReduceIntMax (Vector > const& rvar, int cpu); //! Integer min reduction. void ReduceIntMin (int& rvar); void ReduceIntMin (int* rvar, int cnt); - void ReduceIntMin (Vector >&& rvar); + void ReduceIntMin (Vector > const& rvar); //! Integer min reduction to specified cpu. void ReduceIntMin (int& rvar, int cpu); void ReduceIntMin (int* rvar, int cnt, int cpu); - void ReduceIntMin (Vector >&& rvar, int cpu); + void ReduceIntMin (Vector > const& rvar, int cpu); //! Long sum reduction. void ReduceLongSum (Long& rvar); void ReduceLongSum (Long* rvar, int cnt); - void ReduceLongSum (Vector >&& rvar); + void ReduceLongSum (Vector > const& rvar); //! Long sum reduction to specified cpu. void ReduceLongSum (Long& rvar, int cpu); void ReduceLongSum (Long* rvar, int cnt, int cpu); - void ReduceLongSum (Vector >&& rvar, int cpu); + void ReduceLongSum (Vector > const& rvar, int cpu); //! Long max reduction. void ReduceLongMax (Long& rvar); void ReduceLongMax (Long* rvar, int cnt); - void ReduceLongMax (Vector >&& rvar); + void ReduceLongMax (Vector > const& rvar); //! Long max reduction to specified cpu. void ReduceLongMax (Long& rvar, int cpu); void ReduceLongMax (Long* rvar, int cnt, int cpu); - void ReduceLongMax (Vector >&& rvar, int cpu); + void ReduceLongMax (Vector > const& rvar, int cpu); //! Long min reduction. void ReduceLongMin (Long& rvar); void ReduceLongMin (Long* rvar, int cnt); - void ReduceLongMin (Vector >&& rvar); + void ReduceLongMin (Vector > const& rvar); //! Long min reduction to specified cpu. void ReduceLongMin (Long& rvar, int cpu); void ReduceLongMin (Long* rvar, int cnt, int cpu); - void ReduceLongMin (Vector >&& rvar, int cpu); + void ReduceLongMin (Vector > const& rvar, int cpu); //! Long and-wise reduction. void ReduceLongAnd (Long& rvar); void ReduceLongAnd (Long* rvar, int cnt); - void ReduceLongAnd (Vector >&& rvar); + void ReduceLongAnd (Vector > const& rvar); //! Long and-wise reduction to specified cpu. void ReduceLongAnd (Long& rvar, int cpu); void ReduceLongAnd (Long* rvar, int cnt, int cpu); - void ReduceLongAnd (Vector >&& rvar, int cpu); + void ReduceLongAnd (Vector > const& rvar, int cpu); //! Parallel gather. void Gather (Real const* sendbuf, int nsend, Real* recvbuf, int root); @@ -1284,7 +1284,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealSum (Vector >&& rvar) + ReduceRealSum (Vector > const& rvar) { int cnt = rvar.size(); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -1309,7 +1309,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealSum (Vector >&& rvar, int cpu) + ReduceRealSum (Vector > const& rvar, int cpu) { int cnt = rvar.size(); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -1334,7 +1334,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealMax (Vector >&& rvar) + ReduceRealMax (Vector > const& rvar) { int cnt = rvar.size(); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -1359,7 +1359,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealMax (Vector >&& rvar, int cpu) + ReduceRealMax (Vector > const& rvar, int cpu) { int cnt = rvar.size(); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -1384,7 +1384,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealMin (Vector >&& rvar) + ReduceRealMin (Vector > const& rvar) { int cnt = rvar.size(); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -1409,7 +1409,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealMin (Vector >&& rvar, int cpu) + ReduceRealMin (Vector > const& rvar, int cpu) { int cnt = rvar.size(); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -1432,7 +1432,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealSum (Vector >&&) {} + ReduceRealSum (Vector > const&) {} //! Real sum reduction to specified cpu. template @@ -1445,7 +1445,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealSum (Vector >&&, int) {} + ReduceRealSum (Vector > const&, int) {} //! Real max reduction. template @@ -1458,7 +1458,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealMax (Vector >&&) {} + ReduceRealMax (Vector > const&) {} //! Real max reduction to specified cpu. template @@ -1471,7 +1471,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealMax (Vector >&&, int) {} + ReduceRealMax (Vector > const&, int) {} //! Real min reduction. template @@ -1484,7 +1484,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealMin (Vector >&&) {} + ReduceRealMin (Vector > const&) {} //! Real min reduction to specified cpu. template @@ -1497,7 +1497,7 @@ void DoReduce (T* r, MPI_Op op, int cnt, int cpu) template typename std::enable_if::value>::type - ReduceRealMin (Vector >&&, int) {} + ReduceRealMin (Vector > const&, int) {} #endif } diff --git a/Src/Base/AMReX_ParallelDescriptor.cpp b/Src/Base/AMReX_ParallelDescriptor.cpp index 67431d804f5..2ac86185ea8 100644 --- a/Src/Base/AMReX_ParallelDescriptor.cpp +++ b/Src/Base/AMReX_ParallelDescriptor.cpp @@ -551,39 +551,39 @@ Comm_dup (MPI_Comm comm, MPI_Comm& newcomm) } void -ReduceRealSum (Vector >&& rvar) +ReduceRealSum (Vector > const& rvar) { - ReduceRealSum(std::move(rvar)); + ReduceRealSum(rvar); } void -ReduceRealSum (Vector >&& rvar, int cpu) +ReduceRealSum (Vector > const& rvar, int cpu) { - ReduceRealSum(std::move(rvar), cpu); + ReduceRealSum(rvar, cpu); } void -ReduceRealMax (Vector > && rvar) +ReduceRealMax (Vector > const& rvar) { - ReduceRealMax(std::move(rvar)); + ReduceRealMax(rvar); } void -ReduceRealMax (Vector >&& rvar, int cpu) +ReduceRealMax (Vector > const& rvar, int cpu) { - ReduceRealMax(std::move(rvar), cpu); + ReduceRealMax(rvar, cpu); } void -ReduceRealMin (Vector >&& rvar) +ReduceRealMin (Vector > const& rvar) { - ReduceRealMin(std::move(rvar)); + ReduceRealMin(rvar); } void -ReduceRealMin (Vector >&& rvar, int cpu) +ReduceRealMin (Vector > const& rvar, int cpu) { - ReduceRealMin(std::move(rvar), cpu); + ReduceRealMin(rvar, cpu); } void @@ -643,7 +643,7 @@ ReduceIntSum (int* r, int cnt) } void -ReduceIntSum (Vector >&& rvar) +ReduceIntSum (Vector > const& rvar) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -666,7 +666,7 @@ ReduceIntSum (int* r, int cnt, int cpu) } void -ReduceIntSum (Vector >&& rvar, int cpu) +ReduceIntSum (Vector > const& rvar, int cpu) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -689,7 +689,7 @@ ReduceIntMax (int* r, int cnt) } void -ReduceIntMax (Vector >&& rvar) +ReduceIntMax (Vector > const& rvar) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -712,7 +712,7 @@ ReduceIntMax (int* r, int cnt, int cpu) } void -ReduceIntMax (Vector >&& rvar, int cpu) +ReduceIntMax (Vector > const& rvar, int cpu) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -735,7 +735,7 @@ ReduceIntMin (int* r, int cnt) } void -ReduceIntMin (Vector >&& rvar) +ReduceIntMin (Vector > const& rvar) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -758,7 +758,7 @@ ReduceIntMin (int* r, int cnt, int cpu) } void -ReduceIntMin (Vector >&& rvar, int cpu) +ReduceIntMin (Vector > const& rvar, int cpu) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -781,7 +781,7 @@ ReduceLongSum (Long* r, int cnt) } void -ReduceLongSum (Vector >&& rvar) +ReduceLongSum (Vector > const& rvar) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -804,7 +804,7 @@ ReduceLongSum (Long* r, int cnt, int cpu) } void -ReduceLongSum (Vector >&& rvar, int cpu) +ReduceLongSum (Vector > const& rvar, int cpu) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -827,7 +827,7 @@ ReduceLongMax (Long* r, int cnt) } void -ReduceLongMax (Vector >&& rvar) +ReduceLongMax (Vector > const& rvar) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -850,7 +850,7 @@ ReduceLongMax (Long* r, int cnt, int cpu) } void -ReduceLongMax (Vector >&& rvar, int cpu) +ReduceLongMax (Vector > const& rvar, int cpu) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -873,7 +873,7 @@ ReduceLongMin (Long* r, int cnt) } void -ReduceLongMin (Vector >&& rvar) +ReduceLongMin (Vector > const& rvar) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -896,7 +896,7 @@ ReduceLongMin (Long* r, int cnt, int cpu) } void -ReduceLongMin (Vector >&& rvar, int cpu) +ReduceLongMin (Vector > const& rvar, int cpu) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -919,7 +919,7 @@ ReduceLongAnd (Long* r, int cnt) } void -ReduceLongAnd (Vector >&& rvar) +ReduceLongAnd (Vector > const& rvar) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -942,7 +942,7 @@ ReduceLongAnd (Long* r, int cnt, int cpu) } void -ReduceLongAnd (Vector >&& rvar,int cpu) +ReduceLongAnd (Vector > const& rvar,int cpu) { auto cnt = static_cast(rvar.size()); Vector tmp{std::begin(rvar), std::end(rvar)}; @@ -1211,13 +1211,13 @@ void IProbe (int, int, MPI_Comm, int&, MPI_Status&) {} void Comm_dup (MPI_Comm, MPI_Comm&) {} -void ReduceRealSum (Vector >&& /*rvar*/) {} -void ReduceRealMax (Vector >&& /*rvar*/) {} -void ReduceRealMin (Vector >&& /*rvar*/) {} +void ReduceRealSum (Vector > const& /*rvar*/) {} +void ReduceRealMax (Vector > const& /*rvar*/) {} +void ReduceRealMin (Vector > const& /*rvar*/) {} -void ReduceRealSum (Vector >&& /*rvar*/, int /*cpu*/) {} -void ReduceRealMax (Vector >&& /*rvar*/, int /*cpu*/) {} -void ReduceRealMin (Vector >&& /*rvar*/, int /*cpu*/) {} +void ReduceRealSum (Vector > const& /*rvar*/, int /*cpu*/) {} +void ReduceRealMax (Vector > const& /*rvar*/, int /*cpu*/) {} +void ReduceRealMin (Vector > const& /*rvar*/, int /*cpu*/) {} void ReduceLongAnd (Long&) {} void ReduceLongSum (Long&) {} @@ -1239,15 +1239,15 @@ void ReduceLongSum (Long*,int,int) {} void ReduceLongMax (Long*,int,int) {} void ReduceLongMin (Long*,int,int) {} -void ReduceLongAnd (Vector >&& /*rvar*/) {} -void ReduceLongSum (Vector >&& /*rvar*/) {} -void ReduceLongMax (Vector >&& /*rvar*/) {} -void ReduceLongMin (Vector >&& /*rvar*/) {} +void ReduceLongAnd (Vector > const& /*rvar*/) {} +void ReduceLongSum (Vector > const& /*rvar*/) {} +void ReduceLongMax (Vector > const& /*rvar*/) {} +void ReduceLongMin (Vector > const& /*rvar*/) {} -void ReduceLongAnd (Vector >&& /*rvar*/, int /*cpu*/) {} -void ReduceLongSum (Vector >&& /*rvar*/, int /*cpu*/) {} -void ReduceLongMax (Vector >&& /*rvar*/, int /*cpu*/) {} -void ReduceLongMin (Vector >&& /*rvar*/, int /*cpu*/) {} +void ReduceLongAnd (Vector > const& /*rvar*/, int /*cpu*/) {} +void ReduceLongSum (Vector > const& /*rvar*/, int /*cpu*/) {} +void ReduceLongMax (Vector > const& /*rvar*/, int /*cpu*/) {} +void ReduceLongMin (Vector > const& /*rvar*/, int /*cpu*/) {} void ReduceIntSum (int&) {} void ReduceIntMax (int&) {} @@ -1265,13 +1265,13 @@ void ReduceIntSum (int*,int,int) {} void ReduceIntMax (int*,int,int) {} void ReduceIntMin (int*,int,int) {} -void ReduceIntSum (Vector >&& /*rvar*/) {} -void ReduceIntMax (Vector >&& /*rvar*/) {} -void ReduceIntMin (Vector >&& /*rvar*/) {} +void ReduceIntSum (Vector > const& /*rvar*/) {} +void ReduceIntMax (Vector > const& /*rvar*/) {} +void ReduceIntMin (Vector > const& /*rvar*/) {} -void ReduceIntSum (Vector >&& /*rvar*/, int /*cpu*/) {} -void ReduceIntMax (Vector >&& /*rvar*/, int /*cpu*/) {} -void ReduceIntMin (Vector >&& /*rvar*/, int /*cpu*/) {} +void ReduceIntSum (Vector > const& /*rvar*/, int /*cpu*/) {} +void ReduceIntMax (Vector > const& /*rvar*/, int /*cpu*/) {} +void ReduceIntMin (Vector > const& /*rvar*/, int /*cpu*/) {} void ReduceBoolAnd (bool&) {} void ReduceBoolOr (bool&) {} diff --git a/Src/Base/AMReX_VisMF.cpp b/Src/Base/AMReX_VisMF.cpp index 064d94ce757..f65d2a78641 100644 --- a/Src/Base/AMReX_VisMF.cpp +++ b/Src/Base/AMReX_VisMF.cpp @@ -2243,9 +2243,10 @@ VisMF::AsyncWrite (const FabArray& mf, const std::string& mf_name, bo } void -VisMF::AsyncWrite (FabArray&& mf, const std::string& mf_name, bool valid_cells_only) +VisMF::AsyncWrite (FabArray&& mf, const std::string& mf_name, bool valid_cells_only) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) { if (AsyncOut::UseAsyncOut()) { + // Note that we use `true` below to indicate this is rvalue. AsyncWriteDoit(mf, mf_name, true, valid_cells_only); } else { if (valid_cells_only && mf.nGrowVect() != 0) {