4#include <AMReX_Config.H>
64requires (!BaseFabType<T>)
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)...);
176 explicit operator bool() const noexcept {
189template <BaseFabType DFAB, BaseFabType SFAB>
190requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
194 Copy(dst,src,srccomp,dstcomp,numcomp,
IntVect(nghost));
197template <BaseFabType DFAB, BaseFabType SFAB>
198requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
204 using DT =
typename DFAB::value_type;
209 if constexpr (std::is_same_v<typename SFAB::value_type, typename DFAB::value_type>) {
218 auto const& dstarr = dst.
arrays();
222 dstarr[box_no](i,j,k,dstcomp+n) = DT(srcarr[box_no](i,j,k,srccomp+n));
231#pragma omp parallel if (Gpu::notInLaunchRegion())
235 const Box& bx = mfi.growntilebox(nghost);
239 auto const& dstFab = dst.
array(mfi);
242 dstFab(i,j,k,dstcomp+n) = DT(srcFab(i,j,k,srccomp+n));
249template <BaseFabType FAB>
253 Add(dst,src,srccomp,dstcomp,numcomp,
IntVect(nghost));
256template <BaseFabType FAB>
264 auto const& dstfa = dst.
arrays();
269 dstfa[box_no](i,j,k,n+dstcomp) += srcfa[box_no](i,j,k,n+srccomp);
278#pragma omp parallel if (Gpu::notInLaunchRegion())
282 const Box& bx = mfi.growntilebox(nghost);
285 auto const srcFab = src.
array(mfi);
286 auto dstFab = dst.
array(mfi);
289 dstFab(i,j,k,n+dstcomp) += srcFab(i,j,k,n+srccomp);
393#ifdef AMREX_STRICT_MODE
406#ifdef AMREX_STRICT_MODE
443#ifdef AMREX_STRICT_MODE
456#ifdef AMREX_STRICT_MODE
496 return (f !=
nullptr);
570 const FAB&
get (
int K)
const noexcept {
return *(this->
fabPtr(K)); }
576 FAB&
get (
int K)
noexcept {
return *(this->
fabPtr(K)); }
586 FAB
const*
fabPtr (
int K)
const noexcept;
598 this->
fabPtr(mfi)->prefetchToHost();
614 this->
fabPtr(mfi)->prefetchToDevice();
624 return fabPtr(mfi)->const_array();
631 return fabPtr(mfi)->array();
638 return fabPtr(K)->const_array();
645 return fabPtr(K)->array();
652 return fabPtr(mfi)->const_array();
659 return fabPtr(K)->const_array();
667 return fabPtr(mfi)->const_array(start_comp);
675 return fabPtr(mfi)->array(start_comp);
683 return fabPtr(K)->const_array(start_comp);
691 return fabPtr(K)->array(start_comp);
699 return fabPtr(mfi)->const_array(start_comp);
707 return fabPtr(K)->const_array(start_comp);
739 void setFab (
int boxno, std::unique_ptr<FAB> elem);
742 template <
class F=FAB>
743 requires (std::is_move_constructible_v<F>)
750 template <
class F=FAB>
751 requires (std::is_move_constructible_v<F>)
779 template <BaseFabType SFAB, BaseFabType DFAB = FAB>
780 requires (std::is_convertible_v<
typename SFAB::value_type,
781 typename DFAB::value_type>)
797 template <
class F=FAB>
803 template <
class F=FAB>
808 template <
class F=FAB>
817 template <
class F=FAB>
824 template <
class F=FAB>
837 template <
class F=FAB>
845 template <
class F=FAB>
856 template <
class F=FAB>
860 template <
class F=FAB>
869 template <
class F=FAB>
873 template <
class F=FAB>
877 template <
class F=FAB>
879 void abs (
int comp,
int ncomp,
int nghost = 0);
881 template <
class F=FAB>
883 void abs (
int comp,
int ncomp,
const IntVect& nghost);
885 template <
class F=FAB>
889 template <
class F=FAB>
893 template <
class F=FAB>
897 template <
class F=FAB>
901 template <
class F=FAB>
905 template <
class F=FAB>
910 template <
class F=FAB>
915 template <
class F=FAB>
924 template <
class F=FAB>
934 template <
class F=FAB>
944 template <std::
integral I>
957 template <
typename F=FAB>
959 typename F::value_type
960 sum (
int comp,
IntVect const& nghost,
bool local =
false)
const;
976 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1028 {
ParallelCopy(src,src_comp,dest_comp,num_comp,0,0,period,op); }
1030 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1037 {
ParallelCopy(src,src_comp,dest_comp,num_comp, period, op); }
1113 bool deterministic =
false);
1184 IntVect(dst_nghost),period,op); }
1212 bool to_ghost_cells_only =
false,
1213 bool deterministic =
false);
1245 bool to_ghost_cells_only =
false,
1246 bool deterministic =
false);
1308 void ParallelCopy (
const FabArray<FAB>& src,
int src_comp,
int dest_comp,
int num_comp,
1328 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1339 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1348 {
ParallelCopy(src,src_comp,dest_comp,num_comp,src_nghost,dst_nghost,period,op); }
1362 void copyTo (FAB& dest,
int nghost = 0)
const;
1371 void copyTo (FAB& dest,
int scomp,
int dcomp,
int ncomp,
int nghost = 0)
const;
1391 template <
typename BUF=value_type>
1395 template <
typename BUF=value_type>
1398 template <
typename BUF=value_type>
1403 template <
typename BUF=value_type>
1407 template <
typename BUF=value_type>
1411 template <
typename BUF=value_type>
1414 template <
typename BUF=value_type>
1417 template <
typename BUF=value_type>
1420 template <
typename BUF=value_type>
1423 template <
typename BUF=value_type>
1426 template <
typename BUF=value_type>
1429 template <
typename BUF=value_type>
1432 template <
typename BUF=value_type,
class F=FAB>
1535 bool deterministic =
false);
1538 bool deterministic =
false);
1540 bool deterministic =
false);
1542 bool deterministic =
false);
1556 bool deterministic =
false);
1559 bool deterministic =
false);
1574 bool deterministic =
false);
1577 bool deterministic =
false);
1603 template <
class F=FAB>
1611 template <
typename BUF=value_type,
class F=FAB>
1615 bool enforce_periodicity_only =
false,
1616 bool override_sync =
false,
1618 bool deterministic =
false);
1623 int scomp,
int dcomp,
int ncomp,
CpOp op);
1625 template <
class F=FAB>
1629 template <
class F=FAB>
1641 int scomp,
int dcomp,
int ncomp,
CpOp op,
bool deterministic);
1646#if defined(__CUDACC__)
1648 void FB_local_copy_cuda_graph_1 (
const FB& TheFB,
int scomp,
int ncomp);
1649 void FB_local_copy_cuda_graph_n (
const FB& TheFB,
int scomp,
int ncomp);
1657#if defined(__CUDACC__)
1659 void FB_pack_send_buffer_cuda_graph (
const FB& TheFB,
int scomp,
int ncomp,
1664 void FB_unpack_recv_buffer_cuda_graph (
const FB& TheFB,
int dcomp,
int ncomp,
1668 bool is_thread_safe);
1672 template <
typename BUF = value_type>
1679 template <
typename BUF = value_type>
1684 CpOp op,
bool is_thread_safe,
1685 std::uint64_t
id,
bool deterministic);
1687 template <
typename BUF>
1692 int ncomp, std::uint64_t
id);
1694 template <
typename BUF>
1699 int ncomp, std::uint64_t
id)
const;
1703 template <
typename BUF = value_type>
1709 template <
typename BUF = value_type>
1714 CpOp op,
bool is_thread_safe);
1730 template <
typename F=FAB>
1732 typename F::value_type
1734 [[maybe_unused]]
bool ignore_covered =
false)
const;
1748 template <
typename IFAB,
typename F=FAB>
1750 typename F::value_type
1752 bool local =
false)
const;
1786#if defined(BL_USE_MPI3)
1787 if (win != MPI_WIN_NULL) { MPI_Win_free(&win); }
1797#if defined(BL_USE_MPI3)
1802#if defined(BL_USE_MPI3)
1803 rhs.win = MPI_WIN_NULL;
1812#if defined(BL_USE_MPI3)
1814 rhs.win = MPI_WIN_NULL;
1824#if defined(BL_USE_MPI3)
1825 MPI_Win win = MPI_WIN_NULL;
1833 using Iterator =
typename std::vector<FAB*>::iterator;
1837 bool alloc_single_chunk);
1839 void setFab_assert (
int K, FAB
const& fab)
const;
1841 template <
class F=FAB>
1843 void build_arrays ()
const;
1845 void clear_fab_caches ();
1848 std::map<std::uint64_t,
1849 std::unique_ptr<TagVector<Array4CopyTag<value_type>>>>
1850 m_fb_local_copy_handler;
1852 using RecvSendCopyHandlerKey = std::tuple<std::uint64_t,std::size_t,int>;
1853 std::map<RecvSendCopyHandlerKey,
1854 std::unique_ptr<TagVector<CommRecvBufTag<value_type>>>>
1855 m_recv_copy_handler;
1856 mutable std::map<RecvSendCopyHandlerKey,
1857 std::unique_ptr<TagVector<CommSendBufTag<value_type>>>>
1858 m_send_copy_handler;
1866 template <
typename BUF=value_type>
1868 char*& the_recv_data,
1876 template <
typename BUF=value_type>
1886 template <
typename BUF=value_type>
1888 char*& the_send_data,
1896 template <
typename BUF=value_type>
1913 std::unique_ptr<FBData<FAB>>
fbd;
1914 std::unique_ptr<PCData<FAB>>
pcd;
1930 template <
class F=FAB>
1933 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1946 template <
class F=FAB>
1949 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1965 template <
class F=FAB>
1970 int dstcomp,
int numcomp,
const IntVect& nghost);
1985 template <
class F=FAB>
1989 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
2005 template <
class F=FAB>
2009 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
2024 template <
class F=FAB>
2028 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
2041 int li = localindex(K);
2042 if (li >= 0 && li < std::ssize(m_fabs_v) && m_fabs_v[li] != 0) {
2055 if (li < std::ssize(m_fabs_v) && m_fabs_v[li] !=
nullptr) {
2070 return m_fabs_v[li];
2080 return m_fabs_v[li];
2087 int li = localindex(K);
2089 return m_fabs_v[li];
2096 int li = localindex(K);
2098 return m_fabs_v[li];
2109 static_assert(
sizeof(A) ==
sizeof(AC),
"sizeof(Array4<T>) != sizeof(Array4<T const>)");
2110 if (!m_hp_arrays && local_size() > 0) {
2111 const int n = local_size();
2116 m_hp_arrays = std::malloc(n*2*
sizeof(A));
2118 for (
int li = 0; li < n; ++li) {
2120 new ((A*)m_hp_arrays+li) A(m_fabs_v[li]->array());
2121 new ((AC*)m_hp_arrays+li+n) AC(m_fabs_v[li]->const_array());
2123 new ((A*)m_hp_arrays+li) A{};
2124 new ((AC*)m_hp_arrays+li+n) AC{};
2127 m_arrays.
hp = (A*)m_hp_arrays;
2128 m_const_arrays.
hp = (AC*)m_hp_arrays + n;
2130 m_arrays.
dp = (A*)m_dp_arrays;
2131 m_const_arrays.
dp = (AC*)m_dp_arrays + n;
2153 m_dp_arrays =
nullptr;
2155 std::free(m_hp_arrays);
2157 m_hp_arrays =
nullptr;
2158 m_arrays.
hp =
nullptr;
2159 m_const_arrays.
hp =
nullptr;
2168 m_fb_local_copy_handler.clear();
2169 m_recv_copy_handler.clear();
2170 m_send_copy_handler.clear();
2179 const int li = localindex(K);
2180 if (li >= 0 && li < std::ssize(m_fabs_v) && m_fabs_v[li] !=
nullptr) {
2184 for (
auto const& t : m_tags) {
2185 updateMemUsage(t, -nbytes,
nullptr);
2189 return std::exchange(m_fabs_v[li],
nullptr);
2201 if (li >= 0 && li < std::ssize(m_fabs_v) && m_fabs_v[li] !=
nullptr) {
2205 for (
auto const& t : m_tags) {
2206 updateMemUsage(t, -nbytes,
nullptr);
2210 return std::exchange(m_fabs_v[li],
nullptr);
2220 if (define_function_called)
2222 define_function_called =
false;
2227 for (
auto *
x : m_fabs_v) {
2230 m_factory->destroy(
x);
2236 m_dallocator.
m_arena =
nullptr;
2240 for (
auto const& t : m_tags) {
2241 updateMemUsage(t, -nbytes,
nullptr);
2245 if (m_single_chunk_arena) {
2246 m_single_chunk_arena.reset();
2248 m_single_chunk_size = 0;
2253 m_fb_local_copy_handler.clear();
2254 m_recv_copy_handler.clear();
2255 m_send_copy_handler.clear();
2262template <BaseFabType SFAB, BaseFabType DFAB>
2263requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
2268 amrex::Copy(*
this, src, scomp, dcomp, ncomp, nghost);
2278 amrex::Add(*
this, src, scomp, dcomp, ncomp, nghost);
2296 setVal(val,0,n_comp,nghost);
2314 setVal(val,region,0,n_comp,nghost);
2321 m_FA_stats.recordBuild();
2329 m_FA_stats.recordBuild();
2349 : m_factory(factory.clone()),
2358 : m_factory(rhs.Factory().clone()),
2368 auto const& rhsfab = *(rhs.
m_fabs_v[i]);
2381 , m_factory (std::move(rhs.m_factory))
2382 , m_dallocator (rhs.m_dallocator)
2383 , m_single_chunk_arena(std::move(rhs.m_single_chunk_arena))
2384 , m_single_chunk_size(std::exchange(rhs.m_single_chunk_size,0))
2385 , define_function_called(rhs.define_function_called)
2386 , m_fabs_v (std::move(rhs.m_fabs_v))
2388 , m_dp_arrays (std::exchange(rhs.m_dp_arrays,
nullptr))
2390 , m_hp_arrays (std::exchange(rhs.m_hp_arrays,
nullptr))
2391 , m_arrays (rhs.m_arrays)
2392 , m_const_arrays(rhs.m_const_arrays)
2393 , m_tags (std::move(rhs.m_tags))
2394 , shmem (std::move(rhs.shmem))
2396 , m_fb_local_copy_handler(std::move(rhs.m_fb_local_copy_handler))
2397 , m_recv_copy_handler(std::move(rhs.m_recv_copy_handler))
2398 , m_send_copy_handler(std::move(rhs.m_send_copy_handler))
2402 m_FA_stats.recordBuild();
2403 rhs.define_function_called =
false;
2404 rhs.m_fabs_v.clear();
2417 m_factory = std::move(rhs.m_factory);
2418 m_dallocator = rhs.m_dallocator;
2419 m_single_chunk_arena = std::move(rhs.m_single_chunk_arena);
2420 std::swap(m_single_chunk_size, rhs.m_single_chunk_size);
2421 define_function_called = rhs.define_function_called;
2422 std::swap(m_fabs_v, rhs.m_fabs_v);
2424 std::swap(m_dp_arrays, rhs.m_dp_arrays);
2426 std::swap(m_hp_arrays, rhs.m_hp_arrays);
2427 m_arrays = rhs.m_arrays;
2428 m_const_arrays = rhs.m_const_arrays;
2429 std::swap(m_tags, rhs.m_tags);
2430 shmem = std::move(rhs.shmem);
2432 std::swap(m_fb_local_copy_handler, rhs.m_fb_local_copy_handler);
2433 std::swap(m_recv_copy_handler, rhs.m_recv_copy_handler);
2434 std::swap(m_send_copy_handler, rhs.m_send_copy_handler);
2437 rhs.define_function_called =
false;
2438 rhs.m_fabs_v.clear();
2448 m_FA_stats.recordDelete();
2456 if (!define_function_called) {
return false; }
2464 if (
get(fai).box() != fabbox(fai.index()))
2484 return define_function_called;
2496 define(bxs,dm,nvar,
IntVect(ngrow),info,a_factory);
2508 std::unique_ptr<FabFactory<FAB> > factory(a_factory.
clone());
2510 auto *default_arena = m_dallocator.
m_arena;
2513 m_factory = std::move(factory);
2516 define_function_called =
true;
2537 if (shmem.alloc) { alloc_single_chunk =
false; }
2538 if constexpr (!IsBaseFab_v<FAB>) { alloc_single_chunk =
false; }
2540 const int n = indexArray.
size();
2542 shmem.alloc = (nworkers > 1);
2544 bool alloc = !shmem.alloc;
2547 fab_info.SetAlloc(alloc).SetShared(shmem.alloc).SetArena(ar);
2549 if (alloc_single_chunk) {
2550 m_single_chunk_size = 0L;
2551 for (
int i = 0; i < n; ++i) {
2552 int K = indexArray[i];
2553 const Box& tmpbox = fabbox(K);
2554 m_single_chunk_size += factory.
nBytes(tmpbox, n_comp, K);
2557 m_single_chunk_arena = std::make_unique<detail::SingleChunkArena>(ar, m_single_chunk_size);
2558 fab_info.SetArena(m_single_chunk_arena.get());
2561 m_fabs_v.reserve(n);
2564 for (
int i = 0; i < n; ++i)
2566 int K = indexArray[i];
2567 const Box& tmpbox = fabbox(K);
2568 m_fabs_v.push_back(factory.
create(tmpbox, n_comp, fab_info, K));
2573 m_tags.emplace_back(
"All");
2574 for (
auto const& t : m_region_tag) {
2575 m_tags.push_back(t);
2577 for (
auto const& t : tags) {
2578 m_tags.push_back(t);
2580 for (
auto const& t: m_tags) {
2581 updateMemUsage(t, nbytes, ar);
2591 Vector<Long>
offset(n,0);
2592 Vector<Long> nextoffset(nworkers,-1);
2593 for (
int i = 0; i < n; ++i) {
2594 int K = indexArray[i];
2595 int owner = distributionMap[K] - teamlead;
2596 Long s = m_fabs_v[i]->size();
2598 shmem.n_values += s;
2599 shmem.n_points += m_fabs_v[i]->numPts();
2601 if (nextoffset[owner] < 0) {
2603 nextoffset[owner] = s;
2605 offset[i] = nextoffset[owner];
2606 nextoffset[owner] += s;
2610 size_t bytes = shmem.n_values*
sizeof(value_type);
2613 Vector<value_type*> dps;
2615#if defined (BL_USE_MPI3)
2617 static MPI_Info info = MPI_INFO_NULL;
2618 if (info == MPI_INFO_NULL) {
2619 MPI_Info_create(&info);
2620 MPI_Info_set(info,
"alloc_shared_noncontig",
"true");
2625 BL_MPI_REQUIRE( MPI_Win_allocate_shared(bytes,
sizeof(value_type),
2626 info, team_comm, &mfp, &shmem.win) );
2628 for (
int w = 0; w < nworkers; ++w) {
2631 value_type *dptr = 0;
2632 BL_MPI_REQUIRE( MPI_Win_shared_query(shmem.win, w, &sz, &disp, &dptr) );
2634 dps.push_back(dptr);
2639 amrex::Abort(
"BaseFab::define: to allocate shared memory, USE_MPI3 must be true");
2643 for (
int i = 0; i < n; ++i) {
2644 int K = indexArray[i];
2645 int owner = distributionMap[K] - teamlead;
2646 value_type *p = dps[owner] +
offset[i];
2647 m_fabs_v[i]->setPtr(p, m_fabs_v[i]->size());
2650 for (
Long i = 0; i < shmem.n_values; i++, mfp++) {
2651 new (mfp) value_type;
2661FabArray<FAB>::setFab_assert (
int K, FAB
const& fab)
const
2676 n_comp = elem->nComp();
2679 setFab_assert(boxno, *elem);
2681 if (m_fabs_v.empty()) {
2682 m_fabs_v.resize(indexArray.size(),
nullptr);
2685 const int li = localindex(boxno);
2687 m_factory->destroy(m_fabs_v[li]);
2689 m_fabs_v[li] = elem.release();
2695requires (std::is_move_constructible_v<F>)
2700 n_comp = elem.
nComp();
2703 setFab_assert(boxno, elem);
2705 if (m_fabs_v.empty()) {
2706 m_fabs_v.resize(indexArray.size(),
nullptr);
2709 const int li = localindex(boxno);
2711 m_factory->destroy(m_fabs_v[li]);
2713 m_fabs_v[li] =
new FAB(std::move(elem));
2722 n_comp = elem->nComp();
2725 setFab_assert(mfi.
index(), *elem);
2727 if (m_fabs_v.empty()) {
2728 m_fabs_v.resize(indexArray.size(),
nullptr);
2733 m_factory->destroy(m_fabs_v[li]);
2735 m_fabs_v[li] = elem.release();
2741requires (std::is_move_constructible_v<F>)
2746 n_comp = elem.
nComp();
2749 setFab_assert(mfi.
index(), elem);
2751 if (m_fabs_v.empty()) {
2752 m_fabs_v.resize(indexArray.size(),
nullptr);
2757 m_factory->destroy(m_fabs_v[li]);
2759 m_fabs_v[li] =
new FAB(std::move(elem));
2780 if (n_grow.max() > 0)
2784 bool use_mfparfor =
true;
2785 const int nboxes = local_size();
2787 if (boxarray[indexArray[0]].numPts() >
Long(65*65*65)) {
2788 use_mfparfor =
false;
2791 for (
int i = 0; i < nboxes; ++i) {
2792 const Long npts = boxarray[indexArray[i]].numPts();
2793 if (npts >=
Long(64*64*64)) {
2794 use_mfparfor =
false;
2796 }
else if (npts <=
Long(17*17*17)) {
2801 const IntVect nghost = n_grow;
2803 auto const& ma = this->arrays();
2807 auto const& a = ma[box_no];
2811 for (
int n = 0; n < ncomp; ++n) {
2812 a(i,j,k,strt_comp+n) = val;
2824 auto const& a = this->array(mfi);
2827#if (AMREX_SPACEDIM == 3)
2828 if (nghost[2] > 0) {
2832 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2834 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2837#if (AMREX_SPACEDIM >= 2)
2838 if (nghost[1] > 0) {
2841 b.
grow(0, nghost[0]);
2842 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2844 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2847 if (nghost[0] > 0) {
2850 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2852 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2859 tag.dfab(i,j,k,strt_comp+n) = val;
2870 get(fai).template setComplement<RunOn::Host>(val, fai.validbox(), strt_comp, ncomp);
2882 setDomainBndry(val, 0, n_comp, geom);
2897 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
2899 int n = domain_box.
length(idim);
2900 domain_box.
grow(idim, n);
2905#pragma omp parallel if (Gpu::notInLaunchRegion())
2909 const Box& gbx = fai.fabbox();
2912 get(fai).template setComplement<RunOn::Device>(val, domain_box, strt_comp, ncomp);
2918template <std::
integral I>
2925 mem[mfi] +=
static_cast<I
>((*this)[mfi].nBytesOwned());
2932typename F::value_type
2937 using T =
typename FAB::value_type;
2941 auto const& ma = this->const_arrays();
2946 return ma[box_no](i,j,k,comp);
2952#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
2957 auto const& a = this->const_array(mfi);
2961 tmp += a(i,j,k,comp);
2978 copyTo(dest, 0, 0, dest.nComp(), nghost);
2987 setVal(val,0,n_comp,n_grow);
3028 auto const& fa = this->arrays();
3032 fa[box_no](i,j,k,n+comp) = val;
3041#pragma omp parallel if (Gpu::notInLaunchRegion())
3045 const Box& bx = fai.growntilebox(nghost);
3046 auto fab = this->array(fai);
3049 fab(i,j,k,n+comp) = val;
3081 BL_PROFILE(
"FabArray::setVal(val,region,comp,ncomp,nghost)");
3085 auto const& fa = this->arrays();
3090 fa[box_no](i,j,k,n+comp) = val;
3101#pragma omp parallel if (Gpu::notInLaunchRegion())
3105 Box b = fai.growntilebox(nghost) & region;
3108 auto fab = this->array(fai);
3111 fab(i,j,k,n+comp) = val;
3139 auto const& fa = this->arrays();
3143 fa[box_no](i,j,k,n+comp) = std::abs(fa[box_no](i,j,k,n+comp));
3152#pragma omp parallel if (Gpu::notInLaunchRegion())
3157 auto fab = this->array(mfi);
3160 fab(i,j,k,n+comp) = std::abs(fab(i,j,k,n+comp));
3176 auto const& fa = this->arrays();
3180 fa[box_no](i,j,k,n+comp) += val;
3189#pragma omp parallel if (Gpu::notInLaunchRegion())
3194 auto fab = this->array(mfi);
3197 fab(i,j,k,n+comp) += val;
3209 BL_PROFILE(
"FabArray::plus(val, region, comp, num_comp, nghost)");
3213 auto const& fa = this->arrays();
3218 fa[box_no](i,j,k,n+comp) += val;
3228#pragma omp parallel if (Gpu::notInLaunchRegion())
3234 auto fab = this->array(mfi);
3237 fab(i,j,k,n+comp) += val;
3254 auto const& fa = this->arrays();
3258 fa[box_no](i,j,k,n+comp) *= val;
3267#pragma omp parallel if (Gpu::notInLaunchRegion())
3272 auto fab = this->array(mfi);
3275 fab(i,j,k,n+comp) *= val;
3287 BL_PROFILE(
"FabArray::mult(val, region, comp, num_comp, nghost)");
3291 auto const& fa = this->arrays();
3296 fa[box_no](i,j,k,n+comp) *= val;
3306#pragma omp parallel if (Gpu::notInLaunchRegion())
3312 auto fab = this->array(mfi);
3315 fab(i,j,k,n+comp) *= val;
3332 auto const& fa = this->arrays();
3336 fa[box_no](i,j,k,n+comp) = numerator / fa[box_no](i,j,k,n+comp);
3345#pragma omp parallel if (Gpu::notInLaunchRegion())
3350 auto fab = this->array(mfi);
3353 fab(i,j,k,n+comp) = numerator / fab(i,j,k,n+comp);
3365 BL_PROFILE(
"FabArray::invert(numerator, region, comp, num_comp, nghost)");
3369 auto const& fa = this->arrays();
3374 fa[box_no](i,j,k,n+comp) = numerator / fa[box_no](i,j,k,n+comp);
3384#pragma omp parallel if (Gpu::notInLaunchRegion())
3390 auto fab = this->array(mfi);
3393 fab(i,j,k,n+comp) = numerator / fab(i,j,k,n+comp);
3421 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3425 AMREX_ASSERT(
y.nGrowVect().allGE(nghost) &&
x.nGrowVect().allGE(nghost));
3431 auto const& yma =
y.arrays();
3432 auto const& xma =
x.const_arrays();
3436 yma[box_no](i,j,k,ycomp+n) += a * xma[box_no](i,j,k,xcomp+n);
3445#pragma omp parallel if (Gpu::notInLaunchRegion())
3452 auto const& xfab =
x.const_array(mfi);
3453 auto const& yfab =
y.array(mfi);
3456 yfab(i,j,k,ycomp+n) += a * xfab(i,j,k,xcomp+n);
3468 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3472 AMREX_ASSERT(
y.nGrowVect().allGE(nghost) &&
x.nGrowVect().allGE(nghost));
3478 auto const& yfa =
y.arrays();
3479 auto const& xfa =
x.const_arrays();
3483 yfa[box_no](i,j,k,n+ycomp) = xfa[box_no](i,j,k,n+xcomp)
3484 + a * yfa[box_no](i,j,k,n+ycomp);
3493#pragma omp parallel if (Gpu::notInLaunchRegion())
3498 auto const& xFab =
x.const_array(mfi);
3499 auto const& yFab =
y.array(mfi);
3502 yFab(i,j,k,n+ycomp) = xFab(i,j,k,n+xcomp)
3503 + a * yFab(i,j,k,n+ycomp);
3514 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3520 y.nGrowVect().allGE(nghost) &&
3528 auto const& yma =
y.arrays();
3534 yma[box_no](i,j,k,ycomp+n) = xma2[box_no](i,j,k,xcomp+n)
3535 + a2 * (yma [box_no](i,j,k,ycomp+n)
3536 + a1 * xma1[box_no](i,j,k,xcomp+n));
3545#pragma omp parallel if (Gpu::notInLaunchRegion())
3554 auto const& yfab =
y.array(mfi);
3557 yfab(i,j,k,ycomp+n) = xfab2(i,j,k,xcomp+n)
3558 + a2 * (yfab (i,j,k,ycomp+n)
3559 + a1 * xfab1(i,j,k,xcomp+n));
3571 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3588 auto const& y1ma = y1.
arrays();
3590 auto const& y2ma = y2.
arrays();
3595 y1ma[box_no](i,j,k,ycomp+n) += a1 * x1ma[box_no](i,j,k,xcomp+n);
3596 y2ma[box_no](i,j,k,ycomp+n) += a2 * x2ma[box_no](i,j,k,xcomp+n);
3605#pragma omp parallel if (Gpu::notInLaunchRegion())
3613 auto const& y1fab = y1.
array(mfi);
3615 auto const& y2fab = y2.
array(mfi);
3618 y1fab(i,j,k,ycomp+n) += a1 * x1fab(i,j,k,xcomp+n);
3619 y2fab(i,j,k,ycomp+n) += a2 * x2fab(i,j,k,xcomp+n);
3631 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3639 x.nGrowVect().allGE(nghost));
3645 auto const& y1ma = y1.
arrays();
3646 auto const& y2ma = y2.
arrays();
3647 auto const& xma =
x.const_arrays();
3651 y1ma[box_no](i,j,k,ycomp+n) += a1 * y2ma[box_no](i,j,k,ycomp+n);
3652 y2ma[box_no](i,j,k,ycomp+n) += a2 * xma[box_no](i,j,k,xcomp+n);
3661#pragma omp parallel if (Gpu::notInLaunchRegion())
3668 auto const& xfab =
x.const_array(mfi);
3669 auto const& y1fab = y1.
array(mfi);
3670 auto const& y2fab = y2.
array(mfi);
3673 y1fab(i,j,k,ycomp+n) += a1 * y2fab(i,j,k,ycomp+n);
3674 y2fab(i,j,k,ycomp+n) += a2 * xfab(i,j,k,xcomp+n);
3688 int dstcomp,
int numcomp,
const IntVect& nghost)
3700 auto const& dstma = dst.
arrays();
3701 auto const& xma =
x.const_arrays();
3702 auto const& yma =
y.const_arrays();
3706 dstma[box_no](i,j,k,dstcomp+n) = a*xma[box_no](i,j,k,xcomp+n)
3707 + b*yma[box_no](i,j,k,ycomp+n);
3716#pragma omp parallel if (Gpu::notInLaunchRegion())
3721 auto const& xfab =
x.const_array(mfi);
3722 auto const& yfab =
y.const_array(mfi);
3723 auto const& dfab = dst.
array(mfi);
3726 dfab(i,j,k,dstcomp+n) = a*xfab(i,j,k,xcomp+n) + b*yfab(i,j,k,ycomp+n);
3733template <
typename BUF>
3738 if ( n_grow.max() > 0 ) {
3740 FillBoundary_finish<BUF>();
3745template <
typename BUF>
3750 if ( n_grow.max() > 0 ) {
3751 FillBoundary_nowait<BUF>(0,
nComp(), n_grow, period, cross);
3752 FillBoundary_finish<BUF>();
3757template <
typename BUF>
3763 "FillBoundary: asked to fill more ghost cells than we have");
3764 if ( nghost.
max() > 0 ) {
3765 FillBoundary_nowait<BUF>(0,
nComp(), nghost, period, cross);
3766 FillBoundary_finish<BUF>();
3771template <
typename BUF>
3776 if ( n_grow.max() > 0 ) {
3778 FillBoundary_finish<BUF>();
3783template <
typename BUF>
3788 if ( n_grow.max() > 0 ) {
3789 FillBoundary_nowait<BUF>(scomp, ncomp, n_grow, period, cross);
3790 FillBoundary_finish<BUF>();
3795template <
typename BUF>
3802 "FillBoundary: asked to fill more ghost cells than we have");
3803 if ( nghost.
max() > 0 ) {
3804 FillBoundary_nowait<BUF>(scomp, ncomp, nghost, period, cross);
3805 FillBoundary_finish<BUF>();
3810template <
typename BUF>
3818template <
typename BUF>
3822 FillBoundary_nowait<BUF>(0,
nComp(),
nGrowVect(), period, cross);
3826template <
typename BUF>
3830 FillBoundary_nowait<BUF>(0,
nComp(), nghost, period, cross);
3834template <
typename BUF>
3845 BL_PROFILE(
"FabArray::FillBoundaryAndSync()");
3846 if (n_grow.max() > 0 || !is_cell_centered()) {
3857 BL_PROFILE(
"FabArray::FillBoundaryAndSync()");
3858 if (nghost.
max() > 0 || !is_cell_centered()) {
3877 FBEP_nowait(scomp, ncomp, nghost, period,
false,
false,
true);
3893 if (!is_cell_centered()) {
3904 if (!is_cell_centered()) {
3922 FBEP_nowait(scomp, ncomp,
IntVect(0), period,
false,
false,
true);
3937 SumBoundary(0, n_comp,
IntVect(0), period, deterministic);
3944 SumBoundary(scomp, ncomp,
IntVect(0), period, deterministic);
3951 SumBoundary(scomp, ncomp, this->
nGrowVect(), nghost, period, deterministic);
3960 SumBoundary_nowait(scomp, ncomp, src_nghost, dst_nghost, period, deterministic);
3961 SumBoundary_finish();
3968 SumBoundary_nowait(0, n_comp,
IntVect(0), period, deterministic);
3975 SumBoundary_nowait(scomp, ncomp,
IntVect(0), period, deterministic);
3982 SumBoundary_nowait(scomp, ncomp, this->
nGrowVect(), nghost, period, deterministic);
3989 BL_PROFILE(
"FabArray<FAB>::SumBoundary_nowait()");
3995 FBEP_nowait(scomp, ncomp, dst_nghost, period,
false,
false,
false, src_nghost, deterministic);
4002 BL_PROFILE(
"FabArray<FAB>::SumBoundary_finish()");
4023 FBEP_nowait(scomp, ncomp,
nGrowVect(), period,
false,
true);
4035 FBEP_nowait(scomp, ncomp, nghost, period,
false,
true);
4041template <
typename BUF>
4045 FBEP_nowait<BUF>(scomp, ncomp,
nGrowVect(), period, cross);
4049template <
typename BUF>
4054 FBEP_nowait<BUF>(scomp, ncomp, nghost, period, cross);
4067 int ncomp = this->
nComp();
4071 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
4073 domain.
grow(i, ngrow[i]);
4079 auto const& fa = this->arrays();
4083 auto const& fab = fa[box_no];
4088 }
else if (domain.
contains(i,j,k)) {
4089 fab(i,j,k,n) = notcovered;
4091 fab(i,j,k,n) = physbnd;
4101#pragma omp parallel if (Gpu::notInLaunchRegion())
4105 auto const& fab = this->array(mfi);
4107 Box const& gbx = fbx & domain;
4112 fab(i,j,k,n) = interior;
4114 fab(i,j,k,n) = notcovered;
4116 fab(i,j,k,n) = physbnd;
4132 BL_PROFILE(
"FabArray::setVal(val, thecmd, scomp, ncomp)");
4137 CMD_local_setVal_gpu(val, thecmd, scomp, ncomp);
4138 CMD_remote_setVal_gpu(val, thecmd, scomp, ncomp);
4146 auto N_locs =
static_cast<int>(LocTags.size());
4148#pragma omp parallel for if (thecmd.m_threadsafe_loc)
4150 for (
int i = 0; i < N_locs; ++i) {
4152 (*this)[tag.
dstIndex].template setVal<RunOn::Host>(val, tag.
dbox, scomp, ncomp);
4155 for (
const auto & RcvTag : RcvTags) {
4156 auto N =
static_cast<int>(RcvTag.second.size());
4158#pragma omp parallel for if (thecmd.m_threadsafe_rcv)
4160 for (
int i = 0; i < N; ++i) {
4162 (*this)[tag.
dstIndex].template setVal<RunOn::Host>(val, tag.
dbox, scomp, ncomp);
4178#pragma omp parallel if (thecmd.m_threadsafe_rcv)
4187 auto N_locs =
static_cast<int>(LocTags.size());
4188 for (
int i = 0; i < N_locs; ++i) {
4193 for (
const auto & RcvTag : RcvTags) {
4194 auto N =
static_cast<int>(RcvTag.second.size());
4195 for (
int i = 0; i < N; ++i) {
4204template <
typename F>
4206typename F::value_type
4208 [[maybe_unused]]
bool ignore_covered)
const
4212 using RT =
typename F::value_type;
4217 if ( this->is_cell_centered() && this->hasEBFabFactory() && ignore_covered )
4223 auto const& flagsma = flags.const_arrays();
4224 auto const& ma = this->const_arrays();
4228 if (flagsma[box_no](i,j,k).isCovered()) {
4232 auto const& a = ma[box_no];
4233 for (
int n = 0; n < ncomp; ++n) {
4234 tmp =
amrex::max(tmp, std::abs(a(i,j,k,comp+n)));
4243#pragma omp parallel reduction(max:nm0)
4248 auto const& flag = flags.const_array(mfi);
4249 auto const& a = this->const_array(mfi);
4252 if (!flag(i,j,k).isCovered()) {
4253 nm0 = std::max(nm0, std::abs(a(i,j,k,comp+n)));
4265 auto const& ma = this->const_arrays();
4269 return std::abs(ma[box_no](i,j,k,comp+n));
4275#pragma omp parallel reduction(max:nm0)
4279 auto const& a = this->const_array(mfi);
4282 nm0 = std::max(nm0, std::abs(a(i,j,k,comp+n)));
4296template <
typename IFAB,
typename F>
4298typename F::value_type
4300 IntVect const& nghost,
bool local)
const
4304 using RT =
typename F::value_type;
4310 auto const& ma = this->const_arrays();
4311 auto const& maskma =
mask.const_arrays();
4315 if (maskma[box_no](i,j,k)) {
4317 auto const& a = ma[box_no];
4318 for (
int n = 0; n < ncomp; ++n) {
4319 tmp =
amrex::max(tmp, std::abs(a(i,j,k,comp+n)));
4330#pragma omp parallel reduction(max:nm0)
4334 auto const& a = this->const_array(mfi);
4335 auto const& mskfab =
mask.const_array(mfi);
4338 if (mskfab(i,j,k)) {
4339 nm0 = std::max(nm0, std::abs(a(i,j,k,comp+n)));
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:562
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:124
#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.
Array4< int const > offset
Definition AMReX_HypreMLABecLap.cpp:1131
Array4< int const > mask
Definition AMReX_InterpFaceRegister.cpp:93
#define AMREX_LOOP_3D(bx, i, j, k, block)
Definition AMReX_Loop.nolint.H:4
#define AMREX_LOOP_4D(bx, ncomp, i, j, k, n, block)
Definition AMReX_Loop.nolint.H:16
Abstract base class for memory arenas.
Definition AMReX_Arena.H:153
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:222
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:51
Definition AMReX_EBFabFactory.H:32
const FabArray< EBCellFlagFab > & getMultiEBCellFlagFab() const noexcept
EB cell flags for all boxes.
Definition AMReX_EBFabFactory.H:88
bool isAllRegular() const noexcept
Definition AMReX_EBFabFactory.cpp:232
Base class for FabArray.
Definition AMReX_FabArrayBase.H:47
IntVect nGrowVect() const noexcept
Definition AMReX_FabArrayBase.H:85
void clear()
Clear this object's BoxArray, DistributionMapping, local index/ownership data, and BDKey so the conta...
Definition AMReX_FabArrayBase.cpp:207
Vector< int > indexArray
Definition AMReX_FabArrayBase.H:516
static FabArrayStats m_FA_stats
Definition AMReX_FabArrayBase.H:841
static bool getAllocSingleChunk()
Query whether single-chunk allocation is enabled for new FabArrays.
Definition AMReX_FabArrayBase.H:846
bool isFusingCandidate() const noexcept
Is this a good candidate for kernel fusing?
Definition AMReX_FabArrayBase.cpp:2713
int size() const noexcept
Return the number of FABs in the FabArray.
Definition AMReX_FabArrayBase.H:115
FabArrayBase & operator=(const FabArrayBase &rhs)=default
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, int ngrow)
Definition AMReX_FabArrayBase.cpp:175
CopyComTag::CopyComTagsContainer CopyComTagsContainer
Definition AMReX_FabArrayBase.H:236
CopyComTag::MapOfCopyComTagContainers MapOfCopyComTagContainers
Definition AMReX_FabArrayBase.H:237
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
CpOp
parallel copy or add
Definition AMReX_FabArrayBase.H:411
@ ADD
Definition AMReX_FabArrayBase.H:411
@ COPY
Definition AMReX_FabArrayBase.H:411
DistributionMapping distributionMap
Definition AMReX_FabArrayBase.H:515
friend void FillBoundary(Vector< FabArray< FAB > * > const &mf, const Periodicity &period)
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:356
void ParallelCopyToGhost_finish()
Finish the current ParallelCopyToGhost_nowait() operation.
Definition AMReX_FabArrayCommI.H:399
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:2673
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:1329
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:3973
void mult(value_type val, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:3248
void setBndry(value_type val)
Set all values in the boundary region to val.
Definition AMReX_FabArray.H:2767
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:1340
void FillBoundary_finish()
Definition AMReX_FabArrayCommI.H:237
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)
Definition AMReX_FBI.H:1424
void * m_dp_arrays
Definition AMReX_FabArray.H:1772
void ParallelCopy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:971
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:2719
typename std::conditional_t< IsBaseFab< FAB >::value, FAB, FABType >::value_type value_type
Definition AMReX_FabArray.H:367
std::unique_ptr< FabArray< FAB > > os_temp
Definition AMReX_FabArray.H:1917
static void Saxpy_Xpay(FabArray< FAB > &y, value_type a1, FabArray< FAB > const &x1, value_type a2, FabArray< FAB > const &x2, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
y = x2+a2*(y+a1*x1)
Definition AMReX_FabArray.H:3512
void FillBoundary(const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3759
const FabFactory< FAB > & Factory() const noexcept
Factory used to create FAB instances for this FabArray.
Definition AMReX_FabArray.H:471
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)
Definition AMReX_FabArrayCommI.H:17
void CMD_remote_setVal_gpu(value_type x, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FBI.H:696
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:1000
LayoutData< int > RecvLayoutMask(const CommMetaData &thecmd)
Definition AMReX_FabArray.H:4172
void FillBoundary_nowait(const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3820
static void LinComb(FabArray< FAB > &dst, value_type a, const FabArray< FAB > &x, int xcomp, value_type b, const FabArray< FAB > &y, int ycomp, int dstcomp, int numcomp, const IntVect &nghost)
dst = a*x + b*y
Definition AMReX_FabArray.H:3685
void shift(const IntVect &v)
Shift the boxarray by vector v.
Definition AMReX_FabArray.H:3402
FAB * release(int K)
Release ownership of the FAB. This function is not thread safe.
Definition AMReX_FabArray.H:2177
bool ok() const
Return true if the FabArray is well-defined. That is, the FabArray has a BoxArray and DistributionMap...
Definition AMReX_FabArray.H:2454
const FAB & operator[](const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:555
void ParallelAdd_nowait(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic())
Start an asynchronous ParallelAdd over all components.
Definition AMReX_FabArray.H:990
FabArray(FabArray< FAB > &&rhs) noexcept
Definition AMReX_FabArray.H:2379
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:2343
bool defined(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:2052
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:592
void OverrideSync_nowait(int scomp, int ncomp, const Periodicity &period)
Definition AMReX_FabArray.H:3919
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:368
MultiArray4< typename FabArray< FAB >::value_type > arrays() noexcept
Build, if needed, and return mutable Array4 views for local FABs.
Definition AMReX_FabArray.H:713
void ParallelCopy_finish()
Finish the current nowait ParallelCopy or ParallelAdd operation.
Definition AMReX_FabArrayCommI.H:690
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)
Definition AMReX_FBI.H:1385
FAB & get(int K) noexcept
Return a reference to the FAB associated with the Kth element.
Definition AMReX_FabArray.H:576
FAB const * fabPtr(int K) const noexcept
Definition AMReX_FabArray.H:2094
Array4< typename FabArray< FAB >::value_type > array(const MFIter &mfi, int start_comp) noexcept
Definition AMReX_FabArray.H:672
void SumBoundary_nowait(const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:3966
static void Saxpy_Saxpy(FabArray< FAB > &y1, value_type a1, FabArray< FAB > const &x1, FabArray< FAB > &y2, value_type a2, FabArray< FAB > const &x2, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
y1 += a1*x1; y2 += a2*x2;
Definition AMReX_FabArray.H:3569
void clear_arrays()
Free the cached Array4s so that they are rebuilt by the next arrays() call.
Definition AMReX_FabArray.H:2142
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:1095
Long m_single_chunk_size
Definition AMReX_FabArray.H:1759
FAB & get(const MFIter &mfi) noexcept
Returns a reference to the FAB associated mfi.
Definition AMReX_FabArray.H:564
void OverrideSync_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Split-phase version of OverrideSync.
Definition AMReX_FabArray.H:3912
std::unique_ptr< PCData< FAB > > pcd
Definition AMReX_FabArray.H:1914
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:2489
void setDomainBndry(value_type val, const Geometry &geom)
Set all values outside the Geometry domain described by geom to val.
Definition AMReX_FabArray.H:2880
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:1151
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< FAB > > fbd
Definition AMReX_FabArray.H:1913
std::unique_ptr< detail::SingleChunkArena > m_single_chunk_arena
Definition AMReX_FabArray.H:1758
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:3987
FabArray(const FabArray< FAB > &rhs, MakeType maketype, int scomp, int ncomp)
Construct a component alias of rhs.
Definition AMReX_FabArray.H:2357
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:968
FAB fab_type
Definition AMReX_FabArray.H:369
void FB_local_add_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:455
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:635
bool SharedMemory() const noexcept
Definition AMReX_FabArray.H:1830
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:656
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:608
void FillBoundary_nowait(const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3828
Vector< std::string > m_tags
Definition AMReX_FabArray.H:1778
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:385
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:1050
void FB_local_add_gpu(const FB &TheFB, int scomp, int ncomp, bool deterministic)
Definition AMReX_FBI.H:618
void FB_local_copy_gpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:546
void LocalCopy(FabArray< SFAB > const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
Perform local copy of FabArray data.
Definition AMReX_FabArray.H:2265
Arena * arena() const noexcept
Arena configured for allocations by this FabArray.
Definition AMReX_FabArray.H:480
DataAllocator m_dallocator
Definition AMReX_FabArray.H:1757
void copy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:977
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)
Definition AMReX_FBI.H:1223
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:628
void FillBoundaryAndSync_finish()
Definition AMReX_FabArray.H:3882
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:1175
void FillBoundary_nowait(bool cross=false)
Definition AMReX_FabArray.H:3812
void clear()
Releases FAB memory in the FabArray.
Definition AMReX_FabArray.H:2218
void FillBoundary_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:4051
const Vector< std::string > & tags() const noexcept
Memory-usage tags recorded for this FabArray's allocations.
Definition AMReX_FabArray.H:488
void CMD_local_setVal_gpu(value_type x, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FBI.H:666
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:723
void FillBoundary_nowait(int scomp, int ncomp, bool cross=false)
Definition AMReX_FabArray.H:3836
value_type * singleChunkPtr() noexcept
Definition AMReX_FabArray.H:504
std::vector< FAB * > m_fabs_v
The data.
Definition AMReX_FabArray.H:1769
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:1087
bool define_function_called
has define() been called?
Definition AMReX_FabArray.H:1765
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:1016
FabArray() noexcept
Constructs an empty FabArray<FAB>.
Definition AMReX_FabArray.H:2318
void FillBoundary_test()
Definition AMReX_FabArrayCommI.H:1027
void plus(value_type val, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:3170
bool defined(int K) const noexcept
Definition AMReX_FabArray.H:2039
FAB * fabPtr(int K) noexcept
Definition AMReX_FabArray.H:2085
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:1078
const FAB & atLocalIdx(int L) const noexcept
Definition AMReX_FabArray.H:580
MultiArray4< typename FabArray< FAB >::value_type const > const_arrays() const noexcept
Read-only convenience wrapper equivalent to arrays() const.
Definition AMReX_FabArray.H:731
std::unique_ptr< FabFactory< FAB > > m_factory
Definition AMReX_FabArray.H:1756
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:1031
void invert(value_type numerator, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:3326
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:2976
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:1128
void setVal(value_type val)
Set all components in the entire region of each FAB to val.
Definition AMReX_FabArray.H:2985
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:621
void FillBoundary_nowait(int scomp, int ncomp, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:4043
const FAB & get(const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:558
void SumBoundary_finish()
Definition AMReX_FabArray.H:4000
std::size_t singleChunkSize() const noexcept
Definition AMReX_FabArray.H:516
void SumBoundary_nowait(int scomp, int ncomp, IntVect const &nghost, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:3980
void FB_local_copy_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:396
static void Saxpy(FabArray< FAB > &y, value_type a, FabArray< FAB > const &x, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
y += a*x
Definition AMReX_FabArray.H:3420
MultiArray4< value_type > m_arrays
Definition AMReX_FabArray.H:1775
void FillBoundaryAndSync_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3866
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:90
void FillBoundaryAndSync_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Definition AMReX_FabArray.H:3873
void BuildMask(const Box &phys_domain, const Periodicity &period, value_type covered, value_type notcovered, value_type physbnd, value_type interior)
Definition AMReX_FabArray.H:4061
void * m_hp_arrays
Definition AMReX_FabArray.H:1774
static void Saypy_Saxpy(FabArray< FAB > &y1, value_type a1, FabArray< FAB > &y2, value_type a2, FabArray< FAB > const &x, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
y1 += a1*y2; y2 += a2*x;
Definition AMReX_FabArray.H:3629
ShMem shmem
Definition AMReX_FabArray.H:1828
FabArray< FAB > & operator=(FabArray< FAB > &&rhs) noexcept
Definition AMReX_FabArray.H:2410
Array4< typename FabArray< FAB >::value_type > array(int K, int start_comp) noexcept
Definition AMReX_FabArray.H:688
MultiArray4< value_type const > m_const_arrays
Definition AMReX_FabArray.H:1776
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:1022
bool hasEBFabFactory() const noexcept
Return whether this FabArray uses an EBFArrayBoxFactory.
Definition AMReX_FabArray.H:493
TagVector< Array4CopyTag< value_type > > const * FB_get_local_copy_tag_vector(const FB &TheFB)
Definition AMReX_FBI.H:503
Array4< typename FabArray< FAB >::value_type const > array(int K, int start_comp) const noexcept
Definition AMReX_FabArray.H:680
bool isAllRegular() const noexcept
Return the EB factory's all-regular status, or true for other factories.
Definition AMReX_FabArray.H:521
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:642
FAB * fabPtr(const MFIter &mfi) noexcept
Return pointer to FAB.
Definition AMReX_FabArray.H:2065
void OverrideSync_finish()
Definition AMReX_FabArray.H:3927
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)
Definition AMReX_FBI.H:1125
FAB * release(const MFIter &mfi)
Release ownership of the FAB. This function is not thread safe.
Definition AMReX_FabArray.H:2198
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi, int start_comp) const noexcept
Definition AMReX_FabArray.H:696
static void Xpay(FabArray< FAB > &y, value_type a, FabArray< FAB > const &x, int xcomp, int ycomp, int ncomp, IntVect const &nghost)
y = x + a*y
Definition AMReX_FabArray.H:3467
void capacityOfFabs(LayoutData< I > &mem) const
Accumulate the per-FAB allocation sizes.
Definition AMReX_FabArray.H:2921
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:579
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:2501
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:1003
void LocalAdd(FabArray< FAB > const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
Perform local addition of FabArray data.
Definition AMReX_FabArray.H:2275
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:649
const FAB & get(int K) const noexcept
Return a constant reference to the FAB associated with the Kth element.
Definition AMReX_FabArray.H:570
FAB const * fabPtr(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:2075
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:1069
bool isDefined() const
Definition AMReX_FabArray.H:2482
value_type const * singleChunkPtr() const noexcept
Definition AMReX_FabArray.H:510
~FabArray()
The destructor – deletes all FABs in the array.
Definition AMReX_FabArray.H:2446
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi, int start_comp) const noexcept
Definition AMReX_FabArray.H:664
Array4< typename FabArray< FAB >::value_type const > const_array(int K, int start_comp) const noexcept
Definition AMReX_FabArray.H:704
F::value_type sum(int comp, IntVect const &nghost, bool local=false) const
Returns the sum of component "comp".
Definition AMReX_FabArray.H:2933
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:85
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:244
bool isPeriodic(int dir) const noexcept
Is the domain periodic in the specified direction?
Definition AMReX_Geometry.H:397
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:542
__host__ static __device__ constexpr IntVectND< dim > TheZeroVector() noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:771
__host__ __device__ constexpr int max() const noexcept
maximum (no absolute values) value
Definition AMReX_IntVect.H:313
__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:492
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
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
Long size() const noexcept
Definition AMReX_Vector.H:54
Checks if a type is derived from amrex::BaseFab.
Definition AMReX_Concepts.H:13
amrex_long Long
Definition AMReX_INT.H:30
@ covered
Every cell in the region is covered.
void EnforcePeriodicity(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Definition AMReX_FabArray.H:4030
void SumBoundary(int scomp, int ncomp, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:3942
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:3949
void OverrideSync(const Periodicity &period=Periodicity::NonPeriodic())
Synchronize nodal data.
Definition AMReX_FabArray.H:3890
void FillBoundary(bool cross=false)
Copy on intersection within a FabArray.
Definition AMReX_FabArray.H:3735
void OverrideSync(int scomp, int ncomp, const Periodicity &period)
Synchronize nodal data.
Definition AMReX_FabArray.H:3901
void FillBoundary(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3797
void FillBoundaryAndSync(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Fill ghost cells and synchronize nodal data.
Definition AMReX_FabArray.H:3854
void FillBoundary(const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3747
void FillBoundary(int scomp, int ncomp, bool cross=false)
Definition AMReX_FabArray.H:3773
void FillBoundaryAndSync(const Periodicity &period=Periodicity::NonPeriodic())
Fill ghost cells and synchronize nodal data.
Definition AMReX_FabArray.H:3843
void SumBoundary(const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Sum values in overlapped cells.
Definition AMReX_FabArray.H:3935
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:3956
F::value_type norminf(int comp, int ncomp, IntVect const &nghost, bool local=false, bool ignore_covered=false) const
Return infinity norm.
Definition AMReX_FabArray.H:4207
void EnforcePeriodicity(const Periodicity &period)
Fill ghost cells with values from their corresponding cells across periodic boundaries,...
Definition AMReX_FabArray.H:4008
void FillBoundary(int scomp, int ncomp, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3785
void EnforcePeriodicity(int scomp, int ncomp, const Periodicity &period)
Definition AMReX_FabArray.H:4019
__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:1630
Arena * The_Comms_Arena()
Definition AMReX_Arena.cpp:875
Arena * The_Pinned_Arena()
Definition AMReX_Arena.cpp:855
Arena * The_Arena()
Definition AMReX_Arena.cpp:815
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
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:53
void freeAsync(Arena *arena, void *mem) noexcept
Definition AMReX_GpuDevice.H:345
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:310
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:88
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:421
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:259
void FillBoundary_finish(Vector< MF * > const &mf)
Wait for outstanding FillBoundary_nowait operations launched with the vector helper to complete.
Definition AMReX_FabArrayCommI.H:1134
void Copy(FabArray< DFAB > &dst, FabArray< SFAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:192
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:1660
void Add(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:251
std::unique_ptr< char, TheFaArenaDeleter > TheFaArenaPointer
Definition AMReX_FabArray.H:118
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
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:2870
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.DistributionMap().
Definition AMReX_FabArrayBase.cpp:2875
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:1157
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
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:2860
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
__host__ __device__ T abs(const GpuComplex< T > &a_z) noexcept
Return the absolute value of a complex number.
Definition AMReX_GpuComplex.H:361
void OverrideSync_finish(FabArray< FAB > &fa)
Finish the current masked OverrideSync_nowait() operation.
Definition AMReX_FabArrayUtility.H:1710
IntVect nGrowVect(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.nGrowVect().
Definition AMReX_FabArrayBase.cpp:2865
bool TilingIfNotGPU() noexcept
Definition AMReX_MFIter.H:12
void setBndry(MF &dst, typename MF::value_type val, int scomp, int ncomp)
dst = val in ghost cells.
Definition AMReX_FabArrayUtility.H:2168
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:242
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:1199
void setVal(MF &dst, typename MF::value_type val)
dst = val
Definition AMReX_FabArrayUtility.H:2161
__host__ __device__ constexpr int get(IntVectND< dim > const &iv) noexcept
Get I'th element of IntVectND<dim>
Definition AMReX_IntVect.H:1338
Definition AMReX_TagParallelFor.H:58
A multidimensional array accessor.
Definition AMReX_Array4.H:289
Lightweight allocator/deallocator backed by an Arena.
Definition AMReX_DataAllocator.H:21
Arena * arena() const noexcept
Return the stored arena, or The_Arena() if none was set.
Definition AMReX_DataAllocator.H:41
Arena * m_arena
Stored arena pointer (may be null).
Definition AMReX_DataAllocator.H:22
Definition AMReX_FabArray.H:122
const FabArrayBase::FB * fb
Definition AMReX_FabArray.H:124
bool deterministic
Definition AMReX_FabArray.H:141
char * the_recv_data
Definition AMReX_FabArray.H:129
Vector< MPI_Request > recv_reqs
Definition AMReX_FabArray.H:134
Vector< char * > recv_data
Definition AMReX_FabArray.H:132
Vector< MPI_Status > recv_stat
Definition AMReX_FabArray.H:135
int scomp
Definition AMReX_FabArray.H:125
Vector< int > recv_from
Definition AMReX_FabArray.H:131
char * the_send_data
Definition AMReX_FabArray.H:130
Vector< MPI_Request > send_reqs
Definition AMReX_FabArray.H:138
Vector< char * > send_data
Definition AMReX_FabArray.H:137
Vector< std::size_t > recv_size
Definition AMReX_FabArray.H:133
int ncomp
Definition AMReX_FabArray.H:126
int tag
Definition AMReX_FabArray.H:139
parallel copy or add
Definition AMReX_FabArrayBase.H:630
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:567
void recordBuild() noexcept
Definition AMReX_FabArrayBase.H:819
Definition AMReX_FabArray.H:359
FAB value_type
Definition AMReX_FabArray.H:360
for shared memory
Definition AMReX_FabArray.H:1781
ShMem(ShMem &&rhs) noexcept
Definition AMReX_FabArray.H:1795
Long n_values
Definition AMReX_FabArray.H:1822
Long n_points
Definition AMReX_FabArray.H:1823
bool alloc
Definition AMReX_FabArray.H:1821
ShMem & operator=(ShMem &&rhs) noexcept
Definition AMReX_FabArray.H:1806
ShMem(const ShMem &)=delete
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:168
Array4< T > const *__restrict__ hp
Definition AMReX_FabArray.H:184
__host__ __device__ Array4< T > const & operator[](int li) const noexcept
Definition AMReX_FabArray.H:170
Array4< T > const *__restrict__ dp
Definition AMReX_FabArray.H:182
Definition AMReX_FabArray.H:146
int actual_n_rcvs
Definition AMReX_FabArray.H:152
Vector< std::size_t > recv_size
Definition AMReX_FabArray.H:159
int DC
Definition AMReX_FabArray.H:153
Vector< MPI_Request > send_reqs
Definition AMReX_FabArray.H:161
int tag
Definition AMReX_FabArray.H:151
const FabArray< FAB > * src
Definition AMReX_FabArray.H:149
char * the_recv_data
Definition AMReX_FabArray.H:155
FabArrayBase::CpOp op
Definition AMReX_FabArray.H:150
Vector< MPI_Request > recv_reqs
Definition AMReX_FabArray.H:160
char * the_send_data
Definition AMReX_FabArray.H:156
const FabArrayBase::CPC * cpc
Definition AMReX_FabArray.H:148
Vector< int > recv_from
Definition AMReX_FabArray.H:157
bool deterministic
Definition AMReX_FabArray.H:162
int NC
Definition AMReX_FabArray.H:153
int SC
Definition AMReX_FabArray.H:153
Vector< char * > recv_data
Definition AMReX_FabArray.H:158
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