diff --git a/.clang-tidy b/.clang-tidy index fc4fd05fa1b..4b29e37a657 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -39,7 +39,6 @@ Checks: > -modernize-macro-to-enum, -modernize-return-braced-init-list, -modernize-use-constraints, - -modernize-use-designated-initializers, -modernize-use-integer-sign-comparison, -modernize-use-ranges, -modernize-use-starts-ends-with, @@ -79,7 +78,6 @@ HeaderFileExtensions: ['', "H", 'h', 'hh', 'hpp', 'hxx'] # We will try to modernize this after switching to C++20 # -modernize-use-constraints -# -modernize-use-designated-initializers # -modernize-use-std-numbers # -modernize-use-ranges # -modernize-use-integer-sign-comparison diff --git a/Src/Amr/AMReX_StateData.cpp b/Src/Amr/AMReX_StateData.cpp index 60363f4e06e..f554378686d 100644 --- a/Src/Amr/AMReX_StateData.cpp +++ b/Src/Amr/AMReX_StateData.cpp @@ -30,8 +30,8 @@ std::map > *StateData::faHeaderMap; StateData::StateData () : - new_time{INVALID_TIME,INVALID_TIME}, - old_time{INVALID_TIME,INVALID_TIME} + new_time{.start = INVALID_TIME, .stop = INVALID_TIME}, + old_time{.start = INVALID_TIME, .stop = INVALID_TIME} { } diff --git a/Src/AmrCore/AMReX_FluxRegister.cpp b/Src/AmrCore/AMReX_FluxRegister.cpp index 68c5734ff57..bb7281795bc 100644 --- a/Src/AmrCore/AMReX_FluxRegister.cpp +++ b/Src/AmrCore/AMReX_FluxRegister.cpp @@ -239,7 +239,7 @@ FluxRegister::CrseInit (const MultiFab& mflx, auto dfab = bndry[face].array(mfi); #ifdef AMREX_USE_GPU if (Gpu::inLaunchRegion()) { - tags.push_back({dfab, sfab, bx}); + tags.push_back(Tag{.dfab = dfab, .sfab = sfab, .dbox = bx}); } else #endif { @@ -675,7 +675,7 @@ FluxRegister::ClearInternalBorders (const Geometry& geom) auto const& frarr = frlo[fsi].array(); for (auto const& is : isects) { if (Gpu::inLaunchRegion()) { - tags.emplace_back(Array4BoxTag{frarr, is.second}); + tags.emplace_back(Array4BoxTag{.dfab = frarr, .dbox = is.second}); } else { frlo[fsi].setVal(0.0, is.second, 0, nc); } @@ -687,7 +687,7 @@ FluxRegister::ClearInternalBorders (const Geometry& geom) for (auto const& is : isects2) { const Box& bx2 = amrex::shift(is.second, dir, -domain.length(dir)); if (Gpu::inLaunchRegion()) { - tags.emplace_back(Array4BoxTag{frarr, bx2}); + tags.emplace_back(Array4BoxTag{.dfab = frarr, .dbox = bx2}); } else { frlo[fsi].setVal(0.0, bx2, 0, nc); } @@ -702,7 +702,7 @@ FluxRegister::ClearInternalBorders (const Geometry& geom) auto const& frarr = frhi[fsi].array(); for (auto const& is : isects) { if (Gpu::inLaunchRegion()) { - tags.emplace_back(Array4BoxTag{frarr, is.second}); + tags.emplace_back(Array4BoxTag{.dfab = frarr, .dbox = is.second}); } else { frhi[fsi].setVal(0.0, is.second, 0, nc); } @@ -714,7 +714,7 @@ FluxRegister::ClearInternalBorders (const Geometry& geom) for (auto const& is : isects2) { const Box& bx2 = amrex::shift(is.second, dir, domain.length(dir)); if (Gpu::inLaunchRegion()) { - tags.emplace_back(Array4BoxTag{frarr, bx2}); + tags.emplace_back(Array4BoxTag{.dfab = frarr, .dbox = bx2}); } else { frhi[fsi].setVal(0.0, bx2, 0, nc); } @@ -813,7 +813,7 @@ FluxRegister::OverwriteFlux (Array const& crse_fluxes, Box const& b = is.second-iv; #ifdef AMREX_USE_GPU if (run_on_gpu) { - tags.push_back({fab,b}); + tags.push_back(Array4BoxTag{.dfab = fab, .dbox = b}); } else #endif { diff --git a/Src/AmrCore/AMReX_InterpFaceRegister.cpp b/Src/AmrCore/AMReX_InterpFaceRegister.cpp index ae5beb1985c..d24c55f9c12 100644 --- a/Src/AmrCore/AMReX_InterpFaceRegister.cpp +++ b/Src/AmrCore/AMReX_InterpFaceRegister.cpp @@ -49,7 +49,7 @@ void InterpFaceRegister::define (BoxArray const& fba, DistributionMapping const& ? crse_fine_face : fine_fine_face; #ifdef AMREX_USE_GPU if (Gpu::inLaunchRegion()) { - tags.emplace_back(Array4BoxValTag{fab.array(),dbox,value}); + tags.emplace_back(Array4BoxValTag{.dfab = fab.array(), .dbox = dbox, .val = value}); } else #endif { @@ -143,8 +143,10 @@ InterpFaceRegister::interp (Array const& fine, // NOL auto const& chi_arr = chidata.const_array(mfi); auto const& mlo_arr = mlo_mf.const_array(mfi); auto const& mhi_arr = mhi_mf.const_array(mfi); - tags.push_back(IFRTag{fine_arr, slo_arr, clo_arr, mlo_arr, domlo}); - tags.push_back(IFRTag{fine_arr, shi_arr, chi_arr, mhi_arr, domhi}); + tags.push_back(IFRTag{.fine = fine_arr, .slope = slo_arr, .crse = clo_arr, + .mask = mlo_arr, .domface = domlo}); + tags.push_back(IFRTag{.fine = fine_arr, .slope = shi_arr, .crse = chi_arr, + .mask = mhi_arr, .domface = domhi}); } ParallelFor(tags, [=] AMREX_GPU_DEVICE (int i, int j, int k, IFRTag const& tag) noexcept diff --git a/Src/AmrCore/AMReX_TagBox.cpp b/Src/AmrCore/AMReX_TagBox.cpp index 3e8f4eb5609..7d7adbaf27a 100644 --- a/Src/AmrCore/AMReX_TagBox.cpp +++ b/Src/AmrCore/AMReX_TagBox.cpp @@ -40,7 +40,7 @@ TagBox::coarsen (const IntVect& ratio, const Box& cbox) noexcept Array4 const& carr = cfab.array(); Box fdomain = domain; - Dim3 r{1,1,1}; + Dim3 r{.x = 1, .y = 1, .z = 1}; AMREX_D_TERM(r.x = ratio[0];, r.y = ratio[1];, r.z = ratio[2]); AMREX_HOST_DEVICE_FOR_3D(cbox, i, j, k, @@ -694,7 +694,7 @@ TagBoxArray::setVal (const BoxArray& ba, TagBox::TagVal val) Box const& b = is.second; #ifdef AMREX_USE_GPU if (run_on_gpu) { - tags.push_back({arr,b}); + tags.push_back(Array4BoxTag{.dfab = arr, .dbox = b}); } else #endif { diff --git a/Src/Base/AMReX_Array.H b/Src/Base/AMReX_Array.H index f923416764d..0ea73293079 100644 --- a/Src/Base/AMReX_Array.H +++ b/Src/Base/AMReX_Array.H @@ -1092,11 +1092,11 @@ namespace amrex inline XDim3 makeXDim3 (const Array& a) noexcept { #if (AMREX_SPACEDIM == 1) - return XDim3{a[0], 0., 0.}; + return XDim3{.x = a[0], .y = 0., .z = 0.}; #elif (AMREX_SPACEDIM == 2) - return XDim3{a[0], a[1], 0.}; + return XDim3{.x = a[0], .y = a[1], .z = 0.}; #else - return XDim3{a[0], a[1], a[2]}; + return XDim3{.x = a[0], .y = a[1], .z = a[2]}; #endif } } diff --git a/Src/Base/AMReX_Array4.H b/Src/Base/AMReX_Array4.H index 81322b1b28d..f16aec45940 100644 --- a/Src/Base/AMReX_Array4.H +++ b/Src/Base/AMReX_Array4.H @@ -1316,7 +1316,7 @@ namespace amrex { [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound (Array4 const& a) noexcept { - return Dim3{a.begin.vect[0],a.begin.vect[1],a.begin.vect[2]}; + return Dim3{.x = a.begin.vect[0], .y = a.begin.vect[1], .z = a.begin.vect[2]}; } /** @@ -1330,7 +1330,7 @@ namespace amrex { [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound (Array4 const& a) noexcept { - return Dim3{a.end.vect[0]-1,a.end.vect[1]-1,a.end.vect[2]-1}; + return Dim3{.x = a.end.vect[0]-1, .y = a.end.vect[1]-1, .z = a.end.vect[2]-1}; } /** @@ -1344,7 +1344,9 @@ namespace amrex { [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 length (Array4 const& a) noexcept { - return Dim3{a.end.vect[0]-a.begin.vect[0],a.end.vect[1]-a.begin.vect[1],a.end.vect[2]-a.begin.vect[2]}; + return Dim3{.x = a.end.vect[0]-a.begin.vect[0], + .y = a.end.vect[1]-a.begin.vect[1], + .z = a.end.vect[2]-a.begin.vect[2]}; } /** diff --git a/Src/Base/AMReX_AsyncOut.cpp b/Src/Base/AMReX_AsyncOut.cpp index 3835c0b137e..6ba513e5089 100644 --- a/Src/Base/AMReX_AsyncOut.cpp +++ b/Src/Base/AMReX_AsyncOut.cpp @@ -89,7 +89,7 @@ WriteInfo GetWriteInfo (int rank) nspots = nmaxspots - 1; } - return WriteInfo{ifile, ispot, nspots}; + return WriteInfo{.ifile = ifile, .ispot = ispot, .nspots = nspots}; } void Submit (std::function&& a_f) diff --git a/Src/Base/AMReX_BaseFab.H b/Src/Base/AMReX_BaseFab.H index 05f13fd6464..30e8a8983f7 100644 --- a/Src/Base/AMReX_BaseFab.H +++ b/Src/Base/AMReX_BaseFab.H @@ -1427,7 +1427,7 @@ BaseFab::copy (const BaseFab& src, const Box& srcbox, int srccomp, Array4 const& s = src.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { @@ -2504,7 +2504,7 @@ BaseFab::saxpy (T a, const BaseFab& x, const Box& srcbox, const Box& destb Array4 const& s = x.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { d(i,j,k,n+destcomp) += a * s(i+offset.x,j+offset.y,k+offset.z,n+srccomp); @@ -2542,7 +2542,7 @@ BaseFab::xpay (T a, const BaseFab& x, Array4 const& s = x.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { d(i,j,k,n+destcomp) = s(i+offset.x,j+offset.y,k+offset.z,n+srccomp) + a*d(i,j,k,n+destcomp); @@ -2601,8 +2601,8 @@ BaseFab::linComb (const BaseFab& f1, const Box& b1, int comp1, const auto dlo = amrex::lbound(b); const auto slo1 = amrex::lbound(b1); const auto slo2 = amrex::lbound(b2); - const Dim3 off1{slo1.x-dlo.x,slo1.y-dlo.y,slo1.z-dlo.z}; - const Dim3 off2{slo2.x-dlo.x,slo2.y-dlo.y,slo2.z-dlo.z}; + const Dim3 off1{.x = slo1.x-dlo.x, .y = slo1.y-dlo.y, .z = slo1.z-dlo.z}; + const Dim3 off2{.x = slo2.x-dlo.x, .y = slo2.y-dlo.y, .z = slo2.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, b, numcomp, i, j, k, n, { @@ -2630,7 +2630,7 @@ BaseFab::dot (const Box& xbx, int xcomp, const auto xlo = amrex::lbound(xbx); const auto ylo = amrex::lbound(ybx); - const Dim3 offset{ylo.x-xlo.x,ylo.y-xlo.y,ylo.z-xlo.z}; + const Dim3 offset{.x = ylo.x-xlo.x, .y = ylo.y-xlo.y, .z = ylo.z-xlo.z}; Array4 const& xa = this->const_array(); Array4 const& ya = y.const_array(); @@ -2680,7 +2680,7 @@ BaseFab::dotmask (const BaseFab& mask, const Box& xbx, int xcomp, const auto xlo = amrex::lbound(xbx); const auto ylo = amrex::lbound(ybx); - const Dim3 offset{ylo.x-xlo.x,ylo.y-xlo.y,ylo.z-xlo.z}; + const Dim3 offset{.x = ylo.x-xlo.x, .y = ylo.y-xlo.y, .z = ylo.z-xlo.z}; Array4 const& xa = this->const_array(); Array4 const& ya = y.const_array(); @@ -2836,7 +2836,7 @@ BaseFab::plus (const BaseFab& src, const Box& srcbox, const Box& destbox, Array4 const& s = src.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { d(i,j,k,n+destcomp) += s(i+offset.x,j+offset.y,k+offset.z,n+srccomp); @@ -2858,7 +2858,7 @@ void basefab_atomic_add (BaseFab& dfab, const BaseFab& sfab, Array4 const& s = sfab.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { T* p = d.ptr(i,j,k,n+destcomp); @@ -2920,7 +2920,7 @@ BaseFab::lockAdd (const BaseFab& src, const Box& srcbox, const Box& destbo auto const& dhi = amrex::ubound(destbox); auto const& len = amrex::length(destbox); auto const& slo = amrex::lbound(srcbox); - Dim3 const offset{slo.x-dlo.x, slo.y-dlo.y, slo.z-dlo.z}; + Dim3 const offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; int planedim; int nplanes; @@ -3034,7 +3034,7 @@ BaseFab::minus (const BaseFab& src, const Box& srcbox, const Box& destbox, Array4 const& s = src.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { d(i,j,k,n+destcomp) -= s(i+offset.x,j+offset.y,k+offset.z,n+srccomp); @@ -3092,7 +3092,7 @@ BaseFab::mult (const BaseFab& src, const Box& srcbox, const Box& destbox, Array4 const& s = src.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { d(i,j,k,n+destcomp) *= s(i+offset.x,j+offset.y,k+offset.z,n+srccomp); @@ -3150,7 +3150,7 @@ BaseFab::divide (const BaseFab& src, const Box& srcbox, const Box& destbox Array4 const& s = src.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { d(i,j,k,n+destcomp) /= s(i+offset.x,j+offset.y,k+offset.z,n+srccomp); @@ -3208,7 +3208,7 @@ BaseFab::protected_divide (const BaseFab& src, const Box& srcbox, const Bo Array4 const& s = src.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { if (s(i+offset.x,j+offset.y,k+offset.z,n+srccomp) != 0) { diff --git a/Src/Base/AMReX_Box.H b/Src/Base/AMReX_Box.H index f9afba7ad48..88fafe002cc 100644 --- a/Src/Base/AMReX_Box.H +++ b/Src/Base/AMReX_Box.H @@ -225,7 +225,7 @@ public: template = 0> [[nodiscard]] AMREX_GPU_HOST_DEVICE bool contains (int i, int j, int k) const noexcept { - Dim3 p3d{i, j, k}; + Dim3 p3d{.x = i, .y = j, .z = k}; return contains(p3d); } @@ -268,7 +268,7 @@ public: template = 0> [[nodiscard]] AMREX_GPU_HOST_DEVICE bool strictly_contains (int i, int j, int k) const noexcept { - Dim3 p3d{i, j, k}; + Dim3 p3d{.x = i, .y = j, .z = k}; return strictly_contains(p3d); } @@ -2133,7 +2133,7 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND makeSingleCellBox (int i, int j, int k, IndexTypeND typ = IndexTypeND::TheCellType()) { - Dim3 p3d{i, j, k}; + Dim3 p3d{.x = i, .y = j, .z = k}; IntVectND vect{p3d}; return BoxND{vect, vect, typ}; } @@ -2214,7 +2214,7 @@ struct BoxIndexerND<1> [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 operator() (std::uint64_t icell) const { - return {int(icell)+lo, 0, 0}; + return Dim3{.x = int(icell)+lo, .y = 0, .z = 0}; } [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/Src/Base/AMReX_CudaGraph.H b/Src/Base/AMReX_CudaGraph.H index e7f70908eeb..3cdff8ecd98 100644 --- a/Src/Base/AMReX_CudaGraph.H +++ b/Src/Base/AMReX_CudaGraph.H @@ -14,10 +14,10 @@ struct CopyMemory { void* src = nullptr; void* dst = nullptr; - Dim3 src_begin = {0,0,0}; - Dim3 src_end = {0,0,0}; - Dim3 dst_begin = {0,0,0}; - Dim3 dst_end = {0,0,0}; + Dim3 src_begin{.x = 0, .y = 0, .z = 0}; + Dim3 src_end{.x = 0, .y = 0, .z = 0}; + Dim3 dst_begin{.x = 0, .y = 0, .z = 0}; + Dim3 dst_end{.x = 0, .y = 0, .z = 0}; int scomp = 0; int ncomp = 0; diff --git a/Src/Base/AMReX_Dim3.H b/Src/Base/AMReX_Dim3.H index 11baefe697e..82b3be6a0f3 100644 --- a/Src/Base/AMReX_Dim3.H +++ b/Src/Base/AMReX_Dim3.H @@ -21,19 +21,19 @@ Real dot_product (XDim3 const& a, XDim3 const& b) AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE XDim3 cross_product (XDim3 const& a, XDim3 const& b) { - return {a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x}; + return XDim3{.x = a.y*b.z-a.z*b.y, .y = a.z*b.x-a.x*b.z, .z = a.x*b.y-a.y*b.x}; } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE XDim3 operator+ (XDim3 const& a, XDim3 const& b) { - return {a.x + b.x, a.y + b.y, a.z + b.z}; + return XDim3{.x = a.x + b.x, .y = a.y + b.y, .z = a.z + b.z}; } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE XDim3 operator- (XDim3 const& a, XDim3 const& b) { - return {a.x - b.x, a.y - b.y, a.z - b.z}; + return XDim3{.x = a.x - b.x, .y = a.y - b.y, .z = a.z - b.z}; } template & wgts, for (int i = 0; i < nprocs; ++i) { raii_vwb[i] = std::make_unique >(); - wblq.push(WeightedBoxList({raii_vwb[i].get(),Long(0),-1})); + wblq.push(WeightedBoxList{.m_lb = raii_vwb[i].get(), + .m_weight = Long(0), + .m_rank = -1}); } Vector wblv; wblv.reserve(nprocs); @@ -949,8 +951,9 @@ DistributionMapping::KnapSackProcessorMap (const DistributionMapping& olddm, Vector>> raii_vwb(nprocs); for (int iproc = 0; iproc < nprocs; ++iproc) { raii_vwb[iproc] = std::make_unique>(); - wblq.push(WeightedBoxList({raii_vwb[iproc].get(), base_weight[iproc], - iproc})); + wblq.push(WeightedBoxList{.m_lb = raii_vwb[iproc].get(), + .m_weight = base_weight[iproc], + .m_rank = iproc}); } Vector wblv; wblv.reserve(nprocs); diff --git a/Src/Base/AMReX_FBI.H b/Src/Base/AMReX_FBI.H index 1b3f8cc13f0..fc8ec003623 100644 --- a/Src/Base/AMReX_FBI.H +++ b/Src/Base/AMReX_FBI.H @@ -164,8 +164,9 @@ fab_to_fab (Vector > const& copy_tags, int scomp, int dcom const int N = copy_tags.size(); tags.reserve(N); for (int i = 0; i < N; ++i) { - tags.push_back(TagType{copy_tags[i].dfab, copy_tags[i].sfab, masks[i].dfab, - copy_tags[i].dbox, copy_tags[i].offset}); + tags.push_back(TagType{.dfab = copy_tags[i].dfab, .sfab = copy_tags[i].sfab, + .mask = masks[i].dfab, .dbox = copy_tags[i].dbox, + .offset = copy_tags[i].offset}); } if constexpr (std::is_same_v>) @@ -261,8 +262,10 @@ void deterministic_fab_to_fab (Vector> const& a_tags, int s IntVect lo(AMREX_D_DECL(it*tile_size, jt*tile_size, kt*tile_size)); - tiled_tags.push_back(TiledTag{itag, std::make_pair - (tag.dindex, Box(lo, lo+(tile_size-1), ixtype))}); + tiled_tags.push_back(TiledTag{ + .tag_index = itag, + .dindex_tilebox = std::make_pair(tag.dindex, Box(lo, lo+(tile_size-1), ixtype)) + }); } } } @@ -282,8 +285,9 @@ void deterministic_fab_to_fab (Vector> const& a_tags, int s } auto const& ttag = tiled_tags[itag]; auto const& btag = a_tags[ttag.tag_index]; - h_tags.push_back({btag.dfab, btag.dindex, btag.sfab, - btag.dbox & ttag.dindex_tilebox.second, btag.offset}); + h_tags.push_back(TagType{.dfab = btag.dfab, .dindex = btag.dindex, .sfab = btag.sfab, + .dbox = btag.dbox & ttag.dindex_tilebox.second, + .offset = btag.offset}); } h_ntags.push_back((unsigned int)tiled_tags.size()); @@ -509,10 +513,11 @@ auto FabArray::FB_get_local_copy_tag_vector (const FB& TheFB) int li = this->localindex(tag.dstIndex); loc_copy_tags.push_back - ({this->atLocalIdx(li).array(), tag.dstIndex, - this->fabPtr(tag.srcIndex)->const_array(), - tag.dbox, - (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()}); + (TagType{.dfab = this->atLocalIdx(li).array(), + .dindex = tag.dstIndex, + .sfab = this->fabPtr(tag.srcIndex)->const_array(), + .dbox = tag.dbox, + .offset = (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()}); } auto utv = std::make_unique>(loc_copy_tags); @@ -571,16 +576,17 @@ FabArray::FB_local_copy_gpu (const FB& TheFB, int scomp, int ncomp) int li = this->localindex(tag.dstIndex); loc_copy_tags.push_back - ({this->atLocalIdx(li).array(), tag.dstIndex, - this->fabPtr(tag.srcIndex)->const_array(), - tag.dbox, - (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()}); + (TagType{.dfab = this->atLocalIdx(li).array(), + .dindex = tag.dstIndex, + .sfab = this->fabPtr(tag.srcIndex)->const_array(), + .dbox = tag.dbox, + .offset = (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()}); if (!maskfabs[li].isAllocated()) { maskfabs[li].resize(this->atLocalIdx(li).box()); - masks_unique.emplace_back(Array4Tag{maskfabs[li].array()}); + masks_unique.emplace_back(Array4Tag{.dfab = maskfabs[li].array()}); } - masks.emplace_back(Array4Tag{maskfabs[li].array()}); + masks.emplace_back(Array4Tag{.dfab = maskfabs[li].array()}); } amrex::ParallelFor(masks_unique, @@ -613,13 +619,13 @@ FabArray::FB_local_add_gpu (const FB& TheFB, int scomp, int ncomp, bool det const CopyComTag& tag = LocTags[itag]; src_fabs[itag].resize(tag.sbox,ncomp); loc_copy_tags_1.push_back( - TagType{src_fabs[itag].array(), -1, - this->const_array(tag.srcIndex,scomp), tag.sbox, - Dim3{0,0,0}}); + TagType{.dfab = src_fabs[itag].array(), .dindex = -1, + .sfab = this->const_array(tag.srcIndex,scomp), .dbox = tag.sbox, + .offset = Dim3{.x = 0, .y = 0, .z = 0}}); loc_copy_tags_2.push_back( - TagType{this->array(tag.dstIndex,scomp), tag.dstIndex, - src_fabs[itag].const_array(), tag.dbox, - (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()}); + TagType{.dfab = this->array(tag.dstIndex,scomp), .dindex = tag.dstIndex, + .sfab = src_fabs[itag].const_array(), .dbox = tag.dbox, + .offset = (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()}); } // Note that we have shifted the starting component to zero in the code above. @@ -662,7 +668,7 @@ FabArray::CMD_local_setVal_gpu (typename FabArray::value_type x, { const CopyComTag& tag = LocTags[i]; BL_ASSERT(distributionMap[tag.dstIndex] == ParallelDescriptor::MyProc()); - loc_setval_tags.push_back({this->array(tag.dstIndex), tag.dbox}); + loc_setval_tags.push_back(TagType{.dfab = this->array(tag.dstIndex), .dbox = tag.dbox}); } amrex::ParallelFor(loc_setval_tags, ncomp, @@ -685,7 +691,7 @@ FabArray::CMD_remote_setVal_gpu (typename FabArray::value_type x, for (auto it = RcvTags.begin(); it != RcvTags.end(); ++it) { for (auto const& tag: it->second) { - rcv_setval_tags.push_back({this->array(tag.dstIndex), tag.dbox}); + rcv_setval_tags.push_back(TagType{.dfab = this->array(tag.dstIndex), .dbox = tag.dbox}); } } @@ -975,7 +981,7 @@ FabArray::FB_unpack_recv_buffer_cuda_graph (const FB& TheFB, int dcomp, int auto const& cctc = *recv_cctc[k]; for (auto const& tag : cctc) { - recv_copy_tags[tag.dstIndex].push_back({dptr,tag.dbox}); + recv_copy_tags[tag.dstIndex].push_back(VoidCopyTag{.p = dptr, .dbox = tag.dbox}); dptr += tag.dbox.numPts() * ncomp * sizeof(value_type); launches++; } @@ -1070,7 +1076,7 @@ FabArray::get_send_copy_tag_vector (Vector const& send_data, for (auto const& tag : cctc) { snd_copy_tags.emplace_back - (TagType{this->const_array(tag.srcIndex), dptr-pbuf, tag.sbox}); + (TagType{.sfab = this->const_array(tag.srcIndex), .poff = dptr-pbuf, .bx = tag.sbox}); dptr += (tag.sbox.numPts() * ncomp * sizeof(BUF)); } } @@ -1168,7 +1174,7 @@ FabArray::get_recv_copy_tag_vector (Vector const& recv_data, { const int li = this->localindex(tag.dstIndex); recv_copy_tags.emplace_back - (TagType{this->atLocalIdx(li).array(), dptr-pbuf, tag.dbox}); + (TagType{.dfab = this->atLocalIdx(li).array(), .poff = dptr-pbuf, .bx = tag.dbox}); dptr += tag.dbox.numPts() * ncomp * sizeof(BUF); } } @@ -1233,11 +1239,12 @@ FabArray::unpack_recv_buffer_gpu (FabArray& dst, int dcomp, int ncomp, auto const& cctc = *recv_cctc[k]; for (auto const& tag : cctc) { tags.emplace_back( - TagType{dst.array(tag.dstIndex), tag.dstIndex, - Array4((BUF const*)dptr, - amrex::begin(tag.dbox), - amrex::end(tag.dbox), ncomp), - tag.dbox, Dim3{0,0,0}}); + TagType{.dfab = dst.array(tag.dstIndex), .dindex = tag.dstIndex, + .sfab = Array4((BUF const*)dptr, + amrex::begin(tag.dbox), + amrex::end(tag.dbox), ncomp), + .dbox = tag.dbox, + .offset = Dim3{.x = 0, .y = 0, .z = 0}}); dptr += tag.dbox.numPts() * ncomp * sizeof(BUF); } } @@ -1319,18 +1326,18 @@ FabArray::unpack_recv_buffer_gpu (FabArray& dst, int dcomp, int ncomp, { const int li = dst.localindex(tag.dstIndex); recv_copy_tags.emplace_back(TagType{ - dst.atLocalIdx(li).array(), tag.dstIndex, - amrex::makeArray4((BUF const*)(dptr), tag.dbox, ncomp), - tag.dbox, - Dim3{0,0,0} + .dfab = dst.atLocalIdx(li).array(), .dindex = tag.dstIndex, + .sfab = amrex::makeArray4((BUF const*)(dptr), tag.dbox, ncomp), + .dbox = tag.dbox, + .offset = Dim3{.x = 0, .y = 0, .z = 0} }); dptr += tag.dbox.numPts() * ncomp * sizeof(BUF); if (!maskfabs[li].isAllocated()) { maskfabs[li].resize(dst.atLocalIdx(li).box()); - masks_unique.emplace_back(Array4Tag{maskfabs[li].array()}); + masks_unique.emplace_back(Array4Tag{.dfab = maskfabs[li].array()}); } - masks.emplace_back(Array4Tag{maskfabs[li].array()}); + masks.emplace_back(Array4Tag{.dfab = maskfabs[li].array()}); } BL_ASSERT(dptr <= pbuffer + offset + recv_size[k]); } @@ -1453,7 +1460,7 @@ FabArray::unpack_recv_buffer_cpu (FabArray& dst, int dcomp, int ncomp, auto const& cctc = *recv_cctc[k]; for (auto const& tag : cctc) { - recv_copy_tags[tag.dstIndex].push_back({dptr,tag.dbox}); + recv_copy_tags[tag.dstIndex].push_back(VoidCopyTag{.p = dptr, .dbox = tag.dbox}); dptr += tag.dbox.numPts() * ncomp * sizeof(BUF); } BL_ASSERT(dptr <= recv_data[k] + recv_size[k]); diff --git a/Src/Base/AMReX_FabArray.H b/Src/Base/AMReX_FabArray.H index 3186ae4276b..7747ac03e3d 100644 --- a/Src/Base/AMReX_FabArray.H +++ b/Src/Base/AMReX_FabArray.H @@ -2514,9 +2514,9 @@ FabArray::setBndry (value_type val, b = vbx; b.setRange(2, vbx.smallEnd(2)-nghost[2], nghost[2]); b.grow(IntVect(nghost[0],nghost[1],0)); - tags.emplace_back(Tag{a, b}); + tags.emplace_back(Tag{.dfab = a, .dbox = b}); b.shift(2, vbx.length(2)+nghost[2]); - tags.emplace_back(Tag{a, b}); + tags.emplace_back(Tag{.dfab = a, .dbox = b}); } #endif #if (AMREX_SPACEDIM >= 2) @@ -2524,17 +2524,17 @@ FabArray::setBndry (value_type val, b = vbx; b.setRange(1, vbx.smallEnd(1)-nghost[1], nghost[1]); b.grow(0, nghost[0]); - tags.emplace_back(Tag{a, b}); + tags.emplace_back(Tag{.dfab = a, .dbox = b}); b.shift(1, vbx.length(1)+nghost[1]); - tags.emplace_back(Tag{a, b}); + tags.emplace_back(Tag{.dfab = a, .dbox = b}); } #endif if (nghost[0] > 0) { b = vbx; b.setRange(0, vbx.smallEnd(0)-nghost[0], nghost[0]); - tags.emplace_back(Tag{a, b}); + tags.emplace_back(Tag{.dfab = a, .dbox = b}); b.shift(0, vbx.length(0)+nghost[0]); - tags.emplace_back(Tag{a, b}); + tags.emplace_back(Tag{.dfab = a, .dbox = b}); } } diff --git a/Src/Base/AMReX_FabArrayBase.cpp b/Src/Base/AMReX_FabArrayBase.cpp index b23bc098458..eb871721c9c 100644 --- a/Src/Base/AMReX_FabArrayBase.cpp +++ b/Src/Base/AMReX_FabArrayBase.cpp @@ -1740,8 +1740,9 @@ FabArrayBase::PolarB::define (const FabArrayBase& fa) m_domain.length(1)+m_ngrow[1], 0)})}; - auto const convert = NonLocalBC::PolarFn{m_domain.length(0), m_domain.length(1)}; - auto const convert_corner = NonLocalBC::PolarFn2{m_domain.length(0), m_domain.length(1)}; + auto const convert = NonLocalBC::PolarFn{.Lx = m_domain.length(0), .Ly = m_domain.length(1)}; + auto const convert_corner = NonLocalBC::PolarFn2{.Lx = m_domain.length(0), + .Ly = m_domain.length(1)}; Array const domain_src{convert(domain_dst[0]), convert(domain_dst[1]), convert(domain_dst[2]), convert(domain_dst[3]), diff --git a/Src/Base/AMReX_FabArrayCommI.H b/Src/Base/AMReX_FabArrayCommI.H index 1eec379844c..19c95e7373c 100644 --- a/Src/Base/AMReX_FabArrayCommI.H +++ b/Src/Base/AMReX_FabArrayCommI.H @@ -1247,10 +1247,11 @@ FillBoundary (Vector const& mf, Vector const& scomp, if (cmds[imf]) { auto const& tags = *(cmds[imf]->m_LocTags); for (auto const& tag : tags) { - local_tags.push_back({(*mf[imf])[tag.dstIndex].array (scomp[imf],ncomp[imf]), - (*mf[imf])[tag.srcIndex].const_array(scomp[imf],ncomp[imf]), - tag.dbox, - (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()}); + local_tags.push_back(TagT{.dfab = (*mf[imf])[tag.dstIndex].array(scomp[imf],ncomp[imf]), + .dindex = tag.dstIndex, + .sfab = (*mf[imf])[tag.srcIndex].const_array(scomp[imf],ncomp[imf]), + .dbox = tag.dbox, + .offset = (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()}); } } } @@ -1310,9 +1311,13 @@ FillBoundary (Vector const& mf, Vector const& scomp, for (auto const& cct : it->second) { auto& dfab = (*mf[imf])[cct.dstIndex]; recv_offset[i].push_back(nbytes); - recv_tags.push_back({dfab.array(scomp[imf],ncomp[imf]), - makeArray4(nullptr,cct.dbox,ncomp[imf]), - cct.dbox, Dim3{0,0,0}}); + recv_tags.push_back(TagT{ + .dfab = dfab.array(scomp[imf],ncomp[imf]), + .dindex = cct.dstIndex, + .sfab = makeArray4(nullptr,cct.dbox,ncomp[imf]), + .dbox = cct.dbox, + .offset = Dim3{.x = 0, .y = 0, .z = 0} + }); nbytes += dfab.nBytes(cct.dbox,ncomp[imf]); } } @@ -1383,9 +1388,13 @@ FillBoundary (Vector const& mf, Vector const& scomp, for (auto const& cct : it->second) { auto const& sfab = (*mf[imf])[cct.srcIndex]; send_offset[i].push_back(nbytes); - send_tags.push_back({amrex::makeArray4(nullptr,cct.sbox,ncomp[imf]), - sfab.const_array(scomp[imf],ncomp[imf]), - cct.sbox, Dim3{0,0,0}}); + send_tags.push_back(TagT{ + .dfab = amrex::makeArray4(nullptr,cct.sbox,ncomp[imf]), + .dindex = cct.dstIndex, + .sfab = sfab.const_array(scomp[imf],ncomp[imf]), + .dbox = cct.sbox, + .offset = Dim3{.x = 0, .y = 0, .z = 0} + }); nbytes += sfab.nBytes(cct.sbox,ncomp[imf]); } } diff --git a/Src/Base/AMReX_FabArrayUtility.H b/Src/Base/AMReX_FabArrayUtility.H index 5f178e15fc0..aa3581c9fb8 100644 --- a/Src/Base/AMReX_FabArrayUtility.H +++ b/Src/Base/AMReX_FabArrayUtility.H @@ -2220,7 +2220,7 @@ OverlapMask (FabArray const& fa, IntVect const& nghost, Periodicity const& if (iv == 0 && b == bx) { continue; } #ifdef AMREX_USE_GPU if (run_on_gpu) { - tags.push_back({arr,b}); + tags.push_back(Array4BoxTag{.dfab = arr, .dbox = b}); } else #endif { diff --git a/Src/Base/AMReX_Geometry.H b/Src/Base/AMReX_Geometry.H index a1a8cc6fb6d..00e3eaeef98 100644 --- a/Src/Base/AMReX_Geometry.H +++ b/Src/Base/AMReX_Geometry.H @@ -122,9 +122,13 @@ public: //! Returns non-static copy of geometry's stored data. [[nodiscard]] GeometryData data() const noexcept { - return { prob_domain, domain, {AMREX_D_DECL(dx[0],dx[1],dx[2])}, - {AMREX_D_DECL(is_periodic[0], is_periodic[1], is_periodic[2])}, - static_cast(c_sys) }; + return { + .prob_domain = prob_domain, + .domain = domain, + .dx = {AMREX_D_DECL(dx[0],dx[1],dx[2])}, + .is_periodic = {AMREX_D_DECL(is_periodic[0], is_periodic[1], is_periodic[2])}, + .coord = static_cast(c_sys) + }; } //! Read static values from ParmParse database. diff --git a/Src/Base/AMReX_IntVect.H b/Src/Base/AMReX_IntVect.H index df8792a96ea..5c5d10615e0 100644 --- a/Src/Base/AMReX_IntVect.H +++ b/Src/Base/AMReX_IntVect.H @@ -264,11 +264,11 @@ public: [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr Dim3 dim3 () const noexcept { if constexpr (dim == 1) { - return Dim3{vect[0],0,0}; + return Dim3{.x = vect[0], .y = 0, .z = 0}; } else if constexpr (dim == 2) { - return Dim3{vect[0],vect[1],0}; + return Dim3{.x = vect[0], .y = vect[1], .z = 0}; } else { - return Dim3{vect[0],vect[1],vect[2]}; + return Dim3{.x = vect[0], .y = vect[1], .z = vect[2]}; } } @@ -276,11 +276,11 @@ public: [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr Dim3 dim3 ([[maybe_unused]] int fill_extra) const noexcept { if constexpr (dim == 1) { - return Dim3{vect[0],fill_extra,fill_extra}; + return Dim3{.x = vect[0], .y = fill_extra, .z = fill_extra}; } else if constexpr (dim == 2) { - return Dim3{vect[0],vect[1],fill_extra}; + return Dim3{.x = vect[0], .y = vect[1], .z = fill_extra}; } else { - return Dim3{vect[0],vect[1],vect[2]}; + return Dim3{.x = vect[0], .y = vect[1], .z = vect[2]}; } } @@ -1170,11 +1170,11 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr Dim3 refine (Dim3 const& coarse, IntVectND const& ratio) noexcept { if constexpr (dim == 1) { - return Dim3{coarse.x*ratio[0], coarse.y, coarse.z}; + return Dim3{.x = coarse.x*ratio[0], .y = coarse.y, .z = coarse.z}; } else if constexpr (dim == 2) { - return Dim3{coarse.x*ratio[0], coarse.y*ratio[1], coarse.z}; + return Dim3{.x = coarse.x*ratio[0], .y = coarse.y*ratio[1], .z = coarse.z}; } else { - return Dim3{coarse.x*ratio[0], coarse.y*ratio[1], coarse.z*ratio[2]}; + return Dim3{.x = coarse.x*ratio[0], .y = coarse.y*ratio[1], .z = coarse.z*ratio[2]}; } } @@ -1183,17 +1183,17 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 coarsen (Dim3 const& fine, IntVectND const& ratio) noexcept { if constexpr (dim == 1) { - return Dim3{amrex::coarsen(fine.x, ratio[0]), - fine.y, - fine.z}; + return Dim3{.x = amrex::coarsen(fine.x, ratio[0]), + .y = fine.y, + .z = fine.z}; } else if constexpr (dim == 2) { - return Dim3{amrex::coarsen(fine.x, ratio[0]), - amrex::coarsen(fine.y, ratio[1]), - fine.z}; + return Dim3{.x = amrex::coarsen(fine.x, ratio[0]), + .y = amrex::coarsen(fine.y, ratio[1]), + .z = fine.z}; } else { - return Dim3{amrex::coarsen(fine.x, ratio[0]), - amrex::coarsen(fine.y, ratio[1]), - amrex::coarsen(fine.z, ratio[2])}; + return Dim3{.x = amrex::coarsen(fine.x, ratio[0]), + .y = amrex::coarsen(fine.y, ratio[1]), + .z = amrex::coarsen(fine.z, ratio[2])}; } } diff --git a/Src/Base/AMReX_MemProfiler.cpp b/Src/Base/AMReX_MemProfiler.cpp index faccae225ac..5d497f63588 100644 --- a/Src/Base/AMReX_MemProfiler.cpp +++ b/Src/Base/AMReX_MemProfiler.cpp @@ -257,8 +257,8 @@ MemProfiler::report_ (const std::string& prefix, const std::string& memory_log_n if (hwm_max[i] > 0) { memlog << ident; memlog << "| " << std::setw(width_name) << std::left << the_names[i] << " | "; - memlog << Bytes{cur_min[i],cur_max[i]} << " | "; - memlog << Bytes{hwm_min[i],hwm_max[i]} << " |\n"; + memlog << Bytes{.mn = cur_min[i], .mx = cur_max[i]} << " | "; + memlog << Bytes{.mn = hwm_min[i], .mx = hwm_max[i]} << " |\n"; } } @@ -267,7 +267,7 @@ MemProfiler::report_ (const std::string& prefix, const std::string& memory_log_n memlog << ident; memlog << "| " << std::setw(width_name) << std::left << "Total" << " | "; - memlog << Bytes{mymin[0],mymax[0]} << " | " << std::setw(width_bytes) << " " << " |\n"; + memlog << Bytes{.mn = mymin[0], .mx = mymax[0]} << " | " << std::setw(width_bytes) << " " << " |\n"; memlog << std::setw(0); // Number of builds @@ -286,8 +286,8 @@ MemProfiler::report_ (const std::string& prefix, const std::string& memory_log_n if (hwm_builds_max[i] > 0) { memlog << ident; memlog << "| " << std::setw(width_name) << std::left << the_names_builds[i] << " | "; - memlog << Builds{num_builds_min[i],num_builds_max[i]} << " | "; - memlog << Builds{hwm_builds_min[i],hwm_builds_max[i]} << " |\n"; + memlog << Builds{.mn = num_builds_min[i], .mx = num_builds_max[i]} << " | "; + memlog << Builds{.mn = hwm_builds_min[i], .mx = hwm_builds_max[i]} << " |\n"; } } } @@ -301,7 +301,7 @@ MemProfiler::report_ (const std::string& prefix, const std::string& memory_log_n << " " << std::setw(width_bytes) << "VmRSS" << "\n"; memlog << " "; for (int i = 0; i < npstat; ++i) - memlog << " [" << Bytes{mymin[ipstat+i], mymax[ipstat+i]} << "]"; + memlog << " [" << Bytes{.mn = mymin[ipstat+i], .mx = mymax[ipstat+i]} << "]"; memlog << "\n"; } @@ -316,7 +316,7 @@ MemProfiler::report_ (const std::string& prefix, const std::string& memory_log_n memlog << std::setw(width_bytes) << "shared" << "\n"; memlog << " "; for (int i = 0; i < nsinfo; ++i) - memlog << " [" << Bytes{mymin[isinfo+i], mymax[isinfo+i]} << "]"; + memlog << " [" << Bytes{.mn = mymin[isinfo+i], .mx = mymax[isinfo+i]} << "]"; memlog << "\n"; } #endif diff --git a/Src/Base/AMReX_MultiFab.cpp b/Src/Base/AMReX_MultiFab.cpp index e82133f5c30..a0bbd8b0473 100644 --- a/Src/Base/AMReX_MultiFab.cpp +++ b/Src/Base/AMReX_MultiFab.cpp @@ -1511,7 +1511,7 @@ MultiFab::OverlapMask (const Periodicity& period) const Box const& b = is.second-iv; #ifdef AMREX_USE_GPU if (run_on_gpu) { - tags.push_back({arr,b}); + tags.push_back(Array4BoxTag{.dfab = arr, .dbox = b}); } else #endif { diff --git a/Src/Base/AMReX_MultiFabUtil.cpp b/Src/Base/AMReX_MultiFabUtil.cpp index 1a64ae5f604..4e36ef03749 100644 --- a/Src/Base/AMReX_MultiFabUtil.cpp +++ b/Src/Base/AMReX_MultiFabUtil.cpp @@ -694,7 +694,7 @@ namespace amrex Box const& b = is.second-iv; #ifdef AMREX_USE_GPU if (run_on_gpu) { - tags.push_back({arr,b}); + tags.push_back(Array4BoxTag{.dfab = arr, .dbox = b}); } else #endif { diff --git a/Src/Base/AMReX_NonLocalBC.H b/Src/Base/AMReX_NonLocalBC.H index 70aec860116..6f8dea32111 100644 --- a/Src/Base/AMReX_NonLocalBC.H +++ b/Src/Base/AMReX_NonLocalBC.H @@ -54,7 +54,7 @@ struct MultiBlockIndexMapping { for (int d = 0; d < AMREX_SPACEDIM; ++d) { iv_new[d] = sign[d] * (iv[permutation[d]] - offset[d]); } - return {iv_new[0], iv_new[1], iv_new[2]}; + return Dim3{.x = iv_new[0], .y = iv_new[1], .z = iv_new[2]}; } //! \brief The inverse function is given by rearringing all above terms. @@ -70,7 +70,7 @@ struct MultiBlockIndexMapping { AMREX_ASSERT(sign[d] == 1 || sign[d] == -1); iv[permutation[d]] = iv_new[d] * sign[d] + offset[d]; } - return {iv[0], iv[1], iv[2]}; + return Dim3{.x = iv[0], .y = iv[1], .z = iv[2]}; } [[nodiscard]] IndexType operator()(IndexType it) const noexcept { diff --git a/Src/Base/AMReX_NonLocalBCImpl.H b/Src/Base/AMReX_NonLocalBCImpl.H index f9b3967563d..15efab03cf9 100644 --- a/Src/Base/AMReX_NonLocalBCImpl.H +++ b/Src/Base/AMReX_NonLocalBCImpl.H @@ -16,7 +16,7 @@ struct Rotate90ClockWise { AMREX_GPU_HOST_DEVICE Dim3 operator() (Dim3 const& a) const noexcept { - return Dim3{a.y, -1-a.x, a.z}; + return Dim3{.x = a.y, .y = -1-a.x, .z = a.z}; } Box operator() (Box const& box) const noexcept { @@ -37,7 +37,7 @@ struct Rotate90CounterClockWise { AMREX_GPU_HOST_DEVICE Dim3 operator() (Dim3 const& a) const noexcept { - return Dim3{-1-a.y, a.x, a.z}; + return Dim3{.x = -1-a.y, .y = a.x, .z = a.z}; } Box operator() (Box const& box) const noexcept { @@ -72,7 +72,7 @@ struct Rotate180Fn { AMREX_GPU_HOST_DEVICE Dim3 operator() (Dim3 const& a) const noexcept { - return Dim3{-1-a.x, Ly-1-a.y, a.z}; + return Dim3{.x = -1-a.x, .y = Ly-1-a.y, .z = a.z}; } Box operator() (Box const& box) const noexcept { @@ -105,7 +105,7 @@ struct PolarFn { [[nodiscard]] AMREX_GPU_HOST_DEVICE Dim3 operator() (Dim3 const& a) const noexcept { - return Dim3{i_index(a.x), j_index(a.y), a.z}; + return Dim3{.x = i_index(a.x), .y = j_index(a.y), .z = a.z}; } [[nodiscard]] Box operator() (Box const& box) const noexcept { @@ -146,7 +146,7 @@ struct PolarFn2 { // for the x-y corners [[nodiscard]] AMREX_GPU_HOST_DEVICE Dim3 operator() (Dim3 const& a) const noexcept { - return Dim3{i_index(a.x), j_index(a.y), a.z}; + return Dim3{.x = i_index(a.x), .y = j_index(a.y), .z = a.z}; } [[nodiscard]] Box operator() (Box const& box) const noexcept { @@ -198,7 +198,7 @@ local_copy_cpu (FabArray& dest, const FabArray& src, int dcomp, int sc auto const& dfab = dest.array (tag.dstIndex); amrex::LoopConcurrentOnCpu(tag.dbox, ncomp, [=] (int i, int j, int k, int n) noexcept { - auto const si = dtos(Dim3{i,j,k}); + auto const si = dtos(Dim3{.x = i, .y = j, .z = k}); dfab(i,j,k,dcomp+n) = proj(sfab,si,scomp+n); }); } @@ -231,7 +231,7 @@ unpack_recv_buffer_cpu (FabArray& mf, int dcomp, int ncomp, Vector c auto const& dfab = mf.array(tag.dstIndex); auto const& sfab = amrex::makeArray4((T const*)(dptr), tag.sbox, ncomp); amrex::LoopConcurrentOnCpu(tag.dbox, ncomp, [=](int i, int j, int k, int n) noexcept { - auto const si = dtos(Dim3{i, j, k}); + auto const si = dtos(Dim3{.x = i, .y = j, .z = k}); dfab(i, j, k, dcomp + n) = proj(sfab, si, n); }); dptr += tag.sbox.numPts() * ncomp * sizeof(T); @@ -262,13 +262,15 @@ local_copy_gpu (FabArray& dest, const FabArray& src, int dcomp, int sc Vector > loc_copy_tags; loc_copy_tags.reserve(N_locs); for (auto const& tag : local_tags) { - loc_copy_tags.push_back({dest.array(tag.dstIndex), src.const_array(tag.srcIndex), tag.dbox}); + loc_copy_tags.push_back(Array4Array4Box{.dfab = dest.array(tag.dstIndex), + .sfab = src.const_array(tag.srcIndex), + .dbox = tag.dbox}); } ParallelFor(loc_copy_tags, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n, Array4Array4Box const& tag) noexcept { - auto const si = dtos(Dim3{i,j,k}); + auto const si = dtos(Dim3{.x = i, .y = j, .z = k}); tag.dfab(i,j,k,dcomp+n) = proj(tag.sfab, si, scomp+n); }); } @@ -323,7 +325,7 @@ unpack_recv_buffer_gpu (FabArray& mf, int scomp, int ncomp, ParallelFor(tags, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n, Array4Array4Box const& tag) noexcept { - auto const si = dtos(Dim3{i,j,k}); + auto const si = dtos(Dim3{.x = i, .y = j, .z = k}); tag.dfab(i,j,k,scomp+n) = proj(tag.sfab, si ,n); }); @@ -625,12 +627,12 @@ FillPolar (FabArray& mf, int scomp, int ncomp, IntVect const& nghost, Box c const FabArrayBase::PolarB& ThePolarB = mf.getPolarB(nghost, domain); auto handler = Comm_nowait(mf, scomp, ncomp, ThePolarB, - PolarFn{domain.length(0), domain.length(1)}, + PolarFn{.Lx = domain.length(0), .Ly = domain.length(1)}, Identity{}); #ifdef AMREX_USE_MPI Comm_finish(mf, scomp, ncomp, ThePolarB, std::move(handler), - PolarFn{domain.length(0), domain.length(1)}, Identity{}); + PolarFn{.Lx = domain.length(0), .Ly = domain.length(1)}, Identity{}); #else amrex::ignore_unused(handler); #endif @@ -873,47 +875,47 @@ struct SphThetaPhiRIndexMapping // theta-hi/r-lo edge, and r > r-hi. if (ilo && jmd && kmd) { - return {-1-i, (j+ny/2)%ny, k}; + return Dim3{.x = -1-i, .y = (j+ny/2)%ny, .z = k}; } else if (ihi && jmd && kmd) { - return {2*nx-1-i, (j+ny/2)%ny, k}; + return Dim3{.x = 2*nx-1-i, .y = (j+ny/2)%ny, .z = k}; } else if (imd && jlo && kmd) { - return {i, j+ny, k}; + return Dim3{.x = i, .y = j+ny, .z = k}; } else if (imd && jhi && kmd) { - return {i, j-ny, k}; + return Dim3{.x = i, .y = j-ny, .z = k}; } else if (imd && jmd && klo) { - return {nx-1-i, (j+ny/2)%ny, -1-k}; + return Dim3{.x = nx-1-i, .y = (j+ny/2)%ny, .z = -1-k}; } else if (ilo && jlo && kmd) { - return {-1-i, (j+ny/2)%ny, k}; + return Dim3{.x = -1-i, .y = (j+ny/2)%ny, .z = k}; } else if (ihi && jlo && kmd) { - return {2*nx-1-i, (j+ny/2)%ny, k}; + return Dim3{.x = 2*nx-1-i, .y = (j+ny/2)%ny, .z = k}; } else if (ilo && jhi && kmd) { - return {-1-i, (j+ny/2)%ny, k}; + return Dim3{.x = -1-i, .y = (j+ny/2)%ny, .z = k}; } else if (ihi && jhi && kmd) { - return {2*nx-1-i, (j+ny/2)%ny, k}; + return Dim3{.x = 2*nx-1-i, .y = (j+ny/2)%ny, .z = k}; } else if (imd && jlo && klo) { - return {nx-1-i, (j+ny/2)%ny, -1-k}; + return Dim3{.x = nx-1-i, .y = (j+ny/2)%ny, .z = -1-k}; } else if (imd && jhi && klo) { - return {nx-1-i, (j+ny/2)%ny, -1-k}; + return Dim3{.x = nx-1-i, .y = (j+ny/2)%ny, .z = -1-k}; } else { diff --git a/Src/Base/AMReX_PCI.H b/Src/Base/AMReX_PCI.H index 55c0ae2b254..58e67c1d725 100644 --- a/Src/Base/AMReX_PCI.H +++ b/Src/Base/AMReX_PCI.H @@ -127,9 +127,9 @@ FabArray::PC_local_gpu (const CPC& thecpc, FabArray const& src, if (maskfabs.size() > 0) { if (!maskfabs[li].isAllocated()) { maskfabs[li].resize(this->atLocalIdx(li).box()); - masks_unique.emplace_back(Array4Tag{maskfabs[li].array()}); + masks_unique.emplace_back(Array4Tag{.dfab = maskfabs[li].array()}); } - masks.emplace_back(Array4Tag{maskfabs[li].array()}); + masks.emplace_back(Array4Tag{.dfab = maskfabs[li].array()}); } } } diff --git a/Src/Base/AMReX_iMultiFab.cpp b/Src/Base/AMReX_iMultiFab.cpp index 657ed6dd30a..35705380e42 100644 --- a/Src/Base/AMReX_iMultiFab.cpp +++ b/Src/Base/AMReX_iMultiFab.cpp @@ -741,7 +741,7 @@ OwnerMask (FabArrayBase const& mf, const Periodicity& period, const IntVect& ngr { #ifdef AMREX_USE_GPU if (run_on_gpu) { - tags.push_back({arr,obx}); + tags.push_back(Array4BoxTag{.dfab = arr, .dbox = obx}); } else #endif { diff --git a/Src/Boundary/AMReX_Mask.H b/Src/Boundary/AMReX_Mask.H index 928fa510133..4f8953e0bd0 100644 --- a/Src/Boundary/AMReX_Mask.H +++ b/Src/Boundary/AMReX_Mask.H @@ -273,7 +273,7 @@ Mask::And (const Mask& src, auto const& s = src.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { d(i,j,k,n+destcomp) = d(i,j,k,n+destcomp) ? s(i+offset.x,j+offset.y,k+offset.z,n+srccomp) : 0; @@ -322,7 +322,7 @@ Mask::Or (const Mask& src, auto const& s = src.const_array(); const auto dlo = amrex::lbound(destbox); const auto slo = amrex::lbound(srcbox); - const Dim3 offset{slo.x-dlo.x,slo.y-dlo.y,slo.z-dlo.z}; + const Dim3 offset{.x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z}; AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(run_on, destbox, numcomp, i, j, k, n, { d(i,j,k,n+destcomp) = d(i,j,k,n+destcomp) ? 1: s(i+offset.x,j+offset.y,k+offset.z,n+srccomp); diff --git a/Src/Boundary/AMReX_YAFluxRegister.H b/Src/Boundary/AMReX_YAFluxRegister.H index ef898d885fe..e4ed6ae8baa 100644 --- a/Src/Boundary/AMReX_YAFluxRegister.H +++ b/Src/Boundary/AMReX_YAFluxRegister.H @@ -385,7 +385,7 @@ YAFluxRegisterT::define (const BoxArray& fba, const BoxArray& cba, const Box& ibx = is.second - iv; #ifdef AMREX_USE_GPU if (run_on_gpu) { - tags.push_back({arr,ibx}); + tags.push_back(Array4BoxTag{.dfab = arr, .dbox = ibx}); } else #endif { diff --git a/Src/EB/AMReX_EB2_IF_Cylinder.H b/Src/EB/AMReX_EB2_IF_Cylinder.H index c1a28757b3e..684c5c4dd55 100644 --- a/Src/EB/AMReX_EB2_IF_Cylinder.H +++ b/Src/EB/AMReX_EB2_IF_Cylinder.H @@ -42,9 +42,9 @@ public: Real operator() (AMREX_D_DECL(Real x, Real y, Real z)) const noexcept { #if (AMREX_SPACEDIM == 3) - XDim3 pos{x-m_center.x, y-m_center.y, z-m_center.z}; + XDim3 pos{.x = x-m_center.x, .y = y-m_center.y, .z = z-m_center.z}; #else - XDim3 pos{x-m_center.x, y-m_center.y, 0.0_rt}; + XDim3 pos{.x = x-m_center.x, .y = y-m_center.y, .z = 0.0_rt}; #endif Real d2 = 0.0_rt; Real pdir; diff --git a/Src/EB/AMReX_EB2_IF_Scale.H b/Src/EB/AMReX_EB2_IF_Scale.H index 60d355e176c..62a8e04d691 100644 --- a/Src/EB/AMReX_EB2_IF_Scale.H +++ b/Src/EB/AMReX_EB2_IF_Scale.H @@ -27,9 +27,9 @@ public: ScaleIF (F a_f, const RealArray& a_scalefactor) : m_f(std::move(a_f)), #if (AMREX_SPACEDIM == 3) - m_sfinv{1.0_rt/a_scalefactor[0], 1.0_rt/a_scalefactor[1], 1.0_rt/a_scalefactor[2]} + m_sfinv{.x = 1.0_rt/a_scalefactor[0], .y = 1.0_rt/a_scalefactor[1], .z = 1.0_rt/a_scalefactor[2]} #else - m_sfinv{1.0_rt/a_scalefactor[0], 1.0_rt/a_scalefactor[1], 0.0_rt} + m_sfinv{.x = 1.0_rt/a_scalefactor[0], .y = 1.0_rt/a_scalefactor[1], .z = 0.0_rt} #endif {} diff --git a/Src/EB/AMReX_EBData.H b/Src/EB/AMReX_EBData.H index 899a55faa5d..3f3a6696ebe 100644 --- a/Src/EB/AMReX_EBData.H +++ b/Src/EB/AMReX_EBData.H @@ -234,7 +234,8 @@ struct EBDataArrays [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE EBData get (int box_no) const noexcept { - return EBData{m_cell_flag + box_no, m_real_data + (box_no * real_data_size)}; + return EBData{.m_cell_flag = m_cell_flag + box_no, + .m_real_data = m_real_data + (box_no * real_data_size)}; } static constexpr int real_data_size = static_cast(EBData_t::cellflag); diff --git a/Src/EB/AMReX_EBFabFactory.cpp b/Src/EB/AMReX_EBFabFactory.cpp index b647778dd69..5489029c805 100644 --- a/Src/EB/AMReX_EBFabFactory.cpp +++ b/Src/EB/AMReX_EBFabFactory.cpp @@ -195,7 +195,8 @@ EBFArrayBoxFactory::getEBData (MFIter const& mfi) const noexcept #else auto const* pebflag = ebflags_ma.hp + li; #endif - return EBData{pebflag, m_eb_data.data()+EBData::real_data_size*li}; + return EBData{.m_cell_flag = pebflag, + .m_real_data = m_eb_data.data()+EBData::real_data_size*li}; } EBDataArrays @@ -207,7 +208,8 @@ EBFArrayBoxFactory::getEBDataArrays () const noexcept #else auto const* pebflag = ebflags_ma.hp; #endif - return EBDataArrays{pebflag, m_eb_data.data()}; + return EBDataArrays{.m_cell_flag = pebflag, + .m_real_data = m_eb_data.data()}; } diff --git a/Src/EB/AMReX_EBInterpolater.cpp b/Src/EB/AMReX_EBInterpolater.cpp index 67504383953..305857d5e9c 100644 --- a/Src/EB/AMReX_EBInterpolater.cpp +++ b/Src/EB/AMReX_EBInterpolater.cpp @@ -61,7 +61,7 @@ EBCellConservativeLinear::interp (const FArrayBox& crse, auto const& ca = crse.const_array(); AMREX_HOST_DEVICE_FOR_4D_FLAG(runon, target_fine_region, ncomp, i, j, k, n, { - Dim3 cxyz = amrex::coarsen(Dim3{i,j,k}, ratio); + Dim3 cxyz = amrex::coarsen(Dim3{.x = i, .y = j, .z = k}, ratio); if (cflag(cxyz.x,cxyz.y,cxyz.z).numNeighbors() < AMREX_D_TERM(3,*3,*3)) { fa(i,j,k,n+fine_comp) = ca(cxyz.x,cxyz.y,cxyz.z,n+crse_comp); } diff --git a/Src/EB/AMReX_EB_STL_utils.cpp b/Src/EB/AMReX_EB_STL_utils.cpp index 8a7becf5bce..15252d0fd81 100644 --- a/Src/EB/AMReX_EB_STL_utils.cpp +++ b/Src/EB/AMReX_EB_STL_utils.cpp @@ -17,13 +17,13 @@ namespace { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE XDim3 triangle_norm (STLtools::Triangle const& tri) { - XDim3 vec1{tri.v2.x-tri.v1.x, tri.v2.y-tri.v1.y, tri.v2.z-tri.v1.z}; - XDim3 vec2{tri.v3.x-tri.v2.x, tri.v3.y-tri.v2.y, tri.v3.z-tri.v2.z}; - XDim3 norm{vec1.y*vec2.z-vec1.z*vec2.y, - vec1.z*vec2.x-vec1.x*vec2.z, - vec1.x*vec2.y-vec1.y*vec2.x}; + XDim3 vec1{.x = tri.v2.x-tri.v1.x, .y = tri.v2.y-tri.v1.y, .z = tri.v2.z-tri.v1.z}; + XDim3 vec2{.x = tri.v3.x-tri.v2.x, .y = tri.v3.y-tri.v2.y, .z = tri.v3.z-tri.v2.z}; + XDim3 norm{.x = vec1.y*vec2.z-vec1.z*vec2.y, + .y = vec1.z*vec2.x-vec1.x*vec2.z, + .z = vec1.x*vec2.y-vec1.y*vec2.x}; Real tmp = 1._rt / std::sqrt(norm.x*norm.x + norm.y*norm.y + norm.z*norm.z); - return {norm.x * tmp, norm.y * tmp, norm.z * tmp}; + return XDim3{.x = norm.x * tmp, .y = norm.y * tmp, .z = norm.z * tmp}; } // Does line ab intersect with the triangle? @@ -639,7 +639,7 @@ STLtools::prepare (Gpu::PinnedVector a_tri_pts) // Choose a reference point by extending the normal vector of the first // triangle until it's slightly outside the bounding box. - XDim3 cent0{tri0.cent(0), tri0.cent(1), tri0.cent(2)}; + XDim3 cent0{.x = tri0.cent(0), .y = tri0.cent(1), .z = tri0.cent(2)}; int is_ref_positive; { // We are computing the normal ourselves in case the stl file does @@ -918,21 +918,21 @@ STLtools::getBoxType (Box const& box, Geometry const& geom, RunOn) const const auto plo = geom.ProbLoArray(); const auto dx = geom.CellSizeArray(); - XDim3 blo{plo[0] + static_cast(box.smallEnd(0))*dx[0], - plo[1] + static_cast(box.smallEnd(1))*dx[1], + XDim3 blo{.x = plo[0] + static_cast(box.smallEnd(0))*dx[0], + .y = plo[1] + static_cast(box.smallEnd(1))*dx[1], #if (AMREX_SPACEDIM == 2) - 0._rt + .z = 0._rt #else - plo[2] + static_cast(box.smallEnd(2))*dx[2] + .z = plo[2] + static_cast(box.smallEnd(2))*dx[2] #endif }; - XDim3 bhi{plo[0] + static_cast(box.bigEnd(0))*dx[0], - plo[1] + static_cast(box.bigEnd(1))*dx[1], + XDim3 bhi{.x = plo[0] + static_cast(box.bigEnd(0))*dx[0], + .y = plo[1] + static_cast(box.bigEnd(1))*dx[1], #if (AMREX_SPACEDIM == 2) - 0._rt + .z = 0._rt #else - plo[2] + static_cast(box.bigEnd(2))*dx[2] + .z = plo[2] + static_cast(box.bigEnd(2))*dx[2] #endif }; @@ -1117,12 +1117,12 @@ STLtools::getIntercept (Array,AMREX_SPACEDIM> const& inter_arr, #endif Real r = std::numeric_limits::quiet_NaN(); if (type(i,j,k) == EB2::Type::irregular) { - XDim3 p1{plo[0]+static_cast(i)*dx[0], - plo[1]+static_cast(j)*dx[1], + XDim3 p1{.x = plo[0]+static_cast(i)*dx[0], + .y = plo[1]+static_cast(j)*dx[1], #if (AMREX_SPACEDIM == 2) - Real(0.) + .z = Real(0.) #else - plo[2]+static_cast(k)*dx[2] + .z = plo[2]+static_cast(k)*dx[2] #endif }; if (idim == 0) { @@ -1174,10 +1174,10 @@ STLtools::getIntercept (Array,AMREX_SPACEDIM> const& inter_arr, auto const& tri = tri_pts[it]; auto const& norm = tri_norm[it]; auto tmp = edge_tri_intersects(p1.y, y2, p1.z, p1.x, - {tri.v1.y, tri.v1.z, tri.v1.x}, - {tri.v2.y, tri.v2.z, tri.v2.x}, - {tri.v3.y, tri.v3.z, tri.v3.x}, - { norm.y, norm.z, norm.x}, + XDim3{.x = tri.v1.y, .y = tri.v1.z, .z = tri.v1.x}, + XDim3{.x = tri.v2.y, .y = tri.v2.z, .z = tri.v2.x}, + XDim3{.x = tri.v3.y, .y = tri.v3.z, .z = tri.v3.x}, + XDim3{.x = norm.y, .y = norm.z, .z = norm.x}, lst(i,j+1,k)-lst(i,j,k)); if (tmp.first) { r = tmp.second; @@ -1196,10 +1196,10 @@ STLtools::getIntercept (Array,AMREX_SPACEDIM> const& inter_arr, auto const& tri = ptri[it]; auto const& norm = ptrinorm[it]; auto tmp = edge_tri_intersects(p1.y, y2, p1.z, p1.x, - {tri.v1.y, tri.v1.z, tri.v1.x}, - {tri.v2.y, tri.v2.z, tri.v2.x}, - {tri.v3.y, tri.v3.z, tri.v3.x}, - { norm.y, norm.z, norm.x}, + XDim3{.x = tri.v1.y, .y = tri.v1.z, .z = tri.v1.x}, + XDim3{.x = tri.v2.y, .y = tri.v2.z, .z = tri.v2.x}, + XDim3{.x = tri.v3.y, .y = tri.v3.z, .z = tri.v3.x}, + XDim3{.x = norm.y, .y = norm.z, .z = norm.x}, lst(i,j+1,k)-lst(i,j,k)); if (tmp.first) { r = tmp.second; @@ -1223,10 +1223,10 @@ STLtools::getIntercept (Array,AMREX_SPACEDIM> const& inter_arr, auto const& tri = tri_pts[it]; auto const& norm = tri_norm[it]; auto tmp = edge_tri_intersects(p1.z, z2, p1.x, p1.y, - {tri.v1.z, tri.v1.x, tri.v1.y}, - {tri.v2.z, tri.v2.x, tri.v2.y}, - {tri.v3.z, tri.v3.x, tri.v3.y}, - { norm.z, norm.x, norm.y}, + XDim3{.x = tri.v1.z, .y = tri.v1.x, .z = tri.v1.y}, + XDim3{.x = tri.v2.z, .y = tri.v2.x, .z = tri.v2.y}, + XDim3{.x = tri.v3.z, .y = tri.v3.x, .z = tri.v3.y}, + XDim3{.x = norm.z, .y = norm.x, .z = norm.y}, lst(i,j,k+1)-lst(i,j,k)); if (tmp.first) { r = tmp.second; @@ -1245,10 +1245,10 @@ STLtools::getIntercept (Array,AMREX_SPACEDIM> const& inter_arr, auto const& tri = ptri[it]; auto const& norm = ptrinorm[it]; auto tmp = edge_tri_intersects(p1.z, z2, p1.x, p1.y, - {tri.v1.z, tri.v1.x, tri.v1.y}, - {tri.v2.z, tri.v2.x, tri.v2.y}, - {tri.v3.z, tri.v3.x, tri.v3.y}, - { norm.z, norm.x, norm.y}, + XDim3{.x = tri.v1.z, .y = tri.v1.x, .z = tri.v1.y}, + XDim3{.x = tri.v2.z, .y = tri.v2.x, .z = tri.v2.y}, + XDim3{.x = tri.v3.z, .y = tri.v3.x, .z = tri.v3.y}, + XDim3{.x = norm.z, .y = norm.x, .z = norm.y}, lst(i,j,k+1)-lst(i,j,k)); if (tmp.first) { r = tmp.second; @@ -1354,9 +1354,9 @@ STLtools::fillSignedDistance (MultiFab& mf, IntVect const& nghost, Geometry cons auto const* bvh_root = m_bvh_nodes.data(); ParallelFor(mf, nghost, [=] AMREX_GPU_DEVICE (int b, int i, int j, int k) { - XDim3 coords = {plo[0]+(static_cast(i)+offset[0])*dx[0], - plo[1]+(static_cast(j)+offset[1])*dx[1], - plo[2]+(static_cast(k)+offset[2])*dx[2]}; + XDim3 coords{.x = plo[0]+(static_cast(i)+offset[0])*dx[0], + .y = plo[1]+(static_cast(j)+offset[1])*dx[1], + .z = plo[2]+(static_cast(k)+offset[2])*dx[2]}; auto d2 = bvh_d2(coords, bvh_root); ma[b](i,j,k) *= std::sqrt(d2); }); @@ -1365,9 +1365,9 @@ STLtools::fillSignedDistance (MultiFab& mf, IntVect const& nghost, Geometry cons int num_triangles = m_num_tri; ParallelFor(mf, nghost, [=] AMREX_GPU_DEVICE (int b, int i, int j, int k) { - XDim3 coords = {plo[0]+(static_cast(i)+offset[0])*dx[0], - plo[1]+(static_cast(j)+offset[1])*dx[1], - plo[2]+(static_cast(k)+offset[2])*dx[2]}; + XDim3 coords{.x = plo[0]+(static_cast(i)+offset[0])*dx[0], + .y = plo[1]+(static_cast(j)+offset[1])*dx[1], + .z = plo[2]+(static_cast(k)+offset[2])*dx[2]}; auto d2 = std::numeric_limits::max(); for (int tr = 0; tr < num_triangles; ++tr) { auto tmp = pt_tri_min_d2(coords, tri_pts[tr]); diff --git a/Src/EB/AMReX_MarchingCubes.cpp b/Src/EB/AMReX_MarchingCubes.cpp index 8212fbe5da9..a76e037cc98 100644 --- a/Src/EB/AMReX_MarchingCubes.cpp +++ b/Src/EB/AMReX_MarchingCubes.cpp @@ -974,14 +974,14 @@ void write_stl (std::string const& filename, std::map auto iv1 = tri_v1[itri]; auto iv2 = tri_v2[itri]; auto iv3 = tri_v3[itri]; - XDim3 v1 = { vert_x[iv1], vert_y[iv1], vert_z[iv1] }; - XDim3 v2 = { vert_x[iv2], vert_y[iv2], vert_z[iv2] }; - XDim3 v3 = { vert_x[iv3], vert_y[iv3], vert_z[iv3] }; - XDim3 vec1{v2.x-v1.x, v2.y-v1.y, v2.z-v1.z}; - XDim3 vec2{v3.x-v2.x, v3.y-v2.y, v3.z-v2.z}; - XDim3 norm{vec1.y*vec2.z-vec1.z*vec2.y, - vec1.z*vec2.x-vec1.x*vec2.z, - vec1.x*vec2.y-vec1.y*vec2.x}; + XDim3 v1{.x = vert_x[iv1], .y = vert_y[iv1], .z = vert_z[iv1]}; + XDim3 v2{.x = vert_x[iv2], .y = vert_y[iv2], .z = vert_z[iv2]}; + XDim3 v3{.x = vert_x[iv3], .y = vert_y[iv3], .z = vert_z[iv3]}; + XDim3 vec1{.x = v2.x-v1.x, .y = v2.y-v1.y, .z = v2.z-v1.z}; + XDim3 vec2{.x = v3.x-v2.x, .y = v3.y-v2.y, .z = v3.z-v2.z}; + XDim3 norm{.x = vec1.y*vec2.z-vec1.z*vec2.y, + .y = vec1.z*vec2.x-vec1.x*vec2.z, + .z = vec1.x*vec2.y-vec1.y*vec2.x}; auto tmp = std::sqrt(norm.x*norm.x + norm.y*norm.y + norm.z*norm.z); if (tmp != 0) { tmp = Real(1) / tmp; } ofs << "facet normal " << norm.x*tmp << " " << norm.y*tmp << " " << norm.z*tmp << "\n" diff --git a/Src/Extern/HYPRE/AMReX_HypreMLABecLap.cpp b/Src/Extern/HYPRE/AMReX_HypreMLABecLap.cpp index 21188827309..66e3d9d24ea 100644 --- a/Src/Extern/HYPRE/AMReX_HypreMLABecLap.cpp +++ b/Src/Extern/HYPRE/AMReX_HypreMLABecLap.cpp @@ -1391,7 +1391,9 @@ void HypreMLABecLap::commBCoefs (int flev, Array auto const& sfab = (*a_bcoefs[idir])[t.srcIndex]; #ifdef AMREX_USE_GPU bc_send_tags.emplace_back(Array4PairTag - {makeArray4((Real*)dptr, bx, ncomp), sfab.const_array(), bx}); + {.dfab = makeArray4((Real*)dptr, bx, ncomp), + .sfab = sfab.const_array(), + .dbox = bx}); std::size_t nbytes = bx.numPts()*sizeof(Real)*ncomp; #else auto nbytes = sfab.copyToMem(bx, 0, ncomp, dptr); diff --git a/Src/FFT/AMReX_FFT_Helper.H b/Src/FFT/AMReX_FFT_Helper.H index f005542fa9d..182494cc7f1 100644 --- a/Src/FFT/AMReX_FFT_Helper.H +++ b/Src/FFT/AMReX_FFT_Helper.H @@ -1602,12 +1602,12 @@ struct Swap01 { [[nodiscard]] constexpr Dim3 operator() (Dim3 i) const noexcept { - return {i.y, i.x, i.z}; + return Dim3{.x = i.y, .y = i.x, .z = i.z}; } static constexpr Dim3 Inverse (Dim3 i) { - return {i.y, i.x, i.z}; + return Dim3{.x = i.y, .y = i.x, .z = i.z}; } [[nodiscard]] constexpr IndexType operator() (IndexType it) const noexcept @@ -1625,12 +1625,12 @@ struct Swap02 { [[nodiscard]] constexpr Dim3 operator() (Dim3 i) const noexcept { - return {i.z, i.y, i.x}; + return Dim3{.x = i.z, .y = i.y, .z = i.x}; } static constexpr Dim3 Inverse (Dim3 i) { - return {i.z, i.y, i.x}; + return Dim3{.x = i.z, .y = i.y, .z = i.x}; } [[nodiscard]] constexpr IndexType operator() (IndexType it) const noexcept @@ -1649,13 +1649,13 @@ struct RotateFwd // dest -> src: (x,y,z) -> (y,z,x) [[nodiscard]] constexpr Dim3 operator() (Dim3 i) const noexcept { - return {i.y, i.z, i.x}; + return Dim3{.x = i.y, .y = i.z, .z = i.x}; } // src -> dest: (x,y,z) -> (z,x,y) static constexpr Dim3 Inverse (Dim3 i) { - return {i.z, i.x, i.y}; + return Dim3{.x = i.z, .y = i.x, .z = i.y}; } [[nodiscard]] constexpr IndexType operator() (IndexType it) const noexcept @@ -1674,13 +1674,13 @@ struct RotateBwd // dest -> src: (x,y,z) -> (z,x,y) [[nodiscard]] constexpr Dim3 operator() (Dim3 i) const noexcept { - return {i.z, i.x, i.y}; + return Dim3{.x = i.z, .y = i.x, .z = i.y}; } // src -> dest: (x,y,z) -> (y,z,x) static constexpr Dim3 Inverse (Dim3 i) { - return {i.y, i.z, i.x}; + return Dim3{.x = i.y, .y = i.z, .z = i.x}; } [[nodiscard]] constexpr IndexType operator() (IndexType it) const noexcept diff --git a/Src/FFT/AMReX_FFT_Poisson.H b/Src/FFT/AMReX_FFT_Poisson.H index d822786c882..f7399581e5e 100644 --- a/Src/FFT/AMReX_FFT_Poisson.H +++ b/Src/FFT/AMReX_FFT_Poisson.H @@ -899,7 +899,7 @@ void fill_physbc (MF& mf, Geometry const& geom, } b &= box; if (b.ok() && fbc != Boundary::periodic) { - tags.push_back({arr, b, fbc, face}); + tags.push_back(Tag{.dfab = arr, .dbox = b, .bc = fbc, .face = face}); } } } diff --git a/Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H b/Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H index 0f77a4bcd8f..9f9378c0e6e 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H @@ -990,7 +990,7 @@ MLCellLinOpT::interpolation (int amrlev, int fmglev, MF& fine, const MF& crs { const int ncomp = this->getNComp(); - Dim3 ratio3 = {2,2,2}; + Dim3 ratio3 = {.x = 2, .y = 2, .z = 2}; IntVect ratio = (amrlev > 0) ? IntVect(2) : this->mg_coarsen_ratio_vec[fmglev]; AMREX_D_TERM(ratio3.x = ratio[0];, ratio3.y = ratio[1];, diff --git a/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp b/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp index 07d3a4280a2..7b01dc0b9be 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp @@ -273,7 +273,7 @@ void MLCurlCurl::setDirichletNodesToZero (int amrlev, int mglev, MF& a_mf) const Box b = vbx; b.setRange(idim, vbx[face], 1); #ifdef AMREX_USE_GPU - tags.emplace_back(Array4BoxTag{a,b}); + tags.emplace_back(Array4BoxTag{.dfab = a, .dbox = b}); #else amrex::LoopOnCpu(b, [&] (int i, int j, int k) { @@ -1099,7 +1099,7 @@ void MLCurlCurl::applyPhysBC (int amrlev, int mglev, MultiFab& mf, CurlCurlState } } #ifdef AMREX_USE_GPU - tags.emplace_back(Array4BoxOrientationTag{a,b,face}); + tags.emplace_back(Array4BoxOrientationTag{.fab = a, .bx = b, .face = face}); #else amrex::LoopOnCpu(b, [&] (int i, int j, int k) { @@ -1160,7 +1160,7 @@ void MLCurlCurl::applyPhysBC (int amrlev, int mglev, MultiFab& mf, CurlCurlState b.setRange(jdim,vbx.bigEnd(jdim)+1); } #ifdef AMREX_USE_GPU - tags2.emplace_back(Array4BoxOffsetTag{a,b,offset}); + tags2.emplace_back(Array4BoxOffsetTag{.fab = a, .bx = b, .offset = offset}); #else amrex::LoopOnCpu(b, [&] (int i, int j, int k) { @@ -1226,14 +1226,14 @@ CurlCurlDirichletInfo MLCurlCurl::getDirichletInfo (int amrlev, int mglev) const } }; - return CurlCurlDirichletInfo{IntVect(AMREX_D_DECL(helper(0,0), - helper(1,0), - helper(2,0))), - IntVect(AMREX_D_DECL(helper(0,1), - helper(1,1), - helper(2,1))) + return CurlCurlDirichletInfo{.dirichlet_lo = IntVect(AMREX_D_DECL(helper(0,0), + helper(1,0), + helper(2,0))), + .dirichlet_hi = IntVect(AMREX_D_DECL(helper(0,1), + helper(1,1), + helper(2,1))) #if (AMREX_SPACEDIM < 3) - ,m_coord + ,.coord = m_coord #endif }; } @@ -1268,12 +1268,12 @@ CurlCurlSymmetryInfo MLCurlCurl::getSymmetryInfo (int amrlev, int mglev) const } }; - return CurlCurlSymmetryInfo{IntVect(AMREX_D_DECL(helper(0,0), - helper(1,0), - helper(2,0))), - IntVect(AMREX_D_DECL(helper(0,1), - helper(1,1), - helper(2,1)))}; + return CurlCurlSymmetryInfo{.symmetry_lo = IntVect(AMREX_D_DECL(helper(0,0), + helper(1,0), + helper(2,0))), + .symmetry_hi = IntVect(AMREX_D_DECL(helper(0,1), + helper(1,1), + helper(2,1)))}; } void MLCurlCurl::update () diff --git a/Src/LinearSolvers/OpenBC/AMReX_OpenBC.cpp b/Src/LinearSolvers/OpenBC/AMReX_OpenBC.cpp index 4e13b4818c9..5666c1b1a4e 100644 --- a/Src/LinearSolvers/OpenBC/AMReX_OpenBC.cpp +++ b/Src/LinearSolvers/OpenBC/AMReX_OpenBC.cpp @@ -94,8 +94,8 @@ void OpenBCSolver::define (const Vector& a_geom, Orientation::Side side = (b2d.smallEnd(idim) == domain0.smallEnd(idim)) ? Orientation::low : Orientation::high; Orientation face(idim, side); - m_momtags_h.push_back({m_dpdn[idim].const_array(mfi), b2d, face, - nblocks}); + m_momtags_h.push_back({.gp = m_dpdn[idim].const_array(mfi), .b2d = b2d, + .face = face, .offset = nblocks}); nblocks += static_cast(b2d.numPts()) / (m_coarsen_ratio*m_coarsen_ratio); } diff --git a/Src/Particle/AMReX_ParticleContainerI.H b/Src/Particle/AMReX_ParticleContainerI.H index e0eb6c8496c..adc9e4b5a47 100644 --- a/Src/Particle/AMReX_ParticleContainerI.H +++ b/Src/Particle/AMReX_ParticleContainerI.H @@ -1310,7 +1310,8 @@ ParticleContainer_impl const& a, T tot) auto v1 = a(i,j,k,0); auto v2 = a(IntVectND<4>(i,j,k,0)); auto v3 = a(IntVect(AMREX_D_DECL(i,j,k))); - auto v4 = a(Dim3{i,j,k}); + auto v4 = a(Dim3{.x = i, .y = j, .z = k}); auto* p0 = a.ptr(i,j,k); auto* p1 = a.ptr(i,j,k,0); auto* p2 = a.ptr(IntVectND<4>(i,j,k,0)); auto* p3 = a.ptr(IntVect(AMREX_D_DECL(i,j,k))); - auto* p4 = a.ptr(Dim3{i,j,k}); + auto* p4 = a.ptr(Dim3{.x = i, .y = j, .z = k}); return (v0+v1+v2+v3+v4+*p0+*p1+*p2+*p3+*p4)/10; }); } else { @@ -38,10 +38,10 @@ void test_array4 (Array4 const& a, T tot) { auto v0 = a(i,j,k,n); auto v1 = a(IntVect(AMREX_D_DECL(i,j,k)),n); - auto v2 = a(Dim3{i,j,k},n); + auto v2 = a(Dim3{.x = i, .y = j, .z = k},n); auto* p0 = a.ptr(i,j,k,n); auto* p1 = a.ptr(IntVect(AMREX_D_DECL(i,j,k)),n); - auto* p2 = a.ptr(Dim3{i,j,k},n); + auto* p2 = a.ptr(Dim3{.x = i, .y = j, .z = k},n); return (v0+v1+v2+*p0+*p1+*p2)/6; }); } diff --git a/Tests/Base/TrackedVector/main.cpp b/Tests/Base/TrackedVector/main.cpp index c2c80539020..cb6812e9835 100644 --- a/Tests/Base/TrackedVector/main.cpp +++ b/Tests/Base/TrackedVector/main.cpp @@ -247,7 +247,7 @@ void test_aggregate () std::vector i = {1, 2, 3}; std::vector j = {4, 5, 6}; - [[maybe_unused]] auto ptr1 = std::shared_ptr(new S{42.0, i, j}); // NOLINT(modernize-make-shared) + [[maybe_unused]] auto ptr1 = std::shared_ptr(new S{.x = 42.0, .a = i, .b = j}); // NOLINT(modernize-make-shared) } void test_copy_constructor () diff --git a/Tests/MultiBlock/Advection/main.cpp b/Tests/MultiBlock/Advection/main.cpp index 98baebce272..417dddb8478 100644 --- a/Tests/MultiBlock/Advection/main.cpp +++ b/Tests/MultiBlock/Advection/main.cpp @@ -155,7 +155,9 @@ struct OnesidedMultiBlockBoundaryFn { FabArrayBase::BDKey cached_src_bd_key{}; ApplyDtosAndProjectionOnReciever>> - packing{PackComponents{0, 0, three_components}, dtos}; + packing{PackComponents{.dest_component = 0, + .src_component = 0, + .n_components = three_components}, dtos}; AMREX_NODISCARD CommHandler FillBoundary_nowait() { if (!cmd || cached_dest_bd_key != dest->mass.getBDKey() || cached_src_bd_key != src->mass.getBDKey()) { diff --git a/Tests/MultiBlock/IndexType/main.cpp b/Tests/MultiBlock/IndexType/main.cpp index 881aac90ac8..2b104a8ad91 100644 --- a/Tests/MultiBlock/IndexType/main.cpp +++ b/Tests/MultiBlock/IndexType/main.cpp @@ -54,7 +54,7 @@ bool ParallelCopyWithItselfIsCorrect(amrex::iMultiFab& mf, const amrex::Box& dom reduce_op.eval(section, reduce_data, [=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple { - amrex::Dim3 si = dtos(amrex::Dim3{i,j,k}); + amrex::Dim3 si = dtos(amrex::Dim3{.x = i, .y = j, .z = k}); int value = si.x + si.y*nx + si.z*nx*ny; auto r = int(array(i,j,k) != value); return { r }; @@ -120,7 +120,7 @@ bool ParallelCopyFaceToFace(amrex::iMultiFab& dest, const amrex::Box& domain_des reduce_op.eval(section, reduce_data, [=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple { - amrex::Dim3 si = dtos(amrex::Dim3{i,j,k}); + amrex::Dim3 si = dtos(amrex::Dim3{.x = i, .y = j, .z = k}); int value = si.x + si.y*nx + si.z*nx*ny; auto r = int(darray(i,j,k) != value); return { r }; diff --git a/Tests/Particles/ParticleMeshMultiLevel/main.cpp b/Tests/Particles/ParticleMeshMultiLevel/main.cpp index c89410473d7..39cae32c83c 100644 --- a/Tests/Particles/ParticleMeshMultiLevel/main.cpp +++ b/Tests/Particles/ParticleMeshMultiLevel/main.cpp @@ -128,7 +128,9 @@ void testParticleMesh (TestParams& parms) int num_comp = 1; amrex::ParticleToMesh(myPC,GetVecOfPtrs(density2),0,parms.nlevs-1, - TrilinearDeposition{start_part_comp,start_mesh_comp,num_comp}); + TrilinearDeposition{.start_part_comp = start_part_comp, + .start_mesh_comp = start_mesh_comp, + .num_comp = num_comp}); // // Now write the output from each into separate plotfiles for comparison