4#include <AMReX_Config.H>
59requires (!BaseFabType<T>)
93 template <
typename T,
typename... Ts>
95 tags.emplace_back(std::forward<T>(t));
96 return SetTag(std::forward<Ts>(ts)...);
164 explicit operator bool() const noexcept {
177template <BaseFabType DFAB, BaseFabType SFAB>
178requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
182 Copy(dst,src,srccomp,dstcomp,numcomp,
IntVect(nghost));
185template <BaseFabType DFAB, BaseFabType SFAB>
186requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
192 using DT =
typename DFAB::value_type;
197 if constexpr (std::is_same_v<typename SFAB::value_type, typename DFAB::value_type>) {
206 auto const& dstarr = dst.
arrays();
210 dstarr[box_no](i,j,k,dstcomp+n) = DT(srcarr[box_no](i,j,k,srccomp+n));
219#pragma omp parallel if (Gpu::notInLaunchRegion())
223 const Box& bx = mfi.growntilebox(nghost);
227 auto const& dstFab = dst.
array(mfi);
230 dstFab(i,j,k,dstcomp+n) = DT(srcFab(i,j,k,srccomp+n));
237template <BaseFabType FAB>
241 Add(dst,src,srccomp,dstcomp,numcomp,
IntVect(nghost));
244template <BaseFabType FAB>
252 auto const& dstfa = dst.
arrays();
257 dstfa[box_no](i,j,k,n+dstcomp) += srcfa[box_no](i,j,k,n+srccomp);
266#pragma omp parallel if (Gpu::notInLaunchRegion())
270 const Box& bx = mfi.growntilebox(nghost);
273 auto const srcFab = src.
array(mfi);
274 auto dstFab = dst.
array(mfi);
277 dstFab(i,j,k,n+dstcomp) += srcFab(i,j,k,n+srccomp);
381#ifdef AMREX_STRICT_MODE
393#ifdef AMREX_STRICT_MODE
422#ifdef AMREX_STRICT_MODE
434#ifdef AMREX_STRICT_MODE
452 return (f !=
nullptr);
523 const FAB&
get (
int K)
const noexcept {
return *(this->
fabPtr(K)); }
529 FAB&
get (
int K)
noexcept {
return *(this->
fabPtr(K)); }
539 FAB
const*
fabPtr (
int K)
const noexcept;
545 this->
fabPtr(mfi)->prefetchToHost();
555 this->
fabPtr(mfi)->prefetchToDevice();
564 return fabPtr(mfi)->const_array();
570 return fabPtr(mfi)->array();
576 return fabPtr(K)->const_array();
582 return fabPtr(K)->array();
588 return fabPtr(mfi)->const_array();
594 return fabPtr(K)->const_array();
600 return fabPtr(mfi)->const_array(start_comp);
606 return fabPtr(mfi)->array(start_comp);
612 return fabPtr(K)->const_array(start_comp);
618 return fabPtr(K)->array(start_comp);
624 return fabPtr(mfi)->const_array(start_comp);
630 return fabPtr(K)->const_array(start_comp);
655 void setFab (
int boxno, std::unique_ptr<FAB> elem);
658 template <
class F=FAB>
659 requires (std::is_move_constructible_v<F>)
666 template <
class F=FAB>
667 requires (std::is_move_constructible_v<F>)
695 template <BaseFabType SFAB, BaseFabType DFAB = FAB>
696 requires (std::is_convertible_v<
typename SFAB::value_type,
697 typename DFAB::value_type>)
713 template <
class F=FAB>
719 template <
class F=FAB>
724 template <
class F=FAB>
733 template <
class F=FAB>
740 template <
class F=FAB>
753 template <
class F=FAB>
761 template <
class F=FAB>
772 template <
class F=FAB>
776 template <
class F=FAB>
785 template <
class F=FAB>
789 template <
class F=FAB>
793 template <
class F=FAB>
795 void abs (
int comp,
int ncomp,
int nghost = 0);
797 template <
class F=FAB>
799 void abs (
int comp,
int ncomp,
const IntVect& nghost);
801 template <
class F=FAB>
805 template <
class F=FAB>
809 template <
class F=FAB>
813 template <
class F=FAB>
817 template <
class F=FAB>
821 template <
class F=FAB>
826 template <
class F=FAB>
831 template <
class F=FAB>
836 template <
class F=FAB>
841 template <
class F=FAB>
846 template <std::
integral I>
859 template <
typename F=FAB>
861 typename F::value_type
862 sum (
int comp,
IntVect const& nghost,
bool local =
false)
const;
878 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
912 {
ParallelCopy(src,src_comp,dest_comp,num_comp,0,0,period,op); }
914 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
921 {
ParallelCopy(src,src_comp,dest_comp,num_comp, period, op); }
973 bool deterministic =
false);
1004 IntVect(dst_nghost),period,op); }
1015 bool to_ghost_cells_only =
false,
1016 bool deterministic =
false);
1028 bool to_ghost_cells_only =
false,
1029 bool deterministic =
false);
1063 void ParallelCopy (
const FabArray<FAB>& src,
int src_comp,
int dest_comp,
int num_comp,
1083 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1094 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1103 {
ParallelCopy(src,src_comp,dest_comp,num_comp,src_nghost,dst_nghost,period,op); }
1117 void copyTo (FAB& dest,
int nghost = 0)
const;
1126 void copyTo (FAB& dest,
int scomp,
int dcomp,
int ncomp,
int nghost = 0)
const;
1146 template <
typename BUF=value_type>
1150 template <
typename BUF=value_type>
1153 template <
typename BUF=value_type>
1158 template <
typename BUF=value_type>
1162 template <
typename BUF=value_type>
1166 template <
typename BUF=value_type>
1169 template <
typename BUF=value_type>
1172 template <
typename BUF=value_type>
1175 template <
typename BUF=value_type>
1178 template <
typename BUF=value_type>
1181 template <
typename BUF=value_type>
1184 template <
typename BUF=value_type>
1187 template <
typename BUF=value_type,
class F=FAB>
1282 bool deterministic =
false);
1285 bool deterministic =
false);
1287 bool deterministic =
false);
1289 bool deterministic =
false);
1303 bool deterministic =
false);
1306 bool deterministic =
false);
1321 bool deterministic =
false);
1324 bool deterministic =
false);
1350 template <
class F=FAB>
1358 template <
typename BUF=value_type,
class F=FAB>
1362 bool enforce_periodicity_only =
false,
1363 bool override_sync =
false,
1365 bool deterministic =
false);
1370 int scomp,
int dcomp,
int ncomp,
CpOp op);
1372 template <
class F=FAB>
1376 template <
class F=FAB>
1388 int scomp,
int dcomp,
int ncomp,
CpOp op,
bool deterministic);
1393#if defined(__CUDACC__)
1395 void FB_local_copy_cuda_graph_1 (
const FB& TheFB,
int scomp,
int ncomp);
1396 void FB_local_copy_cuda_graph_n (
const FB& TheFB,
int scomp,
int ncomp);
1404#if defined(__CUDACC__)
1406 void FB_pack_send_buffer_cuda_graph (
const FB& TheFB,
int scomp,
int ncomp,
1411 void FB_unpack_recv_buffer_cuda_graph (
const FB& TheFB,
int dcomp,
int ncomp,
1415 bool is_thread_safe);
1419 template <
typename BUF = value_type>
1426 template <
typename BUF = value_type>
1431 CpOp op,
bool is_thread_safe,
1432 std::uint64_t
id,
bool deterministic);
1434 template <
typename BUF>
1439 int ncomp, std::uint64_t
id);
1441 template <
typename BUF>
1446 int ncomp, std::uint64_t
id)
const;
1450 template <
typename BUF = value_type>
1456 template <
typename BUF = value_type>
1461 CpOp op,
bool is_thread_safe);
1477 template <
typename F=FAB>
1479 typename F::value_type
1481 [[maybe_unused]]
bool ignore_covered =
false)
const;
1495 template <
typename IFAB,
typename F=FAB>
1497 typename F::value_type
1499 bool local =
false)
const;
1530#if defined(BL_USE_MPI3)
1531 if (win != MPI_WIN_NULL) { MPI_Win_free(&win); }
1541#if defined(BL_USE_MPI3)
1546#if defined(BL_USE_MPI3)
1547 rhs.win = MPI_WIN_NULL;
1556#if defined(BL_USE_MPI3)
1558 rhs.win = MPI_WIN_NULL;
1568#if defined(BL_USE_MPI3)
1569 MPI_Win win = MPI_WIN_NULL;
1577 using Iterator =
typename std::vector<FAB*>::iterator;
1581 bool alloc_single_chunk);
1583 void setFab_assert (
int K, FAB
const& fab)
const;
1585 template <
class F=FAB>
1587 void build_arrays ()
const;
1589 void clear_arrays ();
1592 std::map<std::uint64_t,
1593 std::unique_ptr<TagVector<Array4CopyTag<value_type>>>>
1594 m_fb_local_copy_handler;
1596 using RecvSendCopyHandlerKey = std::tuple<std::uint64_t,std::size_t,int>;
1597 std::map<RecvSendCopyHandlerKey,
1598 std::unique_ptr<TagVector<CommRecvBufTag<value_type>>>>
1599 m_recv_copy_handler;
1600 mutable std::map<RecvSendCopyHandlerKey,
1601 std::unique_ptr<TagVector<CommSendBufTag<value_type>>>>
1602 m_send_copy_handler;
1610 template <
typename BUF=value_type>
1612 char*& the_recv_data,
1620 template <
typename BUF=value_type>
1630 template <
typename BUF=value_type>
1632 char*& the_send_data,
1640 template <
typename BUF=value_type>
1657 std::unique_ptr<FBData<FAB>>
fbd;
1658 std::unique_ptr<PCData<FAB>>
pcd;
1674 template <
class F=FAB>
1677 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1690 template <
class F=FAB>
1693 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1709 template <
class F=FAB>
1714 int dstcomp,
int numcomp,
const IntVect& nghost);
1729 template <
class F=FAB>
1733 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1749 template <
class F=FAB>
1753 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1768 template <
class F=FAB>
1772 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1785 int li = localindex(K);
1786 if (li >= 0 && li < std::ssize(m_fabs_v) && m_fabs_v[li] != 0) {
1799 if (li < std::ssize(m_fabs_v) && m_fabs_v[li] !=
nullptr) {
1814 return m_fabs_v[li];
1824 return m_fabs_v[li];
1831 int li = localindex(K);
1833 return m_fabs_v[li];
1840 int li = localindex(K);
1842 return m_fabs_v[li];
1853 static_assert(
sizeof(A) ==
sizeof(AC),
"sizeof(Array4<T>) != sizeof(Array4<T const>)");
1854 if (!m_hp_arrays && local_size() > 0) {
1855 const int n = local_size();
1860 m_hp_arrays = std::malloc(n*2*
sizeof(A));
1862 for (
int li = 0; li < n; ++li) {
1864 new ((A*)m_hp_arrays+li) A(m_fabs_v[li]->array());
1865 new ((AC*)m_hp_arrays+li+n) AC(m_fabs_v[li]->const_array());
1867 new ((A*)m_hp_arrays+li) A{};
1868 new ((AC*)m_hp_arrays+li+n) AC{};
1871 m_arrays.
hp = (A*)m_hp_arrays;
1872 m_const_arrays.
hp = (AC*)m_hp_arrays + n;
1874 m_arrays.
dp = (A*)m_dp_arrays;
1875 m_const_arrays.
dp = (AC*)m_dp_arrays + n;
1886FabArray<FAB>::clear_arrays ()
1891 m_dp_arrays =
nullptr;
1893 std::free(m_hp_arrays);
1895 m_hp_arrays =
nullptr;
1896 m_arrays.
hp =
nullptr;
1897 m_const_arrays.
hp =
nullptr;
1905 const int li = localindex(K);
1906 if (li >= 0 && li < std::ssize(m_fabs_v) && m_fabs_v[li] !=
nullptr) {
1910 for (
auto const& t : m_tags) {
1911 updateMemUsage(t, -nbytes,
nullptr);
1914 return std::exchange(m_fabs_v[li],
nullptr);
1926 if (li >= 0 && li < std::ssize(m_fabs_v) && m_fabs_v[li] !=
nullptr) {
1930 for (
auto const& t : m_tags) {
1931 updateMemUsage(t, -nbytes,
nullptr);
1934 return std::exchange(m_fabs_v[li],
nullptr);
1944 if (define_function_called)
1946 define_function_called =
false;
1951 for (
auto *
x : m_fabs_v) {
1954 m_factory->destroy(
x);
1960 m_dallocator.
m_arena =
nullptr;
1964 for (
auto const& t : m_tags) {
1965 updateMemUsage(t, -nbytes,
nullptr);
1969 if (m_single_chunk_arena) {
1970 m_single_chunk_arena.reset();
1972 m_single_chunk_size = 0;
1977 m_fb_local_copy_handler.clear();
1978 m_recv_copy_handler.clear();
1979 m_send_copy_handler.clear();
1986template <BaseFabType SFAB, BaseFabType DFAB>
1987requires (std::is_convertible_v<typename SFAB::value_type, typename DFAB::value_type>)
1992 amrex::Copy(*
this, src, scomp, dcomp, ncomp, nghost);
2002 amrex::Add(*
this, src, scomp, dcomp, ncomp, nghost);
2020 setVal(val,0,n_comp,nghost);
2038 setVal(val,region,0,n_comp,nghost);
2045 m_FA_stats.recordBuild();
2053 m_FA_stats.recordBuild();
2073 : m_factory(factory.clone()),
2082 : m_factory(rhs.Factory().clone()),
2092 auto const& rhsfab = *(rhs.
m_fabs_v[i]);
2105 , m_factory (std::move(rhs.m_factory))
2106 , m_dallocator (rhs.m_dallocator)
2107 , m_single_chunk_arena(std::move(rhs.m_single_chunk_arena))
2108 , m_single_chunk_size(std::exchange(rhs.m_single_chunk_size,0))
2109 , define_function_called(rhs.define_function_called)
2110 , m_fabs_v (std::move(rhs.m_fabs_v))
2112 , m_dp_arrays (std::exchange(rhs.m_dp_arrays,
nullptr))
2114 , m_hp_arrays (std::exchange(rhs.m_hp_arrays,
nullptr))
2115 , m_arrays (rhs.m_arrays)
2116 , m_const_arrays(rhs.m_const_arrays)
2117 , m_tags (std::move(rhs.m_tags))
2118 , shmem (std::move(rhs.shmem))
2120 , m_fb_local_copy_handler(std::move(rhs.m_fb_local_copy_handler))
2121 , m_recv_copy_handler(std::move(rhs.m_recv_copy_handler))
2122 , m_send_copy_handler(std::move(rhs.m_send_copy_handler))
2126 m_FA_stats.recordBuild();
2127 rhs.define_function_called =
false;
2128 rhs.m_fabs_v.clear();
2141 m_factory = std::move(rhs.m_factory);
2142 m_dallocator = rhs.m_dallocator;
2143 m_single_chunk_arena = std::move(rhs.m_single_chunk_arena);
2144 std::swap(m_single_chunk_size, rhs.m_single_chunk_size);
2145 define_function_called = rhs.define_function_called;
2146 std::swap(m_fabs_v, rhs.m_fabs_v);
2148 std::swap(m_dp_arrays, rhs.m_dp_arrays);
2150 std::swap(m_hp_arrays, rhs.m_hp_arrays);
2151 m_arrays = rhs.m_arrays;
2152 m_const_arrays = rhs.m_const_arrays;
2153 std::swap(m_tags, rhs.m_tags);
2154 shmem = std::move(rhs.shmem);
2156 std::swap(m_fb_local_copy_handler, rhs.m_fb_local_copy_handler);
2157 std::swap(m_recv_copy_handler, rhs.m_recv_copy_handler);
2158 std::swap(m_send_copy_handler, rhs.m_send_copy_handler);
2161 rhs.define_function_called =
false;
2162 rhs.m_fabs_v.clear();
2172 m_FA_stats.recordDelete();
2180 if (!define_function_called) {
return false; }
2188 if (
get(fai).box() != fabbox(fai.index()))
2208 return define_function_called;
2220 define(bxs,dm,nvar,
IntVect(ngrow),info,a_factory);
2232 std::unique_ptr<FabFactory<FAB> > factory(a_factory.
clone());
2234 auto *default_arena = m_dallocator.
m_arena;
2237 m_factory = std::move(factory);
2240 define_function_called =
true;
2261 if (shmem.alloc) { alloc_single_chunk =
false; }
2262 if constexpr (!IsBaseFab_v<FAB>) { alloc_single_chunk =
false; }
2264 const int n = indexArray.
size();
2266 shmem.alloc = (nworkers > 1);
2268 bool alloc = !shmem.alloc;
2271 fab_info.SetAlloc(alloc).SetShared(shmem.alloc).SetArena(ar);
2273 if (alloc_single_chunk) {
2274 m_single_chunk_size = 0L;
2275 for (
int i = 0; i < n; ++i) {
2276 int K = indexArray[i];
2277 const Box& tmpbox = fabbox(K);
2278 m_single_chunk_size += factory.
nBytes(tmpbox, n_comp, K);
2281 m_single_chunk_arena = std::make_unique<detail::SingleChunkArena>(ar, m_single_chunk_size);
2282 fab_info.SetArena(m_single_chunk_arena.get());
2285 m_fabs_v.reserve(n);
2288 for (
int i = 0; i < n; ++i)
2290 int K = indexArray[i];
2291 const Box& tmpbox = fabbox(K);
2292 m_fabs_v.push_back(factory.
create(tmpbox, n_comp, fab_info, K));
2297 m_tags.emplace_back(
"All");
2298 for (
auto const& t : m_region_tag) {
2299 m_tags.push_back(t);
2301 for (
auto const& t : tags) {
2302 m_tags.push_back(t);
2304 for (
auto const& t: m_tags) {
2305 updateMemUsage(t, nbytes, ar);
2315 Vector<Long>
offset(n,0);
2316 Vector<Long> nextoffset(nworkers,-1);
2317 for (
int i = 0; i < n; ++i) {
2318 int K = indexArray[i];
2319 int owner = distributionMap[K] - teamlead;
2320 Long s = m_fabs_v[i]->size();
2322 shmem.n_values += s;
2323 shmem.n_points += m_fabs_v[i]->numPts();
2325 if (nextoffset[owner] < 0) {
2327 nextoffset[owner] = s;
2329 offset[i] = nextoffset[owner];
2330 nextoffset[owner] += s;
2334 size_t bytes = shmem.n_values*
sizeof(value_type);
2337 Vector<value_type*> dps;
2339#if defined (BL_USE_MPI3)
2341 static MPI_Info info = MPI_INFO_NULL;
2342 if (info == MPI_INFO_NULL) {
2343 MPI_Info_create(&info);
2344 MPI_Info_set(info,
"alloc_shared_noncontig",
"true");
2349 BL_MPI_REQUIRE( MPI_Win_allocate_shared(bytes,
sizeof(value_type),
2350 info, team_comm, &mfp, &shmem.win) );
2352 for (
int w = 0; w < nworkers; ++w) {
2355 value_type *dptr = 0;
2356 BL_MPI_REQUIRE( MPI_Win_shared_query(shmem.win, w, &sz, &disp, &dptr) );
2358 dps.push_back(dptr);
2363 amrex::Abort(
"BaseFab::define: to allocate shared memory, USE_MPI3 must be true");
2367 for (
int i = 0; i < n; ++i) {
2368 int K = indexArray[i];
2369 int owner = distributionMap[K] - teamlead;
2370 value_type *p = dps[owner] +
offset[i];
2371 m_fabs_v[i]->setPtr(p, m_fabs_v[i]->size());
2374 for (
Long i = 0; i < shmem.n_values; i++, mfp++) {
2375 new (mfp) value_type;
2385FabArray<FAB>::setFab_assert (
int K, FAB
const& fab)
const
2400 n_comp = elem->nComp();
2403 setFab_assert(boxno, *elem);
2405 if (m_fabs_v.empty()) {
2406 m_fabs_v.resize(indexArray.size(),
nullptr);
2409 const int li = localindex(boxno);
2411 m_factory->destroy(m_fabs_v[li]);
2413 m_fabs_v[li] = elem.release();
2418requires (std::is_move_constructible_v<F>)
2423 n_comp = elem.
nComp();
2426 setFab_assert(boxno, elem);
2428 if (m_fabs_v.empty()) {
2429 m_fabs_v.resize(indexArray.size(),
nullptr);
2432 const int li = localindex(boxno);
2434 m_factory->destroy(m_fabs_v[li]);
2436 m_fabs_v[li] =
new FAB(std::move(elem));
2444 n_comp = elem->nComp();
2447 setFab_assert(mfi.
index(), *elem);
2449 if (m_fabs_v.empty()) {
2450 m_fabs_v.resize(indexArray.size(),
nullptr);
2455 m_factory->destroy(m_fabs_v[li]);
2457 m_fabs_v[li] = elem.release();
2462requires (std::is_move_constructible_v<F>)
2467 n_comp = elem.
nComp();
2470 setFab_assert(mfi.
index(), elem);
2472 if (m_fabs_v.empty()) {
2473 m_fabs_v.resize(indexArray.size(),
nullptr);
2478 m_factory->destroy(m_fabs_v[li]);
2480 m_fabs_v[li] =
new FAB(std::move(elem));
2500 if (n_grow.max() > 0)
2504 bool use_mfparfor =
true;
2505 const int nboxes = local_size();
2507 if (boxarray[indexArray[0]].numPts() >
Long(65*65*65)) {
2508 use_mfparfor =
false;
2511 for (
int i = 0; i < nboxes; ++i) {
2512 const Long npts = boxarray[indexArray[i]].numPts();
2513 if (npts >=
Long(64*64*64)) {
2514 use_mfparfor =
false;
2516 }
else if (npts <=
Long(17*17*17)) {
2521 const IntVect nghost = n_grow;
2523 auto const& ma = this->arrays();
2527 auto const& a = ma[box_no];
2531 for (
int n = 0; n < ncomp; ++n) {
2532 a(i,j,k,strt_comp+n) = val;
2544 auto const& a = this->array(mfi);
2547#if (AMREX_SPACEDIM == 3)
2548 if (nghost[2] > 0) {
2552 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2554 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2557#if (AMREX_SPACEDIM >= 2)
2558 if (nghost[1] > 0) {
2561 b.
grow(0, nghost[0]);
2562 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2564 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2567 if (nghost[0] > 0) {
2570 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2572 tags.emplace_back(Tag{.dfab = a, .dbox = b});
2579 tag.dfab(i,j,k,strt_comp+n) = val;
2590 get(fai).template setComplement<RunOn::Host>(val, fai.validbox(), strt_comp, ncomp);
2602 setDomainBndry(val, 0, n_comp, geom);
2617 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
2619 int n = domain_box.
length(idim);
2620 domain_box.
grow(idim, n);
2625#pragma omp parallel if (Gpu::notInLaunchRegion())
2629 const Box& gbx = fai.fabbox();
2632 get(fai).template setComplement<RunOn::Device>(val, domain_box, strt_comp, ncomp);
2638template <std::
integral I>
2645 mem[mfi] +=
static_cast<I
>((*this)[mfi].nBytesOwned());
2652typename F::value_type
2657 using T =
typename FAB::value_type;
2661 auto const& ma = this->const_arrays();
2666 return ma[box_no](i,j,k,comp);
2672#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
2677 auto const& a = this->const_array(mfi);
2681 tmp += a(i,j,k,comp);
2698 copyTo(dest, 0, 0, dest.nComp(), nghost);
2707 setVal(val,0,n_comp,n_grow);
2748 auto const& fa = this->arrays();
2752 fa[box_no](i,j,k,n+comp) = val;
2761#pragma omp parallel if (Gpu::notInLaunchRegion())
2765 const Box& bx = fai.growntilebox(nghost);
2766 auto fab = this->array(fai);
2769 fab(i,j,k,n+comp) = val;
2801 BL_PROFILE(
"FabArray::setVal(val,region,comp,ncomp,nghost)");
2805 auto const& fa = this->arrays();
2810 fa[box_no](i,j,k,n+comp) = val;
2821#pragma omp parallel if (Gpu::notInLaunchRegion())
2825 Box b = fai.growntilebox(nghost) & region;
2828 auto fab = this->array(fai);
2831 fab(i,j,k,n+comp) = val;
2859 auto const& fa = this->arrays();
2863 fa[box_no](i,j,k,n+comp) = std::abs(fa[box_no](i,j,k,n+comp));
2872#pragma omp parallel if (Gpu::notInLaunchRegion())
2877 auto fab = this->array(mfi);
2880 fab(i,j,k,n+comp) = std::abs(fab(i,j,k,n+comp));
2896 auto const& fa = this->arrays();
2900 fa[box_no](i,j,k,n+comp) += val;
2909#pragma omp parallel if (Gpu::notInLaunchRegion())
2914 auto fab = this->array(mfi);
2917 fab(i,j,k,n+comp) += val;
2929 BL_PROFILE(
"FabArray::plus(val, region, comp, num_comp, nghost)");
2933 auto const& fa = this->arrays();
2938 fa[box_no](i,j,k,n+comp) += val;
2948#pragma omp parallel if (Gpu::notInLaunchRegion())
2954 auto fab = this->array(mfi);
2957 fab(i,j,k,n+comp) += val;
2974 auto const& fa = this->arrays();
2978 fa[box_no](i,j,k,n+comp) *= val;
2987#pragma omp parallel if (Gpu::notInLaunchRegion())
2992 auto fab = this->array(mfi);
2995 fab(i,j,k,n+comp) *= val;
3007 BL_PROFILE(
"FabArray::mult(val, region, comp, num_comp, nghost)");
3011 auto const& fa = this->arrays();
3016 fa[box_no](i,j,k,n+comp) *= val;
3026#pragma omp parallel if (Gpu::notInLaunchRegion())
3032 auto fab = this->array(mfi);
3035 fab(i,j,k,n+comp) *= val;
3052 auto const& fa = this->arrays();
3056 fa[box_no](i,j,k,n+comp) = numerator / fa[box_no](i,j,k,n+comp);
3065#pragma omp parallel if (Gpu::notInLaunchRegion())
3070 auto fab = this->array(mfi);
3073 fab(i,j,k,n+comp) = numerator / fab(i,j,k,n+comp);
3085 BL_PROFILE(
"FabArray::invert(numerator, region, comp, num_comp, nghost)");
3089 auto const& fa = this->arrays();
3094 fa[box_no](i,j,k,n+comp) = numerator / fa[box_no](i,j,k,n+comp);
3104#pragma omp parallel if (Gpu::notInLaunchRegion())
3110 auto fab = this->array(mfi);
3113 fab(i,j,k,n+comp) = numerator / fab(i,j,k,n+comp);
3141 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3145 AMREX_ASSERT(
y.nGrowVect().allGE(nghost) &&
x.nGrowVect().allGE(nghost));
3151 auto const& yma =
y.arrays();
3152 auto const& xma =
x.const_arrays();
3156 yma[box_no](i,j,k,ycomp+n) += a * xma[box_no](i,j,k,xcomp+n);
3165#pragma omp parallel if (Gpu::notInLaunchRegion())
3172 auto const& xfab =
x.const_array(mfi);
3173 auto const& yfab =
y.array(mfi);
3176 yfab(i,j,k,ycomp+n) += a * xfab(i,j,k,xcomp+n);
3188 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3192 AMREX_ASSERT(
y.nGrowVect().allGE(nghost) &&
x.nGrowVect().allGE(nghost));
3198 auto const& yfa =
y.arrays();
3199 auto const& xfa =
x.const_arrays();
3203 yfa[box_no](i,j,k,n+ycomp) = xfa[box_no](i,j,k,n+xcomp)
3204 + a * yfa[box_no](i,j,k,n+ycomp);
3213#pragma omp parallel if (Gpu::notInLaunchRegion())
3218 auto const& xFab =
x.const_array(mfi);
3219 auto const& yFab =
y.array(mfi);
3222 yFab(i,j,k,n+ycomp) = xFab(i,j,k,n+xcomp)
3223 + a * yFab(i,j,k,n+ycomp);
3234 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3240 y.nGrowVect().allGE(nghost) &&
3248 auto const& yma =
y.arrays();
3254 yma[box_no](i,j,k,ycomp+n) = xma2[box_no](i,j,k,xcomp+n)
3255 + a2 * (yma [box_no](i,j,k,ycomp+n)
3256 + a1 * xma1[box_no](i,j,k,xcomp+n));
3265#pragma omp parallel if (Gpu::notInLaunchRegion())
3274 auto const& yfab =
y.array(mfi);
3277 yfab(i,j,k,ycomp+n) = xfab2(i,j,k,xcomp+n)
3278 + a2 * (yfab (i,j,k,ycomp+n)
3279 + a1 * xfab1(i,j,k,xcomp+n));
3291 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3308 auto const& y1ma = y1.
arrays();
3310 auto const& y2ma = y2.
arrays();
3315 y1ma[box_no](i,j,k,ycomp+n) += a1 * x1ma[box_no](i,j,k,xcomp+n);
3316 y2ma[box_no](i,j,k,ycomp+n) += a2 * x2ma[box_no](i,j,k,xcomp+n);
3325#pragma omp parallel if (Gpu::notInLaunchRegion())
3333 auto const& y1fab = y1.
array(mfi);
3335 auto const& y2fab = y2.
array(mfi);
3338 y1fab(i,j,k,ycomp+n) += a1 * x1fab(i,j,k,xcomp+n);
3339 y2fab(i,j,k,ycomp+n) += a2 * x2fab(i,j,k,xcomp+n);
3351 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
3359 x.nGrowVect().allGE(nghost));
3365 auto const& y1ma = y1.
arrays();
3366 auto const& y2ma = y2.
arrays();
3367 auto const& xma =
x.const_arrays();
3371 y1ma[box_no](i,j,k,ycomp+n) += a1 * y2ma[box_no](i,j,k,ycomp+n);
3372 y2ma[box_no](i,j,k,ycomp+n) += a2 * xma[box_no](i,j,k,xcomp+n);
3381#pragma omp parallel if (Gpu::notInLaunchRegion())
3388 auto const& xfab =
x.const_array(mfi);
3389 auto const& y1fab = y1.
array(mfi);
3390 auto const& y2fab = y2.
array(mfi);
3393 y1fab(i,j,k,ycomp+n) += a1 * y2fab(i,j,k,ycomp+n);
3394 y2fab(i,j,k,ycomp+n) += a2 * xfab(i,j,k,xcomp+n);
3408 int dstcomp,
int numcomp,
const IntVect& nghost)
3420 auto const& dstma = dst.
arrays();
3421 auto const& xma =
x.const_arrays();
3422 auto const& yma =
y.const_arrays();
3426 dstma[box_no](i,j,k,dstcomp+n) = a*xma[box_no](i,j,k,xcomp+n)
3427 + b*yma[box_no](i,j,k,ycomp+n);
3436#pragma omp parallel if (Gpu::notInLaunchRegion())
3441 auto const& xfab =
x.const_array(mfi);
3442 auto const& yfab =
y.const_array(mfi);
3443 auto const& dfab = dst.
array(mfi);
3446 dfab(i,j,k,dstcomp+n) = a*xfab(i,j,k,xcomp+n) + b*yfab(i,j,k,ycomp+n);
3453template <
typename BUF>
3458 if ( n_grow.max() > 0 ) {
3460 FillBoundary_finish<BUF>();
3465template <
typename BUF>
3470 if ( n_grow.max() > 0 ) {
3471 FillBoundary_nowait<BUF>(0,
nComp(), n_grow, period, cross);
3472 FillBoundary_finish<BUF>();
3477template <
typename BUF>
3483 "FillBoundary: asked to fill more ghost cells than we have");
3484 if ( nghost.
max() > 0 ) {
3485 FillBoundary_nowait<BUF>(0,
nComp(), nghost, period, cross);
3486 FillBoundary_finish<BUF>();
3491template <
typename BUF>
3496 if ( n_grow.max() > 0 ) {
3498 FillBoundary_finish<BUF>();
3503template <
typename BUF>
3508 if ( n_grow.max() > 0 ) {
3509 FillBoundary_nowait<BUF>(scomp, ncomp, n_grow, period, cross);
3510 FillBoundary_finish<BUF>();
3515template <
typename BUF>
3522 "FillBoundary: asked to fill more ghost cells than we have");
3523 if ( nghost.
max() > 0 ) {
3524 FillBoundary_nowait<BUF>(scomp, ncomp, nghost, period, cross);
3525 FillBoundary_finish<BUF>();
3530template <
typename BUF>
3538template <
typename BUF>
3542 FillBoundary_nowait<BUF>(0,
nComp(),
nGrowVect(), period, cross);
3546template <
typename BUF>
3550 FillBoundary_nowait<BUF>(0,
nComp(), nghost, period, cross);
3554template <
typename BUF>
3565 BL_PROFILE(
"FabArray::FillBoundaryAndSync()");
3566 if (n_grow.max() > 0 || !is_cell_centered()) {
3577 BL_PROFILE(
"FabArray::FillBoundaryAndSync()");
3578 if (nghost.
max() > 0 || !is_cell_centered()) {
3597 FBEP_nowait(scomp, ncomp, nghost, period,
false,
false,
true);
3613 if (!is_cell_centered()) {
3624 if (!is_cell_centered()) {
3642 FBEP_nowait(scomp, ncomp,
IntVect(0), period,
false,
false,
true);
3657 SumBoundary(0, n_comp,
IntVect(0), period, deterministic);
3664 SumBoundary(scomp, ncomp,
IntVect(0), period, deterministic);
3671 SumBoundary(scomp, ncomp, this->
nGrowVect(), nghost, period, deterministic);
3680 SumBoundary_nowait(scomp, ncomp, src_nghost, dst_nghost, period, deterministic);
3681 SumBoundary_finish();
3688 SumBoundary_nowait(0, n_comp,
IntVect(0), period, deterministic);
3695 SumBoundary_nowait(scomp, ncomp,
IntVect(0), period, deterministic);
3702 SumBoundary_nowait(scomp, ncomp, this->
nGrowVect(), nghost, period, deterministic);
3709 BL_PROFILE(
"FabArray<FAB>::SumBoundary_nowait()");
3715 FBEP_nowait(scomp, ncomp, dst_nghost, period,
false,
false,
false, src_nghost, deterministic);
3722 BL_PROFILE(
"FabArray<FAB>::SumBoundary_finish()");
3743 FBEP_nowait(scomp, ncomp,
nGrowVect(), period,
false,
true);
3755 FBEP_nowait(scomp, ncomp, nghost, period,
false,
true);
3761template <
typename BUF>
3765 FBEP_nowait<BUF>(scomp, ncomp,
nGrowVect(), period, cross);
3769template <
typename BUF>
3774 FBEP_nowait<BUF>(scomp, ncomp, nghost, period, cross);
3787 int ncomp = this->
nComp();
3791 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
3793 domain.
grow(i, ngrow[i]);
3799 auto const& fa = this->arrays();
3803 auto const& fab = fa[box_no];
3808 }
else if (domain.
contains(i,j,k)) {
3809 fab(i,j,k,n) = notcovered;
3811 fab(i,j,k,n) = physbnd;
3821#pragma omp parallel if (Gpu::notInLaunchRegion())
3825 auto const& fab = this->array(mfi);
3827 Box const& gbx = fbx & domain;
3832 fab(i,j,k,n) = interior;
3834 fab(i,j,k,n) = notcovered;
3836 fab(i,j,k,n) = physbnd;
3852 BL_PROFILE(
"FabArray::setVal(val, thecmd, scomp, ncomp)");
3857 CMD_local_setVal_gpu(val, thecmd, scomp, ncomp);
3858 CMD_remote_setVal_gpu(val, thecmd, scomp, ncomp);
3866 auto N_locs =
static_cast<int>(LocTags.size());
3868#pragma omp parallel for if (thecmd.m_threadsafe_loc)
3870 for (
int i = 0; i < N_locs; ++i) {
3872 (*this)[tag.
dstIndex].template setVal<RunOn::Host>(val, tag.
dbox, scomp, ncomp);
3875 for (
const auto & RcvTag : RcvTags) {
3876 auto N =
static_cast<int>(RcvTag.second.size());
3878#pragma omp parallel for if (thecmd.m_threadsafe_rcv)
3880 for (
int i = 0; i < N; ++i) {
3882 (*this)[tag.
dstIndex].template setVal<RunOn::Host>(val, tag.
dbox, scomp, ncomp);
3898#pragma omp parallel if (thecmd.m_threadsafe_rcv)
3907 auto N_locs =
static_cast<int>(LocTags.size());
3908 for (
int i = 0; i < N_locs; ++i) {
3913 for (
const auto & RcvTag : RcvTags) {
3914 auto N =
static_cast<int>(RcvTag.second.size());
3915 for (
int i = 0; i < N; ++i) {
3924template <
typename F>
3926typename F::value_type
3928 [[maybe_unused]]
bool ignore_covered)
const
3932 using RT =
typename F::value_type;
3937 if ( this->is_cell_centered() && this->hasEBFabFactory() && ignore_covered )
3943 auto const& flagsma = flags.const_arrays();
3944 auto const& ma = this->const_arrays();
3948 if (flagsma[box_no](i,j,k).isCovered()) {
3952 auto const& a = ma[box_no];
3953 for (
int n = 0; n < ncomp; ++n) {
3954 tmp =
amrex::max(tmp, std::abs(a(i,j,k,comp+n)));
3963#pragma omp parallel reduction(max:nm0)
3968 auto const& flag = flags.const_array(mfi);
3969 auto const& a = this->const_array(mfi);
3972 if (!flag(i,j,k).isCovered()) {
3973 nm0 = std::max(nm0, std::abs(a(i,j,k,comp+n)));
3985 auto const& ma = this->const_arrays();
3989 return std::abs(ma[box_no](i,j,k,comp+n));
3995#pragma omp parallel reduction(max:nm0)
3999 auto const& a = this->const_array(mfi);
4002 nm0 = std::max(nm0, std::abs(a(i,j,k,comp+n)));
4016template <
typename IFAB,
typename F>
4018typename F::value_type
4020 IntVect const& nghost,
bool local)
const
4024 using RT =
typename F::value_type;
4030 auto const& ma = this->const_arrays();
4031 auto const& maskma =
mask.const_arrays();
4035 if (maskma[box_no](i,j,k)) {
4037 auto const& a = ma[box_no];
4038 for (
int n = 0; n < ncomp; ++n) {
4039 tmp =
amrex::max(tmp, std::abs(a(i,j,k,comp+n)));
4050#pragma omp parallel reduction(max:nm0)
4054 auto const& a = this->const_array(mfi);
4055 auto const& mskfab =
mask.const_array(mfi);
4058 if (mskfab(i,j,k)) {
4059 nm0 = std::max(nm0, std::abs(a(i,j,k,comp+n)));
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:551
#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
#define AMREX_NODISCARD
Definition AMReX_Extension.H:252
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_RESTRICT
Definition AMReX_Extension.H:32
#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
Array4< int const > offset
Definition AMReX_HypreMLABecLap.cpp:1139
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
A virtual base class for objects that manage their own dynamic memory allocation.
Definition AMReX_Arena.H:132
virtual void free(void *pt)=0
A pure virtual function for deleting the arena pointed to by pt.
virtual void * alloc(std::size_t sz)=0
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:194
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:564
__host__ __device__ BoxND & grow(int i) noexcept
Definition AMReX_Box.H:649
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:155
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:216
__host__ __device__ BoxND & shift(int dir, int nzones) noexcept
Shift this BoxND nzones indexing positions in coordinate direction dir.
Definition AMReX_Box.H:517
__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:1117
__host__ __device__ bool ok() const noexcept
Checks if it is a proper BoxND (including a valid type).
Definition AMReX_Box.H:212
__host__ __device__ const IntVectND< dim > & smallEnd() const &noexcept
Return the inclusive lower bound of the box.
Definition AMReX_Box.H:112
Definition AMReX_FabFactory.H:76
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:43
Definition AMReX_EBFabFactory.H:32
const FabArray< EBCellFlagFab > & getMultiEBCellFlagFab() const noexcept
EB cell flags for all boxes.
Definition AMReX_EBFabFactory.H:73
bool isAllRegular() const noexcept
Definition AMReX_EBFabFactory.cpp:148
Base class for FabArray.
Definition AMReX_FabArrayBase.H:42
IntVect nGrowVect() const noexcept
Definition AMReX_FabArrayBase.H:80
void clear()
Definition AMReX_FabArrayBase.cpp:207
Vector< int > indexArray
Definition AMReX_FabArrayBase.H:446
static FabArrayStats m_FA_stats
Definition AMReX_FabArrayBase.H:726
static bool getAllocSingleChunk()
Definition AMReX_FabArrayBase.H:730
bool isFusingCandidate() const noexcept
Is this a good candidate for kernel fusing?
Definition AMReX_FabArrayBase.cpp:2705
int size() const noexcept
Return the number of FABs in the FabArray.
Definition AMReX_FabArrayBase.H:110
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:220
CopyComTag::MapOfCopyComTagContainers MapOfCopyComTagContainers
Definition AMReX_FabArrayBase.H:221
const DistributionMapping & DistributionMap() const noexcept
Return constant reference to associated DistributionMapping.
Definition AMReX_FabArrayBase.H:131
int local_size() const noexcept
Return the number of local FABs in the FabArray.
Definition AMReX_FabArrayBase.H:113
CpOp
parallel copy or add
Definition AMReX_FabArrayBase.H:394
@ ADD
Definition AMReX_FabArrayBase.H:394
@ COPY
Definition AMReX_FabArrayBase.H:394
DistributionMapping distributionMap
Definition AMReX_FabArrayBase.H:445
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:83
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:95
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:344
void ParallelCopyToGhost_finish()
Definition AMReX_FabArrayCommI.H:383
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:2397
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:1084
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:3693
void mult(value_type val, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2968
void setBndry(value_type val)
Set all values in the boundary region to val.
Definition AMReX_FabArray.H:2487
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:1095
void FillBoundary_finish()
Definition AMReX_FabArrayCommI.H:221
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:1412
void * m_dp_arrays
Definition AMReX_FabArray.H:1516
void ParallelCopy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:873
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:2441
typename std::conditional_t< IsBaseFab< FAB >::value, FAB, FABType >::value_type value_type
Definition AMReX_FabArray.H:355
std::unique_ptr< FabArray< FAB > > os_temp
Definition AMReX_FabArray.H:1661
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:3232
void FillBoundary(const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3479
const FabFactory< FAB > & Factory() const noexcept
Definition AMReX_FabArray.H:442
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:11
void CMD_remote_setVal_gpu(value_type x, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FBI.H:684
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:981
LayoutData< int > RecvLayoutMask(const CommMetaData &thecmd)
Definition AMReX_FabArray.H:3892
void FillBoundary_nowait(const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3540
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:3405
void shift(const IntVect &v)
Shift the boxarray by vector v.
Definition AMReX_FabArray.H:3122
FAB * release(int K)
Release ownership of the FAB. This function is not thread safe.
Definition AMReX_FabArray.H:1903
bool ok() const
Return true if the FabArray is well-defined. That is, the FabArray has a BoxArray and DistributionMap...
Definition AMReX_FabArray.H:2178
const FAB & operator[](const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:508
void ParallelAdd_nowait(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:884
FabArray(FabArray< FAB > &&rhs) noexcept
Definition AMReX_FabArray.H:2103
FabArray(const BoxArray &bxs, const DistributionMapping &dm, int nvar, const IntVect &ngrow, const MFInfo &info=MFInfo(), const FabFactory< FAB > &factory=DefaultFabFactory< FAB >())
Definition AMReX_FabArray.H:2067
bool defined(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:1796
void prefetchToHost(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:541
void OverrideSync_nowait(int scomp, int ncomp, const Periodicity &period)
Definition AMReX_FabArray.H:3639
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())
Definition AMReX_FabArrayCommI.H:352
MultiArray4< typename FabArray< FAB >::value_type > arrays() noexcept
Definition AMReX_FabArray.H:633
void ParallelCopy_finish()
Definition AMReX_FabArrayCommI.H:671
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:1373
FAB & get(int K) noexcept
Return a reference to the FAB associated with the Kth element.
Definition AMReX_FabArray.H:529
FAB const * fabPtr(int K) const noexcept
Definition AMReX_FabArray.H:1838
Array4< typename FabArray< FAB >::value_type > array(const MFIter &mfi, int start_comp) noexcept
Definition AMReX_FabArray.H:603
void SumBoundary_nowait(const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:3686
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:3289
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:955
Long m_single_chunk_size
Definition AMReX_FabArray.H:1506
FAB & get(const MFIter &mfi) noexcept
Returns a reference to the FAB associated mfi.
Definition AMReX_FabArray.H:517
void OverrideSync_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3632
std::unique_ptr< PCData< FAB > > pcd
Definition AMReX_FabArray.H:1658
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:2213
void setDomainBndry(value_type val, const Geometry &geom)
Set all values outside the Geometry domain to val.
Definition AMReX_FabArray.H:2600
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())
Definition AMReX_FabArray.H:985
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:1657
std::unique_ptr< detail::SingleChunkArena > m_single_chunk_arena
Definition AMReX_FabArray.H:1505
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:3707
FabArray(const FabArray< FAB > &rhs, MakeType maketype, int scomp, int ncomp)
Definition AMReX_FabArray.H:2081
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:870
FAB fab_type
Definition AMReX_FabArray.H:357
void FB_local_add_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:443
Array4< typename FabArray< FAB >::value_type const > array(int K) const noexcept
Definition AMReX_FabArray.H:573
bool SharedMemory() const noexcept
Definition AMReX_FabArray.H:1574
Array4< typename FabArray< FAB >::value_type const > const_array(int K) const noexcept
Definition AMReX_FabArray.H:591
void prefetchToDevice(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:551
void FillBoundary_nowait(const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3548
Vector< std::string > m_tags
Definition AMReX_FabArray.H:1522
void ParallelCopyToGhost_nowait(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArrayCommI.H:369
void ParallelAdd_nowait(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:923
void FB_local_add_gpu(const FB &TheFB, int scomp, int ncomp, bool deterministic)
Definition AMReX_FBI.H:606
void FB_local_copy_gpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:534
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:1989
Arena * arena() const noexcept
Definition AMReX_FabArray.H:445
DataAllocator m_dallocator
Definition AMReX_FabArray.H:1504
void copy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:879
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:1211
Array4< typename FabArray< FAB >::value_type > array(const MFIter &mfi) noexcept
Definition AMReX_FabArray.H:567
void FillBoundaryAndSync_finish()
Definition AMReX_FabArray.H:3602
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)
Definition AMReX_FabArray.H:995
void FillBoundary_nowait(bool cross=false)
Definition AMReX_FabArray.H:3532
void clear()
Releases FAB memory in the FabArray.
Definition AMReX_FabArray.H:1942
void FillBoundary_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3771
const Vector< std::string > & tags() const noexcept
Definition AMReX_FabArray.H:447
void CMD_local_setVal_gpu(value_type x, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FBI.H:654
MultiArray4< typename FabArray< FAB >::value_type const > arrays() const noexcept
Definition AMReX_FabArray.H:640
void FillBoundary_nowait(int scomp, int ncomp, bool cross=false)
Definition AMReX_FabArray.H:3556
value_type * singleChunkPtr() noexcept
Definition AMReX_FabArray.H:460
std::vector< FAB * > m_fabs_v
The data.
Definition AMReX_FabArray.H:1513
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:947
bool define_function_called
has define() been called?
Definition AMReX_FabArray.H:1509
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:900
FabArray() noexcept
Constructs an empty FabArray<FAB>.
Definition AMReX_FabArray.H:2042
void FillBoundary_test()
Definition AMReX_FabArrayCommI.H:1008
void plus(value_type val, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2890
bool defined(int K) const noexcept
Definition AMReX_FabArray.H:1783
FAB * fabPtr(int K) noexcept
Definition AMReX_FabArray.H:1829
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:938
const FAB & atLocalIdx(int L) const noexcept
Definition AMReX_FabArray.H:533
MultiArray4< typename FabArray< FAB >::value_type const > const_arrays() const noexcept
Definition AMReX_FabArray.H:647
std::unique_ptr< FabFactory< FAB > > m_factory
Definition AMReX_FabArray.H:1503
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:915
void invert(value_type numerator, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:3046
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:2696
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())
Definition AMReX_FabArray.H:975
void setVal(value_type val)
Set all components in the entire region of each FAB to val.
Definition AMReX_FabArray.H:2705
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:561
void FillBoundary_nowait(int scomp, int ncomp, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3763
const FAB & get(const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:511
void SumBoundary_finish()
Definition AMReX_FabArray.H:3720
std::size_t singleChunkSize() const noexcept
Definition AMReX_FabArray.H:472
void SumBoundary_nowait(int scomp, int ncomp, IntVect const &nghost, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:3700
void FB_local_copy_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:384
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:3140
MultiArray4< value_type > m_arrays
Definition AMReX_FabArray.H:1519
void FillBoundaryAndSync_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3586
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:3593
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:3781
void * m_hp_arrays
Definition AMReX_FabArray.H:1518
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:3349
ShMem shmem
Definition AMReX_FabArray.H:1572
FabArray< FAB > & operator=(FabArray< FAB > &&rhs) noexcept
Definition AMReX_FabArray.H:2134
Array4< typename FabArray< FAB >::value_type > array(int K, int start_comp) noexcept
Definition AMReX_FabArray.H:615
MultiArray4< value_type const > m_const_arrays
Definition AMReX_FabArray.H:1520
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:906
bool hasEBFabFactory() const noexcept
Definition AMReX_FabArray.H:449
TagVector< Array4CopyTag< value_type > > const * FB_get_local_copy_tag_vector(const FB &TheFB)
Definition AMReX_FBI.H:491
Array4< typename FabArray< FAB >::value_type const > array(int K, int start_comp) const noexcept
Definition AMReX_FabArray.H:609
bool isAllRegular() const noexcept
Definition AMReX_FabArray.H:474
Array4< typename FabArray< FAB >::value_type > array(int K) noexcept
Definition AMReX_FabArray.H:579
FAB * fabPtr(const MFIter &mfi) noexcept
Return pointer to FAB.
Definition AMReX_FabArray.H:1809
void OverrideSync_finish()
Definition AMReX_FabArray.H:3647
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:1113
FAB * release(const MFIter &mfi)
Release ownership of the FAB. This function is not thread safe.
Definition AMReX_FabArray.H:1923
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi, int start_comp) const noexcept
Definition AMReX_FabArray.H:621
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:3187
void capacityOfFabs(LayoutData< I > &mem) const
Get capacity of the FabArray.
Definition AMReX_FabArray.H:2641
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:532
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, const IntVect &ngrow, const MFInfo &info=MFInfo(), const FabFactory< FAB > &factory=DefaultFabFactory< FAB >())
Definition AMReX_FabArray.H:2225
void ParallelCopy_nowait(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:887
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:1999
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:585
const FAB & get(int K) const noexcept
Return a constant reference to the FAB associated with the Kth element.
Definition AMReX_FabArray.H:523
FAB const * fabPtr(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:1819
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)
Definition AMReX_FabArray.H:929
bool isDefined() const
Definition AMReX_FabArray.H:2206
value_type const * singleChunkPtr() const noexcept
Definition AMReX_FabArray.H:466
~FabArray()
The destructor – deletes all FABs in the array.
Definition AMReX_FabArray.H:2170
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi, int start_comp) const noexcept
Definition AMReX_FabArray.H:597
Array4< typename FabArray< FAB >::value_type const > const_array(int K, int start_comp) const noexcept
Definition AMReX_FabArray.H:627
F::value_type sum(int comp, IntVect const &nghost, bool local=false) const
Returns the sum of component "comp".
Definition AMReX_FabArray.H:2653
Definition AMReX_FabFactory.H:50
virtual Long nBytes(const Box &box, int ncomps, int) const
Definition AMReX_FabFactory.H:64
virtual FabFactory< FAB > * clone() const =0
virtual FAB * create(const Box &box, int ncomps, const FabInfo &info, int box_index) const =0
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:75
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:216
bool isPeriodic(int dir) const noexcept
Is the domain periodic in the specified direction?
Definition AMReX_Geometry.H:337
GPU-compatible tuple.
Definition AMReX_Tuple.H:98
__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:476
const DistributionMapping & DistributionMap() const noexcept
Definition AMReX_MFIter.H:197
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:172
Box validbox() const noexcept
Return the valid Box in which the current tile resides.
Definition AMReX_MFIter.H:163
int index() const noexcept
The index into the underlying BoxArray of the current FAB.
Definition AMReX_MFIter.H:175
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:190
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
void EnforcePeriodicity(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Definition AMReX_FabArray.H:3750
void SumBoundary(int scomp, int ncomp, const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Definition AMReX_FabArray.H:3662
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:3669
void OverrideSync(const Periodicity &period=Periodicity::NonPeriodic())
Synchronize nodal data.
Definition AMReX_FabArray.H:3610
void FillBoundary(bool cross=false)
Copy on intersection within a FabArray.
Definition AMReX_FabArray.H:3455
void OverrideSync(int scomp, int ncomp, const Periodicity &period)
Synchronize nodal data.
Definition AMReX_FabArray.H:3621
void FillBoundary(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3517
void FillBoundaryAndSync(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Fill ghost cells and synchronize nodal data.
Definition AMReX_FabArray.H:3574
void FillBoundary(const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3467
void FillBoundary(int scomp, int ncomp, bool cross=false)
Definition AMReX_FabArray.H:3493
void FillBoundaryAndSync(const Periodicity &period=Periodicity::NonPeriodic())
Fill ghost cells and synchronize nodal data.
Definition AMReX_FabArray.H:3563
void SumBoundary(const Periodicity &period=Periodicity::NonPeriodic(), bool deterministic=false)
Sum values in overlapped cells.
Definition AMReX_FabArray.H:3655
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:3676
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:3927
void EnforcePeriodicity(const Periodicity &period)
Fill ghost cells with values from their corresponding cells across periodic boundaries,...
Definition AMReX_FabArray.H:3728
void FillBoundary(int scomp, int ncomp, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3505
void EnforcePeriodicity(int scomp, int ncomp, const Periodicity &period)
Definition AMReX_FabArray.H:3739
Arena * The_Comms_Arena()
Definition AMReX_Arena.cpp:880
Arena * The_Pinned_Arena()
Definition AMReX_Arena.cpp:860
Arena * The_Arena()
Definition AMReX_Arena.cpp:820
int MyProc() noexcept
Definition AMReX_ParallelDescriptor.H:128
void Min(KeyValuePair< K, V > &vi, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:161
void Sum(T &v, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:221
void Max(KeyValuePair< K, V > &vi, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:133
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 &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:139
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Return a BoxND with different type.
Definition AMReX_Box.H:1567
void FillBoundary_finish(Vector< MF * > const &mf)
Wait for outstanding FillBoundary_nowait operations launched with the vector helper to complete.
Definition AMReX_FabArrayCommI.H:1115
int nComp(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2852
void Copy(FabArray< DFAB > &dst, FabArray< SFAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:180
void OverrideSync_nowait(FabArray< FAB > &fa, FabArray< IFAB > const &msk, const Periodicity &period)
Definition AMReX_FabArrayUtility.H:1390
void Add(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:239
std::unique_ptr< char, TheFaArenaDeleter > TheFaArenaPointer
Definition AMReX_FabArray.H:106
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
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2867
Long nBytesOwned(T const &) noexcept
Definition AMReX_FabArray.H:60
IntVect nGrowVect(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2857
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:1138
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:30
bool isMFIterSafe(const FabArrayBase &x, const FabArrayBase &y)
Definition AMReX_MFIter.H:252
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:33
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:45
__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)
Definition AMReX_FabArrayUtility.H:1437
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:1868
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition AMReX.cpp:241
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:1180
BoxArray const & boxArray(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2862
void setVal(MF &dst, typename MF::value_type val)
dst = val
Definition AMReX_FabArrayUtility.H:1861
__host__ __device__ constexpr int get(IntVectND< dim > const &iv) noexcept
Get I'th element of IntVectND<dim>
Definition AMReX_IntVect.H:1334
Definition AMReX_TagParallelFor.H:58
A multidimensional array accessor.
Definition AMReX_Array4.H:285
Definition AMReX_DataAllocator.H:9
Arena * arena() const noexcept
Definition AMReX_DataAllocator.H:24
Arena * m_arena
Definition AMReX_DataAllocator.H:10
Definition AMReX_FabArray.H:110
const FabArrayBase::FB * fb
Definition AMReX_FabArray.H:112
bool deterministic
Definition AMReX_FabArray.H:129
char * the_recv_data
Definition AMReX_FabArray.H:117
Vector< MPI_Request > recv_reqs
Definition AMReX_FabArray.H:122
Vector< char * > recv_data
Definition AMReX_FabArray.H:120
Vector< MPI_Status > recv_stat
Definition AMReX_FabArray.H:123
int scomp
Definition AMReX_FabArray.H:113
Vector< int > recv_from
Definition AMReX_FabArray.H:119
char * the_send_data
Definition AMReX_FabArray.H:118
Vector< MPI_Request > send_reqs
Definition AMReX_FabArray.H:126
Vector< char * > send_data
Definition AMReX_FabArray.H:125
Vector< std::size_t > recv_size
Definition AMReX_FabArray.H:121
int ncomp
Definition AMReX_FabArray.H:114
int tag
Definition AMReX_FabArray.H:127
parallel copy or add
Definition AMReX_FabArrayBase.H:538
Used by a bunch of routines when communicating via MPI.
Definition AMReX_FabArrayBase.H:195
Box dbox
Definition AMReX_FabArrayBase.H:196
int dstIndex
Definition AMReX_FabArrayBase.H:198
FillBoundary.
Definition AMReX_FabArrayBase.H:488
void recordBuild() noexcept
Definition AMReX_FabArrayBase.H:704
Definition AMReX_FabArray.H:347
FAB value_type
Definition AMReX_FabArray.H:348
for shared memory
Definition AMReX_FabArray.H:1525
ShMem(ShMem &&rhs) noexcept
Definition AMReX_FabArray.H:1539
Long n_values
Definition AMReX_FabArray.H:1566
Long n_points
Definition AMReX_FabArray.H:1567
bool alloc
Definition AMReX_FabArray.H:1565
ShMem & operator=(ShMem &&rhs) noexcept
Definition AMReX_FabArray.H:1550
ShMem(const ShMem &)=delete
FabArray memory allocation information.
Definition AMReX_FabArray.H:68
MFInfo & SetTag(T &&t, Ts &&... ts) noexcept
Definition AMReX_FabArray.H:94
MFInfo & SetTag(const std::string &t) noexcept
Definition AMReX_FabArray.H:88
Arena * arena
Definition AMReX_FabArray.H:72
MFInfo & SetArena(Arena *ar) noexcept
Definition AMReX_FabArray.H:79
MFInfo & SetTag() noexcept
Definition AMReX_FabArray.H:81
bool alloc
Definition AMReX_FabArray.H:70
MFInfo & SetAlloc(bool a) noexcept
Definition AMReX_FabArray.H:75
bool alloc_single_chunk
Definition AMReX_FabArray.H:71
MFInfo & SetAllocSingleChunk(bool a) noexcept
Definition AMReX_FabArray.H:77
Vector< std::string > tags
Definition AMReX_FabArray.H:73
MFInfo & SetTag(const char *t) noexcept
Definition AMReX_FabArray.H:83
Definition AMReX_MFIter.H:20
MFItInfo & DisableDeviceSync() noexcept
Definition AMReX_MFIter.H:47
Definition AMReX_FabArray.H:156
Array4< T > const *__restrict__ hp
Definition AMReX_FabArray.H:172
__host__ __device__ Array4< T > const & operator[](int li) const noexcept
Definition AMReX_FabArray.H:158
Array4< T > const *__restrict__ dp
Definition AMReX_FabArray.H:170
Definition AMReX_FabArray.H:134
int actual_n_rcvs
Definition AMReX_FabArray.H:140
Vector< std::size_t > recv_size
Definition AMReX_FabArray.H:147
int DC
Definition AMReX_FabArray.H:141
Vector< MPI_Request > send_reqs
Definition AMReX_FabArray.H:149
int tag
Definition AMReX_FabArray.H:139
const FabArray< FAB > * src
Definition AMReX_FabArray.H:137
char * the_recv_data
Definition AMReX_FabArray.H:143
FabArrayBase::CpOp op
Definition AMReX_FabArray.H:138
Vector< MPI_Request > recv_reqs
Definition AMReX_FabArray.H:148
char * the_send_data
Definition AMReX_FabArray.H:144
const FabArrayBase::CPC * cpc
Definition AMReX_FabArray.H:136
Vector< int > recv_from
Definition AMReX_FabArray.H:145
bool deterministic
Definition AMReX_FabArray.H:150
int NC
Definition AMReX_FabArray.H:141
int SC
Definition AMReX_FabArray.H:141
Vector< char * > recv_data
Definition AMReX_FabArray.H:146
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:100
char * pointer
Definition AMReX_FabArray.H:101
void operator()(pointer p) const noexcept
Definition AMReX_FabArray.H:102
Struct for holding types.
Definition AMReX_TypeList.H:13