4#include <AMReX_Config.H>
100 tags.emplace_back(t);
105 template <
typename T,
typename... Ts>
107 tags.emplace_back(std::forward<T>(t));
108 return SetTag(std::forward<Ts>(ts)...);
120#if defined(AMREX_USE_MPI) && defined(AMREX_USE_GPU)
121#define AMREX_FB_UNPACK_ON_ARRIVAL 1
166#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
203 explicit operator bool() const noexcept {
216template <BaseFabType DFAB, BaseFabType SFAB>
217requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
221 Copy(dst,src,srccomp,dstcomp,numcomp,
IntVect(nghost));
224template <BaseFabType DFAB, BaseFabType SFAB>
225requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
231 using DT =
typename DFAB::value_type;
236 if constexpr (std::is_same_v<typename SFAB::value_type, typename DFAB::value_type>) {
245 auto const& dstarr = dst.
arrays();
249 dstarr[box_no](i,j,k,dstcomp+n) = DT(srcarr[box_no](i,j,k,srccomp+n));
258#pragma omp parallel if (Gpu::notInLaunchRegion())
262 const Box& bx = mfi.growntilebox(nghost);
266 auto const& dstFab = dst.
array(mfi);
269 dstFab(i,j,k,dstcomp+n) = DT(srcFab(i,j,k,srccomp+n));
276template <BaseFabType FAB>
280 Add(dst,src,srccomp,dstcomp,numcomp,
IntVect(nghost));
283template <BaseFabType FAB>
291 auto const& dstfa = dst.
arrays();
296 dstfa[box_no](i,j,k,n+dstcomp) += srcfa[box_no](i,j,k,n+srccomp);
305#pragma omp parallel if (Gpu::notInLaunchRegion())
309 const Box& bx = mfi.growntilebox(nghost);
312 auto const srcFab = src.
array(mfi);
313 auto dstFab = dst.
array(mfi);
316 dstFab(i,j,k,n+dstcomp) += srcFab(i,j,k,n+srccomp);
421#ifdef AMREX_STRICT_MODE
434#ifdef AMREX_STRICT_MODE
471#ifdef AMREX_STRICT_MODE
484#ifdef AMREX_STRICT_MODE
524 return (f !=
nullptr);
553 return f->isAllRegular();
598 const FAB&
get (
int K)
const noexcept {
return *(this->
fabPtr(K)); }
604 FAB&
get (
int K)
noexcept {
return *(this->
fabPtr(K)); }
614 FAB
const*
fabPtr (
int K)
const noexcept;
626 this->
fabPtr(mfi)->prefetchToHost();
642 this->
fabPtr(mfi)->prefetchToDevice();
652 return fabPtr(mfi)->const_array();
659 return fabPtr(mfi)->array();
666 return fabPtr(K)->const_array();
673 return fabPtr(K)->array();
680 return fabPtr(mfi)->const_array();
687 return fabPtr(K)->const_array();
695 return fabPtr(mfi)->const_array(start_comp);
703 return fabPtr(mfi)->array(start_comp);
711 return fabPtr(K)->const_array(start_comp);
719 return fabPtr(K)->array(start_comp);
727 return fabPtr(mfi)->const_array(start_comp);
735 return fabPtr(K)->const_array(start_comp);
767 void setFab (
int boxno, std::unique_ptr<FAB> elem);
770 template <
class F=FAB>
771 requires (std::is_move_constructible_v<F>)
778 template <
class F=FAB>
779 requires (std::is_move_constructible_v<F>)
807 template <BaseFabType SFAB, BaseFabType DFAB = FAB>
808 requires (std::is_convertible_v<
typename SFAB::value_type,
809 typename DFAB::value_type>)
825 template <
class F=FAB>
831 template <
class F=FAB>
836 template <
class F=FAB>
845 template <
class F=FAB>
852 template <
class F=FAB>
865 template <
class F=FAB>
873 template <
class F=FAB>
884 template <
class F=FAB>
888 template <
class F=FAB>
897 template <
class F=FAB>
901 template <
class F=FAB>
905 template <
class F=FAB>
907 void abs (
int comp,
int ncomp,
int nghost = 0);
909 template <
class F=FAB>
913 template <
class F=FAB>
917 template <
class F=FAB>
921 template <
class F=FAB>
925 template <
class F=FAB>
929 template <
class F=FAB>
933 template <
class F=FAB>
938 template <
class F=FAB>
943 template <
class F=FAB>
952 template <
class F=FAB>
962 template <
class F=FAB>
972 template <std::
integral Int>
985 template <
typename F=FAB>
987 typename F::value_type
988 sum (
int comp,
IntVect const& nghost,
bool local =
false)
const;
1004 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1056 {
ParallelCopy(src,src_comp,dest_comp,num_comp,0,0,period,op); }
1058 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1065 {
ParallelCopy(src,src_comp,dest_comp,num_comp, period, op); }
1141 bool deterministic =
false);
1212 IntVect(dst_nghost),period,op); }
1240 bool to_ghost_cells_only =
false,
1241 bool deterministic =
false);
1273 bool to_ghost_cells_only =
false,
1274 bool deterministic =
false);
1356 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1367 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1376 {
ParallelCopy(src,src_comp,dest_comp,num_comp,src_nghost,dst_nghost,period,op); }
1390 void copyTo (FAB& dest,
int nghost = 0)
const;
1399 void copyTo (FAB& dest,
int scomp,
int dcomp,
int ncomp,
int nghost = 0)
const;
1419 template <
typename BUF=value_type>
1423 template <
typename BUF=value_type>
1426 template <
typename BUF=value_type>
1431 template <
typename BUF=value_type>
1435 template <
typename BUF=value_type>
1439 template <
typename BUF=value_type>
1442 template <
typename BUF=value_type>
1445 template <
typename BUF=value_type>
1448 template <
typename BUF=value_type>
1451 template <
typename BUF=value_type>
1454 template <
typename BUF=value_type>
1457 template <
typename BUF=value_type>
1460 template <
typename BUF=value_type,
class F=FAB>
1563 bool deterministic =
false);
1566 bool deterministic =
false);
1568 bool deterministic =
false);
1570 bool deterministic =
false);
1584 bool deterministic =
false);
1587 bool deterministic =
false);
1602 bool deterministic =
false);
1605 bool deterministic =
false);
1631 template <
class F=FAB>
1639 template <
typename BUF=value_type,
class F=FAB>
1643 bool enforce_periodicity_only =
false,
1644 bool override_sync =
false,
1646 bool deterministic =
false);
1651 int scomp,
int dcomp,
int ncomp,
CpOp op);
1653 template <
class F=FAB>
1657 template <
class F=FAB>
1669 int scomp,
int dcomp,
int ncomp,
CpOp op,
bool deterministic);
1674#if defined(__CUDACC__)
1676 void FB_local_copy_cuda_graph_1 (
const FB& TheFB,
int scomp,
int ncomp);
1677 void FB_local_copy_cuda_graph_n (
const FB& TheFB,
int scomp,
int ncomp);
1685#if defined(__CUDACC__)
1687 void FB_pack_send_buffer_cuda_graph (
const FB& TheFB,
int scomp,
int ncomp,
1692 void FB_unpack_recv_buffer_cuda_graph (
const FB& TheFB,
int dcomp,
int ncomp,
1696 bool is_thread_safe);
1700 template <
typename BUF = value_type>
1715 template <
typename BUF = value_type>
1720 CpOp op,
bool is_thread_safe,
1721 std::uint64_t
id,
bool deterministic);
1723 template <
typename BUF>
1728 int ncomp, std::uint64_t
id);
1730 template <
typename BUF>
1735 int ncomp, std::uint64_t
id)
const;
1737#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
1738 template <
typename BUF>
1741 template <
typename BUF>
1745 template <
typename BUF>
1751 template <
typename BUF = value_type>
1757 template <
typename BUF = value_type>
1762 CpOp op,
bool is_thread_safe);
1778 template <
typename F=FAB>
1780 typename F::value_type
1782 [[maybe_unused]]
bool ignore_covered =
false)
const;
1796 template <
typename IFAB,
typename F=FAB>
1798 typename F::value_type
1800 bool local =
false)
const;
1836#if defined(BL_USE_MPI3)
1837 if (win != MPI_WIN_NULL) { MPI_Win_free(&win); }
1847#if defined(BL_USE_MPI3)
1852#if defined(BL_USE_MPI3)
1853 rhs.win = MPI_WIN_NULL;
1862#if defined(BL_USE_MPI3)
1864 rhs.win = MPI_WIN_NULL;
1874#if defined(BL_USE_MPI3)
1875 MPI_Win win = MPI_WIN_NULL;
1883 using Iterator =
typename std::vector<FAB*>::iterator;
1887 bool alloc_single_chunk);
1889 void setFab_assert (
int K, FAB
const& fab)
const;
1891 template <
class F=FAB>
1893 void build_arrays ()
const;
1895 void clear_fab_caches ();
1898 std::map<std::uint64_t,
1899 std::unique_ptr<TagVector<Array4CopyTag<value_type>>>>
1900 m_fb_local_copy_handler;
1902 using RecvSendCopyHandlerKey = std::tuple<std::uint64_t,std::size_t,int>;
1903 std::map<RecvSendCopyHandlerKey,
1904 std::unique_ptr<TagVector<CommRecvBufTag<value_type>>>>
1905 m_recv_copy_handler;
1906 mutable std::map<RecvSendCopyHandlerKey,
1907 std::unique_ptr<TagVector<CommSendBufTag<value_type>>>>
1908 m_send_copy_handler;
1910#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
1911 std::map<RecvSendCopyHandlerKey, std::unique_ptr<FBOnArrivalMeta<FAB>>> m_fb_on_arrival_meta;
1919 template <
typename BUF=value_type>
1921 char*& the_recv_data,
1929 template <
typename BUF=value_type>
1939 template <
typename BUF=value_type>
1941 char*& the_send_data,
1949 template <
typename BUF=value_type>
1966 std::unique_ptr<FBData<FAB>>
fbd;
1967 std::unique_ptr<PCData<FAB>>
pcd;
1983 template <
class F=FAB>
1986 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1999 template <
class F=FAB>
2002 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
2018 template <
class F=FAB>
2023 int dstcomp,
int numcomp,
const IntVect& nghost);
2038 template <
class F=FAB>
2042 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
2058 template <
class F=FAB>
2062 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
2077 template <
class F=FAB>
2081 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
2158FabArray<FAB>::build_arrays ()
const
2162 static_assert(
sizeof(A) ==
sizeof(AC),
"sizeof(Array4<T>) != sizeof(Array4<T const>)");
2163 if (!m_hp_arrays && local_size() > 0) {
2164 const int n = local_size();
2169 m_hp_arrays = std::malloc(n*2*
sizeof(A));
2171 for (
int li = 0; li < n; ++li) {
2173 new ((A*)m_hp_arrays+li) A(m_fabs_v[li]->array());
2174 new ((AC*)m_hp_arrays+li+n) AC(m_fabs_v[li]->const_array());
2176 new ((A*)m_hp_arrays+li) A{};
2177 new ((AC*)m_hp_arrays+li+n) AC{};
2180 m_arrays.
hp = (A*)m_hp_arrays;
2181 m_const_arrays.
hp = (AC*)m_hp_arrays + n;
2183 m_arrays.
dp = (A*)m_dp_arrays;
2184 m_const_arrays.
dp = (AC*)m_dp_arrays + n;
2226FabArray<FAB>::clear_fab_caches ()
2230 m_fb_local_copy_handler.clear();
2231 m_recv_copy_handler.clear();
2232 m_send_copy_handler.clear();
2234#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
2235 m_fb_on_arrival_meta.clear();
2249 for (
auto const& t :
m_tags) {
2254 return std::exchange(
m_fabs_v[li],
nullptr);
2270 for (
auto const& t :
m_tags) {
2275 return std::exchange(
m_fabs_v[li],
nullptr);
2305 for (
auto const& t :
m_tags) {
2318 m_fb_local_copy_handler.clear();
2319 m_recv_copy_handler.clear();
2320 m_send_copy_handler.clear();
2322#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
2323 m_fb_on_arrival_meta.clear();
2330template <BaseFabType SFAB, BaseFabType DFAB>
2331requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
2336 amrex::Copy(*
this, src, scomp, dcomp, ncomp, nghost);
2346 amrex::Add(*
this, src, scomp, dcomp, ncomp, nghost);
2436 for (
int i = 0, n =
indexArray.size(); i < n; ++i) {
2437 auto const& rhsfab = *(rhs.
m_fabs_v[i]);
2456 ,
m_fabs_v (std::move(rhs.m_fabs_v))
2458 ,
m_dp_arrays (std::exchange(rhs.m_dp_arrays,
nullptr))
2460 ,
m_hp_arrays (std::exchange(rhs.m_hp_arrays,
nullptr))
2463 ,
m_tags (std::move(rhs.m_tags))
2464 ,
shmem (std::move(rhs.shmem))
2466 , m_fb_local_copy_handler(std::move(rhs.m_fb_local_copy_handler))
2467 , m_recv_copy_handler(std::move(rhs.m_recv_copy_handler))
2468 , m_send_copy_handler(std::move(rhs.m_send_copy_handler))
2470#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
2471 , m_fb_on_arrival_meta(std::move(rhs.m_fb_on_arrival_meta))
2476 rhs.define_function_called =
false;
2477 rhs.m_fabs_v.clear();
2503 std::swap(
m_tags, rhs.m_tags);
2504 shmem = std::move(rhs.shmem);
2506 std::swap(m_fb_local_copy_handler, rhs.m_fb_local_copy_handler);
2507 std::swap(m_recv_copy_handler, rhs.m_recv_copy_handler);
2508 std::swap(m_send_copy_handler, rhs.m_send_copy_handler);
2510#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
2511 std::swap(m_fb_on_arrival_meta, rhs.m_fb_on_arrival_meta);
2514 rhs.define_function_called =
false;
2515 rhs.m_fabs_v.clear();
2537 for (
MFIter fai(*
this); fai.isValid() && isok; ++fai)
2585 std::unique_ptr<FabFactory<FAB> > factory(a_factory.
clone());
2614 if (shmem.alloc) { alloc_single_chunk =
false; }
2617 const int n = indexArray.size();
2619 shmem.alloc = (nworkers > 1);
2621 bool alloc = !shmem.alloc;
2626 if (alloc_single_chunk) {
2627 m_single_chunk_size = 0L;
2628 for (
int i = 0; i < n; ++i) {
2629 int K = indexArray[i];
2630 const Box& tmpbox = fabbox(K);
2631 m_single_chunk_size += factory.
nBytes(tmpbox, n_comp, K);
2634 m_single_chunk_arena = std::make_unique<detail::SingleChunkArena>(ar, m_single_chunk_size);
2635 fab_info.SetArena(m_single_chunk_arena.get());
2638 m_fabs_v.reserve(n);
2641 for (
int i = 0; i < n; ++i)
2643 int K = indexArray[i];
2644 const Box& tmpbox = fabbox(K);
2645 m_fabs_v.push_back(factory.
create(tmpbox, n_comp, fab_info, K));
2650 m_tags.emplace_back(
"All");
2651 for (
auto const& t : m_region_tag) {
2652 m_tags.push_back(t);
2654 for (
auto const& t : tags) {
2655 m_tags.push_back(t);
2657 for (
auto const& t: m_tags) {
2658 updateMemUsage(t, nbytes, ar);
2670 for (
int i = 0; i < n; ++i) {
2671 int K = indexArray[i];
2672 int owner = distributionMap[K] - teamlead;
2673 Long s = m_fabs_v[i]->size();
2675 shmem.n_values += s;
2676 shmem.n_points += m_fabs_v[i]->numPts();
2678 if (nextoffset[owner] < 0) {
2680 nextoffset[owner] = s;
2682 offset[i] = nextoffset[owner];
2683 nextoffset[owner] += s;
2687 size_t bytes = shmem.n_values*
sizeof(value_type);
2692#if defined (BL_USE_MPI3)
2694 static MPI_Info info = MPI_INFO_NULL;
2695 if (info == MPI_INFO_NULL) {
2696 MPI_Info_create(&info);
2697 MPI_Info_set(info,
"alloc_shared_noncontig",
"true");
2702 BL_MPI_REQUIRE( MPI_Win_allocate_shared(bytes,
sizeof(value_type),
2703 info, team_comm, &mfp, &shmem.win) );
2705 for (
int w = 0; w < nworkers; ++w) {
2708 value_type *dptr = 0;
2709 BL_MPI_REQUIRE( MPI_Win_shared_query(shmem.win, w, &sz, &disp, &dptr) );
2711 dps.push_back(dptr);
2716 amrex::Abort(
"BaseFab::define: to allocate shared memory, USE_MPI3 must be true");
2720 for (
int i = 0; i < n; ++i) {
2721 int K = indexArray[i];
2722 int owner = distributionMap[K] - teamlead;
2723 value_type *
p = dps[owner] + offset[i];
2724 m_fabs_v[i]->setPtr(
p, m_fabs_v[i]->size());
2727 for (
Long i = 0; i < shmem.n_values; i++, mfp++) {
2728 new (mfp) value_type;
2738FabArray<FAB>::setFab_assert (
int K, FAB
const& fab)
const
2756 setFab_assert(boxno, *elem);
2772requires (std::is_move_constructible_v<F>)
2780 setFab_assert(boxno, elem);
2790 m_fabs_v[li] =
new FAB(std::move(elem));
2802 setFab_assert(mfi.
index(), *elem);
2818requires (std::is_move_constructible_v<F>)
2826 setFab_assert(mfi.
index(), elem);
2836 m_fabs_v[li] =
new FAB(std::move(elem));
2861 bool use_mfparfor =
true;
2865 use_mfparfor =
false;
2868 for (
int i = 0; i < nboxes; ++i) {
2870 if (npts >=
Long(64*64*64)) {
2871 use_mfparfor =
false;
2873 }
else if (npts <=
Long(17*17*17)) {
2880 auto const& ma = this->
arrays();
2884 auto const& a = ma[box_no];
2888 for (
int n = 0; n < ncomp; ++n) {
2889 a(i,j,k,strt_comp+n) = val;
2901 auto const& a = this->
array(mfi);
2904#if (AMREX_SPACEDIM == 3)
2905 if (nghost[2] > 0) {
2909 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2911 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2914#if (AMREX_SPACEDIM >= 2)
2915 if (nghost[1] > 0) {
2918 b.
grow(0, nghost[0]);
2919 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2921 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2924 if (nghost[0] > 0) {
2927 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2929 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2936 tag.dfab(i,j,k,strt_comp+n) = val;
2948 for (
MFIter fai(*
this); fai.isValid(); ++fai)
2950 get(fai).template setComplement<RunOn::Host>(val, fai.validbox(), strt_comp, ncomp);
2977 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
2979 int n = domain_box.
length(idim);
2980 domain_box.
grow(idim, n);
2985#pragma omp parallel if (Gpu::notInLaunchRegion())
2987 for (
MFIter fai(*
this); fai.isValid(); ++fai)
2989 const Box& gbx = fai.fabbox();
2992 get(fai).template setComplement<RunOn::Device>(val, domain_box, strt_comp, ncomp);
2998template <std::
integral Int>
3005 mem[mfi] +=
static_cast<Int
>((*this)[mfi].nBytesOwned());
3012typename F::value_type
3017 using T =
typename FAB::value_type;
3028 return ma[box_no](i,j,k,comp);
3034#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
3043 tmp += a(i,j,k,comp);
3061 copyTo(dest, 0, 0, dest.nComp(), nghost);
3111 auto const& fa = this->
arrays();
3115 fa[box_no](i,j,k,n+comp) = val;
3124#pragma omp parallel if (Gpu::notInLaunchRegion())
3128 const Box& bx = fai.growntilebox(nghost);
3129 auto fab = this->
array(fai);
3132 fab(i,j,k,n+comp) = val;
3164 BL_PROFILE(
"FabArray::setVal(val,region,comp,ncomp,nghost)");
3168 auto const& fa = this->
arrays();
3173 fa[box_no](i,j,k,n+comp) = val;
3184#pragma omp parallel if (Gpu::notInLaunchRegion())
3188 Box b = fai.growntilebox(nghost) & region;
3191 auto fab = this->
array(fai);
3194 fab(i,j,k,n+comp) = val;
3222 auto const& fa = this->
arrays();
3226 fa[box_no](i,j,k,n+comp) = std::abs(fa[box_no](i,j,k,n+comp));
3235#pragma omp parallel if (Gpu::notInLaunchRegion())
3240 auto fab = this->
array(mfi);
3243 fab(i,j,k,n+comp) = std::abs(fab(i,j,k,n+comp));
3259 auto const& fa = this->
arrays();
3263 fa[box_no](i,j,k,n+comp) += val;
3272#pragma omp parallel if (Gpu::notInLaunchRegion())
3277 auto fab = this->
array(mfi);
3280 fab(i,j,k,n+comp) += val;
3292 BL_PROFILE(
"FabArray::plus(val, region, comp, num_comp, nghost)");
3296 auto const& fa = this->
arrays();
3301 fa[box_no](i,j,k,n+comp) += val;
3311#pragma omp parallel if (Gpu::notInLaunchRegion())
3317 auto fab = this->
array(mfi);
3320 fab(i,j,k,n+comp) += val;
3337 auto const& fa = this->
arrays();
3341 fa[box_no](i,j,k,n+comp) *= val;
3350#pragma omp parallel if (Gpu::notInLaunchRegion())
3355 auto fab = this->
array(mfi);
3358 fab(i,j,k,n+comp) *= val;
3370 BL_PROFILE(
"FabArray::mult(val, region, comp, num_comp, nghost)");
3374 auto const& fa = this->
arrays();
3379 fa[box_no](i,j,k,n+comp) *= val;
3389#pragma omp parallel if (Gpu::notInLaunchRegion())
3395 auto fab = this->
array(mfi);
3398 fab(i,j,k,n+comp) *= val;
3415 auto const& fa = this->
arrays();
3419 fa[box_no](i,j,k,n+comp) = numerator / fa[box_no](i,j,k,n+comp);
3428#pragma omp parallel if (Gpu::notInLaunchRegion())
3433 auto fab = this->
array(mfi);
3436 fab(i,j,k,n+comp) = numerator / fab(i,j,k,n+comp);
3448 BL_PROFILE(
"FabArray::invert(numerator, region, comp, num_comp, nghost)");
3452 auto const& fa = this->
arrays();
3457 fa[box_no](i,j,k,n+comp) = numerator / fa[box_no](i,j,k,n+comp);
3467#pragma omp parallel if (Gpu::notInLaunchRegion())
3473 auto fab = this->
array(mfi);
3476 fab(i,j,k,n+comp) = numerator / fab(i,j,k,n+comp);
3493 for (
MFIter fai(*
this); fai.isValid(); ++fai)
3504 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3508 AMREX_ASSERT(
y.nGrowVect().allGE(nghost) &&
x.nGrowVect().allGE(nghost));
3514 auto const& yma =
y.arrays();
3515 auto const& xma =
x.const_arrays();
3519 yma[box_no](i,j,k,ycomp+n) += a * xma[box_no](i,j,k,xcomp+n);
3528#pragma omp parallel if (Gpu::notInLaunchRegion())
3535 auto const& xfab =
x.const_array(mfi);
3536 auto const& yfab =
y.array(mfi);
3539 yfab(i,j,k,ycomp+n) += a * xfab(i,j,k,xcomp+n);
3551 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3555 AMREX_ASSERT(
y.nGrowVect().allGE(nghost) &&
x.nGrowVect().allGE(nghost));
3561 auto const& yfa =
y.arrays();
3562 auto const& xfa =
x.const_arrays();
3566 yfa[box_no](i,j,k,n+ycomp) = xfa[box_no](i,j,k,n+xcomp)
3567 + a * yfa[box_no](i,j,k,n+ycomp);
3576#pragma omp parallel if (Gpu::notInLaunchRegion())
3581 auto const& xFab =
x.const_array(mfi);
3582 auto const& yFab =
y.array(mfi);
3585 yFab(i,j,k,n+ycomp) = xFab(i,j,k,n+xcomp)
3586 + a * yFab(i,j,k,n+ycomp);
3597 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3603 y.nGrowVect().allGE(nghost) &&
3611 auto const& yma =
y.arrays();
3617 yma[box_no](i,j,k,ycomp+n) = xma2[box_no](i,j,k,xcomp+n)
3618 + a2 * (yma [box_no](i,j,k,ycomp+n)
3619 + a1 * xma1[box_no](i,j,k,xcomp+n));
3628#pragma omp parallel if (Gpu::notInLaunchRegion())
3637 auto const& yfab =
y.array(mfi);
3640 yfab(i,j,k,ycomp+n) = xfab2(i,j,k,xcomp+n)
3641 + a2 * (yfab (i,j,k,ycomp+n)
3642 + a1 * xfab1(i,j,k,xcomp+n));
3654 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3671 auto const& y1ma = y1.
arrays();
3673 auto const& y2ma = y2.
arrays();
3678 y1ma[box_no](i,j,k,ycomp+n) += a1 * x1ma[box_no](i,j,k,xcomp+n);
3679 y2ma[box_no](i,j,k,ycomp+n) += a2 * x2ma[box_no](i,j,k,xcomp+n);
3688#pragma omp parallel if (Gpu::notInLaunchRegion())
3696 auto const& y1fab = y1.
array(mfi);
3698 auto const& y2fab = y2.
array(mfi);
3701 y1fab(i,j,k,ycomp+n) += a1 * x1fab(i,j,k,xcomp+n);
3702 y2fab(i,j,k,ycomp+n) += a2 * x2fab(i,j,k,xcomp+n);
3714 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3722 x.nGrowVect().allGE(nghost));
3728 auto const& y1ma = y1.
arrays();
3729 auto const& y2ma = y2.
arrays();
3730 auto const& xma =
x.const_arrays();
3734 y1ma[box_no](i,j,k,ycomp+n) += a1 * y2ma[box_no](i,j,k,ycomp+n);
3735 y2ma[box_no](i,j,k,ycomp+n) += a2 * xma[box_no](i,j,k,xcomp+n);
3744#pragma omp parallel if (Gpu::notInLaunchRegion())
3751 auto const& xfab =
x.const_array(mfi);
3752 auto const& y1fab = y1.
array(mfi);
3753 auto const& y2fab = y2.
array(mfi);
3756 y1fab(i,j,k,ycomp+n) += a1 * y2fab(i,j,k,ycomp+n);
3757 y2fab(i,j,k,ycomp+n) += a2 * xfab(i,j,k,xcomp+n);
3771 int dstcomp,
int numcomp,
const IntVect& nghost)
3783 auto const& dstma = dst.
arrays();
3784 auto const& xma =
x.const_arrays();
3785 auto const& yma =
y.const_arrays();
3789 dstma[box_no](i,j,k,dstcomp+n) = a*xma[box_no](i,j,k,xcomp+n)
3790 + b*yma[box_no](i,j,k,ycomp+n);
3799#pragma omp parallel if (Gpu::notInLaunchRegion())
3804 auto const& xfab =
x.const_array(mfi);
3805 auto const& yfab =
y.const_array(mfi);
3806 auto const& dfab = dst.
array(mfi);
3809 dfab(i,j,k,dstcomp+n) = a*xfab(i,j,k,xcomp+n) + b*yfab(i,j,k,ycomp+n);
3816template <
typename BUF>
3821 if (
n_grow.max() > 0 ) {
3828template <
typename BUF>
3833 if (
n_grow.max() > 0 ) {
3840template <
typename BUF>
3846 "FillBoundary: asked to fill more ghost cells than we have");
3847 if ( nghost.
max() > 0 ) {
3854template <
typename BUF>
3859 if (
n_grow.max() > 0 ) {
3866template <
typename BUF>
3871 if (
n_grow.max() > 0 ) {
3878template <
typename BUF>
3885 "FillBoundary: asked to fill more ghost cells than we have");
3886 if ( nghost.
max() > 0 ) {
3893template <
typename BUF>
3901template <
typename BUF>
3909template <
typename BUF>
3917template <
typename BUF>
3928 BL_PROFILE(
"FabArray::FillBoundaryAndSync()");
3940 BL_PROFILE(
"FabArray::FillBoundaryAndSync()");
3960 FBEP_nowait(scomp, ncomp, nghost, period,
false,
false,
true);
4072 BL_PROFILE(
"FabArray<FAB>::SumBoundary_nowait()");
4078 FBEP_nowait(scomp, ncomp, dst_nghost, period,
false,
false,
false, src_nghost, deterministic);
4085 BL_PROFILE(
"FabArray<FAB>::SumBoundary_finish()");
4118 FBEP_nowait(scomp, ncomp, nghost, period,
false,
true);
4124template <
typename BUF>
4132template <
typename BUF>
4150 int ncomp = this->
nComp();
4154 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
4156 domain.
grow(i, ngrow[i]);
4162 auto const& fa = this->
arrays();
4166 auto const& fab = fa[box_no];
4171 }
else if (domain.
contains(i,j,k)) {
4172 fab(i,j,k,n) = notcovered;
4174 fab(i,j,k,n) = physbnd;
4184#pragma omp parallel if (Gpu::notInLaunchRegion())
4188 auto const& fab = this->
array(mfi);
4190 Box const& gbx = fbx & domain;
4197 fab(i,j,k,n) = notcovered;
4199 fab(i,j,k,n) = physbnd;
4215 BL_PROFILE(
"FabArray::setVal(val, thecmd, scomp, ncomp)");
4232 auto N_locs =
static_cast<int>(LocTags.size());
4234#pragma omp parallel for if (thecmd.m_threadsafe_loc)
4236 for (
int i = 0; i < N_locs; ++i) {
4241 for (
const auto & RcvTag : RcvTags) {
4242 auto N =
static_cast<int>(RcvTag.second.size());
4244#pragma omp parallel for if (thecmd.m_threadsafe_rcv)
4246 for (
int i = 0; i < N; ++i) {
4264#pragma omp parallel if (thecmd.m_threadsafe_rcv)
4273 auto N_locs =
static_cast<int>(LocTags.size());
4274 for (
int i = 0; i < N_locs; ++i) {
4279 for (
const auto & RcvTag : RcvTags) {
4280 auto N =
static_cast<int>(RcvTag.second.size());
4281 for (
int i = 0; i < N; ++i) {
4290template <
typename F>
4292typename F::value_type
4294 [[maybe_unused]]
bool ignore_covered)
const
4298 using RT =
typename F::value_type;
4301 Math::detail::AbsNanToInf<RT>
const absinf{};
4312 auto const& flagsma = flags.const_arrays();
4318 return flagsma[box_no](i,j,k).isCovered() ? RT(0.0) : absinf(ma[box_no](i,j,k,comp+n));
4321 RT v = ma[box_no](i,j,k,comp+n);
4322 v = flagsma[box_no](i,j,k).isCovered() ? RT(0.0) : v;
4330#pragma omp parallel reduction(max:nm0)
4335 auto const& flag = flags.const_array(mfi);
4339 if (!flag(i,j,k).isCovered()) {
4340 nm0 = std::max(nm0, absinf(a(i,j,k,comp+n)));
4359 return absinf(ma[box_no](i,j,k,comp+n));
4365#pragma omp parallel reduction(max:nm0)
4372 nm0 = std::max(nm0, absinf(a(i,j,k,comp+n)));
4379 nm0 = std::max(nm0, RT(0.0));
4389template <
typename IFAB,
typename F>
4391typename F::value_type
4393 IntVect const& nghost,
bool local)
const
4397 using RT =
typename F::value_type;
4400 Math::detail::AbsNanToInf<RT>
const absinf{};
4412 return maskma[box_no](i,j,k) ? absinf(ma[box_no](i,j,k,comp+n)) : RT(0.0);
4415 RT v = ma[box_no](i,j,k,comp+n);
4416 v = maskma[box_no](i,j,k) ? v : RT(0.0);
4424#pragma omp parallel reduction(max:nm0)
4432 if (mskfab(i,j,k)) {
4433 nm0 = std::max(nm0, absinf(a(i,j,k,comp+n)));
4440 nm0 = std::max(nm0, RT(0.0));
Runtime initialization/finalization helpers and global diagnostics.
Fixed-size array types for use on GPU and CPU.
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:593
Assertion macros used across AMReX for runtime consistency checks.
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:49
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_ALWAYS_ASSERT(EX)
Definition AMReX_BLassert.H:50
Helper routines for manipulating BaseFab data and related arrays.
BaseFab container template providing box-based field storage.
Container and helper utilities for sets of boxes on integer index space.
Disjoint-list representation of boxes and associated utilities.
Integer-lattice boxes and helpers for defining index-space regions.
Maps FABs in a FabArray to MPI processes.
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:123
#define AMREX_RESTRICT
Definition AMReX_Extension.H:37
Common infrastructure shared by FabArray specializations.
Inline FabArray communication routines: FillBoundary, ParallelCopy, ParallelCopyToGhost,...
Abstract factory interface for creating and destroying FAB objects.
Problem-domain geometry: maps between index space and physical space.
#define AMREX_HOST_DEVICE_FOR_4D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:107
#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:111
#define AMREX_IF_ON_DEVICE(CODE)
Definition AMReX_GpuQualifiers.H:56
#define AMREX_IF_ON_HOST(CODE)
Definition AMReX_GpuQualifiers.H:58
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
Convenience header for the core AMReX GPU facilities.
#define AMREX_LOOP_3D(bx, i, j, k, block)
#define AMREX_LOOP_4D(bx, ncomp, i, j, k, n, block)
while parser_exe_t p
Definition AMReX_Parser_Exe_Body.H:33
Abstract base class for memory arenas.
Definition AMReX_Arena.H:154
virtual void free(void *pt)=0
Free a previously allocated block pointed to by pt.
virtual void * alloc(std::size_t sz)=0
Allocate sz bytes from this arena.
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:243
Reference-counted collection of Boxes.
Definition AMReX_BoxArray.H:681
__host__ __device__ BoxND & grow(int i) noexcept
Grow in all directions by i cells (negative shrinks).
Definition AMReX_Box.H:668
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:167
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:233
__host__ __device__ BoxND & shift(int dir, int nzones) noexcept
Shift this BoxND nzones indexing positions in coordinate direction dir.
Definition AMReX_Box.H:538
__host__ __device__ BoxND & setRange(int dir, int sm_index, int n_cells=1) noexcept
Set the entire range in a given direction, starting at sm_index with length n_cells....
Definition AMReX_Box.H:1143
__host__ __device__ bool ok() const noexcept
Return true if high bounds are >= low bounds and the index type is valid.
Definition AMReX_Box.H:229
__host__ __device__ const IntVectND< dim > & smallEnd() const &noexcept
Return the inclusive lower bound of the box.
Definition AMReX_Box.H:124
Default FabFactory that calls new / delete on the FAB type directly.
Definition AMReX_FabFactory.H:124
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:55
Definition AMReX_EBFabFactory.H:32
const FabArray< EBCellFlagFab > & getMultiEBCellFlagFab() const noexcept
EB cell flags for all boxes.
Definition AMReX_EBFabFactory.H:88
IntVect nGrowVect() const noexcept
Definition AMReX_FabArrayBase.H:85
void clearThisBD(bool no_assertion=false) const
clear BD count and caches associated with this BD, if no other is using this BD.
Definition AMReX_FabArrayBase.cpp:2610
void clear()
Clear this object's BoxArray, DistributionMapping, local index/ownership data, and BDKey so the conta...
Definition AMReX_FabArrayBase.cpp:209
friend class MFIter
Definition AMReX_FabArrayBase.H:48
Vector< int > indexArray
Definition AMReX_FabArrayBase.H:537
static FabArrayStats m_FA_stats
Definition AMReX_FabArrayBase.H:893
static bool getAllocSingleChunk()
Query whether single-chunk allocation is enabled for new FabArrays.
Definition AMReX_FabArrayBase.H:904
void addThisBD()
add the current BD into BD count database
Definition AMReX_FabArrayBase.cpp:2640
int n_comp
Definition AMReX_FabArrayBase.H:540
const FB & getFB(const IntVect &nghost, const Periodicity &period, bool cross=false, bool enforce_periodicity_only=false, bool override_sync=false, IntVect const &sumboundary_src_nghost=IntVect(-1)) const
Retrieve (and cache) the FillBoundary metadata for the requested halo.
Definition AMReX_FabArrayBase.cpp:1308
bool isFusingCandidate() const noexcept
Is this a good candidate for kernel fusing?
Definition AMReX_FabArrayBase.cpp:2795
bool is_cell_centered() const noexcept
This tests on whether the FabArray is cell-centered.
Definition AMReX_FabArrayBase.cpp:2789
IndexType ixType() const noexcept
Return index type.
Definition AMReX_FabArrayBase.H:91
FabArrayBase & operator=(const FabArrayBase &rhs)=default
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, int ngrow)
Definition AMReX_FabArrayBase.cpp:177
static void updateMemUsage(std::string const &tag, Long nbytes, Arena const *ar)
Accumulate memory usage statistics for diagnostics.
Definition AMReX_FabArrayBase.cpp:2717
CopyComTag::CopyComTagsContainer CopyComTagsContainer
Definition AMReX_FabArrayBase.H:236
CopyComTag::MapOfCopyComTagContainers MapOfCopyComTagContainers
Definition AMReX_FabArrayBase.H:237
int localindex(int K) const noexcept
Return local index in the vector of FABs.
Definition AMReX_FabArrayBase.H:124
const DistributionMapping & DistributionMap() const noexcept
Return constant reference to associated DistributionMapping.
Definition AMReX_FabArrayBase.H:135
int local_size() const noexcept
Return the number of local FABs in the FabArray.
Definition AMReX_FabArrayBase.H:118
IntVect n_grow
Definition AMReX_FabArrayBase.H:539
CpOp
parallel copy or add
Definition AMReX_FabArrayBase.H:432
@ ADD
Definition AMReX_FabArrayBase.H:432
@ COPY
Definition AMReX_FabArrayBase.H:432
Box box(int K) const noexcept
Return the Kth Box in the BoxArray. That is, the valid region of the Kth grid.
Definition AMReX_FabArrayBase.H:106
DistributionMapping distributionMap
Definition AMReX_FabArrayBase.H:536
Box fabbox(int K) const noexcept
Return the Kth FABs Box in the FabArray. That is, the region the Kth fab is actually defined on.
Definition AMReX_FabArrayBase.cpp:219
BoxArray boxarray
Definition AMReX_FabArrayBase.H:535
int nComp() const noexcept
Return number of variables (aka components) associated with each point.
Definition AMReX_FabArrayBase.H:88
const BoxArray & boxArray() const noexcept
Return a constant reference to the BoxArray that defines the valid region associated with this FabArr...
Definition AMReX_FabArrayBase.H:100
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:383
void ParallelCopy(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const IntVect &snghost, const IntVect &dnghost, const IntVect &offset, const Periodicity &period)
This function copies data from src to this FabArray.
Definition AMReX_FabArrayCommI.H:370
void ParallelCopyToGhost_finish()
Finish the current ParallelCopyToGhost_nowait() operation.
Definition AMReX_FabArrayCommI.H:426
void setFab(int boxno, std::unique_ptr< FAB > elem)
Explicitly set the Kth FAB in the FabArray to point to elem.
Definition AMReX_FabArray.H:2750
void copy(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, int src_nghost, int dst_nghost, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:1357
TagVector< CommSendBufTag< value_type > > const * get_send_copy_tag_vector(Vector< char * > const &send_data, Vector< std::size_t > const &send_size, Vector< CopyComTagsContainer const * > const &send_cctc, int ncomp, std::uint64_t id) const
void SumBoundary_nowait(int scomp, int ncomp, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:4056
FBOnArrivalMeta< FAB > * FB_on_arrival_meta(const FB &TheFB, int ncomp)
void mult(value_type val, int comp, int num_comp, int nghost=0)
void setBndry(value_type val)
void copy(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const IntVect &src_nghost, const IntVect &dst_nghost, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:1368
void FillBoundary_finish()
void * m_dp_arrays
Definition AMReX_FabArray.H:1822
void ParallelCopy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:999
void setFab(const MFIter &mfi, std::unique_ptr< FAB > elem)
Explicitly set the FAB associated with mfi in the FabArray to point to elem.
Definition AMReX_FabArray.H:2796
typename std::conditional_t< IsBaseFab< FAB >::value, FAB, FABType >::value_type value_type
Definition AMReX_FabArray.H:394
void capacityOfFabs(LayoutData< Int > &mem) const
std::unique_ptr< FabArray< BaseFab< GpuComplex< Real > > > > os_temp
Definition AMReX_FabArray.H:1970
static void Saxpy_Xpay(FabArray< BaseFab< GpuComplex< Real > > > &y, value_type a1, FabArray< BaseFab< GpuComplex< Real > > > const &x1, value_type a2, FabArray< BaseFab< GpuComplex< Real > > > const &x2, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
void FillBoundary(const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3842
const FabFactory< FAB > & Factory() const noexcept
Factory used to create FAB instances for this FabArray.
Definition AMReX_FabArray.H:499
void FBEP_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross, bool enforce_periodicity_only=false, bool override_sync=false, IntVect const &sumboundary_src_nghost=IntVect(-1), bool deterministic=false)
void CMD_remote_setVal_gpu(value_type x, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FBI.H:723
void Redistribute(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &nghost)
Copy from src to this. this and src have the same BoxArray, but different DistributionMapping.
Definition AMReX_FabArrayCommI.H:1037
LayoutData< int > RecvLayoutMask(const CommMetaData &thecmd)
void FillBoundary_nowait(const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3903
static void LinComb(FabArray< BaseFab< GpuComplex< Real > > > &dst, value_type a, const FabArray< BaseFab< GpuComplex< Real > > > &x, int xcomp, value_type b, const FabArray< BaseFab< GpuComplex< Real > > > &y, int ycomp, int dstcomp, int numcomp, const IntVect &nghost)
void shift(const IntVect &v)
Shift the boxarray by vector v.
Definition AMReX_FabArray.H:3485
FAB * release(int K)
Release ownership of the FAB. This function is not thread safe.
Definition AMReX_FabArray.H:2242
bool ok() const
Return true if the FabArray is well-defined. That is, the FabArray has a BoxArray and DistributionMap...
Definition AMReX_FabArray.H:2531
const FAB & operator[](const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:583
void ParallelAdd_nowait(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic())
Start an asynchronous ParallelAdd over all components.
Definition AMReX_FabArray.H:1018
FabArray(FabArray< FAB > &&rhs) noexcept
Definition AMReX_FabArray.H:2448
void ParallelCopy(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY, const FabArrayBase::CPC *a_cpc=nullptr, bool deterministic=false)
Definition AMReX_FabArrayCommI.H:350
FabArray(const BoxArray &bxs, const DistributionMapping &dm, int nvar, const IntVect &ngrow, const MFInfo &info=MFInfo(), const FabFactory< FAB > &factory=DefaultFabFactory< FAB >())
Construct a FabArray with a per-direction grow vector.
Definition AMReX_FabArray.H:2412
bool defined(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:2105
void prefetchToHost(const MFIter &mfi) const noexcept
Request that the FAB selected by iterator mfi be prefetched to host memory, where supported.
Definition AMReX_FabArray.H:620
Arena * m_default_arena
Definition AMReX_FabArray.H:1807
void OverrideSync_nowait(int scomp, int ncomp, const Periodicity &period)
Definition AMReX_FabArray.H:4002
FabArray(const FabArray< FAB > &rhs)=delete
void ParallelCopyToGhost(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic())
Copy source data to destination ghost cells only.
Definition AMReX_FabArrayCommI.H:395
MultiArray4< typename FabArray< FAB >::value_type > arrays() noexcept
Build, if needed, and return mutable Array4 views for local FABs.
Definition AMReX_FabArray.H:741
static void unpack_recv_buffer_gpu(FabArray< FAB > &dst, int dcomp, int ncomp, Vector< char * > const &recv_data, Vector< std::size_t > const &recv_size, Vector< const CopyComTagsContainer * > const &recv_cctc, CpOp op, bool is_thread_safe, std::uint64_t id, bool deterministic)
Unpack received messages into dst on the GPU.
void ParallelCopy_finish()
Finish the current nowait ParallelCopy or ParallelAdd operation.
Definition AMReX_FabArrayCommI.H:723
FAB & get(int K) noexcept
Return a reference to the FAB associated with the Kth element.
Definition AMReX_FabArray.H:604
void ParallelAdd(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const IntVect &snghost, const IntVect &dnghost, const IntVect &offset, const Periodicity &period)
This function adds data from src to this FabArray.
Definition AMReX_FabArrayCommI.H:382
FAB const * fabPtr(int K) const noexcept
Definition AMReX_FabArray.H:2147
Array4< typename FabArray< FAB >::value_type > array(const MFIter &mfi, int start_comp) noexcept
Definition AMReX_FabArray.H:700
void SumBoundary_nowait(const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:4049
static void Saxpy_Saxpy(FabArray< BaseFab< GpuComplex< Real > > > &y1, value_type a1, FabArray< BaseFab< GpuComplex< Real > > > const &x1, FabArray< BaseFab< GpuComplex< Real > > > &y2, value_type a2, FabArray< BaseFab< GpuComplex< Real > > > const &x2, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
void clear_arrays()
Free the cached Array4s so that they are rebuilt by the next arrays() call.
Definition AMReX_FabArray.H:2204
void ParallelCopy(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, int src_nghost, int dst_nghost, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:1123
Long m_single_chunk_size
Definition AMReX_FabArray.H:1809
FAB & get(const MFIter &mfi) noexcept
Returns a reference to the FAB associated mfi.
Definition AMReX_FabArray.H:592
void OverrideSync_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Split-phase version of OverrideSync.
Definition AMReX_FabArray.H:3995
std::unique_ptr< PCData< BaseFab< GpuComplex< Real > > > > pcd
Definition AMReX_FabArray.H:1967
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, int ngrow, const MFInfo &info=MFInfo(), const FabFactory< FAB > &factory=DefaultFabFactory< FAB >())
Define this FabArray identically to that performed by the constructor having an analogous function si...
Definition AMReX_FabArray.H:2566
void setDomainBndry(value_type val, const Geometry &geom)
void ParallelAdd_nowait(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const IntVect &src_nghost, const IntVect &dst_nghost, const Periodicity &period=Periodicity::NonPeriodic())
Asynchronous ParallelAdd with per-direction ghost-cell growth.
Definition AMReX_FabArray.H:1179
void PC_local_cpu(const CPC &thecpc, FabArray< FAB > const &src, int scomp, int dcomp, int ncomp, CpOp op)
Definition AMReX_PCI.H:8
std::unique_ptr< FBData< BaseFab< GpuComplex< Real > > > > fbd
Definition AMReX_FabArray.H:1966
std::unique_ptr< detail::SingleChunkArena > m_single_chunk_arena
Definition AMReX_FabArray.H:1808
void SumBoundary_nowait(int scomp, int ncomp, IntVect const &src_nghost, IntVect const &dst_nghost, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:4070
FabArray(const FabArray< FAB > &rhs, MakeType maketype, int scomp, int ncomp)
Construct a component alias of rhs.
Definition AMReX_FabArray.H:2426
void ParallelAdd(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic())
This function copies data from src to this FabArray. Each FAB in fa is intersected with all FABs in t...
Definition AMReX_FabArray.H:996
FAB fab_type
Definition AMReX_FabArray.H:396
void ParallelCopy_nowait(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY, const FabArrayBase::CPC *a_cpc=nullptr, bool to_ghost_cells_only=false, bool deterministic=false)
Asynchronous ParallelCopy with per-direction ghost-cell growth.
Definition AMReX_FabArrayCommI.H:434
void FB_local_add_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:467
Array4< typename FabArray< FAB >::value_type const > array(int K) const noexcept
Read-only Array4 view for the FAB identified by global index K.
Definition AMReX_FabArray.H:663
bool SharedMemory() const noexcept
Definition AMReX_FabArray.H:1880
void FB_on_arrival_nowait(const FB &TheFB, int scomp, int ncomp, int SeqNum, bool sumboundary)
Array4< typename FabArray< FAB >::value_type const > const_array(int K) const noexcept
Read-only Array4 view for the FAB identified by global index K.
Definition AMReX_FabArray.H:684
void prefetchToDevice(const MFIter &mfi) const noexcept
Request that the FAB selected by iterator mfi be prefetched to device memory, where supported.
Definition AMReX_FabArray.H:636
void FillBoundary_nowait(const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3911
Vector< std::string > m_tags
Definition AMReX_FabArray.H:1828
void ParallelCopyToGhost_nowait(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic())
Start an asynchronous version of ParallelCopyToGhost().
Definition AMReX_FabArrayCommI.H:412
static void unpack_recv_buffer_cpu(FabArray< FAB > &dst, int dcomp, int ncomp, Vector< char * > const &recv_data, Vector< std::size_t > const &recv_size, Vector< const CopyComTagsContainer * > const &recv_cctc, CpOp op, bool is_thread_safe)
void ParallelAdd_nowait(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic())
Start an asynchronous ParallelAdd for a component subset.
Definition AMReX_FabArray.H:1078
void FB_local_add_gpu(const FB &TheFB, int scomp, int ncomp, bool deterministic)
Definition AMReX_FBI.H:630
void FB_local_copy_gpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:558
void LocalCopy(FabArray< SFAB > const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
void FB_on_arrival_finish()
Arena * arena() const noexcept
Arena configured for allocations by this FabArray.
Definition AMReX_FabArray.H:508
DataAllocator m_dallocator
Definition AMReX_FabArray.H:1805
void copy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:1005
Array4< typename FabArray< FAB >::value_type > array(const MFIter &mfi) noexcept
Mutable Array4 view for the FAB referenced by iterator mfi.
Definition AMReX_FabArray.H:656
void FillBoundaryAndSync_finish()
Definition AMReX_FabArray.H:3965
void ParallelCopy_nowait(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, int src_nghost, int dst_nghost, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Asynchronous ParallelCopy with scalar ghost-cell growth.
Definition AMReX_FabArray.H:1203
void ParallelCopy_nowait(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const IntVect &offset, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY, const FabArrayBase::CPC *a_cpc=nullptr, bool to_ghost_cells_only=false, bool deterministic=false)
Asynchronous ParallelCopy with per-direction ghost-cell growth and a spatial offset.
Definition AMReX_FabArrayCommI.H:452
void FillBoundary_nowait(bool cross=false)
Definition AMReX_FabArray.H:3895
void clear()
Releases FAB memory in the FabArray.
Definition AMReX_FabArray.H:2283
void FillBoundary_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:4134
const Vector< std::string > & tags() const noexcept
Memory-usage tags recorded for this FabArray's allocations.
Definition AMReX_FabArray.H:516
void CMD_local_setVal_gpu(value_type x, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FBI.H:693
MultiArray4< typename FabArray< FAB >::value_type const > arrays() const noexcept
Build, if needed, and return read-only Array4 views for local FABs.
Definition AMReX_FabArray.H:751
void FillBoundary_nowait(int scomp, int ncomp, bool cross=false)
Definition AMReX_FabArray.H:3919
value_type * singleChunkPtr() noexcept
Definition AMReX_FabArray.H:532
std::vector< BaseFab< GpuComplex< Real > > * > m_fabs_v
Definition AMReX_FabArray.H:1819
static void pack_send_buffer_gpu(FabArray< FAB > const &src, int scomp, int ncomp, Vector< char * > const &send_data, Vector< std::size_t > const &send_size, Vector< const CopyComTagsContainer * > const &send_cctc, std::uint64_t id)
void ParallelAdd(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const IntVect &src_nghost, const IntVect &dst_nghost, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:1115
bool define_function_called
Definition AMReX_FabArray.H:1815
void ParallelAdd(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic())
This function copies data from src to this FabArray. Each FAB in src is intersected with all FABs in ...
Definition AMReX_FabArray.H:1044
FabArray() noexcept
Constructs an empty FabArray<FAB>.
Definition AMReX_FabArray.H:2386
void FillBoundary_test()
Definition AMReX_FabArrayCommI.H:1064
void plus(value_type val, int comp, int num_comp, int nghost=0)
bool defined(int K) const noexcept
Definition AMReX_FabArray.H:2092
FAB * fabPtr(int K) noexcept
Definition AMReX_FabArray.H:2138
void ParallelAdd(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, int src_nghost, int dst_nghost, const Periodicity &period=Periodicity::NonPeriodic())
Similar to the above function, except that source and destination are grown by src_nghost and dst_ngh...
Definition AMReX_FabArray.H:1106
const FAB & atLocalIdx(int L) const noexcept
Definition AMReX_FabArray.H:608
MultiArray4< typename FabArray< FAB >::value_type const > const_arrays() const noexcept
Read-only convenience wrapper equivalent to arrays() const.
Definition AMReX_FabArray.H:759
std::unique_ptr< FabFactory< BaseFab< GpuComplex< Real > > > > m_factory
Definition AMReX_FabArray.H:1804
void copy(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:1059
void invert(value_type numerator, int comp, int num_comp, int nghost=0)
void copyTo(FAB &dest, int nghost=0) const
Copy the values contained in the intersection of the valid + nghost region of this FabArray with the ...
Definition AMReX_FabArray.H:3059
void ParallelAdd_nowait(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, int src_nghost, int dst_nghost, const Periodicity &period=Periodicity::NonPeriodic())
Asynchronous ParallelAdd with scalar ghost-cell growth.
Definition AMReX_FabArray.H:1156
void setVal(value_type val)
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi) const noexcept
Read-only Array4 view for the FAB referenced by iterator mfi.
Definition AMReX_FabArray.H:649
void FillBoundary_nowait(int scomp, int ncomp, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:4126
const FAB & get(const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:586
void SumBoundary_finish()
Definition AMReX_FabArray.H:4083
std::size_t singleChunkSize() const noexcept
Definition AMReX_FabArray.H:544
void SumBoundary_nowait(int scomp, int ncomp, IntVect const &nghost, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:4063
void FB_local_copy_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:396
void abs(int comp, int ncomp, int nghost=0)
static void Saxpy(FabArray< BaseFab< GpuComplex< Real > > > &y, value_type a, FabArray< BaseFab< GpuComplex< Real > > > const &x, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
MultiArray4< value_type > m_arrays
Definition AMReX_FabArray.H:1825
void FillBoundaryAndSync_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3949
void PC_local_gpu(const CPC &thecpc, FabArray< FAB > const &src, int scomp, int dcomp, int ncomp, CpOp op, bool deterministic)
Definition AMReX_PCI.H:98
void FillBoundaryAndSync_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Definition AMReX_FabArray.H:3956
void BuildMask(const Box &phys_domain, const Periodicity &period, value_type covered, value_type notcovered, value_type physbnd, value_type interior)
void * m_hp_arrays
Definition AMReX_FabArray.H:1824
static void Saypy_Saxpy(FabArray< BaseFab< GpuComplex< Real > > > &y1, value_type a1, FabArray< BaseFab< GpuComplex< Real > > > &y2, value_type a2, FabArray< BaseFab< GpuComplex< Real > > > const &x, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
ShMem shmem
Definition AMReX_FabArray.H:1878
FabArray< FAB > & operator=(FabArray< FAB > &&rhs) noexcept
Definition AMReX_FabArray.H:2483
Array4< typename FabArray< FAB >::value_type > array(int K, int start_comp) noexcept
Definition AMReX_FabArray.H:716
MultiArray4< value_type const > m_const_arrays
Definition AMReX_FabArray.H:1826
void ParallelCopy(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:1050
bool hasEBFabFactory() const noexcept
Return whether this FabArray uses an EBFArrayBoxFactory.
Definition AMReX_FabArray.H:521
TagVector< Array4CopyTag< value_type > > const * FB_get_local_copy_tag_vector(const FB &TheFB)
Definition AMReX_FBI.H:515
Array4< typename FabArray< FAB >::value_type const > array(int K, int start_comp) const noexcept
Definition AMReX_FabArray.H:708
bool isAllRegular() const noexcept
Return the EB factory's all-regular status, or true for other factories.
Definition AMReX_FabArray.H:549
Array4< typename FabArray< FAB >::value_type > array(int K) noexcept
Mutable Array4 view for the FAB identified by global index K.
Definition AMReX_FabArray.H:670
static void pack_send_buffer_cpu(FabArray< FAB > const &src, int scomp, int ncomp, Vector< char * > const &send_data, Vector< std::size_t > const &send_size, Vector< const CopyComTagsContainer * > const &send_cctc)
FAB * fabPtr(const MFIter &mfi) noexcept
Return pointer to FAB.
Definition AMReX_FabArray.H:2118
void copyTo(FAB &dest, int scomp, int dcomp, int ncomp, int nghost=0) const
Copy the values contained in the intersection of the num_comp component valid + nghost region of this...
Definition AMReX_FabArrayCommI.H:804
void OverrideSync_finish()
Definition AMReX_FabArray.H:4010
FAB * release(const MFIter &mfi)
Release ownership of the FAB. This function is not thread safe.
Definition AMReX_FabArray.H:2263
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi, int start_comp) const noexcept
Definition AMReX_FabArray.H:724
static void Xpay(FabArray< BaseFab< GpuComplex< Real > > > &y, value_type a, FabArray< BaseFab< GpuComplex< Real > > > const &x, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
TagVector< CommRecvBufTag< value_type > > const * get_recv_copy_tag_vector(Vector< char * > const &recv_data, Vector< std::size_t > const &recv_size, Vector< CopyComTagsContainer const * > const &recv_cctc, int ncomp, std::uint64_t id)
FAB & atLocalIdx(int L) noexcept
Return a reference to the FAB associated with local index L.
Definition AMReX_FabArray.H:607
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, const IntVect &ngrow, const MFInfo &info=MFInfo(), const FabFactory< FAB > &factory=DefaultFabFactory< FAB >())
Define this FabArray with a per-direction grow vector.
Definition AMReX_FabArray.H:2578
void ParallelCopy_nowait(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Start an asynchronous ParallelCopy that copies every component.
Definition AMReX_FabArray.H:1031
void LocalAdd(FabArray< BaseFab< GpuComplex< Real > > > const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi) const noexcept
Synonym for array(const MFIter&) that highlights read-only semantics.
Definition AMReX_FabArray.H:677
const FAB & get(int K) const noexcept
Return a constant reference to the FAB associated with the Kth element.
Definition AMReX_FabArray.H:598
FAB const * fabPtr(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:2128
void ParallelCopy_nowait(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Start an asynchronous ParallelCopy for a component subset.
Definition AMReX_FabArray.H:1097
bool isDefined() const
Definition AMReX_FabArray.H:2559
value_type const * singleChunkPtr() const noexcept
Definition AMReX_FabArray.H:538
~FabArray()
The destructor – deletes all FABs in the array.
Definition AMReX_FabArray.H:2523
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi, int start_comp) const noexcept
Definition AMReX_FabArray.H:692
Array4< typename FabArray< FAB >::value_type const > const_array(int K, int start_comp) const noexcept
Definition AMReX_FabArray.H:732
F::value_type sum(int comp, IntVect const &nghost, bool local=false) const
Abstract factory interface for creating, aliasing, and destroying FAB objects.
Definition AMReX_FabFactory.H:73
virtual Long nBytes(const Box &box, int ncomps, int) const
Return the storage size for ncomps components in box, or -1 if unavailable.
Definition AMReX_FabFactory.H:106
virtual FabFactory< FAB > * clone() const =0
Return a heap-allocated copy of this factory.
virtual FAB * create(const Box &box, int ncomps, const FabInfo &info, int box_index) const =0
Create a FAB covering box with ncomps components.
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:87
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:246
bool isPeriodic(int dir) const noexcept
Is the domain periodic in the specified direction?
Definition AMReX_Geometry.H:399
GPU-compatible tuple.
Definition AMReX_Tuple.H:104
__host__ __device__ constexpr bool allGE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is greater than or equal to argument for all components. NOTE: This is NOT a str...
Definition AMReX_IntVect.H:549
__host__ static __device__ constexpr IntVectND< dim > TheZeroVector() noexcept
Definition AMReX_IntVect.H:778
__host__ __device__ constexpr int max() const noexcept
maximum (no absolute values) value
Definition AMReX_IntVect.H:320
__host__ __device__ constexpr bool allLE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is less than or equal to argument for all components. NOTE: This is NOT a strict...
Definition AMReX_IntVect.H:499
a one-thingy-per-box distributed object
Definition AMReX_LayoutData.H:13
Iterator for looping ever tiles and boxes of amrex::FabArray based containers.
Definition AMReX_MFIter.H:88
Box growntilebox(int ng=-1000000) const noexcept
Return the tile box at the current index grown to include ghost cells.
Definition AMReX_MFIter.cpp:457
const DistributionMapping & DistributionMap() const noexcept
Definition AMReX_MFIter.H:201
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:176
Box validbox() const noexcept
Return the valid Box in which the current tile resides.
Definition AMReX_MFIter.H:167
int index() const noexcept
The index into the underlying BoxArray of the current FAB.
Definition AMReX_MFIter.H:179
int LocalIndex() const noexcept
Return local index into the vector of fab pointers, m_fabs_v When AllBoxes is on, local_index_map is ...
Definition AMReX_MFIter.H:194
static int currentDepth()
Definition AMReX_MFIter.cpp:21
This provides length of period for periodic domains. 0 means it is not periodic in that direction....
Definition AMReX_Periodicity.H:17
static const Periodicity & NonPeriodic() noexcept
Definition AMReX_Periodicity.cpp:52
bool isAnyPeriodic() const noexcept
Definition AMReX_Periodicity.H:22
bool isPeriodic(int dir) const noexcept
Definition AMReX_Periodicity.H:26
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
Checks if a type is derived from amrex::BaseFab.
Definition AMReX_Concepts.H:13
amrex_long Long
Definition AMReX_INT.H:30
ArrayND< T, 4, true > Array4
Convenient alias for a 4D ArrayND with three spatial dimensions plus a component dimension.
Definition AMReX_Array4.H:1352
@ covered
Every cell in the region is covered.
Definition AMReX_FabFactory.H:28
void EnforcePeriodicity(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Definition AMReX_FabArray.H:4113
void SumBoundary(int scomp, int ncomp, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:4025
void SumBoundary(int scomp, int ncomp, IntVect const &nghost, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Sum values in overlapped cells.
Definition AMReX_FabArray.H:4032
void OverrideSync(const Periodicity &period=Periodicity::NonPeriodic())
Synchronize nodal data.
Definition AMReX_FabArray.H:3973
void FillBoundary(bool cross=false)
Copy on intersection within a FabArray.
Definition AMReX_FabArray.H:3818
void OverrideSync(int scomp, int ncomp, const Periodicity &period)
Synchronize nodal data.
Definition AMReX_FabArray.H:3984
void FillBoundary(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3880
void FillBoundaryAndSync(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Fill ghost cells and synchronize nodal data.
Definition AMReX_FabArray.H:3937
void FillBoundary(const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3830
void FillBoundary(int scomp, int ncomp, bool cross=false)
Definition AMReX_FabArray.H:3856
void FillBoundaryAndSync(const Periodicity &period=Periodicity::NonPeriodic())
Fill ghost cells and synchronize nodal data.
Definition AMReX_FabArray.H:3926
void SumBoundary(const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Sum values in overlapped cells.
Definition AMReX_FabArray.H:4018
void SumBoundary(int scomp, int ncomp, IntVect const &src_nghost, IntVect const &dst_nghost, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Sum values in overlapped cells.
Definition AMReX_FabArray.H:4039
F::value_type norminf(int comp, int ncomp, IntVect const &nghost, bool local=false, bool ignore_covered=false) const
void EnforcePeriodicity(const Periodicity &period)
Fill ghost cells with values from their corresponding cells across periodic boundaries,...
Definition AMReX_FabArray.H:4091
void FillBoundary(int scomp, int ncomp, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3868
void EnforcePeriodicity(int scomp, int ncomp, const Periodicity &period)
Definition AMReX_FabArray.H:4102
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Return a copy of b converted to the nodal flags typ.
Definition AMReX_Box.H:1632
Arena * The_Comms_Arena()
Definition AMReX_Arena.cpp:899
Arena * The_Pinned_Arena()
Definition AMReX_Arena.cpp:879
Arena * The_Arena()
Definition AMReX_Arena.cpp:839
int MyProc() noexcept
Definition AMReX_ParallelDescriptor.H:128
void Min(KeyValuePair< K, V > &vi, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:161
void Sum(Gpu::DeviceVector< T > &v, MPI_Comm comm)
Definition AMReX_GpuParallelReduce.H:37
void Max(KeyValuePair< K, V > &vi, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:133
void freeAsync(Arena *arena, void *mem) noexcept
Definition AMReX_GpuDevice.H:364
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:329
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:88
int numGpuStreams() noexcept
Definition AMReX_GpuDevice.H:317
bool inNoSyncRegion() noexcept
Definition AMReX_GpuControl.H:148
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:440
MPI_Comm CommunicatorSub() noexcept
sub-communicator for current frame
Definition AMReX_ParallelContext.H:70
int MyTeamLead() noexcept
Definition AMReX_ParallelDescriptor.H:325
int TeamSize() noexcept
Definition AMReX_ParallelDescriptor.H:310
const ProcessTeam & MyTeam() noexcept
Definition AMReX_ParallelDescriptor.H:365
int MPI_Comm
Definition AMReX_ccse-mpi.H:51
Definition AMReX_Amr.cpp:50
MakeType
Definition AMReX_MakeType.H:7
@ make_alias
Definition AMReX_MakeType.H:7
__host__ __device__ void ignore_unused(const Ts &...)
No-op helper that marks variables as intentionally unused.
Definition AMReX.H:273
void FillBoundary_finish(Vector< MF * > const &mf)
Wait for outstanding FillBoundary_nowait operations launched with the vector helper to complete.
Definition AMReX_FabArrayCommI.H:1171
void Copy(FabArray< DFAB > &dst, FabArray< SFAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:219
void OverrideSync_nowait(FabArray< FAB > &fa, FabArray< IFAB > const &msk, const Periodicity &period)
Start the masked OverrideSync operation; call OverrideSync_finish() to complete it.
Definition AMReX_FabArrayUtility.H:1668
void Add(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:278
ReduceData< Ts... >::Type ParReduce(TypeList< Ops... > operation_list, TypeList< Ts... > type_list, FabArray< FAB > const &fa, IntVect const &nghost, F &&f)
Parallel reduce for MultiFab/FabArray. The reduce result is local and it's the user's responsibility ...
Definition AMReX_ParReduce.H:48
std::unique_ptr< char, TheFaArenaDeleter > TheFaArenaPointer
Definition AMReX_FabArray.H:118
Long nBytesOwned(T const &) noexcept
Definition AMReX_FabArray.H:65
BoxArray const & boxArray(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.boxArray().
Definition AMReX_FabArrayBase.cpp:3038
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.DistributionMap().
Definition AMReX_FabArrayBase.cpp:3043
void FillBoundary_nowait(Vector< MF * > const &mf, Vector< int > const &scomp, Vector< int > const &ncomp, Vector< IntVect > const &nghost, Vector< Periodicity > const &period, Vector< int > const &cross={})
Launch FillBoundary_nowait across a vector of FabArrays.
Definition AMReX_FabArrayCommI.H:1125
void FillBoundaryAndSync_nowait(Vector< MF * > const &mf, Vector< int > const &scomp, Vector< int > const &ncomp, Vector< IntVect > const &nghost, Vector< Periodicity > const &period)
Launch FillBoundaryAndSync_nowait across a vector of FabArrays.
Definition AMReX_FabArrayCommI.H:1194
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
FabArray< BaseFab< GpuComplex< Real > > > cMultiFab
Definition AMReX_FabArray.H:4449
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:35
bool isMFIterSafe(const FabArrayBase &x, const FabArrayBase &y)
Definition AMReX_MFIter.H:256
int nComp(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.nComp().
Definition AMReX_FabArrayBase.cpp:3028
@ interior
Definition AMReX_LO_BCTYPES.H:28
@ y
Definition AMReX_Orientation.H:14
@ x
Definition AMReX_Orientation.H:14
__host__ __device__ T abs(const GpuComplex< T > &a_z) noexcept
Return the absolute value of a complex number.
Definition AMReX_GpuComplex.H:361
constexpr bool IsBaseFab_v
Definition AMReX_TypeTraits.H:25
void OverrideSync_finish(FabArray< FAB > &fa)
Finish the current masked OverrideSync_nowait() operation.
Definition AMReX_FabArrayUtility.H:1718
IntVect nGrowVect(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.nGrowVect().
Definition AMReX_FabArrayBase.cpp:3033
bool TilingIfNotGPU() noexcept
Definition AMReX_MFIter.H:12
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
void setBndry(MF &dst, typename MF::value_type val, int scomp, int ncomp)
dst = val in ghost cells.
Definition AMReX_FabArrayUtility.H:2181
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:239
void update_fab_stats(Long n, Long s, size_t szt) noexcept
Definition AMReX_BaseFab.cpp:146
void FillBoundaryAndSync_finish(Vector< MF * > const &mf)
Wait for outstanding FillBoundaryAndSync_nowait operations launched with the vector helper to complet...
Definition AMReX_FabArrayCommI.H:1236
void setVal(MF &dst, typename MF::value_type val)
dst = val
Definition AMReX_FabArrayUtility.H:2174
__host__ __device__ constexpr int get(IntVectND< dim > const &iv) noexcept
Get the Idx-th element of IntVectND<dim>.
Definition AMReX_IntVect.H:1367
Definition AMReX_TagParallelFor.H:58
Lightweight allocator/deallocator backed by an Arena.
Definition AMReX_DataAllocator.H:21
Definition AMReX_FabArray.H:146
const FabArrayBase::FB * fb
Definition AMReX_FabArray.H:148
FBOnArrivalMeta< FAB > * oa_meta
Definition AMReX_FabArray.H:167
bool deterministic
Definition AMReX_FabArray.H:165
char * the_recv_data
Definition AMReX_FabArray.H:153
Vector< MPI_Request > recv_reqs
Definition AMReX_FabArray.H:158
Vector< char * > recv_data
Definition AMReX_FabArray.H:156
Vector< MPI_Status > recv_stat
Definition AMReX_FabArray.H:159
int scomp
Definition AMReX_FabArray.H:149
Vector< int > recv_from
Definition AMReX_FabArray.H:155
char * the_send_data
Definition AMReX_FabArray.H:154
Vector< MPI_Request > send_reqs
Definition AMReX_FabArray.H:162
Vector< char * > send_data
Definition AMReX_FabArray.H:161
Vector< std::size_t > recv_size
Definition AMReX_FabArray.H:157
int ncomp
Definition AMReX_FabArray.H:150
int tag
Definition AMReX_FabArray.H:163
parallel copy or add
Definition AMReX_FabArrayBase.H:651
Used by a bunch of routines when communicating via MPI.
Definition AMReX_FabArrayBase.H:211
Box dbox
Definition AMReX_FabArrayBase.H:212
int dstIndex
Definition AMReX_FabArrayBase.H:214
FillBoundary.
Definition AMReX_FabArrayBase.H:588
Definition AMReX_FabArray.H:386
FAB value_type
Definition AMReX_FabArray.H:387
ShMem(ShMem &&rhs) noexcept
Definition AMReX_FabArray.H:1845
Long n_values
Definition AMReX_FabArray.H:1872
Long n_points
Definition AMReX_FabArray.H:1873
bool alloc
Definition AMReX_FabArray.H:1871
ShMem & operator=(ShMem &&rhs) noexcept
Definition AMReX_FabArray.H:1856
ShMem(const ShMem &)=delete
Construction hints passed to FabFactory::create.
Definition AMReX_FabFactory.H:41
FabInfo & SetShared(bool s) noexcept
Set the shared flag; returns *this for chaining.
Definition AMReX_FabFactory.H:53
FabInfo & SetAlloc(bool a) noexcept
Set the alloc flag; returns *this for chaining.
Definition AMReX_FabFactory.H:47
FabInfo & SetArena(Arena *ar) noexcept
Set the arena pointer; returns *this for chaining.
Definition AMReX_FabFactory.H:59
FabArray memory allocation information.
Definition AMReX_FabArray.H:73
MFInfo & SetTag(T &&t, Ts &&... ts) noexcept
Append one or more memory-usage tags.
Definition AMReX_FabArray.H:106
MFInfo & SetTag(const std::string &t) noexcept
Append memory-usage tag t.
Definition AMReX_FabArray.H:99
Arena * arena
Definition AMReX_FabArray.H:77
MFInfo & SetArena(Arena *ar) noexcept
Select the Arena used for FAB storage.
Definition AMReX_FabArray.H:87
MFInfo & SetTag() noexcept
Terminate a variadic SetTag() call.
Definition AMReX_FabArray.H:90
bool alloc
Definition AMReX_FabArray.H:75
MFInfo & SetAlloc(bool a) noexcept
Control whether FAB storage is allocated when the FabArray is defined.
Definition AMReX_FabArray.H:81
bool alloc_single_chunk
Definition AMReX_FabArray.H:76
MFInfo & SetAllocSingleChunk(bool a) noexcept
Control whether eligible FABs use one contiguous allocation.
Definition AMReX_FabArray.H:84
Vector< std::string > tags
Definition AMReX_FabArray.H:78
MFInfo & SetTag(const char *t) noexcept
Append memory-usage tag t.
Definition AMReX_FabArray.H:93
Definition AMReX_MFIter.H:20
MFItInfo & DisableDeviceSync() noexcept
Definition AMReX_MFIter.H:47
Definition AMReX_FabArray.H:195
Array4< T > const *__restrict__ hp
Definition AMReX_FabArray.H:211
__host__ __device__ Array4< T > const & operator[](int li) const noexcept
Definition AMReX_FabArray.H:197
Array4< T > const *__restrict__ dp
Definition AMReX_FabArray.H:209
Definition AMReX_FabArray.H:173
int actual_n_rcvs
Definition AMReX_FabArray.H:179
Vector< std::size_t > recv_size
Definition AMReX_FabArray.H:186
int DC
Definition AMReX_FabArray.H:180
Vector< MPI_Request > send_reqs
Definition AMReX_FabArray.H:188
int tag
Definition AMReX_FabArray.H:178
const FabArray< FAB > * src
Definition AMReX_FabArray.H:176
char * the_recv_data
Definition AMReX_FabArray.H:182
FabArrayBase::CpOp op
Definition AMReX_FabArray.H:177
Vector< MPI_Request > recv_reqs
Definition AMReX_FabArray.H:187
char * the_send_data
Definition AMReX_FabArray.H:183
const FabArrayBase::CPC * cpc
Definition AMReX_FabArray.H:175
Vector< int > recv_from
Definition AMReX_FabArray.H:184
bool deterministic
Definition AMReX_FabArray.H:189
int NC
Definition AMReX_FabArray.H:180
int SC
Definition AMReX_FabArray.H:180
Vector< char * > recv_data
Definition AMReX_FabArray.H:185
void MemoryBarrier() const
memory fence
Definition AMReX_ParallelDescriptor.H:161
const team_t & get() const
Definition AMReX_ParallelDescriptor.H:189
Definition AMReX_TagParallelFor.H:156
Definition AMReX_FabArray.H:112
char * pointer
Definition AMReX_FabArray.H:113
void operator()(pointer p) const noexcept
Definition AMReX_FabArray.H:114
Struct for holding types.
Definition AMReX_TypeList.H:13