From d78e241d1ad4b55acce238aed9d2b7d965283d0b Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Tue, 2 Apr 2024 10:59:46 -0400 Subject: [PATCH] make clang-tidy recognize .H as a header (#3832) the output of `clang-tidy --dump-config` shows that .H is not recognized as a header fix warnings --------- Co-authored-by: Weiqun Zhang --- .clang-tidy | 15 ++++++ Src/AmrCore/AMReX_FillPatchUtil_I.H | 22 ++++---- Src/AmrCore/AMReX_FillPatcher.H | 12 ++--- Src/AmrCore/AMReX_Interp_2D_C.H | 6 ++- Src/AmrCore/AMReX_Interp_3D_C.H | 6 ++- Src/AmrCore/AMReX_MFInterp_C.H | 4 -- Src/Boundary/AMReX_YAFluxRegister_K.H | 10 ++-- Src/EB/AMReX_EB2_2D_C.H | 4 +- Src/EB/AMReX_EB2_3D_C.H | 8 ++- Src/EB/AMReX_EBFluxRegister_2D_C.H | 22 ++++---- Src/EB/AMReX_EBFluxRegister_3D_C.H | 22 ++++---- Src/EB/AMReX_EB_Slopes_2D_K.H | 3 -- Src/EB/AMReX_EB_Slopes_3D_K.H | 3 -- Src/LinearSolvers/MLMG/AMReX_MLEBABecLap_K.H | 4 +- .../MLMG/AMReX_MLNodeABecLaplacian.cpp | 2 +- Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H | 43 ++++++++++----- Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H | 52 ++++++++++++++----- Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H | 5 +- .../MLMG/AMReX_MLNodeLaplacian.cpp | 4 +- .../MLMG/AMReX_MLNodeLaplacian_hypre.cpp | 24 ++++----- .../MLMG/AMReX_MLNodeTensorLap_2D_K.H | 6 ++- .../MLMG/AMReX_MLNodeTensorLap_3D_K.H | 6 ++- .../MLMG/AMReX_MLNodeTensorLap_K.H | 19 ------- .../MLMG/AMReX_MLNodeTensorLaplacian.cpp | 8 +-- Src/Particle/AMReX_NeighborList.H | 6 +-- Src/Particle/AMReX_NeighborParticlesI.H | 2 +- Src/Particle/AMReX_Particle.H | 3 -- Tests/EB_CNS/Source/hydro/CNS_hydro_K.H | 39 ++++++-------- Tests/EB_CNS/Source/hydro/CNS_hydro_eb_K.H | 36 ++++++------- Tests/GPU/CNS/Source/hydro/CNS_hydro_K.H | 39 ++++++-------- Tests/LinearSolvers/CellEB2/MyTest_K.H | 4 -- 31 files changed, 230 insertions(+), 209 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index add3ba63bbd..24270cbde20 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -51,3 +51,18 @@ Checks: > # Files not ending with nolint.H will be filtered in. HeaderFilterRegex: '([^n].....|[^o]....|[^l]...|[^i]..|[^n].|[^t])\.H$' + +CheckOptions: + - key: bugprone-dynamic-static-initializers.HeaderFileExtensions + value: ';H;h;hh;hpp;hxx' + - key: bugprone-suspicious-include.HeaderFileExtensions + value: ';H;h;hh;hpp;hxx' + - key: google-global-names-in-headers.HeaderFileExtensions + value: ';H;h;hh;hpp;hxx' + - key: google-build-namespaces.HeaderFileExtensions + value: ';H;h;hh;hpp;hxx' + - key: misc-definitions-in-headers.HeaderFileExtensions + value: ';H;h;hh;hpp;hxx' + - key: misc-use-anonymous-namespace.HeaderFileExtensions + value: ';H;h;hh;hpp;hxx' + diff --git a/Src/AmrCore/AMReX_FillPatchUtil_I.H b/Src/AmrCore/AMReX_FillPatchUtil_I.H index b3e1ee64aae..298928b41d2 100644 --- a/Src/AmrCore/AMReX_FillPatchUtil_I.H +++ b/Src/AmrCore/AMReX_FillPatchUtil_I.H @@ -293,7 +293,7 @@ InterpFace (InterpBase *interp, } -namespace { +namespace detail { // ======== FArrayBox @@ -739,7 +739,7 @@ namespace { } } -} // Anonymous namespace +} // namespace detail template std::enable_if_t::value> @@ -761,7 +761,7 @@ FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, #else EB2::IndexSpace const* index_space = nullptr; #endif - FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft, + detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft, scomp,dcomp,ncomp,cgeom,fgeom, cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp, pre_interp,post_interp,index_space); @@ -788,7 +788,7 @@ FillPatchTwoLevels (MF& mf, Real time, EB2::IndexSpace const* index_space = nullptr; #endif - FillPatchTwoLevels_doit(mf,mf.nGrowVect(),time,cmf,ct,fmf,ft, + detail::FillPatchTwoLevels_doit(mf,mf.nGrowVect(),time,cmf,ct,fmf,ft, scomp,dcomp,ncomp,cgeom,fgeom, cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp, pre_interp,post_interp,index_space); @@ -815,7 +815,7 @@ FillPatchTwoLevels (Array const& mf, IntVect const& nghost, EB2::IndexSpace const* index_space = nullptr; #endif - FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft, + detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft, scomp,dcomp,ncomp,cgeom,fgeom, cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp, pre_interp,post_interp,index_space); @@ -846,7 +846,7 @@ FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Array fbccomp_arr = {AMREX_D_DECL(fbccomp,fbccomp,fbccomp)}; Array bcscomp_arr = {AMREX_D_DECL(bcscomp,bcscomp,bcscomp)}; - FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft, + detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft, scomp,dcomp,ncomp,cgeom,fgeom, cbc,cbccomp_arr,fbc,fbccomp_arr,ratio,mapper,bcs,bcscomp_arr, pre_interp,post_interp,index_space); @@ -877,7 +877,7 @@ FillPatchTwoLevels (Array const& mf, Real time, Array fbccomp_arr = {AMREX_D_DECL(fbccomp,fbccomp,fbccomp)}; Array bcscomp_arr = {AMREX_D_DECL(bcscomp,bcscomp,bcscomp)}; - FillPatchTwoLevels_doit(mf,mf[0]->nGrowVect(),time,cmf,ct,fmf,ft, + detail::FillPatchTwoLevels_doit(mf,mf[0]->nGrowVect(),time,cmf,ct,fmf,ft, scomp,dcomp,ncomp,cgeom,fgeom, cbc,cbccomp_arr,fbc,fbccomp_arr,ratio,mapper,bcs,bcscomp_arr, pre_interp,post_interp,index_space); @@ -900,7 +900,7 @@ FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, const PreInterpHook& pre_interp, const PostInterpHook& post_interp) { - FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft, + detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft, scomp,dcomp,ncomp,cgeom,fgeom, cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp, pre_interp,post_interp,&index_space); @@ -922,7 +922,7 @@ FillPatchTwoLevels (MF& mf, Real time, const PreInterpHook& pre_interp, const PostInterpHook& post_interp) { - FillPatchTwoLevels_doit(mf,mf.nGrowVect(),time,cmf,ct,fmf,ft, + detail::FillPatchTwoLevels_doit(mf,mf.nGrowVect(),time,cmf,ct,fmf,ft, scomp,dcomp,ncomp,cgeom,fgeom, cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp, pre_interp,post_interp,&index_space); @@ -1016,7 +1016,7 @@ InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, { mf_crse_patch.define(ba_crse_patch, dm, ncomp, 0); } - mf_set_domain_bndry (mf_crse_patch, cgeom); + detail::mf_set_domain_bndry (mf_crse_patch, cgeom); mf_crse_patch.ParallelCopy(cmf, scomp, 0, ncomp, cgeom.periodicity()); @@ -1131,7 +1131,7 @@ InterpFromCoarseLevel (Array const& mf, IntVect const& ngho #else mf_crse_patch[d].define(ba_crse_idxed, dm, ncomp, 0); #endif - mf_set_domain_bndry(mf_crse_patch[d], cgeom); + detail::mf_set_domain_bndry(mf_crse_patch[d], cgeom); mf_crse_patch[d].ParallelCopy(*(cmf[d]), scomp, 0, ncomp, cgeom.periodicity()); cbc[d](mf_crse_patch[d], 0, ncomp, mf_crse_patch[d].nGrowVect(), time, cbccomp); diff --git a/Src/AmrCore/AMReX_FillPatcher.H b/Src/AmrCore/AMReX_FillPatcher.H index 5ff1c9550d3..c6b5567abdb 100644 --- a/Src/AmrCore/AMReX_FillPatcher.H +++ b/Src/AmrCore/AMReX_FillPatcher.H @@ -308,7 +308,7 @@ FillPatcher::fillCoarseFineBoundary (MF& mf, IntVect const& nghost, Real tim { if (m_cf_fine_data == nullptr) { m_cf_fine_data = std::make_unique - (make_mf_fine_patch(fpc, m_ncomp)); + (detail::make_mf_fine_patch(fpc, m_ncomp)); } int ncmfs = cmf.size(); @@ -320,7 +320,7 @@ FillPatcher::fillCoarseFineBoundary (MF& mf, IntVect const& nghost, Real tim }); if (it == std::end(m_cf_crse_data)) { - MF mf_crse_patch = make_mf_crse_patch(fpc, m_ncomp); + MF mf_crse_patch = detail::make_mf_crse_patch(fpc, m_ncomp); mf_crse_patch.ParallelCopy(*cmf[icmf], m_cgeom.periodicity()); std::pair> tmp; @@ -332,7 +332,7 @@ FillPatcher::fillCoarseFineBoundary (MF& mf, IntVect const& nghost, Real tim if (m_cf_crse_data_tmp == nullptr) { m_cf_crse_data_tmp = std::make_unique - (make_mf_crse_patch(fpc, m_ncomp)); + (detail::make_mf_crse_patch(fpc, m_ncomp)); } int const ng_space_interp = 8; // Need to be big enough @@ -419,7 +419,7 @@ void FillPatcher::storeRKCoarseData (Real /*time*/, Real dt, MF const& S_old for (auto& tmf : m_cf_crse_data) { tmf.first = std::numeric_limits::lowest(); // because we don't need it - tmf.second = std::make_unique(make_mf_crse_patch(fpc, m_ncomp)); + tmf.second = std::make_unique(detail::make_mf_crse_patch(fpc, m_ncomp)); } m_cf_crse_data[0].second->ParallelCopy(S_old, m_cgeom.periodicity()); for (std::size_t i = 0; i < order; ++i) { @@ -444,7 +444,7 @@ void FillPatcher::fillRK (int stage, int iteration, int ncycle, auto const& fpc = getFPinfo(); if (m_cf_crse_data_tmp == nullptr) { m_cf_crse_data_tmp = std::make_unique - (make_mf_crse_patch(fpc, m_ncomp)); + (detail::make_mf_crse_patch(fpc, m_ncomp)); } auto const& u = m_cf_crse_data_tmp->arrays(); @@ -596,7 +596,7 @@ void FillPatcher::fillRK (int stage, int iteration, int ncycle, cbc(*m_cf_crse_data_tmp, 0, m_ncomp, m_nghost, time, 0); if (m_cf_fine_data == nullptr) { - m_cf_fine_data = std::make_unique(make_mf_fine_patch(fpc, m_ncomp)); + m_cf_fine_data = std::make_unique(detail::make_mf_fine_patch(fpc, m_ncomp)); } FillPatchInterp(*m_cf_fine_data, 0, *m_cf_crse_data_tmp, 0, diff --git a/Src/AmrCore/AMReX_Interp_2D_C.H b/Src/AmrCore/AMReX_Interp_2D_C.H index a47f265011d..3b451fdf975 100644 --- a/Src/AmrCore/AMReX_Interp_2D_C.H +++ b/Src/AmrCore/AMReX_Interp_2D_C.H @@ -28,7 +28,7 @@ pcinterp_interp (Box const& bx, } } -namespace { +namespace interp_detail { constexpr int ix = 0; constexpr int iy = 1; constexpr int ixy = 2; @@ -39,6 +39,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void nodebilin_slopes (Box const& bx, Array4 const& slope, Array4 const& u, const int icomp, const int ncomp, IntVect const& ratio) noexcept { + using namespace interp_detail; + const auto lo = amrex::lbound(bx); const auto hi = amrex::ubound(bx); @@ -67,6 +69,8 @@ nodebilin_interp (Box const& bx, Array4 const& fine, const int fcomp, const i Array4 const& slope, Array4 const& crse, const int ccomp, IntVect const& ratio) noexcept { + using namespace interp_detail; + const auto lo = amrex::lbound(bx); const auto hi = amrex::ubound(bx); const auto chi = amrex::ubound(slope); diff --git a/Src/AmrCore/AMReX_Interp_3D_C.H b/Src/AmrCore/AMReX_Interp_3D_C.H index 709b44761d0..b29ba4aca40 100644 --- a/Src/AmrCore/AMReX_Interp_3D_C.H +++ b/Src/AmrCore/AMReX_Interp_3D_C.H @@ -31,7 +31,7 @@ pcinterp_interp (Box const& bx, } } -namespace { +namespace interp_detail { constexpr int ix = 0; constexpr int iy = 1; constexpr int iz = 2; @@ -49,6 +49,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void nodebilin_slopes (Box const& bx, Array4 const& slope, Array4 const& u, const int icomp, const int ncomp, IntVect const& ratio) noexcept { + using namespace interp_detail; + const auto lo = amrex::lbound(bx); const auto hi = amrex::ubound(bx); @@ -91,6 +93,8 @@ nodebilin_interp (Box const& bx, Array4 const& fine, const int fcomp, const i Array4 const& slope, Array4 const& crse, const int ccomp, IntVect const& ratio) noexcept { + using namespace interp_detail; + const auto lo = amrex::lbound(bx); const auto hi = amrex::ubound(bx); const auto chi = amrex::ubound(slope); diff --git a/Src/AmrCore/AMReX_MFInterp_C.H b/Src/AmrCore/AMReX_MFInterp_C.H index fbd2b86c6bc..cce4103d199 100644 --- a/Src/AmrCore/AMReX_MFInterp_C.H +++ b/Src/AmrCore/AMReX_MFInterp_C.H @@ -7,8 +7,6 @@ namespace amrex { -namespace { - AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mf_compute_slopes_x (int i, int j, int k, Array4 const& u, int nu, Box const& domain, BCRec const& bc) @@ -252,8 +250,6 @@ Real mf_cell_quadratic_compute_slopes_yz (int i, int j, int k, return yz; } -} // namespace - } // namespace amrex #if (AMREX_SPACEDIM == 1) diff --git a/Src/Boundary/AMReX_YAFluxRegister_K.H b/Src/Boundary/AMReX_YAFluxRegister_K.H index 5dbdb7b3bef..d42312de8e2 100644 --- a/Src/Boundary/AMReX_YAFluxRegister_K.H +++ b/Src/Boundary/AMReX_YAFluxRegister_K.H @@ -2,12 +2,10 @@ #define AMREX_YAFLUXREGISTER_K_H_ #include -namespace { - // must be same as in AMReX_YAFluxRegister.H - constexpr int amrex_yafluxreg_crse_cell = 0; - constexpr int amrex_yafluxreg_crse_fine_boundary_cell = 1; - constexpr int amrex_yafluxreg_fine_cell = 2; -} +// must be same as in AMReX_YAFluxRegister.H +constexpr int amrex_yafluxreg_crse_cell = 0; +constexpr int amrex_yafluxreg_crse_fine_boundary_cell = 1; +constexpr int amrex_yafluxreg_fine_cell = 2; #if (AMREX_SPACEDIM == 1) #include diff --git a/Src/EB/AMReX_EB2_2D_C.H b/Src/EB/AMReX_EB2_2D_C.H index 529d513163b..7da67456792 100644 --- a/Src/EB/AMReX_EB2_2D_C.H +++ b/Src/EB/AMReX_EB2_2D_C.H @@ -66,7 +66,7 @@ amrex_eb2_build_types (Box const& tbx, Box const& bxg2, }); } -namespace { +namespace detail { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int num_cuts (Real a, Real b) noexcept { return (a >= 0.0_rt && b < 0.0_rt) || (b >= 0.0_rt && a < 0.0_rt); @@ -76,6 +76,8 @@ namespace { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int check_mvmc (int i, int j, int, Array4 const& fine) { + using detail::num_cuts; + constexpr int k = 0; i *= 2; j *= 2; diff --git a/Src/EB/AMReX_EB2_3D_C.H b/Src/EB/AMReX_EB2_3D_C.H index 10dbdb342d2..bedd1733f66 100644 --- a/Src/EB/AMReX_EB2_3D_C.H +++ b/Src/EB/AMReX_EB2_3D_C.H @@ -159,7 +159,7 @@ amrex_eb2_build_types (Box const& tbx, Box const& bxg2, }); } -namespace { +namespace detail { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int num_cuts (Real a, Real b) noexcept { return (a >= 0.0_rt && b < 0.0_rt) || (b >= 0.0_rt && a < 0.0_rt); @@ -169,6 +169,8 @@ namespace { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int check_mvmc (int i, int j, int k, Array4 const& fine) { + using detail::num_cuts; + int ierr = 0; i *= 2; @@ -272,7 +274,7 @@ int check_mvmc (int i, int j, int k, Array4 const& fine) return ierr; } -namespace { +namespace detail { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real coarsen_edge_cent (Real f1, Real f2) { @@ -320,6 +322,8 @@ int coarsen_from_fine (int i, int j, int k, Box const& bx, int ngrow, Array4 const& fecy, Array4 const& fecz, Array4 const& fflag) { + using detail::coarsen_edge_cent; + const Box& gbx = amrex::grow(bx,ngrow); const Box& xbx = amrex::surroundingNodes(bx,0); // face boxes const Box& ybx = amrex::surroundingNodes(bx,1); diff --git a/Src/EB/AMReX_EBFluxRegister_2D_C.H b/Src/EB/AMReX_EBFluxRegister_2D_C.H index 067411f0198..0fb9b229f7c 100644 --- a/Src/EB/AMReX_EBFluxRegister_2D_C.H +++ b/Src/EB/AMReX_EBFluxRegister_2D_C.H @@ -42,20 +42,18 @@ void eb_flux_reg_crseadd_va(int i, int j, int k, Array4 const& d, } } -namespace { - AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - Real eb_flux_reg_cvol (int i, int j, Array4 const& vfrac, - Dim3 const& ratio, Real threshold) noexcept - { - Real cvol = Real(0.0); - constexpr int kk = 0; - for (int jj = j*ratio.y; jj < (j+1)*ratio.y; ++jj) { - for (int ii = i*ratio.x; ii < (i+1)*ratio.x; ++ii) { - cvol += vfrac(ii,jj,kk); - } +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE +Real eb_flux_reg_cvol (int i, int j, Array4 const& vfrac, + Dim3 const& ratio, Real threshold) noexcept +{ + Real cvol = Real(0.0); + constexpr int kk = 0; + for (int jj = j*ratio.y; jj < (j+1)*ratio.y; ++jj) { + for (int ii = i*ratio.x; ii < (i+1)*ratio.x; ++ii) { + cvol += vfrac(ii,jj,kk); } - return (cvol > threshold) ? Real(1.0)/cvol : Real(0.0); } + return (cvol > threshold) ? Real(1.0)/cvol : Real(0.0); } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/Src/EB/AMReX_EBFluxRegister_3D_C.H b/Src/EB/AMReX_EBFluxRegister_3D_C.H index 3410c7180db..99d5ca53c25 100644 --- a/Src/EB/AMReX_EBFluxRegister_3D_C.H +++ b/Src/EB/AMReX_EBFluxRegister_3D_C.H @@ -55,21 +55,19 @@ void eb_flux_reg_crseadd_va(int i, int j, int k, Array4 const& d, } } -namespace { - AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - Real eb_flux_reg_cvol (int i, int j, int k, Array4 const& vfrac, - Dim3 const& ratio, Real small) noexcept - { - Real cvol = Real(0.0); - for (int kk = k*ratio.z; kk < (k+1)*ratio.z; ++kk) { - for (int jj = j*ratio.y; jj < (j+1)*ratio.y; ++jj) { - for (int ii = i*ratio.x; ii < (i+1)*ratio.x; ++ii) { - cvol += vfrac(ii,jj,kk); - } +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE +Real eb_flux_reg_cvol (int i, int j, int k, Array4 const& vfrac, + Dim3 const& ratio, Real small) noexcept +{ + Real cvol = Real(0.0); + for (int kk = k*ratio.z; kk < (k+1)*ratio.z; ++kk) { + for (int jj = j*ratio.y; jj < (j+1)*ratio.y; ++jj) { + for (int ii = i*ratio.x; ii < (i+1)*ratio.x; ++ii) { + cvol += vfrac(ii,jj,kk); } } - return (cvol > small) ? Real(1.0)/cvol : Real(0.0); } + return (cvol > small) ? Real(1.0)/cvol : Real(0.0); } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/Src/EB/AMReX_EB_Slopes_2D_K.H b/Src/EB/AMReX_EB_Slopes_2D_K.H index 06f1e6cba6a..9854756050e 100644 --- a/Src/EB/AMReX_EB_Slopes_2D_K.H +++ b/Src/EB/AMReX_EB_Slopes_2D_K.H @@ -7,8 +7,6 @@ #include #include -namespace { - // amrex_calc_slopes_eb calculates the slope in each coordinate direction using a // least squares linear fit to the 8 nearest neighbors, with the function // going through the centroid of cell(i,j,k). This does not assume that the cell centroids, @@ -882,5 +880,4 @@ amrex_lim_slopes_extdir_eb (int i, int j, int k, int n, return {alpha_lim[0]*slopes[0],alpha_lim[1]*slopes[1]}; } -} #endif diff --git a/Src/EB/AMReX_EB_Slopes_3D_K.H b/Src/EB/AMReX_EB_Slopes_3D_K.H index 3de0e92287f..46f89f4bfd1 100644 --- a/Src/EB/AMReX_EB_Slopes_3D_K.H +++ b/Src/EB/AMReX_EB_Slopes_3D_K.H @@ -7,8 +7,6 @@ #include #include -namespace { - // amrex_calc_slopes_eb calculates the slope in each coordinate direction using a // least squares linear fit to the 26 nearest neighbors, with the function // going through the centroid of cell(i,j,k). This does not assume that the cell centroids, @@ -1119,5 +1117,4 @@ amrex_lim_slopes_extdir_eb (int i, int j, int k, int n, return {alpha_lim[0]*slopes[0],alpha_lim[1]*slopes[1],alpha_lim[2]*slopes[2]}; } -} #endif diff --git a/Src/LinearSolvers/MLMG/AMReX_MLEBABecLap_K.H b/Src/LinearSolvers/MLMG/AMReX_MLEBABecLap_K.H index 9194344de55..517b1875bc3 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLEBABecLap_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLEBABecLap_K.H @@ -6,12 +6,12 @@ #include -namespace amrex { namespace { +namespace amrex { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real get_dx_eb (Real kappa) noexcept { return amrex::max(Real(0.3),(kappa*kappa-Real(0.25))/(Real(2.0)*kappa)); } -}} +} #if (AMREX_SPACEDIM == 2) #include diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeABecLaplacian.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeABecLaplacian.cpp index 07c516992f6..0fda51eac14 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeABecLaplacian.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeABecLaplacian.cpp @@ -278,7 +278,7 @@ MLNodeABecLaplacian::fixUpResidualMask (int amrlev, iMultiFab& resmsk) amrex::ParallelFor(resmsk, [=] AMREX_GPU_DEVICE (int bno, int i, int j, int k) { - if (fmsk[bno](i,j,k) == crse_fine_node) { rmsk[bno](i,j,k) = 1; } + if (fmsk[bno](i,j,k) == nodelap_detail::crse_fine_node) { rmsk[bno](i,j,k) = 1; } }); Gpu::streamSynchronize(); } diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H index b251de33b7a..372215f5d73 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H @@ -12,6 +12,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_nodal_mask (int i, int j, int k, Array4 const& nmsk, Array4 const& cmsk) noexcept { + using namespace nodelap_detail; + int s = cmsk(i-1,j-1,k) + cmsk(i ,j-1,k) + cmsk(i-1,j ,k) + cmsk(i ,j ,k); if (s == 4*crse_cell) { @@ -883,8 +885,6 @@ void mlndlap_semi_restriction (int i, int j, int k, Array4 const& crse, // interpolation // -namespace { - AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real aa_interp_line_x (Array4 const& crse, Array4 const& sig, int i, int j, int ic, int jc) noexcept @@ -916,7 +916,6 @@ namespace { w3 * aa_interp_line_x(crse,sig,i ,j-1,ic ,jc ) + w4 * aa_interp_line_x(crse,sig,i ,j+1,ic ,jc+1)) / (w1+w2+w3+w4); } -} AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_interpadd_c (int i, int j, int, Array4 const& fine, @@ -1007,7 +1006,6 @@ void mlndlap_semi_interpadd_aa (int i, int j, int, Array4 const& fine, } } -namespace { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real ha_interp_face_xy (Array4 const& crse, Array4 const& sigx, Array4 const& sigy, @@ -1022,7 +1020,6 @@ namespace { w3 * aa_interp_line_x(crse,sigx,i ,j-1,ic ,jc ) + w4 * aa_interp_line_x(crse,sigx,i ,j+1,ic ,jc+1)) / (w1+w2+w3+w4); } -} AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_interpadd_ha (int i, int j, int, @@ -1158,7 +1155,6 @@ void mlndlap_mknewu_c (int i, int j, int k, Array4 const& u, Array4 const& vel, Box const& velbx, bool is_rz) noexcept @@ -1181,7 +1177,6 @@ namespace { } return Df; } -} template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE @@ -1247,7 +1242,6 @@ void mlndlap_rhcc_fine_contrib (int i, int j, int, Box const& ccbx, } } -namespace { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real neumann_scale (int i, int j, Box const& nddom, GpuArray const& bclo, @@ -1274,7 +1268,6 @@ namespace { return val; } -} AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_divu_cf_contrib (int i, int j, int, Array4 const& rhs, @@ -1286,6 +1279,8 @@ void mlndlap_divu_cf_contrib (int i, int j, int, Array4 const& rhs, GpuArray const& bclo, GpuArray const& bchi) noexcept { + using namespace nodelap_detail; + if (!dmsk(i,j,0) && ndmsk(i,j,0) == crse_fine_node) { Real facx = Real(0.5) * dxinv[0]; Real facy = Real(0.5) * dxinv[1]; @@ -1373,7 +1368,6 @@ void mlndlap_crse_resid (int i, int j, int k, Array4 const& resid, // sync residual // -namespace { template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_sum_Ax (P const& pred, S const& sig, int i, int j, Real facx, Real facy, @@ -1459,7 +1453,6 @@ namespace { f(i,j,0) = Real(0.0); } } -} template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE @@ -1502,6 +1495,8 @@ void mlndlap_res_cf_contrib (int i, int j, int, Array4 const& res, GpuArray const& bchi, bool neumann_doubling) noexcept { + using namespace nodelap_detail; + if (!dmsk(i,j,0) && ndmsk(i,j,0) == crse_fine_node) { Real facx = Real(1./6.)*dxinv[0]*dxinv[0]; Real facy = Real(1./6.)*dxinv[1]*dxinv[1]; @@ -1535,6 +1530,8 @@ void mlndlap_res_cf_contrib_cs (int i, int j, int, Array4 const& res, GpuArray const& bchi, bool neumann_doubling) noexcept { + using namespace nodelap_detail; + if (!dmsk(i,j,0) && ndmsk(i,j,0) == crse_fine_node) { Real facx = Real(1./6.)*dxinv[0]*dxinv[0]; Real facy = Real(1./6.)*dxinv[1]*dxinv[1]; @@ -1581,6 +1578,8 @@ void mlndlap_set_stencil (Box const& bx, Array4 const& sten, AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_stencil_s0 (int i, int j, int k, Array4 const& sten) noexcept { + using namespace nodelap_detail; + sten(i,j,k,0) = -(sten(i-1,j ,k,1) + sten(i ,j ,k,1) + sten(i ,j-1,k,2) + sten(i ,j ,k,2) + sten(i-1,j-1,k,3) + sten(i ,j-1,k,3) @@ -1595,6 +1594,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_stencil_rap (int i, int j, int, Array4 const& csten, Array4 const& fsten) noexcept { + using namespace nodelap_detail; + constexpr int k = 0; #if 0 @@ -1867,6 +1868,8 @@ void mlndlap_interpadd_rap (int i, int j, int, Array4 const& fine, Array4 const& crse, Array4 const& sten, Array4 const& msk) noexcept { + using namespace nodelap_detail; + if (!msk(i,j,0) && sten(i,j,0,0) != Real(0.0)) { int ic = amrex::coarsen(i,2); int jc = amrex::coarsen(j,2); @@ -1910,6 +1913,8 @@ void mlndlap_restriction_rap (int i, int j, int /*k*/, Array4 const& crse, Array4 const& fine, Array4 const& sten, Array4 const& msk) noexcept { + using namespace nodelap_detail; + int ii = i*2; int jj = j*2; if (msk(ii,jj,0)) { @@ -1972,7 +1977,7 @@ void mlndlap_restriction_rap (int i, int j, int /*k*/, Array4 const& crse, #ifdef AMREX_USE_EB -namespace { +namespace nodelap_detail { constexpr int i_S_x = 0; constexpr int i_S_y = 1; constexpr int i_S_x2 = 2; @@ -1991,6 +1996,8 @@ void mlndlap_set_connection (int i, int j, int, Array4 const& conn, Array4 const& intg, Array4 const& vol, Array4 const& flag) noexcept { + using namespace nodelap_detail; + if (flag(i,j,0).isCovered()) { for (int n = 0; n < 6; ++n) { conn(i,j,0,n) = Real(0.); } } else if (flag(i,j,0).isRegular() || vol(i,j,0) >= almostone) { @@ -2088,6 +2095,8 @@ void add_eb_flow_contribution (int i, int j, int, Array4 const& rhs, Array4 const& sintg, Array4 const& eb_vel_dot_n) noexcept { + using namespace nodelap_detail; + Real fac_eb = 0.25 *dxinv[0]; if (!msk(i,j,0)) { @@ -2152,6 +2161,8 @@ Real mlndlap_rhcc_eb (int i, int j, int, Array4 const& rhcc, Array4 const& vfrac, Array4 const& intg, Array4 const& msk) noexcept { + using namespace nodelap_detail; + if (!msk(i,j,0)) { return rhcc(i ,j ,0)*(Real(0.25)*vfrac(i ,j ,0)-intg(i ,j ,0,i_S_x)-intg(i ,j ,0,i_S_y)+intg(i ,j ,0,i_S_xy)) + @@ -2166,6 +2177,8 @@ Real mlndlap_rhcc_eb (int i, int j, int, Array4 const& rhcc, AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_integral (int i, int j, int, Array4 const& intg) noexcept { + using namespace nodelap_detail; + intg(i,j,0,i_S_x ) = Real(0.); intg(i,j,0,i_S_y ) = Real(0.); intg(i,j,0,i_S_x2) = Real(1./12.); @@ -2176,6 +2189,8 @@ void mlndlap_set_integral (int i, int j, int, Array4 const& intg) noexcept AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_surface_integral (int i, int j, int, Array4 const& sintg) noexcept { + using namespace nodelap_detail; + sintg(i,j,0,i_B_x ) = Real(0.); sintg(i,j,0,i_B_y ) = Real(0.); sintg(i,j,0,i_B_xy) = Real(0.); @@ -2187,6 +2202,8 @@ void mlndlap_set_integral_eb (int i, int j, int, Array4 const& intg, Array4 const& ax, Array4 const& ay, Array4 const& bcen) noexcept { + using namespace nodelap_detail; + if (flag(i,j,0).isCovered()) { intg(i,j,0,i_S_x ) = Real(0.); intg(i,j,0,i_S_y ) = Real(0.); @@ -2287,6 +2304,8 @@ void mlndlap_set_surface_integral_eb (int i, int j, int, Array4 const& sin Array4 const& barea, Array4 const& bnorm) noexcept { + using namespace nodelap_detail; + if (flag(i,j,0).isCovered() || flag(i,j,0).isRegular()) { sintg(i,j,0,i_B_x ) = Real(0.); sintg(i,j,0,i_B_y ) = Real(0.); diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H index 2824b26f894..f6b94e7c526 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H @@ -12,6 +12,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_nodal_mask (int i, int j, int k, Array4 const& nmsk, Array4 const& cmsk) noexcept { + using namespace nodelap_detail; + int s = cmsk(i-1,j-1,k-1) + cmsk(i ,j-1,k-1) + cmsk(i-1,j ,k-1) + cmsk(i ,j ,k-1) + cmsk(i-1,j-1,k ) + cmsk(i ,j-1,k ) @@ -1721,8 +1723,6 @@ void mlndlap_semi_restriction (int i, int j, int k, Array4 const& crse, // interpolation // -namespace { - AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real aa_interp_line_x (Array4 const& crse, Array4 const& sig, int i, int j, int k, int ic, int jc, int kc) noexcept @@ -1791,7 +1791,6 @@ namespace { w3 * aa_interp_line_y(crse,sig,i,j ,k-1,ic,jc ,kc ) + w4 * aa_interp_line_y(crse,sig,i,j ,k+1,ic,jc ,kc+1)) / (w1+w2+w3+w4); } -} AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_interpadd_c (int i, int j, int k, Array4 const& fine, @@ -1971,7 +1970,7 @@ void mlndlap_semi_interpadd_aa (int i, int j, int k, Array4 const& fine, amrex::Abort("mlndlap_semi_interpolation semi direction wrong semi-direction. "); } } -namespace { + AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real ha_interp_face_xy (Array4 const& crse, @@ -2017,7 +2016,6 @@ namespace { w3 * aa_interp_line_y(crse,sigy,i,j ,k-1,ic,jc ,kc ) + w4 * aa_interp_line_y(crse,sigy,i,j ,k+1,ic,jc ,kc+1)) / (w1+w2+w3+w4); } -} AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_interpadd_ha (int i, int j, int k, Array4 const& fine, @@ -2202,7 +2200,6 @@ void mlndlap_mknewu_c (int i, int j, int k, Array4 const& u, Array4 const& vel, Box const& velbx) noexcept @@ -2234,7 +2231,6 @@ namespace { } return Df; } -} template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE @@ -2311,7 +2307,6 @@ void mlndlap_rhcc_fine_contrib (int i, int j, int k, Box const& ccbx, } } -namespace { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real neumann_scale (int i, int j, int k, Box const& nddom, GpuArray const& bclo, @@ -2345,7 +2340,6 @@ namespace { return val; } -} AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_divu_cf_contrib (int i, int j, int k, Array4 const& rhs, @@ -2357,6 +2351,8 @@ void mlndlap_divu_cf_contrib (int i, int j, int k, Array4 const& rhs, GpuArray const& bclo, GpuArray const& bchi) noexcept { + using namespace nodelap_detail; + if (!dmsk(i,j,k) && ndmsk(i,j,k) == crse_fine_node) { Real facx = Real(0.25) * dxinv[0]; Real facy = Real(0.25) * dxinv[1]; @@ -2479,7 +2475,6 @@ void mlndlap_crse_resid (int i, int j, int k, Array4 const& resid, // sync residual // -namespace { template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_sum_Ax (P const& pred, S const& sig, @@ -2652,7 +2647,6 @@ namespace { f(i,j,k) = Real(0.0); } } -} template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE @@ -2692,6 +2686,8 @@ void mlndlap_res_cf_contrib (int i, int j, int k, Array4 const& res, GpuArray const& bchi, bool neumann_doubling) noexcept { + using namespace nodelap_detail; + if (!dmsk(i,j,k) && ndmsk(i,j,k) == crse_fine_node) { Real facx = Real(1./36.)*dxinv[0]*dxinv[0]; Real facy = Real(1./36.)*dxinv[1]*dxinv[1]; @@ -2725,6 +2721,8 @@ void mlndlap_res_cf_contrib_cs (int i, int j, int k, Array4 const& res, GpuArray const& bchi, bool neumann_doubling) noexcept { + using namespace nodelap_detail; + if (!dmsk(i,j,k) && ndmsk(i,j,k) == crse_fine_node) { Real facx = Real(1./36.)*dxinv[0]*dxinv[0]; Real facy = Real(1./36.)*dxinv[1]*dxinv[1]; @@ -2750,7 +2748,7 @@ void mlndlap_res_cf_contrib_cs (int i, int j, int k, Array4 const& res, // RAP // -namespace { +namespace nodelap_detail { constexpr int ist_000 = 0; constexpr int ist_p00 = 1; @@ -2769,6 +2767,8 @@ void mlndlap_set_stencil (Box const& bx, Array4 const& sten, Array4 const& sig, GpuArray const& dxinv) noexcept { + using namespace nodelap_detail; + Real facx = Real(1.0/36.0)*dxinv[0]*dxinv[0]; Real facy = Real(1.0/36.0)*dxinv[1]*dxinv[1]; Real facz = Real(1.0/36.0)*dxinv[2]*dxinv[2]; @@ -2827,6 +2827,8 @@ void mlndlap_set_stencil (Box const& bx, Array4 const& sten, AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_stencil_s0 (int i, int j, int k, Array4 const& sten) noexcept { + using namespace nodelap_detail; + sten(i,j,k,ist_000) = -(sten(i-1,j,k,ist_p00) + sten(i,j,k,ist_p00) + sten(i,j-1,k,ist_0p0) + sten(i,j,k,ist_0p0) + sten(i,j,k-1,ist_00p) + sten(i,j,k,ist_00p) @@ -2860,6 +2862,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_stencil_rap (int i, int j, int k, Array4 const& csten, Array4 const& fsten) noexcept { + using namespace nodelap_detail; + auto interp_from_mmm_to = [&fsten] (int i_, int j_, int k_) -> Real { Real p = Real(1.); p += std::abs(fsten(i_-1,j_ ,k_ ,ist_p00)) / @@ -5459,6 +5463,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_adotx_sten (int i, int j, int k, Array4 const& x, Array4 const& sten, Array4 const& msk) noexcept { + using namespace nodelap_detail; + if (msk(i,j,k)) { return Real(0.0); } else { @@ -5505,6 +5511,8 @@ void mlndlap_gauss_seidel_sten (Box const& bx, Array4 const& sol, Array4 const& sten, Array4 const& msk) noexcept { + using namespace nodelap_detail; + amrex::LoopConcurrent(bx, [=] (int i, int j, int k) noexcept { if (msk(i,j,k)) { @@ -5555,6 +5563,8 @@ void mlndlap_interpadd_rap (int i, int j, int k, Array4 const& fine, Array4 const& crse, Array4 const& sten, Array4 const& msk) noexcept { + using namespace nodelap_detail; + if (!msk(i,j,k) && sten(i,j,k,ist_000) != Real(0.0)) { int ic = amrex::coarsen(i,2); int jc = amrex::coarsen(j,2); @@ -5803,6 +5813,8 @@ void mlndlap_restriction_rap (int i, int j, int k, Array4 const& crse, Array4 const& fine, Array4 const& sten, Array4 const& msk) noexcept { + using namespace nodelap_detail; + int ii = i*2; int jj = j*2; int kk = k*2; @@ -6391,7 +6403,7 @@ void mlndlap_restriction_rap (int i, int j, int k, Array4 const& crse, #ifdef AMREX_USE_EB -namespace { +namespace nodelap_detail { constexpr int i_S_x = 0; constexpr int i_S_y = 1; @@ -6459,6 +6471,8 @@ void mlndlap_set_connection (int i, int j, int k, Array4 const& conn, Array4 const& intg, Array4 const& vol, Array4 const& flag) noexcept { + using namespace nodelap_detail; + if (flag(i,j,k).isCovered()) { for (int n = 0; n < n_conn; ++n) { conn(i,j,k,n) = Real(0.); } } else if (flag(i,j,k).isRegular() || vol(i,j,k) >= almostone) { @@ -6630,6 +6644,8 @@ void mlndlap_set_stencil_eb (int i, int j, int k, Array4 const& sten, Array4 const& sig, Array4 const& conn, GpuArray const& dxinv) noexcept { + using namespace nodelap_detail; + Real facx = Real(1./36.)*dxinv[0]*dxinv[0]; Real facy = Real(1./36.)*dxinv[1]*dxinv[1]; Real facz = Real(1./36.)*dxinv[2]*dxinv[2]; @@ -6682,6 +6698,8 @@ void mlndlap_divu_eb (int i, int j, int k, Array4 const& rhs, Array4 const& bclo, GpuArray const& bchi) noexcept { + using namespace nodelap_detail; + Real facx = Real(0.25)*dxinv[0]; Real facy = Real(0.25)*dxinv[1]; Real facz = Real(0.25)*dxinv[2]; @@ -6842,6 +6860,8 @@ void add_eb_flow_contribution (int i, int j, int k, Array4 const& rhs, Array4 const& sintg, Array4 const& eb_vel_dot_n) noexcept { + using namespace nodelap_detail; + Real fac_eb = Real(0.125) * dxinv[0]; if (!msk(i,j,k)) { @@ -6918,6 +6938,8 @@ void mlndlap_mknewu_eb (int i, int j, int k, Array4 const& u, Array4 const& sig, Array4 const& vfrac, Array4 const& intg, GpuArray const& dxinv) noexcept { + using namespace nodelap_detail; + if (vfrac(i,j,k) == Real(0.)) { u(i,j,k,0) = u(i,j,k,1) = u(i,j,k,2) = Real(0.); } else { @@ -6957,6 +6979,8 @@ void mlndlap_mknewu_eb_c (int i, int j, int k, Array4 const& u, Array4 const& vfrac, Array4 const& intg, GpuArray const& dxinv) noexcept { + using namespace nodelap_detail; + if (vfrac(i,j,k) == Real(0.)) { u(i,j,k,0) = u(i,j,k,1) = u(i,j,k,2) = Real(0.); } else { @@ -6996,6 +7020,8 @@ Real mlndlap_rhcc_eb (int i, int j, int k, Array4 const& rhcc, Array4 const& vfrac, Array4 const& intg, Array4 const& msk) noexcept { + using namespace nodelap_detail; + if (!msk(i,j,k)) { return rhcc(i ,j ,k ) * diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H index 32bd012ac34..4e76a486890 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H @@ -9,7 +9,8 @@ #endif namespace amrex { -namespace { + +namespace nodelap_detail { struct GetNode { AMREX_GPU_DEVICE Dim3 operator() (Dim3 const& lo, Dim3 const& len, int& offset) @@ -67,7 +68,6 @@ namespace { } -namespace { inline void mlndlap_scale_neumann_bc (Real s, Box const& bx, Array4 const& rhs, Box const& nddom, GpuArray const& lobc, @@ -94,7 +94,6 @@ mlndlap_scale_neumann_bc (Real s, Box const& bx, Array4 const& rhs, Box co } } } -} inline void mlndlap_impose_neumann_bc (Box const& bx, Array4 const& rhs, Box const& nddom, diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp index d96e183af4d..6c9e88c9816 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp @@ -442,7 +442,7 @@ MLNodeLaplacian::fixUpResidualMask (int amrlev, iMultiFab& resmsk) Array4 const& fmsk = cfmask.const_array(mfi); AMREX_HOST_DEVICE_PARALLEL_FOR_3D ( bx, i, j, k, { - if (fmsk(i,j,k) == crse_fine_node) { rmsk(i,j,k) = 1; } + if (fmsk(i,j,k) == nodelap_detail::crse_fine_node) { rmsk(i,j,k) = 1; } }); } } @@ -829,7 +829,7 @@ MLNodeLaplacian::restrictInteriorNodes (int camrlev, MultiFab& crhs, MultiFab& a Array4 const& mfab = c_nd_mask.const_array(mfi); AMREX_HOST_DEVICE_PARALLEL_FOR_3D ( bx, i, j, k, { - if (mfab(i,j,k) == fine_node) { dfab(i,j,k) = sfab(i,j,k); } + if (mfab(i,j,k) == nodelap_detail::fine_node) { dfab(i,j,k) = sfab(i,j,k); } }); } } diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_hypre.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_hypre.cpp index f8ec20ccc7d..2ae7ebbc86d 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_hypre.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_hypre.cpp @@ -65,15 +65,15 @@ MLNodeLaplacian::fillIJMatrix_gpu (MFIter const& mfi, (nmax, [=] AMREX_GPU_DEVICE (int offset) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); - Dim3 node2 = GetNode2()(offset, node); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); + Dim3 node2 = nodelap_detail::GetNode2()(offset, node); return (lid(node.x,node.y,node.z) >= 0 && gid(node2.x,node2.y,node2.z) < std::numeric_limits::max()); }, [=] AMREX_GPU_DEVICE (int offset, int ps) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); mlndlap_fillijmat_sten_gpu(ps, node.x, node.y, node.z, offset, gid, lid, ncols, cols, mat, sten); }, @@ -86,15 +86,15 @@ MLNodeLaplacian::fillIJMatrix_gpu (MFIter const& mfi, (nmax, [=] AMREX_GPU_DEVICE (int offset) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); - Dim3 node2 = GetNode2()(offset, node); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); + Dim3 node2 = nodelap_detail::GetNode2()(offset, node); return (lid(node.x,node.y,node.z) >= 0 && gid(node2.x,node2.y,node2.z) < std::numeric_limits::max()); }, [=] AMREX_GPU_DEVICE (int offset, int ps) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); mlndlap_fillijmat_cs_gpu(ps, node.x, node.y, node.z, offset, ndbx, gid, lid, ncols, cols, mat, const_sigma, dxinvarr, domain @@ -115,15 +115,15 @@ MLNodeLaplacian::fillIJMatrix_gpu (MFIter const& mfi, (nmax, [=] AMREX_GPU_DEVICE (int offset) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); - Dim3 node2 = GetNode2()(offset, node); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); + Dim3 node2 = nodelap_detail::GetNode2()(offset, node); return (lid(node.x,node.y,node.z) >= 0 && gid(node2.x,node2.y,node2.z) < std::numeric_limits::max()); }, [=] AMREX_GPU_DEVICE (int offset, int ps) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); mlndlap_fillijmat_ha_gpu(ps, node.x, node.y, node.z, offset, ndbx, gid, lid, ncols, cols, mat, AMREX_D_DECL(sxarr, syarr, szarr), @@ -142,15 +142,15 @@ MLNodeLaplacian::fillIJMatrix_gpu (MFIter const& mfi, (nmax, [=] AMREX_GPU_DEVICE (int offset) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); - Dim3 node2 = GetNode2()(offset, node); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); + Dim3 node2 = nodelap_detail::GetNode2()(offset, node); return (lid(node.x,node.y,node.z) >= 0 && gid(node2.x,node2.y,node2.z) < std::numeric_limits::max()); }, [=] AMREX_GPU_DEVICE (int offset, int ps) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); mlndlap_fillijmat_aa_gpu(ps, node.x, node.y, node.z, offset, ndbx, gid, lid, ncols, cols, mat, sarr, dxinvarr, domain diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_2D_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_2D_K.H index 78d62530d02..43c0f3f69c5 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_2D_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_2D_K.H @@ -4,7 +4,7 @@ namespace amrex { -namespace { +namespace mlndts_detail { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real ts_interp_line_x (Array4 const& crse, int ic, int jc) noexcept @@ -32,6 +32,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndtslap_interpadd (int i, int j, int, Array4 const& fine, Array4 const& crse, Array4 const& msk) noexcept { + using namespace mlndts_detail; + if (!msk(i,j,0)) { int ic = amrex::coarsen(i,2); int jc = amrex::coarsen(j,2); @@ -58,6 +60,8 @@ void mlndtslap_semi_interpadd (int i, int j, int, Array4 const& fine, Array4 const& crse, Array4 const& msk, int semi_dir) noexcept { + using namespace mlndts_detail; + if (!msk(i,j,0)) { if (semi_dir == 0) { int jc = amrex::coarsen(j,2); diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_3D_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_3D_K.H index f383ccbdc6c..1dd965ba138 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_3D_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_3D_K.H @@ -4,7 +4,7 @@ namespace amrex { -namespace { +namespace mlndts_detail { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real ts_interp_line_x (Array4 const& crse, @@ -62,6 +62,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndtslap_interpadd (int i, int j, int k, Array4 const& fine, Array4 const& crse, Array4 const& msk) noexcept { + using namespace mlndts_detail; + if (!msk(i,j,k)) { int ic = amrex::coarsen(i,2); int jc = amrex::coarsen(j,2); @@ -107,6 +109,8 @@ void mlndtslap_semi_interpadd (int i, int j, int k, Array4 const& fine, Array4 const& crse, Array4 const& msk, int semi_dir) noexcept { + using namespace mlndts_detail; + if (!msk(i,j,k)) { if (semi_dir == 0) { int jc = amrex::coarsen(j,2); diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_K.H index 08aabe13c84..95d1e0c757d 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLap_K.H @@ -5,25 +5,6 @@ #include #include -namespace amrex { - -namespace { - - constexpr int ixx = 0; - constexpr int ixy = 1; -#if (AMREX_SPACEDIM == 2) - constexpr int iyy = 2; -#else - constexpr int ixz = 2; - constexpr int iyy = 3; - constexpr int iyz = 4; - constexpr int izz = 5; -#endif - constexpr int nelems = MLNodeTensorLaplacian::nelems; -} - -} - #if (AMREX_SPACEDIM == 1) #include #elif (AMREX_SPACEDIM == 2) diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLaplacian.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLaplacian.cpp index 130c4eb6e84..ed0b7f0d374 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLaplacian.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeTensorLaplacian.cpp @@ -38,7 +38,7 @@ MLNodeTensorLaplacian::setBeta (Array const& a_beta) noexce #endif } -GpuArray +GpuArray MLNodeTensorLaplacian::scaledSigma (int amrlev, int mglev) const noexcept { auto s = m_sigma; @@ -305,15 +305,15 @@ MLNodeTensorLaplacian::fillIJMatrix (MFIter const& mfi, (nmax, [=] AMREX_GPU_DEVICE (int offset) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); - Dim3 node2 = GetNode2()(offset, node); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); + Dim3 node2 = nodelap_detail::GetNode2()(offset, node); return (lid(node.x,node.y,node.z) >= 0 && gid(node2.x,node2.y,node2.z) < std::numeric_limits::max()); }, [=] AMREX_GPU_DEVICE (int offset, int ps) noexcept { - Dim3 node = GetNode()(ndlo, ndlen, offset); + Dim3 node = nodelap_detail::GetNode()(ndlo, ndlen, offset); mlndtslap_fill_ijmatrix_gpu(ps, node.x, node.y, node.z, offset, ndbx, gid, lid, ncols, cols, mat, s); }, diff --git a/Src/Particle/AMReX_NeighborList.H b/Src/Particle/AMReX_NeighborList.H index 94b195d13fb..53434ec7c3c 100644 --- a/Src/Particle/AMReX_NeighborList.H +++ b/Src/Particle/AMReX_NeighborList.H @@ -9,7 +9,7 @@ namespace amrex { -namespace +namespace detail { // SelectActualNeighbors template = np_real); if (is_same && (pid == i)) { continue; } - if (call_check_pair(check_pair, + if (detail::call_check_pair(check_pair, src_ptile_data, dst_ptile_data, i, pid, type, ghost_i, ghost_pid)) { count += 1; @@ -436,7 +436,7 @@ public: const auto& pid = pperm[p]; bool ghost_pid = (pid >= np_real); if (is_same && (pid == i)) { continue; } - if (call_check_pair(check_pair, + if (detail::call_check_pair(check_pair, src_ptile_data, dst_ptile_data, i, pid, type, ghost_i, ghost_pid)) { pm_nbor_list[pnbor_offset[i] + n] = pid; diff --git a/Src/Particle/AMReX_NeighborParticlesI.H b/Src/Particle/AMReX_NeighborParticlesI.H index b292b927fbe..ca1747b6b8b 100644 --- a/Src/Particle/AMReX_NeighborParticlesI.H +++ b/Src/Particle/AMReX_NeighborParticlesI.H @@ -1066,7 +1066,7 @@ selectActualNeighbors (CheckPair const& check_pair, int num_cells) int nbr_cell_id = (ii * ny + jj) * nz + kk; for (auto p = poffset[nbr_cell_id]; p < poffset[nbr_cell_id+1]; ++p) { if (pperm[p] == i) { continue; } - if (call_check_pair(check_pair, ptile_data, ptile_data, i, pperm[p])) { + if (detail::call_check_pair(check_pair, ptile_data, ptile_data, i, pperm[p])) { IntVect cell_ijk = getParticleCell(pstruct[pperm[p]], plo, dxi, domain); if (!box.contains(cell_ijk)) { unsigned int loc = Gpu::Atomic::Add(p_np_boundary, 1U); diff --git a/Src/Particle/AMReX_Particle.H b/Src/Particle/AMReX_Particle.H index 1ff630929e0..5d34751587f 100644 --- a/Src/Particle/AMReX_Particle.H +++ b/Src/Particle/AMReX_Particle.H @@ -13,8 +13,6 @@ namespace amrex { -namespace -{ /** Special flags used for 64-bit Long particle Ids */ namespace LongParticleIds { constexpr Long GhostParticleID = 549755813887L; // 2**39-1 @@ -34,7 +32,6 @@ namespace } using namespace ParticleIdCpus; -} struct ParticleIDWrapper { diff --git a/Tests/EB_CNS/Source/hydro/CNS_hydro_K.H b/Tests/EB_CNS/Source/hydro/CNS_hydro_K.H index a6967e06c64..86af431d2ee 100644 --- a/Tests/EB_CNS/Source/hydro/CNS_hydro_K.H +++ b/Tests/EB_CNS/Source/hydro/CNS_hydro_K.H @@ -61,10 +61,8 @@ cns_flux_to_dudt (int i, int j, int k, int n, #endif } -namespace { - AMREX_GPU_DEVICE AMREX_FORCE_INLINE -amrex::Real limiter (amrex::Real dlft, amrex::Real drgt, amrex::Real plm_theta) noexcept +amrex::Real cns_limiter (amrex::Real dlft, amrex::Real drgt, amrex::Real plm_theta) noexcept { using amrex::Real; @@ -75,8 +73,6 @@ amrex::Real limiter (amrex::Real dlft, amrex::Real drgt, amrex::Real plm_theta) return dsgn * amrex::min(dlim,std::abs(dcen)); } -} - AMREX_GPU_DEVICE AMREX_FORCE_INLINE void cns_slope_x (int i, int j, int k, @@ -97,20 +93,20 @@ cns_slope_x (int i, int j, int k, Real dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i-1,j,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QU) - q(i-1,j,k,QU)); Real drgt = Real(0.5)*(q(i+1,j,k,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i+1,j,k,QU) - q(i,j,k,QU)); - Real d0 = limiter(dlft, drgt, plm_theta); + Real d0 = cns_limiter(dlft, drgt, plm_theta); Real cs2 = q(i,j,k,QCS)*q(i,j,k,QCS); dlft = (q(i,j,k,QRHO)-q(i-1,j,k,QRHO)) - (q(i,j,k,QPRES) - q(i-1,j,k,QPRES))/cs2; drgt = (q(i+1,j,k,QRHO)-q(i,j,k,QRHO)) - (q(i+1,j,k,QPRES) - q(i,j,k,QPRES))/cs2; - Real d1 = limiter(dlft, drgt, plm_theta); + Real d1 = cns_limiter(dlft, drgt, plm_theta); dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i-1,j,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QU) - q(i-1,j,k,QU)); drgt = Real(0.5)*(q(i+1,j,k,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i+1,j,k,QU) - q(i,j,k,QU)); - Real d2 = limiter(dlft, drgt, plm_theta); + Real d2 = cns_limiter(dlft, drgt, plm_theta); dlft = q(i,j,k,QV) - q(i-1,j,k,QV); drgt = q(i+1,j,k,QV) - q(i,j,k,QV); - Real d3 = limiter(dlft, drgt, plm_theta); + Real d3 = cns_limiter(dlft, drgt, plm_theta); dq(i,j,k,0) = d0; dq(i,j,k,1) = d1; @@ -120,7 +116,7 @@ cns_slope_x (int i, int j, int k, #if (AMREX_SPACEDIM ==3 ) dlft = q(i,j,k,QW) - q(i-1,j,k,QW); drgt = q(i+1,j,k,QW) - q(i,j,k,QW); - Real d4 = limiter(dlft, drgt, plm_theta); + Real d4 = cns_limiter(dlft, drgt, plm_theta); dq(i,j,k,4) = d4; #endif } @@ -146,20 +142,20 @@ cns_slope_y (int i, int j, int k, Real dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i,j-1,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QV) - q(i,j-1,k,QV)); Real drgt = Real(0.5)*(q(i,j+1,k,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j+1,k,QV) - q(i,j,k,QV)); - Real d0 = limiter(dlft, drgt, plm_theta); + Real d0 = cns_limiter(dlft, drgt, plm_theta); Real cs2 = q(i,j,k,QCS)*q(i,j,k,QCS); dlft = (q(i,j,k,QRHO)-q(i,j-1,k,QRHO)) - (q(i,j,k,QPRES) - q(i,j-1,k,QPRES))/cs2; drgt = (q(i,j+1,k,QRHO)-q(i,j,k,QRHO)) - (q(i,j+1,k,QPRES) - q(i,j,k,QPRES))/cs2; - Real d1 = limiter(dlft, drgt, plm_theta); + Real d1 = cns_limiter(dlft, drgt, plm_theta); dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i,j-1,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QV) - q(i,j-1,k,QV)); drgt = Real(0.5)*(q(i,j+1,k,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j+1,k,QV) - q(i,j,k,QV)); - Real d2 = limiter(dlft, drgt, plm_theta); + Real d2 = cns_limiter(dlft, drgt, plm_theta); dlft = q(i,j,k,QU) - q(i,j-1,k,QU); drgt = q(i,j+1,k,QU) - q(i,j,k,QU); - Real d3 = limiter(dlft, drgt, plm_theta); + Real d3 = cns_limiter(dlft, drgt, plm_theta); dq(i,j,k,0) = d0; dq(i,j,k,1) = d1; @@ -169,7 +165,7 @@ cns_slope_y (int i, int j, int k, #if (AMREX_SPACEDIM ==3 ) dlft = q(i,j,k,QW) - q(i,j-1,k,QW); drgt = q(i,j+1,k,QW) - q(i,j,k,QW); - Real d4 = limiter(dlft, drgt, plm_theta); + Real d4 = cns_limiter(dlft, drgt, plm_theta); dq(i,j,k,4) = d4; #endif } @@ -196,24 +192,24 @@ cns_slope_z (int i, int j, int k, Real dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i,j,k-1,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QW) - q(i,j,k-1,QW)); Real drgt = Real(0.5)*(q(i,j,k+1,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k+1,QW) - q(i,j,k,QW)); - Real d0 = limiter(dlft, drgt, plm_theta); + Real d0 = cns_limiter(dlft, drgt, plm_theta); Real cs2 = q(i,j,k,QCS)*q(i,j,k,QCS); dlft = (q(i,j,k,QRHO)-q(i,j,k-1,QRHO)) - (q(i,j,k,QPRES) - q(i,j,k-1,QPRES))/cs2; drgt = (q(i,j,k+1,QRHO)-q(i,j,k,QRHO)) - (q(i,j,k+1,QPRES) - q(i,j,k,QPRES))/cs2; - Real d1 = limiter(dlft, drgt, plm_theta); + Real d1 = cns_limiter(dlft, drgt, plm_theta); dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i,j,k-1,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QW) - q(i,j,k-1,QW)); drgt = Real(0.5)*(q(i,j,k+1,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k+1,QW) - q(i,j,k,QW)); - Real d2 = limiter(dlft, drgt, plm_theta); + Real d2 = cns_limiter(dlft, drgt, plm_theta); dlft = q(i,j,k,QU) - q(i,j,k-1,QU); drgt = q(i,j,k+1,QU) - q(i,j,k,QU); - Real d3 = limiter(dlft, drgt, plm_theta); + Real d3 = cns_limiter(dlft, drgt, plm_theta); dlft = q(i,j,k,QV) - q(i,j,k-1,QV); drgt = q(i,j,k+1,QV) - q(i,j,k,QV); - Real d4 = limiter(dlft, drgt, plm_theta); + Real d4 = cns_limiter(dlft, drgt, plm_theta); dq(i,j,k,0) = d0; dq(i,j,k,1) = d1; @@ -224,8 +220,6 @@ cns_slope_z (int i, int j, int k, } #endif -namespace { - AMREX_GPU_DEVICE AMREX_FORCE_INLINE void riemann (const amrex::Real gamma, const amrex::Real smallp, const amrex::Real /*smallr*/, @@ -411,7 +405,6 @@ compute_hyp_wallflux (const amrex::Real rho, fluxw[UMY] = (aym-ayp) * momfluxn;, fluxw[UMZ] = (azm-azp) * momfluxn;); } -} AMREX_GPU_DEVICE AMREX_FORCE_INLINE void diff --git a/Tests/EB_CNS/Source/hydro/CNS_hydro_eb_K.H b/Tests/EB_CNS/Source/hydro/CNS_hydro_eb_K.H index 61c5dcb0fc8..0dbbd9661c3 100644 --- a/Tests/EB_CNS/Source/hydro/CNS_hydro_eb_K.H +++ b/Tests/EB_CNS/Source/hydro/CNS_hydro_eb_K.H @@ -8,10 +8,8 @@ #include #include -namespace { - AMREX_GPU_DEVICE AMREX_FORCE_INLINE -amrex::Real limiter_eb (amrex::Real dlft, amrex::Real drgt, amrex::Real plm_theta) noexcept +amrex::Real cns_limiter_eb (amrex::Real dlft, amrex::Real drgt, amrex::Real plm_theta) noexcept { using amrex::Real; @@ -22,8 +20,6 @@ amrex::Real limiter_eb (amrex::Real dlft, amrex::Real drgt, amrex::Real plm_thet return dsgn * amrex::min(dlim,std::abs(dcen)); } -} - AMREX_GPU_DEVICE AMREX_FORCE_INLINE void cns_slope_eb_x (int i, int j, int k, @@ -84,12 +80,12 @@ cns_slope_eb_x (int i, int j, int k, #endif } - dq(i,j,k,0) = limiter_eb(dlft0, drgt0, plm_theta); - dq(i,j,k,1) = limiter_eb(dlft1, drgt1, plm_theta); - dq(i,j,k,2) = limiter_eb(dlft2, drgt2, plm_theta); - dq(i,j,k,3) = limiter_eb(dlft3, drgt3, plm_theta); + dq(i,j,k,0) = cns_limiter_eb(dlft0, drgt0, plm_theta); + dq(i,j,k,1) = cns_limiter_eb(dlft1, drgt1, plm_theta); + dq(i,j,k,2) = cns_limiter_eb(dlft2, drgt2, plm_theta); + dq(i,j,k,3) = cns_limiter_eb(dlft3, drgt3, plm_theta); #if (AMREX_SPACEDIM == 3) - dq(i,j,k,4) = limiter_eb(dlft4, drgt4, plm_theta); + dq(i,j,k,4) = cns_limiter_eb(dlft4, drgt4, plm_theta); #endif } } @@ -154,12 +150,12 @@ cns_slope_eb_y (int i, int j, int k, #endif } - dq(i,j,k,0) = limiter_eb(dlft0, drgt0, plm_theta); - dq(i,j,k,1) = limiter_eb(dlft1, drgt1, plm_theta); - dq(i,j,k,2) = limiter_eb(dlft2, drgt2, plm_theta); - dq(i,j,k,3) = limiter_eb(dlft3, drgt3, plm_theta); + dq(i,j,k,0) = cns_limiter_eb(dlft0, drgt0, plm_theta); + dq(i,j,k,1) = cns_limiter_eb(dlft1, drgt1, plm_theta); + dq(i,j,k,2) = cns_limiter_eb(dlft2, drgt2, plm_theta); + dq(i,j,k,3) = cns_limiter_eb(dlft3, drgt3, plm_theta); #if (AMREX_SPACEDIM == 3) - dq(i,j,k,4) = limiter_eb(dlft4, drgt4, plm_theta); + dq(i,j,k,4) = cns_limiter_eb(dlft4, drgt4, plm_theta); #endif } } @@ -219,11 +215,11 @@ cns_slope_eb_z (int i, int j, int k, } - dq(i,j,k,0) = limiter_eb(dlft0, drgt0, plm_theta); - dq(i,j,k,1) = limiter_eb(dlft1, drgt1, plm_theta); - dq(i,j,k,2) = limiter_eb(dlft2, drgt2, plm_theta); - dq(i,j,k,3) = limiter_eb(dlft3, drgt3, plm_theta); - dq(i,j,k,4) = limiter_eb(dlft4, drgt4, plm_theta); + dq(i,j,k,0) = cns_limiter_eb(dlft0, drgt0, plm_theta); + dq(i,j,k,1) = cns_limiter_eb(dlft1, drgt1, plm_theta); + dq(i,j,k,2) = cns_limiter_eb(dlft2, drgt2, plm_theta); + dq(i,j,k,3) = cns_limiter_eb(dlft3, drgt3, plm_theta); + dq(i,j,k,4) = cns_limiter_eb(dlft4, drgt4, plm_theta); } } #endif diff --git a/Tests/GPU/CNS/Source/hydro/CNS_hydro_K.H b/Tests/GPU/CNS/Source/hydro/CNS_hydro_K.H index 2efc267a4de..2734976efcd 100644 --- a/Tests/GPU/CNS/Source/hydro/CNS_hydro_K.H +++ b/Tests/GPU/CNS/Source/hydro/CNS_hydro_K.H @@ -54,10 +54,8 @@ cns_flux_to_dudt (int i, int j, int k, int n, + dxinv[2] * (fz(i,j,k,n) - fz(i,j,k+1,n)); } -namespace { - AMREX_GPU_DEVICE AMREX_FORCE_INLINE -amrex::Real limiter (amrex::Real dlft, amrex::Real drgt) noexcept +amrex::Real cns_limiter (amrex::Real dlft, amrex::Real drgt) noexcept { using amrex::Real; @@ -68,8 +66,6 @@ amrex::Real limiter (amrex::Real dlft, amrex::Real drgt) noexcept return dsgn * amrex::min(dlim,std::abs(dcen)); } -} - AMREX_GPU_DEVICE inline void @@ -81,24 +77,24 @@ cns_slope_x (int i, int j, int k, Real dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i-1,j,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QU) - q(i-1,j,k,QU)); Real drgt = Real(0.5)*(q(i+1,j,k,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i+1,j,k,QU) - q(i,j,k,QU)); - Real d0 = limiter(dlft, drgt); + Real d0 = cns_limiter(dlft, drgt); Real cs2 = q(i,j,k,QCS)*q(i,j,k,QCS); dlft = (q(i,j,k,QRHO)-q(i-1,j,k,QRHO)) - (q(i,j,k,QPRES) - q(i-1,j,k,QPRES))/cs2; drgt = (q(i+1,j,k,QRHO)-q(i,j,k,QRHO)) - (q(i+1,j,k,QPRES) - q(i,j,k,QPRES))/cs2; - Real d1 = limiter(dlft, drgt); + Real d1 = cns_limiter(dlft, drgt); dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i-1,j,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QU) - q(i-1,j,k,QU)); drgt = Real(0.5)*(q(i+1,j,k,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i+1,j,k,QU) - q(i,j,k,QU)); - Real d2 = limiter(dlft, drgt); + Real d2 = cns_limiter(dlft, drgt); dlft = q(i,j,k,QV) - q(i-1,j,k,QV); drgt = q(i+1,j,k,QV) - q(i,j,k,QV); - Real d3 = limiter(dlft, drgt); + Real d3 = cns_limiter(dlft, drgt); dlft = q(i,j,k,QW) - q(i-1,j,k,QW); drgt = q(i+1,j,k,QW) - q(i,j,k,QW); - Real d4 = limiter(dlft, drgt); + Real d4 = cns_limiter(dlft, drgt); dq(i,j,k,0) = d0; dq(i,j,k,1) = d1; @@ -118,24 +114,24 @@ cns_slope_y (int i, int j, int k, Real dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i,j-1,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QV) - q(i,j-1,k,QV)); Real drgt = Real(0.5)*(q(i,j+1,k,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j+1,k,QV) - q(i,j,k,QV)); - Real d0 = limiter(dlft, drgt); + Real d0 = cns_limiter(dlft, drgt); Real cs2 = q(i,j,k,QCS)*q(i,j,k,QCS); dlft = (q(i,j,k,QRHO)-q(i,j-1,k,QRHO)) - (q(i,j,k,QPRES) - q(i,j-1,k,QPRES))/cs2; drgt = (q(i,j+1,k,QRHO)-q(i,j,k,QRHO)) - (q(i,j+1,k,QPRES) - q(i,j,k,QPRES))/cs2; - Real d1 = limiter(dlft, drgt); + Real d1 = cns_limiter(dlft, drgt); dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i,j-1,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QV) - q(i,j-1,k,QV)); drgt = Real(0.5)*(q(i,j+1,k,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j+1,k,QV) - q(i,j,k,QV)); - Real d2 = limiter(dlft, drgt); + Real d2 = cns_limiter(dlft, drgt); dlft = q(i,j,k,QU) - q(i,j-1,k,QU); drgt = q(i,j+1,k,QU) - q(i,j,k,QU); - Real d3 = limiter(dlft, drgt); + Real d3 = cns_limiter(dlft, drgt); dlft = q(i,j,k,QW) - q(i,j-1,k,QW); drgt = q(i,j+1,k,QW) - q(i,j,k,QW); - Real d4 = limiter(dlft, drgt); + Real d4 = cns_limiter(dlft, drgt); dq(i,j,k,0) = d0; dq(i,j,k,1) = d1; @@ -155,24 +151,24 @@ cns_slope_z (int i, int j, int k, Real dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i,j,k-1,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QW) - q(i,j,k-1,QW)); Real drgt = Real(0.5)*(q(i,j,k+1,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) - Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k+1,QW) - q(i,j,k,QW)); - Real d0 = limiter(dlft, drgt); + Real d0 = cns_limiter(dlft, drgt); Real cs2 = q(i,j,k,QCS)*q(i,j,k,QCS); dlft = (q(i,j,k,QRHO)-q(i,j,k-1,QRHO)) - (q(i,j,k,QPRES) - q(i,j,k-1,QPRES))/cs2; drgt = (q(i,j,k+1,QRHO)-q(i,j,k,QRHO)) - (q(i,j,k+1,QPRES) - q(i,j,k,QPRES))/cs2; - Real d1 = limiter(dlft, drgt); + Real d1 = cns_limiter(dlft, drgt); dlft = Real(0.5)*(q(i,j,k,QPRES)-q(i,j,k-1,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k,QW) - q(i,j,k-1,QW)); drgt = Real(0.5)*(q(i,j,k+1,QPRES)-q(i,j,k,QPRES))/q(i,j,k,QCS) + Real(0.5)*q(i,j,k,QRHO)*(q(i,j,k+1,QW) - q(i,j,k,QW)); - Real d2 = limiter(dlft, drgt); + Real d2 = cns_limiter(dlft, drgt); dlft = q(i,j,k,QU) - q(i,j,k-1,QU); drgt = q(i,j,k+1,QU) - q(i,j,k,QU); - Real d3 = limiter(dlft, drgt); + Real d3 = cns_limiter(dlft, drgt); dlft = q(i,j,k,QV) - q(i,j,k-1,QV); drgt = q(i,j,k+1,QV) - q(i,j,k,QV); - Real d4 = limiter(dlft, drgt); + Real d4 = cns_limiter(dlft, drgt); dq(i,j,k,0) = d0; dq(i,j,k,1) = d1; @@ -181,8 +177,6 @@ cns_slope_z (int i, int j, int k, dq(i,j,k,4) = d4; } -namespace { - AMREX_GPU_DEVICE inline void @@ -314,7 +308,6 @@ riemann (const amrex::Real gamma, const amrex::Real smallp, const amrex::Real /* flxutt = rgdnv*ugdnv*utrans2; flxe = ugdnv*(Real(0.5)*rgdnv*(ugdnv*ugdnv+utrans1*utrans1+utrans2*utrans2) + pgdnv/(gamma -Real(1.)) + pgdnv); } -} AMREX_GPU_DEVICE inline diff --git a/Tests/LinearSolvers/CellEB2/MyTest_K.H b/Tests/LinearSolvers/CellEB2/MyTest_K.H index 5a6c7b5c69f..deafabf9d7d 100644 --- a/Tests/LinearSolvers/CellEB2/MyTest_K.H +++ b/Tests/LinearSolvers/CellEB2/MyTest_K.H @@ -4,8 +4,6 @@ #include #include -namespace { - AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mytest_set_phi_reg (int i, int j, int k, amrex::Array4 const& phie, amrex::Array4 const& rhs, @@ -173,6 +171,4 @@ void mytest_set_phi_boundary (int i, int j, int k, amrex::Array4 co } } -} - #endif