diff --git a/Src/AmrCore/AMReX_FillPatchUtil.H b/Src/AmrCore/AMReX_FillPatchUtil.H index fab29231bf3..467b8c46eab 100644 --- a/Src/AmrCore/AMReX_FillPatchUtil.H +++ b/Src/AmrCore/AMReX_FillPatchUtil.H @@ -10,7 +10,7 @@ #include #include #include - +#include /** * \file AMReX_FillPatchUtil.H * \brief High-level FillPatch helpers for AMR coarse-to-fine synchronization. @@ -37,13 +37,13 @@ namespace amrex template struct NullInterpHook { - template ::value,int> = 0> + template void operator() (MFFAB& /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const {} - template ::value,int> = 0> + template void operator() (Array /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const {} - template ::value,int> = 0> + template void operator() (MFFAB& /*mf*/, int /*icomp*/, int /*ncomp*/) const {} }; @@ -87,9 +87,8 @@ namespace amrex * \param physbcf functor for physical boundaries * \param bcfcomp starting component for physbcf */ - template - std::enable_if_t::value> - FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, + template + void FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, const Vector& smf, const Vector& stime, int scomp, int dcomp, int ncomp, const Geometry& geom, @@ -118,9 +117,8 @@ namespace amrex * \param physbcf functor for physical boundaries * \param bcfcomp starting component for physbcf */ - template - std::enable_if_t::value> - FillPatchSingleLevel (MF& mf, Real time, + template + void FillPatchSingleLevel (MF& mf, Real time, const Vector& smf, const Vector& stime, int scomp, int dcomp, int ncomp, const Geometry& geom, @@ -164,11 +162,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, + void FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -218,11 +215,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - FillPatchTwoLevels (MF& mf, Real time, + void FillPatchTwoLevels (MF& mf, Real time, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -276,11 +272,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Real time, + void FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Real time, const Vector >& cmf, const Vector& ct, const Vector >& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -334,11 +329,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Real time, + void FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Real time, const Vector >& cmf, const Vector& ct, const Vector >& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -391,11 +385,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - FillPatchTwoLevels (Array const& mf, Real time, + void FillPatchTwoLevels (Array const& mf, Real time, const Vector >& cmf, const Vector& ct, const Vector >& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -448,9 +441,8 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template - std::enable_if_t::value> - FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, + template + void FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, const EB2::IndexSpace& index_space, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, @@ -502,9 +494,8 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template - std::enable_if_t::value> - FillPatchTwoLevels (MF& mf, Real time, + template + void FillPatchTwoLevels (MF& mf, Real time, const EB2::IndexSpace& index_space, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, @@ -549,11 +540,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - InterpFromCoarseLevel (MF& mf, Real time, + void InterpFromCoarseLevel (MF& mf, Real time, const MF& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, BC& cbc, int cbccomp, @@ -593,11 +583,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, + void InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, const MF& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, BC& cbc, int cbccomp, @@ -638,11 +627,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, + void InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, const EB2::IndexSpace* index_space, const MF& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, @@ -684,11 +672,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - InterpFromCoarseLevel (Array const& mf, Real time, + void InterpFromCoarseLevel (Array const& mf, Real time, const Array& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, Array& cbc, int cbccomp, @@ -730,11 +717,10 @@ namespace amrex * \param pre_interp pre-interpolation hook * \param post_interp post-interpolation hook */ - template , typename PostInterpHook=NullInterpHook > - std::enable_if_t::value> - InterpFromCoarseLevel (Array const& mf, IntVect const& nghost, Real time, + void InterpFromCoarseLevel (Array const& mf, IntVect const& nghost, Real time, const Array& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, Array& cbc, int cbccomp, @@ -771,9 +757,8 @@ namespace amrex * \param bcs boundar types for each component * \param bcscomp starting component for bcs */ - template - std::enable_if_t::value> - InterpFromCoarseLevel (MF& mf, IntVect const& nghost, + template + void InterpFromCoarseLevel (MF& mf, IntVect const& nghost, IntVect const& nghost_outside_domain, const MF& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, @@ -802,9 +787,8 @@ namespace amrex * \param ncomp number of components * \param geom Geometry for this level */ - template - std::enable_if_t::value> - FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, + template + void FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, const Vector& smf, IntVect const& snghost, const Vector& stime, int scomp, int dcomp, int ncomp, const Geometry& geom); @@ -839,9 +823,8 @@ namespace amrex * \param bcs boundary types for each component. * \param bcscomp starting component for bcs */ - template - std::enable_if_t::value> - FillPatchTwoLevels (MF& mf, IntVect const& nghost, + template + void FillPatchTwoLevels (MF& mf, IntVect const& nghost, IntVect const& nghost_outside_domain, Real time, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, @@ -904,9 +887,8 @@ namespace amrex * \param bcr boundary types for each component. We need this because some interpolaters need it. * \param bcrcomp starting component for bcr */ - template - std::enable_if_t::value> - FillPatchNLevels (MF& mf, int level, const IntVect& nghost, Real time, + template + void FillPatchNLevels (MF& mf, int level, const IntVect& nghost, Real time, const Vector>& smf, const Vector>& st, int scomp, int dcomp, int ncomp, const Vector& geom, diff --git a/Src/AmrCore/AMReX_FillPatchUtil_I.H b/Src/AmrCore/AMReX_FillPatchUtil_I.H index 593f0edee4a..1bd80aec539 100644 --- a/Src/AmrCore/AMReX_FillPatchUtil_I.H +++ b/Src/AmrCore/AMReX_FillPatchUtil_I.H @@ -58,9 +58,8 @@ bool ProperlyNested (const IntVect& ratio, const IntVect& blocking_factor, int n return crse_box.contains(fine_box_coarsened); } -template -std::enable_if_t::value> -FillPatchSingleLevel (MF& mf, Real time, +template +void FillPatchSingleLevel (MF& mf, Real time, const Vector& smf, const Vector& stime, int scomp, int dcomp, int ncomp, const Geometry& geom, @@ -70,9 +69,8 @@ FillPatchSingleLevel (MF& mf, Real time, geom, physbcf, bcfcomp); } -template -std::enable_if_t::value> -FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, +template +void FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, const Vector& smf, const Vector& stime, int scomp, int dcomp, int ncomp, const Geometry& geom, @@ -216,9 +214,9 @@ void FillPatchInterp (MultiFab& mf_fine_patch, int fcomp, MultiFab const& mf_crs Box const& dest_domain, const IntVect& ratio, MFInterpolater* mapper, const Vector& bcs, int bcscomp); -template -std::enable_if_t::value && !std::is_same_v> -FillPatchInterp (MF& mf_fine_patch, int fcomp, MF const& mf_crse_patch, int ccomp, +template +requires (!std::is_same_v) +void FillPatchInterp (MF& mf_fine_patch, int fcomp, MF const& mf_crse_patch, int ccomp, int ncomp, IntVect const& ng, const Geometry& cgeom, const Geometry& fgeom, Box const& dest_domain, const IntVect& ratio, Interp* mapper, const Vector& bcs, int bcscomp) @@ -247,9 +245,8 @@ FillPatchInterp (MF& mf_fine_patch, int fcomp, MF const& mf_crse_patch, int ccom } } -template -std::enable_if_t::value> -FillPatchInterp (MF& mf_fine_patch, int fcomp, MF const& mf_crse_patch, int ccomp, +template +void FillPatchInterp (MF& mf_fine_patch, int fcomp, MF const& mf_crse_patch, int ccomp, int ncomp, IntVect const& ng, const Geometry& cgeom, const Geometry& fgeom, Box const& dest_domain, const IntVect& ratio, InterpBase* mapper, const Vector& bcs, int bcscomp) @@ -267,9 +264,9 @@ FillPatchInterp (MF& mf_fine_patch, int fcomp, MF const& mf_crse_patch, int ccom } } -template -std::enable_if_t::value && !std::is_same_v> -InterpFace (Interp *interp, +template +requires (!std::is_same_v) +void InterpFace (Interp *interp, MF const& mf_crse_patch, int crse_comp, MF& mf_refined_patch, int fine_comp, int ncomp, const IntVect& ratio, @@ -293,9 +290,8 @@ InterpFace (Interp *interp, } } -template -std::enable_if_t::value> -InterpFace (InterpBase *interp, +template +void InterpFace (InterpBase *interp, MF const& mf_crse_patch, int crse_comp, MF& mf_refined_patch, int fine_comp, int ncomp, const IntVect& ratio, @@ -467,9 +463,8 @@ namespace detail { // nothing } - template - std::enable_if_t::value,int> - FillPatchTwoLevels_doit (MF& mf, IntVect const& nghost, Real time, + template + int FillPatchTwoLevels_doit (MF& mf, IntVect const& nghost, Real time, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -640,9 +635,8 @@ namespace detail { return success_code; } - template - std::enable_if_t::value> - FillPatchTwoLevels_doit (Array const& mf, IntVect const& nghost, Real time, + template + void FillPatchTwoLevels_doit (Array const& mf, IntVect const& nghost, Real time, const Vector >& cmf, const Vector& ct, const Vector >& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -812,9 +806,8 @@ namespace detail { } // namespace detail /// \endcond -template -std::enable_if_t::value> -FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, +template +void FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -838,9 +831,8 @@ FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, pre_interp,post_interp,index_space); } -template -std::enable_if_t::value> -FillPatchTwoLevels (MF& mf, Real time, +template +void FillPatchTwoLevels (MF& mf, Real time, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -865,9 +857,8 @@ FillPatchTwoLevels (MF& mf, Real time, pre_interp,post_interp,index_space); } -template -std::enable_if_t::value> -FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Real time, +template +void FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Real time, const Vector >& cmf, const Vector& ct, const Vector >& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -892,9 +883,8 @@ FillPatchTwoLevels (Array const& mf, IntVect const& nghost, pre_interp,post_interp,index_space); } -template -std::enable_if_t::value> -FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Real time, +template +void FillPatchTwoLevels (Array const& mf, IntVect const& nghost, Real time, const Vector >& cmf, const Vector& ct, const Vector >& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -923,9 +913,8 @@ FillPatchTwoLevels (Array const& mf, IntVect const& nghost, pre_interp,post_interp,index_space); } -template -std::enable_if_t::value> -FillPatchTwoLevels (Array const& mf, Real time, +template +void FillPatchTwoLevels (Array const& mf, Real time, const Vector >& cmf, const Vector& ct, const Vector >& fmf, const Vector& ft, int scomp, int dcomp, int ncomp, @@ -955,9 +944,8 @@ FillPatchTwoLevels (Array const& mf, Real time, } #ifdef AMREX_USE_EB -template -std::enable_if_t::value> -FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, +template +void FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, const EB2::IndexSpace& index_space, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, @@ -977,9 +965,8 @@ FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time, pre_interp,post_interp,&index_space); } -template -std::enable_if_t::value> -FillPatchTwoLevels (MF& mf, Real time, +template +void FillPatchTwoLevels (MF& mf, Real time, const EB2::IndexSpace& index_space, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, @@ -1000,9 +987,8 @@ FillPatchTwoLevels (MF& mf, Real time, } #endif -template -std::enable_if_t::value> -InterpFromCoarseLevel (MF& mf, Real time, +template +void InterpFromCoarseLevel (MF& mf, Real time, const MF& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, BC& cbc, int cbccomp, @@ -1024,9 +1010,8 @@ InterpFromCoarseLevel (MF& mf, Real time, pre_interp,post_interp); } -template -std::enable_if_t::value> -InterpFromCoarseLevel (Array const& mf, Real time, +template +void InterpFromCoarseLevel (Array const& mf, Real time, const Array& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, Array& cbc, int cbccomp, @@ -1042,9 +1027,8 @@ InterpFromCoarseLevel (Array const& mf, Real time, pre_interp,post_interp); } -template -std::enable_if_t::value> -InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, +template +void InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, const MF& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, BC& cbc, int cbccomp, @@ -1066,9 +1050,8 @@ InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, pre_interp,post_interp); } -template -std::enable_if_t::value> -InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, +template +void InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, const EB2::IndexSpace* index_space, const MF& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, @@ -1162,9 +1145,8 @@ InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time, fbc(mf, dcomp, ncomp, nghost, time, fbccomp); } -template -std::enable_if_t::value> -InterpFromCoarseLevel (Array const& mf, IntVect const& nghost, Real time, +template +void InterpFromCoarseLevel (Array const& mf, IntVect const& nghost, Real time, const Array& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, Array& cbc, int cbccomp, @@ -1312,9 +1294,8 @@ InterpFromCoarseLevel (Array const& mf, IntVect const& ngho } } -template -std::enable_if_t::value> -InterpFromCoarseLevel (MF& mf, IntVect const& nghost, +template +void InterpFromCoarseLevel (MF& mf, IntVect const& nghost, IntVect const& nghost_outside_domain, const MF& cmf, int scomp, int dcomp, int ncomp, const Geometry& cgeom, const Geometry& fgeom, @@ -1327,9 +1308,8 @@ InterpFromCoarseLevel (MF& mf, IntVect const& nghost, bcs, bcscomp); } -template -std::enable_if_t::value> -FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, +template +void FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, const Vector& smf, IntVect const& snghost, const Vector& stime, int scomp, int dcomp, int ncomp, const Geometry& geom) @@ -1339,9 +1319,8 @@ FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time, erfbc, 0); } -template -std::enable_if_t::value> -FillPatchTwoLevels (MF& mf, IntVect const& nghost, +template +void FillPatchTwoLevels (MF& mf, IntVect const& nghost, IntVect const& nghost_outside_domain, Real time, const Vector& cmf, const Vector& ct, const Vector& fmf, const Vector& ft, @@ -1358,9 +1337,8 @@ FillPatchTwoLevels (MF& mf, IntVect const& nghost, bcs, bcscomp); } -template -std::enable_if_t::value> -FillPatchNLevels (MF& mf, int level, const IntVect& nghost, Real time, +template +void FillPatchNLevels (MF& mf, int level, const IntVect& nghost, Real time, const Vector>& smf, const Vector>& st, int scomp, int dcomp, int ncomp, const Vector& geom, diff --git a/Src/Base/AMReX_Concepts.H b/Src/Base/AMReX_Concepts.H new file mode 100644 index 00000000000..26f64bf2194 --- /dev/null +++ b/Src/Base/AMReX_Concepts.H @@ -0,0 +1,21 @@ +#ifndef AMREX_CONCEPTS_H_ +#define AMREX_CONCEPTS_H_ + +#include +#include +#include + +namespace amrex { +/** + * \brief Checks if a type is derived from amrex::BaseFab. + */ +template +concept BaseFabType = amrex::IsBaseFab::value; + +/** + * \brief Checks if a type is an amrex::FabArray (like MultiFab). + */ +template +concept FabArrayType = amrex::IsFabArray::value; +} // namespace amrex +#endif diff --git a/Src/Base/AMReX_FabArray.H b/Src/Base/AMReX_FabArray.H index 3186ae4276b..5c86148534c 100644 --- a/Src/Base/AMReX_FabArray.H +++ b/Src/Base/AMReX_FabArray.H @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -54,7 +55,8 @@ namespace amrex { -template ::value,int> = 0> +template +requires (!BaseFabType) Long nBytesOwned (T const&) noexcept { return 0; } template @@ -238,16 +240,14 @@ Copy (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, } } -template ::value> > +template void Add (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, int numcomp, int nghost) { Add(dst,src,srccomp,dstcomp,numcomp,IntVect(nghost)); } -template ::value> > +template void Add (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, int numcomp, const IntVect& nghost) { @@ -544,7 +544,7 @@ public: FAB * fabPtr (int K) noexcept; // Here K is global index FAB const* fabPtr (int K) const noexcept; - template ::value,int> = 0> + template void prefetchToHost (const MFIter& mfi) const noexcept { #ifdef AMREX_USE_CUDA @@ -554,7 +554,7 @@ public: #endif } - template ::value,int> = 0> + template void prefetchToDevice (const MFIter& mfi) const noexcept { #ifdef AMREX_USE_CUDA @@ -564,93 +564,93 @@ public: #endif } - template ::value,int> = 0> + template Array4::value_type const> array (const MFIter& mfi) const noexcept { return fabPtr(mfi)->const_array(); } - template ::value,int> = 0> + template Array4::value_type> array (const MFIter& mfi) noexcept { return fabPtr(mfi)->array(); } - template ::value,int> = 0> + template Array4::value_type const> array (int K) const noexcept { return fabPtr(K)->const_array(); } - template ::value,int> = 0> + template Array4::value_type> array (int K) noexcept { return fabPtr(K)->array(); } - template ::value,int> = 0> + template Array4::value_type const> const_array (const MFIter& mfi) const noexcept { return fabPtr(mfi)->const_array(); } - template ::value,int> = 0> + template Array4::value_type const> const_array (int K) const noexcept { return fabPtr(K)->const_array(); } - template ::value,int> = 0> + template Array4::value_type const> array (const MFIter& mfi, int start_comp) const noexcept { return fabPtr(mfi)->const_array(start_comp); } - template ::value,int> = 0> + template Array4::value_type> array (const MFIter& mfi, int start_comp) noexcept { return fabPtr(mfi)->array(start_comp); } - template ::value,int> = 0> + template Array4::value_type const> array (int K, int start_comp) const noexcept { return fabPtr(K)->const_array(start_comp); } - template ::value,int> = 0> + template Array4::value_type> array (int K, int start_comp) noexcept { return fabPtr(K)->array(start_comp); } - template ::value,int> = 0> + template Array4::value_type const> const_array (const MFIter& mfi, int start_comp) const noexcept { return fabPtr(mfi)->const_array(start_comp); } - template ::value,int> = 0> + template Array4::value_type const> const_array (int K, int start_comp) const noexcept { return fabPtr(K)->const_array(start_comp); } - template ::value,int> = 0> + template MultiArray4::value_type> arrays () noexcept { build_arrays(); return m_arrays; } - template ::value,int> = 0> + template MultiArray4::value_type const> arrays () const noexcept { build_arrays(); return m_const_arrays; } - template ::value,int> = 0> + template MultiArray4::value_type const> const_arrays () const noexcept { build_arrays(); @@ -716,16 +716,16 @@ public: * \param ncomp number of components * \param nghost number of ghost cells */ - template ::value,int> = 0> + template void LocalAdd (FabArray const& src, int scomp, int dcomp, int ncomp, IntVect const& nghost); //! Set all components in the entire region of each FAB to val. - template ::value,int> = 0> + template void setVal (value_type val); //! Set all components in the entire region of each FAB to val. - template ::value,int> = 0> + template FabArray& operator= (value_type val); /** @@ -733,13 +733,13 @@ public: * each FAB in the FabArray, starting at component comp to val. * Also set the value of nghost boundary cells. */ - template ::value,int> = 0> + template void setVal (value_type val, int comp, int ncomp, int nghost = 0); - template ::value,int> = 0> + template void setVal (value_type val, int comp, int ncomp, @@ -751,14 +751,14 @@ public: * as nghost boundary cells, to val, provided they also intersect * with the Box region. */ - template ::value,int> = 0> + template void setVal (value_type val, const Box& region, int comp, int ncomp, int nghost = 0); - template ::value,int> = 0> + template void setVal (value_type val, const Box& region, int comp, @@ -768,10 +768,10 @@ public: * \brief Set all components in the valid region of each FAB in the * FabArray to val, including nghost boundary cells. */ - template ::value,int> = 0> + template void setVal (value_type val, int nghost); - template ::value,int> = 0> + template void setVal (value_type val, const IntVect& nghost); /** @@ -779,54 +779,54 @@ public: * FabArray to val, including nghost boundary cells, that also * intersect the Box region. */ - template ::value,int> = 0> + template void setVal (value_type val, const Box& region, int nghost); - template ::value,int> = 0> + template void setVal (value_type val, const Box& region, const IntVect& nghost); - template ::value,int> = 0> + template void abs (int comp, int ncomp, int nghost = 0); - template ::value,int> = 0> + template void abs (int comp, int ncomp, const IntVect& nghost); - template ::value,int> = 0> + template void plus (value_type val, int comp, int num_comp, int nghost = 0); - template ::value,int> = 0> + template void plus (value_type val, const Box& region, int comp, int num_comp, int nghost = 0); - template ::value,int> = 0> + template void mult (value_type val, int comp, int num_comp, int nghost = 0); - template ::value,int> = 0> + template void mult (value_type val, const Box& region, int comp, int num_comp, int nghost = 0); - template ::value,int> = 0> + template void invert (value_type numerator, int comp, int num_comp, int nghost = 0); - template ::value,int> = 0> + template void invert (value_type numerator, const Box& region, int comp, int num_comp, int nghost = 0); //! Set all values in the boundary region to val. - template ::value,int> = 0> + template void setBndry (value_type val); //! Set ncomp values in the boundary region, starting at start_comp to val. - template ::value,int> = 0> + template void setBndry (value_type val, int strt_comp, int ncomp); //! Set all values outside the Geometry domain to val. - template ::value,int> = 0> + template void setDomainBndry (value_type val, const Geometry& geom); //! Set ncomp values outside the Geometry domain to val, starting at start_comp. - template ::value,int> = 0> + template void setDomainBndry (value_type val, int strt_comp, int ncomp, const Geometry& geom); //! Get capacity of the FabArray - template ::value && std::is_integral_v && (sizeof(I) >= sizeof(Long)), int> = 0> + template && (sizeof(I) >= sizeof(Long)), int> = 0> void capacityOfFabs (LayoutData& mem) const; /** @@ -838,7 +838,7 @@ public: * \warning Unless \p local is true, this routine performs an MPI collective * and every rank in the current active MPI communicator must participate. */ - template ::value,int> = 0> + template typename F::value_type sum (int comp, IntVect const& nghost, bool local = false) const; @@ -1166,7 +1166,7 @@ public: void FillBoundary_nowait (int scomp, int ncomp, const IntVect& nghost, const Periodicity& period, bool cross = false); template ::value,int> = 0> + BaseFabType F=FAB> void FillBoundary_finish (); void FillBoundary_test (); @@ -1329,7 +1329,7 @@ public: // (including ghost cells outside periodic boundaries) // physbnd : boundary cells outside the domain (excluding periodic boundaries) // interior : interior cells (i.e., valid cells) - template ::value,int> = 0> + template void BuildMask (const Box& phys_domain, const Periodicity& period, value_type covered, value_type notcovered, value_type physbnd, value_type interior); @@ -1337,7 +1337,7 @@ public: // The following are private functions. But we have to make them public for cuda. template ::value,int> = 0> + BaseFabType F=FAB> void FBEP_nowait (int scomp, int ncomp, const IntVect& nghost, const Periodicity& period, bool cross, bool enforce_periodicity_only = false, @@ -1350,10 +1350,10 @@ public: void PC_local_cpu (const CPC& thecpc, FabArray const& src, int scomp, int dcomp, int ncomp, CpOp op); - template ::value,int> = 0> + template void setVal (value_type val, const CommMetaData& thecmd, int scomp, int ncomp); - template ::value,int> = 0> + template LayoutData RecvLayoutMask (const CommMetaData& thecmd); #ifdef AMREX_USE_GPU @@ -1453,7 +1453,7 @@ public: * \warning Unless \p local is true, this routine performs an MPI collective * and every rank in the current active MPI communicator must participate. */ - template ::value,int> = 0> + template typename F::value_type norminf (int comp, int ncomp, IntVect const& nghost, bool local = false, [[maybe_unused]] bool ignore_covered = false) const; @@ -1470,7 +1470,7 @@ public: * \warning Unless \p local is true, this routine performs an MPI collective * and every rank in the current active MPI communicator must participate. */ - template ::value,int> = 0> + template typename F::value_type norminf (FabArray const& mask, int comp, int ncomp, IntVect const& nghost, bool local = false) const; @@ -1559,7 +1559,7 @@ private: void setFab_assert (int K, FAB const& fab) const; - template ::value,int> = 0> + template void build_arrays () const; void clear_arrays (); @@ -1649,7 +1649,7 @@ public: * \param ncomp number of components * \param nghost number of ghost cells */ - template ::value,int> = 0> + template static void Saxpy (FabArray& y, value_type a, FabArray const& x, int xcomp, int ycomp, int ncomp, IntVect const& nghost); @@ -1664,7 +1664,7 @@ public: * \param ncomp number of components * \param nghost number of ghost cells */ - template ::value,int> = 0> + template static void Xpay (FabArray& y, value_type a, FabArray const& x, int xcomp, int ycomp, int ncomp, IntVect const& nghost); @@ -1682,7 +1682,7 @@ public: * \param numcomp number of components * \param nghost number of ghost cells */ - template ::value,int> = 0> + template static void LinComb (FabArray& dst, value_type a, const FabArray& x, int xcomp, value_type b, const FabArray& y, int ycomp, @@ -1701,7 +1701,7 @@ public: * \param ncomp number of components * \param nghost number of ghost cells */ - template ::value,int> = 0> + template static void Saxpy_Xpay (FabArray& y, value_type a1, FabArray const& x1, value_type a2, FabArray const& x2, int xcomp, int ycomp, int ncomp, IntVect const& nghost); @@ -1720,7 +1720,7 @@ public: * \param ncomp number of components * \param nghost number of ghost cells */ - template ::value,int> = 0> + template static void Saxpy_Saxpy (FabArray& y1, value_type a1, FabArray const& x1, FabArray& y2, value_type a2, FabArray const& x2, int xcomp, int ycomp, int ncomp, IntVect const& nghost); @@ -1738,7 +1738,7 @@ public: * \param ncomp number of components * \param nghost number of ghost cells */ - template ::value,int> = 0> + template static void Saypy_Saxpy (FabArray& y1, value_type a1, FabArray& y2, value_type a2, FabArray const& x, int xcomp, int ycomp, int ncomp, IntVect const& nghost); @@ -1815,7 +1815,7 @@ FabArray::fabPtr (int K) const noexcept } template -template ::value,int>> +template void FabArray::build_arrays () const { @@ -1967,7 +1967,7 @@ FabArray::LocalCopy (FabArray const& src, int scomp, int dcomp, int n } template -template ::value,int>> +template void FabArray::LocalAdd (FabArray const& src, int scomp, int dcomp, int ncomp, IntVect const& nghost) @@ -1976,7 +1976,7 @@ FabArray::LocalAdd (FabArray const& src, int scomp, int dcomp, int nco } template -template ::value,int>> +template void FabArray::setVal (value_type val, int nghost) { @@ -1984,7 +1984,7 @@ FabArray::setVal (value_type val, int nghost) } template -template ::value,int>> +template void FabArray::setVal (value_type val, const IntVect& nghost) { @@ -1992,7 +1992,7 @@ FabArray::setVal (value_type val, const IntVect& nghost) } template -template ::value,int>> +template void FabArray::setVal (value_type val, const Box& region, int nghost) { @@ -2000,7 +2000,7 @@ FabArray::setVal (value_type val, const Box& region, int nghost) } template -template ::value,int>> +template void FabArray::setVal (value_type val, const Box& region, const IntVect& nghost) { @@ -2448,7 +2448,7 @@ FabArray::setFab (const MFIter& mfi, FAB&& elem) } template -template ::value,int>> +template void FabArray::setBndry (value_type val) { @@ -2456,7 +2456,7 @@ FabArray::setBndry (value_type val) } template -template ::value,int>Z> +template void FabArray::setBndry (value_type val, int strt_comp, @@ -2559,7 +2559,7 @@ FabArray::setBndry (value_type val, } template -template ::value,int>> +template void FabArray::setDomainBndry (value_type val, const Geometry& geom) { @@ -2567,7 +2567,7 @@ FabArray::setDomainBndry (value_type val, const Geometry& geom) } template -template ::value,int>> +template void FabArray::setDomainBndry (value_type val, int strt_comp, @@ -2599,7 +2599,7 @@ FabArray::setDomainBndry (value_type val, template -template ::value && std::is_integral_v && (sizeof(I) >= sizeof(Long)), int> FOO> +template && (sizeof(I) >= sizeof(Long)), int> FOO> void FabArray::capacityOfFabs (LayoutData& mem) const { AMREX_ASSERT(amrex::isMFIterSafe(*this, mem)); @@ -2609,7 +2609,7 @@ FabArray::capacityOfFabs (LayoutData& mem) const { } template -template ::value,int> FOO> +template typename F::value_type FabArray::sum (int comp, IntVect const& nghost, bool local) const { @@ -2660,7 +2660,7 @@ FabArray::copyTo (FAB& dest, int nghost) const } template -template ::value,int>> +template void FabArray::setVal (value_type val) { @@ -2668,7 +2668,7 @@ FabArray::setVal (value_type val) } template -template ::value,int>> +template FabArray& FabArray::operator= (value_type val) { @@ -2677,7 +2677,7 @@ FabArray::operator= (value_type val) } template -template ::value,int>> +template void FabArray::setVal (value_type val, int comp, @@ -2688,7 +2688,7 @@ FabArray::setVal (value_type val, } template -template ::value,int>Z> +template void FabArray::setVal (value_type val, int comp, @@ -2730,7 +2730,7 @@ FabArray::setVal (value_type val, } template -template ::value,int>> +template void FabArray::setVal (value_type val, const Box& region, @@ -2742,7 +2742,7 @@ FabArray::setVal (value_type val, } template -template ::value,int>Z> +template void FabArray::setVal (value_type val, const Box& region, @@ -2791,7 +2791,7 @@ FabArray::setVal (value_type val, } template -template ::value,int>> +template void FabArray::abs (int comp, int ncomp, int nghost) { @@ -2799,7 +2799,7 @@ FabArray::abs (int comp, int ncomp, int nghost) } template -template ::value,int>Z> +template void FabArray::abs (int comp, int ncomp, const IntVect& nghost) { @@ -2837,7 +2837,7 @@ FabArray::abs (int comp, int ncomp, const IntVect& nghost) } template -template ::value,int>Z> +template void FabArray::plus (value_type val, int comp, int num_comp, int nghost) { @@ -2873,7 +2873,7 @@ FabArray::plus (value_type val, int comp, int num_comp, int nghost) } template -template ::value,int>Z> +template void FabArray::plus (value_type val, const Box& region, int comp, int num_comp, int nghost) { @@ -2913,7 +2913,7 @@ FabArray::plus (value_type val, const Box& region, int comp, int num_comp, } template -template ::value,int>Z> +template void FabArray::mult (value_type val, int comp, int num_comp, int nghost) { @@ -2949,7 +2949,7 @@ FabArray::mult (value_type val, int comp, int num_comp, int nghost) } template -template ::value,int>Z> +template void FabArray::mult (value_type val, const Box& region, int comp, int num_comp, int nghost) { @@ -2989,7 +2989,7 @@ FabArray::mult (value_type val, const Box& region, int comp, int num_comp, } template -template ::value,int>Z> +template void FabArray::invert (value_type numerator, int comp, int num_comp, int nghost) { @@ -3025,7 +3025,7 @@ FabArray::invert (value_type numerator, int comp, int num_comp, int nghost) } template -template ::value,int>Z> +template void FabArray::invert (value_type numerator, const Box& region, int comp, int num_comp, int nghost) { @@ -3082,7 +3082,7 @@ FabArray::shift (const IntVect& v) } template -template ::value,int> FOO> +template void FabArray::Saxpy (FabArray& y, value_type a, FabArray const& x, int xcomp, int ycomp, int ncomp, IntVect const& nghost) { @@ -3127,7 +3127,7 @@ void FabArray::Saxpy (FabArray& y, value_type a, FabArray const& } template -template ::value,int> FOO> +template void FabArray::Xpay (FabArray& y, value_type a, FabArray const& x, int xcomp, int ycomp, int ncomp, IntVect const& nghost) @@ -3172,7 +3172,7 @@ FabArray::Xpay (FabArray& y, value_type a, FabArray const& x, } template -template ::value,int> FOO> +template void FabArray::Saxpy_Xpay (FabArray& y, value_type a1, FabArray const& x1, value_type a2, FabArray const& x2, int xcomp, int ycomp, int ncomp, IntVect const& nghost) @@ -3228,7 +3228,7 @@ void FabArray::Saxpy_Xpay (FabArray& y, value_type a1, FabArray c } template -template ::value,int> FOO> +template void FabArray::Saxpy_Saxpy (FabArray& y1, value_type a1, FabArray const& x1, FabArray& y2, value_type a2, FabArray const& x2, int xcomp, int ycomp, int ncomp, IntVect const& nghost) @@ -3287,7 +3287,7 @@ void FabArray::Saxpy_Saxpy (FabArray& y1, value_type a1, FabArray } template -template ::value,int> FOO> +template void FabArray::Saypy_Saxpy (FabArray& y1, value_type a1, FabArray& y2, value_type a2, FabArray const& x, int xcomp, int ycomp, int ncomp, IntVect const& nghost) @@ -3341,7 +3341,7 @@ void FabArray::Saypy_Saxpy (FabArray& y1, value_type a1, } template -template ::value,int> FOO> +template void FabArray::LinComb (FabArray& dst, value_type a, const FabArray& x, int xcomp, @@ -3716,7 +3716,7 @@ FabArray::FillBoundary_nowait (int scomp, int ncomp, const IntVect& nghost, } template -template ::value,int>Z> +template void FabArray::BuildMask (const Box& phys_domain, const Periodicity& period, value_type covered, value_type notcovered, @@ -3784,7 +3784,7 @@ FabArray::BuildMask (const Box& phys_domain, const Periodicity& period, } template -template ::value,int>> +template void FabArray::setVal (value_type val, const CommMetaData& thecmd, int scomp, int ncomp) { @@ -3825,7 +3825,7 @@ FabArray::setVal (value_type val, const CommMetaData& thecmd, int scomp, in } template -template ::value,int>> +template LayoutData FabArray::RecvLayoutMask (const CommMetaData& thecmd) { @@ -3859,7 +3859,7 @@ FabArray::RecvLayoutMask (const CommMetaData& thecmd) } template -template ::value,int> FOO> +template typename F::value_type FabArray::norminf (int comp, int ncomp, IntVect const& nghost, bool local, [[maybe_unused]] bool ignore_covered) const @@ -3950,7 +3950,7 @@ FabArray::norminf (int comp, int ncomp, IntVect const& nghost, bool local, } template -template ::value,int> FOO> +template typename F::value_type FabArray::norminf (FabArray const& mask, int comp, int ncomp, IntVect const& nghost, bool local) const diff --git a/Src/Base/AMReX_FabArrayCommI.H b/Src/Base/AMReX_FabArrayCommI.H index 1eec379844c..b890e2f8f99 100644 --- a/Src/Base/AMReX_FabArrayCommI.H +++ b/Src/Base/AMReX_FabArrayCommI.H @@ -5,7 +5,7 @@ namespace amrex { template -template ::value,int>Z> +template void FabArray::FBEP_nowait (int scomp, int ncomp, const IntVect& nghost, const Periodicity& period, bool cross, @@ -214,7 +214,7 @@ FabArray::FBEP_nowait (int scomp, int ncomp, const IntVect& nghost, } template -template ::value,int>Z> +template void FabArray::FillBoundary_finish () { @@ -1062,9 +1062,8 @@ void fbv_copy (Vector const& tags) * \param cross Optional cross-stencil flags; non-zero entries skip * corner ghost cells for the corresponding FabArray. */ -template -std::enable_if_t::value> -FillBoundary_nowait (Vector const& mf, Vector const& scomp, +template +void FillBoundary_nowait (Vector const& mf, Vector const& scomp, Vector const& ncomp, Vector const& nghost, Vector const& period, Vector const& cross = {}) @@ -1085,9 +1084,8 @@ FillBoundary_nowait (Vector const& mf, Vector const& scomp, * \param mf FabArray pointers that should be updated. * \param a_period Periodicity applied to every FabArray. */ -template -std::enable_if_t::value> -FillBoundary_nowait (Vector const& mf, +template +void FillBoundary_nowait (Vector const& mf, const Periodicity& a_period = Periodicity::NonPeriodic()) { Vector scomp(mf.size(), 0); @@ -1108,9 +1106,8 @@ FillBoundary_nowait (Vector const& mf, * * \param mf FabArray pointers whose FillBoundary_nowait calls should finish. */ -template -std::enable_if_t::value> -FillBoundary_finish (Vector const& mf) +template +void FillBoundary_finish (Vector const& mf) { BL_PROFILE("FillBoundary_finish(Vector)"); const int N = mf.size(); @@ -1131,9 +1128,8 @@ FillBoundary_finish (Vector const& mf) * \param nghost Number of ghost cells to populate per FabArray. * \param period Periodicity description per FabArray. */ -template -std::enable_if_t::value> -FillBoundaryAndSync_nowait (Vector const& mf, Vector const& scomp, +template +void FillBoundaryAndSync_nowait (Vector const& mf, Vector const& scomp, Vector const& ncomp, Vector const& nghost, Vector const& period) { @@ -1150,9 +1146,8 @@ FillBoundaryAndSync_nowait (Vector const& mf, Vector const& scomp, * \param mf FabArray pointers that should be updated. * \param a_period Periodicity applied to every FabArray. */ -template -std::enable_if_t::value> -FillBoundaryAndSync_nowait (Vector const& mf, +template +void FillBoundaryAndSync_nowait (Vector const& mf, const Periodicity& a_period = Periodicity::NonPeriodic()) { Vector scomp(mf.size(), 0); @@ -1173,9 +1168,8 @@ FillBoundaryAndSync_nowait (Vector const& mf, * * \param mf FabArray pointers whose FillBoundaryAndSync_nowait calls should finish. */ -template -std::enable_if_t::value> -FillBoundaryAndSync_finish (Vector const& mf) +template +void FillBoundaryAndSync_finish (Vector const& mf) { BL_PROFILE("FillBoundaryAndSync_finish(Vector)"); const int N = mf.size(); @@ -1199,9 +1193,8 @@ FillBoundaryAndSync_finish (Vector const& mf) * \param cross Optional flags; non-zero entries skip corner ghost cells * (cross stencil) for the corresponding FabArray. */ -template -std::enable_if_t::value> -FillBoundary (Vector const& mf, Vector const& scomp, +template +void FillBoundary (Vector const& mf, Vector const& scomp, Vector const& ncomp, Vector const& nghost, Vector const& period, Vector const& cross = {}) { @@ -1465,9 +1458,8 @@ FillBoundary (Vector const& mf, Vector const& scomp, * \param nghost Number of ghost cells to fill for each FabArray. * \param period Periodicity to use for each FabArray. */ -template -std::enable_if_t::value> -FillBoundaryAndSync (Vector const& mf, Vector const& scomp, +template +void FillBoundaryAndSync (Vector const& mf, Vector const& scomp, Vector const& ncomp, Vector const& nghost, Vector const& period) { @@ -1482,18 +1474,16 @@ FillBoundaryAndSync (Vector const& mf, Vector const& scomp, } /** \brief Convenience overload that fills every component/ghost cell on each FabArray. */ -template -std::enable_if_t::value> -FillBoundary (Vector const& mf, const Periodicity& a_period = Periodicity::NonPeriodic()) +template +void FillBoundary (Vector const& mf, const Periodicity& a_period = Periodicity::NonPeriodic()) { FillBoundary_nowait(mf, a_period); FillBoundary_finish(mf); } /** \brief Convenience overload that fills/syncs every component/ghost cell on each FabArray. */ -template -std::enable_if_t::value> -FillBoundaryAndSync (Vector const& mf, const Periodicity& a_period = Periodicity::NonPeriodic()) +template +void FillBoundaryAndSync (Vector const& mf, const Periodicity& a_period = Periodicity::NonPeriodic()) { FillBoundaryAndSync_nowait(mf, a_period); FillBoundaryAndSync_finish(mf); diff --git a/Src/Base/AMReX_FabArrayUtility.H b/Src/Base/AMReX_FabArrayUtility.H index b429e9c622c..614c2454912 100644 --- a/Src/Base/AMReX_FabArrayUtility.H +++ b/Src/Base/AMReX_FabArrayUtility.H @@ -10,8 +10,7 @@ namespace amrex { -template ::value> > +template typename FAB::value_type ReduceSum (FabArray const& fa, int nghost, F&& f) { return ReduceSum(fa, IntVect(nghost), std::forward(f)); @@ -19,8 +18,7 @@ ReduceSum (FabArray const& fa, int nghost, F&& f) { /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB::value_type ReduceSum_host (FabArray const& fa, IntVect const& nghost, F const& f) { @@ -45,11 +43,10 @@ ReduceSum_host (FabArray const& fa, IntVect const& nghost, F const& f) #ifdef AMREX_USE_GPU /// \cond DOXYGEN_IGNORE namespace fudetail { -template -std::enable_if_t::value, - std::conditional_t || - std::is_same_v, - int, typename FAB::value_type> > +template +std::conditional_t || + std::is_same_v, + int, typename FAB::value_type> ReduceMF (FabArray const& fa, IntVect const& nghost, F const& f) { using T = std::conditional_t || @@ -64,11 +61,10 @@ ReduceMF (FabArray const& fa, IntVect const& nghost, F const& f) }); } -template -std::enable_if_t::value && IsBaseFab::value, - std::conditional_t || - std::is_same_v, - int, typename FAB1::value_type> > +template +std::conditional_t || + std::is_same_v, + int, typename FAB1::value_type> ReduceMF (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F const& f) { using T = std::conditional_t || @@ -85,11 +81,10 @@ ReduceMF (FabArray const& fa1, FabArray const& fa2, IntVect const& n }); } -template -std::enable_if_t::value && IsBaseFab::value && IsBaseFab::value, - std::conditional_t || - std::is_same_v, - int, typename FAB1::value_type> > +template +std::conditional_t || + std::is_same_v, + int, typename FAB1::value_type> ReduceMF (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F const& f) { @@ -126,8 +121,7 @@ ReduceSum_host_wrapper (FabArray const& fa, IntVect const& nghost, F&& f) } /// \endcond -template ::value> > +template typename FAB::value_type ReduceSum (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -138,8 +132,7 @@ ReduceSum (FabArray const& fa, IntVect const& nghost, F&& f) } } #else -template ::value> > +template typename FAB::value_type ReduceSum (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -147,8 +140,7 @@ ReduceSum (FabArray const& fa, IntVect const& nghost, F&& f) } #endif -template ::value> > +template typename FAB1::value_type ReduceSum (FabArray const& fa1, FabArray const& fa2, int nghost, F&& f) { @@ -157,8 +149,7 @@ ReduceSum (FabArray const& fa1, FabArray const& fa2, /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB1::value_type ReduceSum_host (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F const& f) @@ -205,8 +196,7 @@ ReduceSum_host_wrapper (FabArray const& fa1, FabArray const& fa2, } /// \endcond -template ::value> > +template typename FAB1::value_type ReduceSum (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -218,8 +208,7 @@ ReduceSum (FabArray const& fa1, FabArray const& fa2, } } #else -template ::value> > +template typename FAB1::value_type ReduceSum (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -228,8 +217,7 @@ ReduceSum (FabArray const& fa1, FabArray const& fa2, } #endif -template ::value> > +template typename FAB1::value_type ReduceSum (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, int nghost, F&& f) @@ -239,8 +227,7 @@ ReduceSum (FabArray const& fa1, FabArray const& fa2, FabArray /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB1::value_type ReduceSum_host (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F const& f) @@ -288,8 +275,7 @@ ReduceSum_host_wrapper (FabArray const& fa1, FabArray const& fa2, } /// \endcond -template ::value> > +template typename FAB1::value_type ReduceSum (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F&& f) @@ -301,8 +287,7 @@ ReduceSum (FabArray const& fa1, FabArray const& fa2, } } #else -template ::value> > +template typename FAB1::value_type ReduceSum (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F&& f) @@ -311,8 +296,7 @@ ReduceSum (FabArray const& fa1, FabArray const& fa2, } #endif -template ::value> > +template typename FAB::value_type ReduceMin (FabArray const& fa, int nghost, F&& f) { @@ -321,8 +305,7 @@ ReduceMin (FabArray const& fa, int nghost, F&& f) /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB::value_type ReduceMin_host (FabArray const& fa, IntVect const& nghost, F const& f) { @@ -364,8 +347,7 @@ ReduceMin_host_wrapper (FabArray const& fa, IntVect const& nghost, F&& f) } /// \endcond -template ::value> > +template typename FAB::value_type ReduceMin (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -376,8 +358,7 @@ ReduceMin (FabArray const& fa, IntVect const& nghost, F&& f) } } #else -template ::value> > +template typename FAB::value_type ReduceMin (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -385,8 +366,7 @@ ReduceMin (FabArray const& fa, IntVect const& nghost, F&& f) } #endif -template ::value> > +template typename FAB1::value_type ReduceMin (FabArray const& fa1, FabArray const& fa2, int nghost, F&& f) { @@ -395,8 +375,7 @@ ReduceMin (FabArray const& fa1, FabArray const& fa2, int nghost, F&& /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB1::value_type ReduceMin_host (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F const& f) @@ -443,8 +422,7 @@ ReduceMin_host_wrapper (FabArray const& fa1, FabArray const& fa2, } /// \endcond -template ::value> > +template typename FAB1::value_type ReduceMin (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -456,8 +434,7 @@ ReduceMin (FabArray const& fa1, FabArray const& fa2, } } #else -template ::value> > +template typename FAB1::value_type ReduceMin (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -466,8 +443,7 @@ ReduceMin (FabArray const& fa1, FabArray const& fa2, } #endif -template ::value> > +template typename FAB1::value_type ReduceMin (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, int nghost, F&& f) @@ -477,8 +453,7 @@ ReduceMin (FabArray const& fa1, FabArray const& fa2, FabArray /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB1::value_type ReduceMin_host (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F const& f) @@ -526,8 +501,7 @@ ReduceMin_host_wrapper (FabArray const& fa1, FabArray const& fa2, } /// \endcond -template ::value> > +template typename FAB1::value_type ReduceMin (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F&& f) @@ -539,8 +513,7 @@ ReduceMin (FabArray const& fa1, FabArray const& fa2, } } #else -template ::value> > +template typename FAB1::value_type ReduceMin (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F&& f) @@ -549,8 +522,7 @@ ReduceMin (FabArray const& fa1, FabArray const& fa2, } #endif -template ::value> > +template typename FAB::value_type ReduceMax (FabArray const& fa, int nghost, F&& f) { @@ -559,8 +531,7 @@ ReduceMax (FabArray const& fa, int nghost, F&& f) /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB::value_type ReduceMax_host (FabArray const& fa, IntVect const& nghost, F const& f) { @@ -603,8 +574,7 @@ ReduceMax_host_wrapper (FabArray const& fa, IntVect const& nghost, F&& f) } /// \endcond -template ::value> > +template typename FAB::value_type ReduceMax (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -615,8 +585,7 @@ ReduceMax (FabArray const& fa, IntVect const& nghost, F&& f) } } #else -template ::value> > +template typename FAB::value_type ReduceMax (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -624,8 +593,7 @@ ReduceMax (FabArray const& fa, IntVect const& nghost, F&& f) } #endif -template ::value> > +template typename FAB1::value_type ReduceMax (FabArray const& fa1, FabArray const& fa2, int nghost, F&& f) { @@ -634,8 +602,7 @@ ReduceMax (FabArray const& fa1, FabArray const& fa2, int nghost, F&& /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB1::value_type ReduceMax_host (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F const& f) @@ -682,8 +649,7 @@ ReduceMax_host_wrapper (FabArray const& fa1, FabArray const& fa2, } /// \endcond -template ::value> > +template typename FAB1::value_type ReduceMax (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -695,8 +661,7 @@ ReduceMax (FabArray const& fa1, FabArray const& fa2, } } #else -template ::value> > +template typename FAB1::value_type ReduceMax (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -705,8 +670,7 @@ ReduceMax (FabArray const& fa1, FabArray const& fa2, } #endif -template ::value> > +template typename FAB1::value_type ReduceMax (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, int nghost, F&& f) @@ -716,8 +680,7 @@ ReduceMax (FabArray const& fa1, FabArray const& fa2, FabArray /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template typename FAB1::value_type ReduceMax_host (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F const& f) @@ -765,8 +728,7 @@ ReduceMax_host_wrapper (FabArray const& fa1, FabArray const& fa2, } /// \endcond -template ::value> > +template typename FAB1::value_type ReduceMax (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F&& f) @@ -778,8 +740,7 @@ ReduceMax (FabArray const& fa1, FabArray const& fa2, } } #else -template ::value> > +template typename FAB1::value_type ReduceMax (FabArray const& fa1, FabArray const& fa2, FabArray const& fa3, IntVect const& nghost, F&& f) @@ -788,8 +749,7 @@ ReduceMax (FabArray const& fa1, FabArray const& fa2, } #endif -template ::value> > +template bool ReduceLogicalAnd (FabArray const& fa, int nghost, F&& f) { @@ -798,8 +758,7 @@ ReduceLogicalAnd (FabArray const& fa, int nghost, F&& f) /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template bool ReduceLogicalAnd_host (FabArray const& fa, IntVect const& nghost, F const& f) { @@ -841,8 +800,7 @@ ReduceLogicalAnd_host_wrapper (FabArray const& fa, IntVect const& nghost, F } /// \endcond -template ::value> > +template bool ReduceLogicalAnd (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -853,8 +811,7 @@ ReduceLogicalAnd (FabArray const& fa, IntVect const& nghost, F&& f) } } #else -template ::value> > +template bool ReduceLogicalAnd (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -862,8 +819,7 @@ ReduceLogicalAnd (FabArray const& fa, IntVect const& nghost, F&& f) } #endif -template ::value> > +template bool ReduceLogicalAnd (FabArray const& fa1, FabArray const& fa2, int nghost, F&& f) @@ -873,8 +829,7 @@ ReduceLogicalAnd (FabArray const& fa1, FabArray const& fa2, /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template bool ReduceLogicalAnd_host (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F const& f) @@ -920,8 +875,7 @@ ReduceLogicalAnd_host_wrapper (FabArray const& fa1, FabArray const& } /// \endcond -template ::value> > +template bool ReduceLogicalAnd (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -933,8 +887,7 @@ ReduceLogicalAnd (FabArray const& fa1, FabArray const& fa2, } } #else -template ::value> > +template bool ReduceLogicalAnd (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -943,8 +896,7 @@ ReduceLogicalAnd (FabArray const& fa1, FabArray const& fa2, } #endif -template ::value> > +template bool ReduceLogicalOr (FabArray const& fa, int nghost, F&& f) { @@ -953,8 +905,7 @@ ReduceLogicalOr (FabArray const& fa, int nghost, F&& f) /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template bool ReduceLogicalOr_host (FabArray const& fa, IntVect const& nghost, F const& f) { @@ -996,8 +947,7 @@ ReduceLogicalOr_host (FabArray const& fa, IntVect const& nghost, F&& /*f*/) } /// \endcond -template ::value> > +template bool ReduceLogicalOr (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -1008,8 +958,7 @@ ReduceLogicalOr (FabArray const& fa, IntVect const& nghost, F&& f) } } #else -template ::value> > +template bool ReduceLogicalOr (FabArray const& fa, IntVect const& nghost, F&& f) { @@ -1017,8 +966,7 @@ ReduceLogicalOr (FabArray const& fa, IntVect const& nghost, F&& f) } #endif -template ::value> > +template bool ReduceLogicalOr (FabArray const& fa1, FabArray const& fa2, int nghost, F&& f) @@ -1028,8 +976,7 @@ ReduceLogicalOr (FabArray const& fa1, FabArray const& fa2, /// \cond DOXYGEN_IGNORE namespace fudetail { -template ::value> > +template bool ReduceLogicalOr_host (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F const& f) @@ -1075,8 +1022,7 @@ ReduceLogicalOr_host_wrapper (FabArray const& fa1, FabArray const& f } /// \endcond -template ::value> > +template bool ReduceLogicalOr (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -1088,8 +1034,7 @@ ReduceLogicalOr (FabArray const& fa1, FabArray const& fa2, } } #else -template ::value> > +template bool ReduceLogicalOr (FabArray const& fa1, FabArray const& fa2, IntVect const& nghost, F&& f) @@ -1098,7 +1043,7 @@ ReduceLogicalOr (FabArray const& fa1, FabArray const& fa2, } #endif -template ::value> > +template void printCell (FabArray const& mf, const IntVect& cell, int comp = -1, const IntVect& ng = IntVect::TheZeroVector()) @@ -1150,16 +1095,14 @@ printCell (FabArray const& mf, const IntVect& cell, int comp = -1, } } -template ::value> > +template void Swap (FabArray& dst, FabArray& src, int srccomp, int dstcomp, int numcomp, int nghost) { Swap(dst,src,srccomp,dstcomp,numcomp,IntVect(nghost)); } -template ::value> > +template void Swap (FabArray& dst, FabArray& src, int srccomp, int dstcomp, int numcomp, const IntVect& nghost) { @@ -1217,16 +1160,14 @@ Swap (FabArray& dst, FabArray& src, int srccomp, int dstcomp, int numc } } -template ::value> > +template void Subtract (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, int numcomp, int nghost) { Subtract(dst,src,srccomp,dstcomp,numcomp,IntVect(nghost)); } -template ::value> > +template void Subtract (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, int numcomp, const IntVect& nghost) { @@ -1265,16 +1206,14 @@ Subtract (FabArray& dst, FabArray const& src, int srccomp, int dstcomp } -template ::value> > +template void Multiply (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, int numcomp, int nghost) { Multiply(dst,src,srccomp,dstcomp,numcomp,IntVect(nghost)); } -template ::value> > +template void Multiply (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, int numcomp, const IntVect& nghost) { @@ -1313,16 +1252,14 @@ Multiply (FabArray& dst, FabArray const& src, int srccomp, int dstcomp } -template ::value> > +template void Divide (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, int numcomp, int nghost) { Divide(dst,src,srccomp,dstcomp,numcomp,IntVect(nghost)); } -template ::value> > +template void Divide (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, int numcomp, const IntVect& nghost) { @@ -1360,16 +1297,14 @@ Divide (FabArray& dst, FabArray const& src, int srccomp, int dstcomp, } } -template ::value> > +template void Abs (FabArray& fa, int icomp, int numcomp, int nghost) { Abs(fa,icomp,numcomp,IntVect(nghost)); } -template ::value> > +template void Abs (FabArray& fa, int icomp, int numcomp, const IntVect& nghost) { @@ -1405,7 +1340,7 @@ Abs (FabArray& fa, int icomp, int numcomp, const IntVect& nghost) } } -template ::value> > +template void prefetchToHost (FabArray const& fa, const bool synchronous = true) { @@ -1420,7 +1355,7 @@ prefetchToHost (FabArray const& fa, const bool synchronous = true) #endif } -template ::value> > +template void prefetchToDevice (FabArray const& fa, const bool synchronous = true) { @@ -1436,8 +1371,7 @@ prefetchToDevice (FabArray const& fa, const bool synchronous = true) } -template ::value - && IsBaseFab::value> > +template void OverrideSync (FabArray & fa, FabArray const& msk, const Periodicity& period) { @@ -1448,8 +1382,7 @@ OverrideSync (FabArray & fa, FabArray const& msk, const Periodicity& } -template ::value - && IsBaseFab::value> > +template void OverrideSync_nowait (FabArray & fa, FabArray const& msk, const Periodicity& period) { @@ -1496,7 +1429,7 @@ OverrideSync_nowait (FabArray & fa, FabArray const& msk, const Period fa.os_temp->ParallelCopy_nowait(fa, period, FabArrayBase::ADD); } -template ::value> > +template void OverrideSync_finish (FabArray & fa) { @@ -1510,7 +1443,7 @@ OverrideSync_finish (FabArray & fa) fa.os_temp.reset(); } -template ::value> > +template void dtoh_memcpy (FabArray& dst, FabArray const& src, int scomp, int dcomp, int ncomp) @@ -1528,14 +1461,14 @@ dtoh_memcpy (FabArray& dst, FabArray const& src, #endif } -template ::value> > +template void dtoh_memcpy (FabArray& dst, FabArray const& src) { dtoh_memcpy(dst, src, 0, 0, dst.nComp()); } -template ::value> > +template void htod_memcpy (FabArray& dst, FabArray const& src, int scomp, int dcomp, int ncomp) @@ -1553,14 +1486,14 @@ htod_memcpy (FabArray& dst, FabArray const& src, #endif } -template ::value> > +template void htod_memcpy (FabArray& dst, FabArray const& src) { htod_memcpy(dst, src, 0, 0, dst.nComp()); } -template ::value> > +template IntVect indexFromValue (FabArray const& mf, int comp, IntVect const& nghost, typename FAB::value_type value) @@ -1668,7 +1601,7 @@ indexFromValue (FabArray const& mf, int comp, IntVect const& nghost, * \param nghost number of ghost cells * \param local If true, MPI communication is skipped. */ -template ::value,int> FOO = 0> +template typename FAB::value_type Dot (FabArray const& x, int xcomp, FabArray const& y, int ycomp, int ncomp, IntVect const& nghost, bool local = false) @@ -1730,7 +1663,7 @@ Dot (FabArray const& x, int xcomp, FabArray const& y, int ycomp, int n * \param nghost number of ghost cells * \param local If true, MPI communication is skipped. */ -template ::value,int> FOO = 0> +template typename FAB::value_type Dot (FabArray const& x, int xcomp, int ncomp, IntVect const& nghost, bool local = false) { @@ -1791,8 +1724,7 @@ Dot (FabArray const& x, int xcomp, int ncomp, IntVect const& nghost, bool l * \param nghost number of ghost cells * \param local If true, MPI communication is skipped. */ -template ::value && IsBaseFab::value,int> FOO = 0> +template typename FAB::value_type Dot (FabArray const& mask, FabArray const& x, int xcomp, FabArray const& y, int ycomp, int ncomp, IntVect const& nghost, @@ -1863,8 +1795,7 @@ Dot (FabArray const& mask, FabArray const& x, int xcomp, * \param nghost number of ghost cells * \param local If true, MPI communication is skipped. */ -template ::value && IsBaseFab::value,int> FOO = 0> +template typename FAB::value_type Dot (FabArray const& mask, FabArray const& x, int xcomp, int ncomp, IntVect const& nghost, bool local = false) diff --git a/Src/Base/CMakeLists.txt b/Src/Base/CMakeLists.txt index c1fbf44a439..d6088bc7156 100644 --- a/Src/Base/CMakeLists.txt +++ b/Src/Base/CMakeLists.txt @@ -92,6 +92,7 @@ foreach(D IN LISTS AMReX_SPACEDIM) AMReX_NFiles.cpp AMReX_parstream.H AMReX_parstream.cpp + AMReX_Concepts.H # I/O stuff -------------------------------------------------------------- AMReX_ANSIEscCode.H AMReX_FabConv.H diff --git a/Src/Base/Make.package b/Src/Base/Make.package index 5ec492ce5a4..ab4fb34dca2 100644 --- a/Src/Base/Make.package +++ b/Src/Base/Make.package @@ -124,6 +124,9 @@ C$(AMREX_BASE)_headers += AMReX_CTOParallelForImpl.H C$(AMREX_BASE)_headers += AMReX_ParReduce.H +C$(AMREX_BASE)_headers += AMReX_Concepts.H + + # # I/O stuff. #