4#include <AMReX_Config.H>
57template <typename T, std::enable_if_t<!IsBaseFab<T>::value,
int> = 0>
91 template <
typename T,
typename... Ts>
93 tags.emplace_back(std::forward<T>(t));
94 return SetTag(std::forward<Ts>(ts)...);
160 explicit operator bool() const noexcept {
173template <
class DFAB,
class SFAB,
174 std::enable_if_t<std::conjunction_v<
176 std::is_convertible<
typename SFAB::value_type,
177 typename DFAB::value_type>>,
int> BAR = 0>
181 Copy(dst,src,srccomp,dstcomp,numcomp,
IntVect(nghost));
184template <
class DFAB,
class SFAB,
185 std::enable_if_t<std::conjunction_v<
186 IsBaseFab<DFAB>, IsBaseFab<SFAB>,
187 std::is_convertible<
typename SFAB::value_type,
188 typename DFAB::value_type>>,
int> BAR = 0>
194 using DT =
typename DFAB::value_type;
199 if constexpr (std::is_same_v<typename SFAB::value_type, typename DFAB::value_type>) {
208 auto const& dstarr = dst.
arrays();
212 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));
238 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
242 Add(dst,src,srccomp,dstcomp,numcomp,
IntVect(nghost));
246 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
254 auto const& dstfa = dst.
arrays();
259 dstfa[box_no](i,j,k,n+dstcomp) += srcfa[box_no](i,j,k,n+srccomp);
268#pragma omp parallel if (Gpu::notInLaunchRegion())
272 const Box& bx = mfi.growntilebox(nghost);
275 auto const srcFab = src.
array(mfi);
276 auto dstFab = dst.
array(mfi);
279 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);
521 const FAB&
get (
int K)
const noexcept {
return *(this->
fabPtr(K)); }
527 FAB&
get (
int K)
noexcept {
return *(this->
fabPtr(K)); }
537 FAB
const*
fabPtr (
int K)
const noexcept;
539 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
543 this->
fabPtr(mfi)->prefetchToHost();
549 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
553 this->
fabPtr(mfi)->prefetchToDevice();
559 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
562 return fabPtr(mfi)->const_array();
565 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
568 return fabPtr(mfi)->array();
571 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
574 return fabPtr(K)->const_array();
577 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
580 return fabPtr(K)->array();
583 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
586 return fabPtr(mfi)->const_array();
589 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
592 return fabPtr(K)->const_array();
595 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
598 return fabPtr(mfi)->const_array(start_comp);
601 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
604 return fabPtr(mfi)->array(start_comp);
607 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
610 return fabPtr(K)->const_array(start_comp);
613 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
616 return fabPtr(K)->array(start_comp);
619 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
622 return fabPtr(mfi)->const_array(start_comp);
625 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
628 return fabPtr(K)->const_array(start_comp);
631 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
638 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
645 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
653 void setFab (
int boxno, std::unique_ptr<FAB> elem);
656 template <
class F=FAB, std::enable_if_t<std::is_move_constructible_v<F>,
int> = 0>
663 template <
class F=FAB, std::enable_if_t<std::is_move_constructible_v<F>,
int> = 0>
691 template <
typename SFAB,
typename DFAB = FAB,
692 std::enable_if_t<std::conjunction_v<
694 std::is_convertible<
typename SFAB::value_type,
695 typename DFAB::value_type>>,
int> = 0>
711 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
716 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
720 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
728 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
734 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
746 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
753 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
763 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
766 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
774 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
777 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
780 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
781 void abs (
int comp,
int ncomp,
int nghost = 0);
783 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
786 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
789 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
792 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
795 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
798 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
801 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
805 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
809 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
813 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
817 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
827 template <typename F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
828 typename F::value_type
829 sum (
int comp,
IntVect const& nghost,
bool local =
false)
const;
845 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
879 {
ParallelCopy(src,src_comp,dest_comp,num_comp,0,0,period,op); }
881 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
888 {
ParallelCopy(src,src_comp,dest_comp,num_comp, period, op); }
970 IntVect(dst_nghost),period,op); }
981 bool to_ghost_cells_only =
false);
1003 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1014 [[deprecated(
"Use FabArray::ParallelCopy() instead.")]]
1023 {
ParallelCopy(src,src_comp,dest_comp,num_comp,src_nghost,dst_nghost,period,op); }
1037 void copyTo (FAB& dest,
int nghost = 0)
const;
1046 void copyTo (FAB& dest,
int scomp,
int dcomp,
int ncomp,
int nghost = 0)
const;
1065 template <
typename BUF=value_type>
1068 template <
typename BUF=value_type>
1071 template <
typename BUF=value_type>
1075 template <
typename BUF=value_type>
1078 template <
typename BUF=value_type>
1081 template <
typename BUF=value_type>
1084 template <
typename BUF=value_type>
1087 template <
typename BUF=value_type>
1090 template <
typename BUF=value_type>
1093 template <
typename BUF=value_type>
1096 template <
typename BUF=value_type>
1099 template <
typename BUF=value_type>
1103 class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1212 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1220 class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1223 bool enforce_periodicity_only =
false,
1224 bool override_sync =
false);
1228 int scomp,
int dcomp,
int ncomp,
CpOp op);
1230 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1233 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1240 int scomp,
int dcomp,
int ncomp,
CpOp op);
1245#if defined(__CUDACC__)
1247 void FB_local_copy_cuda_graph_1 (
const FB& TheFB,
int scomp,
int ncomp);
1248 void FB_local_copy_cuda_graph_n (
const FB& TheFB,
int scomp,
int ncomp);
1256#if defined(__CUDACC__)
1258 void FB_pack_send_buffer_cuda_graph (
const FB& TheFB,
int scomp,
int ncomp,
1263 void FB_unpack_recv_buffer_cuda_graph (
const FB& TheFB,
int dcomp,
int ncomp,
1267 bool is_thread_safe);
1271 template <
typename BUF = value_type>
1277 template <
typename BUF = value_type>
1282 CpOp op,
bool is_thread_safe);
1286 template <
typename BUF = value_type>
1292 template <
typename BUF = value_type>
1297 CpOp op,
bool is_thread_safe);
1310 template <typename F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1311 typename F::value_type
1313 [[maybe_unused]]
bool ignore_covered =
false)
const;
1324 template <typename IFAB, typename F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1325 typename F::value_type
1327 bool local =
false)
const;
1358#if defined(BL_USE_MPI3)
1359 if (win != MPI_WIN_NULL) { MPI_Win_free(&win); }
1369#if defined(BL_USE_MPI3)
1374#if defined(BL_USE_MPI3)
1375 rhs.win = MPI_WIN_NULL;
1384#if defined(BL_USE_MPI3)
1386 rhs.win = MPI_WIN_NULL;
1396#if defined(BL_USE_MPI3)
1397 MPI_Win win = MPI_WIN_NULL;
1409 bool alloc_single_chunk);
1413 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1423 template <
typename BUF=value_type>
1425 char*& the_recv_data,
1433 template <
typename BUF=value_type>
1443 template <
typename BUF=value_type>
1445 char*& the_send_data,
1453 template <
typename BUF=value_type>
1470 std::unique_ptr<FBData<FAB>>
fbd;
1471 std::unique_ptr<PCData<FAB>>
pcd;
1489 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1491 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1504 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1506 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost);
1522 template <class F=FAB, std::enable_if_t<IsBaseFab<F>::value,
int> = 0>
1526 int dstcomp,
int numcomp,
const IntVect& nghost);
1536 int li = localindex(K);
1537 if (li >= 0 && li <
static_cast<int>(m_fabs_v.size()) && m_fabs_v[li] != 0) {
1549 int li = mfi.LocalIndex();
1550 if (li <
static_cast<int>(m_fabs_v.size()) && m_fabs_v[li] !=
nullptr) {
1564 int li = mfi.LocalIndex();
1565 return m_fabs_v[li];
1574 int li = mfi.LocalIndex();
1575 return m_fabs_v[li];
1582 int li = localindex(K);
1584 return m_fabs_v[li];
1591 int li = localindex(K);
1593 return m_fabs_v[li];
1597template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
1603 static_assert(
sizeof(A) ==
sizeof(AC),
"sizeof(Array4<T>) != sizeof(Array4<T const>)");
1604 if (!m_hp_arrays && local_size() > 0) {
1605 const int n = local_size();
1610 m_hp_arrays = (
void*)std::malloc(n*2*
sizeof(A));
1612 for (
int li = 0; li < n; ++li) {
1614 new ((A*)m_hp_arrays+li) A(m_fabs_v[li]->array());
1615 new ((AC*)m_hp_arrays+li+n) AC(m_fabs_v[li]->const_array());
1617 new ((A*)m_hp_arrays+li) A{};
1618 new ((AC*)m_hp_arrays+li+n) AC{};
1621 m_arrays.
hp = (A*)m_hp_arrays;
1622 m_const_arrays.
hp = (AC*)m_hp_arrays + n;
1624 m_arrays.
dp = (A*)m_dp_arrays;
1625 m_const_arrays.
dp = (AC*)m_dp_arrays + n;
1638 m_dp_arrays =
nullptr;
1640 std::free(m_hp_arrays);
1642 m_hp_arrays =
nullptr;
1643 m_arrays.
hp =
nullptr;
1644 m_const_arrays.
hp =
nullptr;
1652 const int li = localindex(K);
1653 if (li >= 0 && li <
static_cast<int>(m_fabs_v.size()) && m_fabs_v[li] !=
nullptr) {
1657 for (
auto const& t : m_tags) {
1658 updateMemUsage(t, -nbytes,
nullptr);
1661 return std::exchange(m_fabs_v[li],
nullptr);
1673 if (li >= 0 && li <
static_cast<int>(m_fabs_v.size()) && m_fabs_v[li] !=
nullptr) {
1677 for (
auto const& t : m_tags) {
1678 updateMemUsage(t, -nbytes,
nullptr);
1681 return std::exchange(m_fabs_v[li],
nullptr);
1691 if (define_function_called)
1693 define_function_called =
false;
1698 for (
auto *
x : m_fabs_v) {
1701 m_factory->destroy(
x);
1707 m_dallocator.
m_arena =
nullptr;
1711 for (
auto const& t : m_tags) {
1712 updateMemUsage(t, -nbytes,
nullptr);
1716 if (m_single_chunk_arena) {
1717 m_single_chunk_arena.reset();
1719 m_single_chunk_size = 0;
1727template <
typename SFAB,
typename DFAB,
1728 std::enable_if_t<std::conjunction_v<
1730 std::is_convertible<
typename SFAB::value_type,
1731 typename DFAB::value_type>>,
int>>
1736 amrex::Copy(*
this, src, scomp, dcomp, ncomp, nghost);
1740template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
1745 amrex::Add(*
this, src, scomp, dcomp, ncomp, nghost);
1749template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
1757template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
1761 setVal(val,0,n_comp,nghost);
1765template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
1773template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
1777 setVal(val,region,0,n_comp,nghost);
1784 m_FA_stats.recordBuild();
1792 m_FA_stats.recordBuild();
1812 : m_factory(factory.clone()),
1821 : m_factory(rhs.Factory().clone()),
1831 auto const& rhsfab = *(rhs.
m_fabs_v[i]);
1844 , m_factory (std::move(rhs.m_factory))
1845 , m_dallocator (std::move(rhs.m_dallocator))
1846 , m_single_chunk_arena(std::move(rhs.m_single_chunk_arena))
1847 , m_single_chunk_size(std::exchange(rhs.m_single_chunk_size,0))
1848 , define_function_called(rhs.define_function_called)
1849 , m_fabs_v (std::move(rhs.m_fabs_v))
1851 , m_dp_arrays (std::exchange(rhs.m_dp_arrays,
nullptr))
1853 , m_hp_arrays (std::exchange(rhs.m_hp_arrays,
nullptr))
1854 , m_arrays (rhs.m_arrays)
1855 , m_const_arrays(rhs.m_const_arrays)
1856 , m_tags (std::move(rhs.m_tags))
1857 , shmem (std::move(rhs.shmem))
1860 m_FA_stats.recordBuild();
1861 rhs.define_function_called =
false;
1862 rhs.m_fabs_v.clear();
1875 m_factory = std::move(rhs.m_factory);
1876 m_dallocator = std::move(rhs.m_dallocator);
1877 m_single_chunk_arena = std::move(rhs.m_single_chunk_arena);
1878 std::swap(m_single_chunk_size, rhs.m_single_chunk_size);
1879 define_function_called = rhs.define_function_called;
1880 std::swap(m_fabs_v, rhs.m_fabs_v);
1882 std::swap(m_dp_arrays, rhs.m_dp_arrays);
1884 std::swap(m_hp_arrays, rhs.m_hp_arrays);
1885 m_arrays = rhs.m_arrays;
1886 m_const_arrays = rhs.m_const_arrays;
1887 std::swap(m_tags, rhs.m_tags);
1888 shmem = std::move(rhs.shmem);
1890 rhs.define_function_called =
false;
1891 rhs.m_fabs_v.clear();
1901 m_FA_stats.recordDelete();
1909 if (!define_function_called) {
return false; }
1917 if (
get(fai).box() != fabbox(fai.index()))
1937 return define_function_called;
1949 define(bxs,dm,nvar,
IntVect(ngrow),info,a_factory);
1961 std::unique_ptr<FabFactory<FAB> > factory(a_factory.
clone());
1963 auto *default_arena = m_dallocator.
m_arena;
1966 m_factory = std::move(factory);
1969 define_function_called =
true;
1990 if (shmem.alloc) { alloc_single_chunk =
false; }
1991 if constexpr (!IsBaseFab_v<FAB>) { alloc_single_chunk =
false; }
1993 const int n = indexArray.size();
1995 shmem.alloc = (nworkers > 1);
1997 bool alloc = !shmem.alloc;
2002 if (alloc_single_chunk) {
2003 m_single_chunk_size = 0L;
2004 for (
int i = 0; i < n; ++i) {
2005 int K = indexArray[i];
2006 const Box& tmpbox = fabbox(K);
2007 m_single_chunk_size += factory.
nBytes(tmpbox, n_comp, K);
2010 m_single_chunk_arena = std::make_unique<detail::SingleChunkArena>(ar, m_single_chunk_size);
2011 fab_info.
SetArena(m_single_chunk_arena.get());
2014 m_fabs_v.reserve(n);
2017 for (
int i = 0; i < n; ++i)
2019 int K = indexArray[i];
2020 const Box& tmpbox = fabbox(K);
2021 m_fabs_v.push_back(factory.
create(tmpbox, n_comp, fab_info, K));
2026 m_tags.emplace_back(
"All");
2027 for (
auto const& t : m_region_tag) {
2028 m_tags.push_back(t);
2030 for (
auto const& t : tags) {
2031 m_tags.push_back(t);
2033 for (
auto const& t: m_tags) {
2034 updateMemUsage(t, nbytes, ar);
2046 for (
int i = 0; i < n; ++i) {
2047 int K = indexArray[i];
2048 int owner = distributionMap[K] - teamlead;
2049 Long s = m_fabs_v[i]->size();
2051 shmem.n_values += s;
2052 shmem.n_points += m_fabs_v[i]->numPts();
2054 if (nextoffset[owner] < 0) {
2056 nextoffset[owner] = s;
2058 offset[i] = nextoffset[owner];
2059 nextoffset[owner] += s;
2063 size_t bytes = shmem.n_values*
sizeof(
value_type);
2068#if defined (BL_USE_MPI3)
2070 static MPI_Info info = MPI_INFO_NULL;
2071 if (info == MPI_INFO_NULL) {
2072 MPI_Info_create(&info);
2073 MPI_Info_set(info,
"alloc_shared_noncontig",
"true");
2078 BL_MPI_REQUIRE( MPI_Win_allocate_shared(bytes,
sizeof(
value_type),
2079 info, team_comm, &mfp, &shmem.win) );
2081 for (
int w = 0; w < nworkers; ++w) {
2085 BL_MPI_REQUIRE( MPI_Win_shared_query(shmem.win, w, &sz, &disp, &dptr) );
2087 dps.push_back(dptr);
2092 amrex::Abort(
"BaseFab::define: to allocate shared memory, USE_MPI3 must be true");
2096 for (
int i = 0; i < n; ++i) {
2097 int K = indexArray[i];
2098 int owner = distributionMap[K] - teamlead;
2100 m_fabs_v[i]->setPtr(p, m_fabs_v[i]->size());
2103 for (Long i = 0; i < shmem.n_values; i++, mfp++) {
2129 n_comp = elem->nComp();
2132 setFab_assert(boxno, *elem);
2134 if (m_fabs_v.empty()) {
2135 m_fabs_v.resize(indexArray.size(),
nullptr);
2138 const int li = localindex(boxno);
2140 m_factory->destroy(m_fabs_v[li]);
2142 m_fabs_v[li] = elem.release();
2146template <
class F, std::enable_if_t<std::is_move_constructible_v<F>,
int> >
2151 n_comp = elem.nComp();
2154 setFab_assert(boxno, elem);
2156 if (m_fabs_v.empty()) {
2157 m_fabs_v.resize(indexArray.size(),
nullptr);
2160 const int li = localindex(boxno);
2162 m_factory->destroy(m_fabs_v[li]);
2164 m_fabs_v[li] =
new FAB(std::move(elem));
2172 n_comp = elem->nComp();
2175 setFab_assert(mfi.
index(), *elem);
2177 if (m_fabs_v.empty()) {
2178 m_fabs_v.resize(indexArray.size(),
nullptr);
2183 m_factory->destroy(m_fabs_v[li]);
2185 m_fabs_v[li] = elem.release();
2189template <
class F, std::enable_if_t<std::is_move_constructible_v<F>,
int> >
2194 n_comp = elem.nComp();
2197 setFab_assert(mfi.
index(), elem);
2199 if (m_fabs_v.empty()) {
2200 m_fabs_v.resize(indexArray.size(),
nullptr);
2205 m_factory->destroy(m_fabs_v[li]);
2207 m_fabs_v[li] =
new FAB(std::move(elem));
2211template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
2219template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2225 if (n_grow.max() > 0)
2229 bool use_mfparfor =
true;
2230 const int nboxes = local_size();
2232 if (boxarray[indexArray[0]].numPts() > Long(65*65*65)) {
2233 use_mfparfor =
false;
2236 for (
int i = 0; i < nboxes; ++i) {
2237 const Long npts = boxarray[indexArray[i]].numPts();
2238 if (npts >= Long(64*64*64)) {
2239 use_mfparfor =
false;
2241 }
else if (npts <= Long(17*17*17)) {
2246 const IntVect nghost = n_grow;
2248 auto const& ma = this->arrays();
2252 auto const& a = ma[box_no];
2256 for (
int n = 0; n < ncomp; ++n) {
2257 a(i,j,k,strt_comp+n) = val;
2266 Box const& vbx = mfi.validbox();
2267 auto const& a = this->array(mfi);
2270#if (AMREX_SPACEDIM == 3)
2271 if (nghost[2] > 0) {
2275 tags.emplace_back(Tag{a,
b});
2276 b.shift(2, vbx.
length(2)+nghost[2]);
2277 tags.emplace_back(Tag{a,
b});
2280#if (AMREX_SPACEDIM >= 2)
2281 if (nghost[1] > 0) {
2284 b.
grow(0, nghost[0]);
2285 tags.emplace_back(Tag{a,
b});
2286 b.shift(1, vbx.
length(1)+nghost[1]);
2287 tags.emplace_back(Tag{a,
b});
2290 if (nghost[0] > 0) {
2293 tags.emplace_back(Tag{a,
b});
2294 b.shift(0, vbx.
length(0)+nghost[0]);
2295 tags.emplace_back(Tag{a,
b});
2302 tag.dfab(i,j,k,strt_comp+n) = val;
2313 get(fai).template setComplement<RunOn::Host>(val, fai.validbox(), strt_comp, ncomp);
2320template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
2324 setDomainBndry(val, 0, n_comp, geom);
2328template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
2338 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
2340 int n = domain_box.
length(idim);
2341 domain_box.
grow(idim, n);
2346#pragma omp parallel if (Gpu::notInLaunchRegion())
2350 const Box& gbx = fai.fabbox();
2353 get(fai).template setComplement<RunOn::Device>(val, domain_box, strt_comp, ncomp);
2359template <class F, std::enable_if_t<IsBaseFab<F>::value,
int> FOO>
2360typename F::value_type
2365 using T =
typename FAB::value_type;
2369 auto const& ma = this->const_arrays();
2374 return ma[box_no](i,j,k,comp);
2380#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
2384 Box const& bx = mfi.growntilebox(nghost);
2385 auto const& a = this->const_array(mfi);
2389 tmp += a(i,j,k,comp);
2406 copyTo(dest, 0, 0, dest.nComp(), nghost);
2410template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
2414 setVal(val,0,n_comp,n_grow);
2418template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
2427template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
2438template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2452 auto const& fa = this->arrays();
2456 fa[box_no](i,j,k,n+comp) = val;
2465#pragma omp parallel if (Gpu::notInLaunchRegion())
2469 const Box& bx = fai.growntilebox(nghost);
2470 auto fab = this->array(fai);
2473 fab(i,j,k,n+comp) = val;
2480template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
2492template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2503 BL_PROFILE(
"FabArray::setVal(val,region,comp,ncomp,nghost)");
2507 auto const& fa = this->arrays();
2512 fa[box_no](i,j,k,n+comp) = val;
2523#pragma omp parallel if (Gpu::notInLaunchRegion())
2527 Box b = fai.growntilebox(nghost) & region;
2530 auto fab = this->array(fai);
2533 fab(i,j,k,n+comp) = val;
2541template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
2549template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2559 auto const& fa = this->arrays();
2563 fa[box_no](i,j,k,n+comp) = std::abs(fa[box_no](i,j,k,n+comp));
2572#pragma omp parallel if (Gpu::notInLaunchRegion())
2576 const Box& bx = mfi.growntilebox(nghost);
2577 auto fab = this->array(mfi);
2580 fab(i,j,k,n+comp) = std::abs(fab(i,j,k,n+comp));
2587template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2595 auto const& fa = this->arrays();
2599 fa[box_no](i,j,k,n+comp) += val;
2608#pragma omp parallel if (Gpu::notInLaunchRegion())
2612 const Box& bx = mfi.growntilebox(nghost);
2613 auto fab = this->array(mfi);
2616 fab(i,j,k,n+comp) += val;
2623template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2627 BL_PROFILE(
"FabArray::plus(val, region, comp, num_comp, nghost)");
2631 auto const& fa = this->arrays();
2636 fa[box_no](i,j,k,n+comp) += val;
2646#pragma omp parallel if (Gpu::notInLaunchRegion())
2650 const Box& bx = mfi.growntilebox(nghost) & region;
2652 auto fab = this->array(mfi);
2655 fab(i,j,k,n+comp) += val;
2663template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2671 auto const& fa = this->arrays();
2675 fa[box_no](i,j,k,n+comp) *= val;
2684#pragma omp parallel if (Gpu::notInLaunchRegion())
2688 const Box& bx = mfi.growntilebox(nghost);
2689 auto fab = this->array(mfi);
2692 fab(i,j,k,n+comp) *= val;
2699template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2703 BL_PROFILE(
"FabArray::mult(val, region, comp, num_comp, nghost)");
2707 auto const& fa = this->arrays();
2712 fa[box_no](i,j,k,n+comp) *= val;
2722#pragma omp parallel if (Gpu::notInLaunchRegion())
2726 const Box& bx = mfi.growntilebox(nghost) & region;
2728 auto fab = this->array(mfi);
2731 fab(i,j,k,n+comp) *= val;
2739template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2747 auto const& fa = this->arrays();
2751 fa[box_no](i,j,k,n+comp) = numerator / fa[box_no](i,j,k,n+comp);
2760#pragma omp parallel if (Gpu::notInLaunchRegion())
2764 const Box& bx = mfi.growntilebox(nghost);
2765 auto fab = this->array(mfi);
2768 fab(i,j,k,n+comp) = numerator / fab(i,j,k,n+comp);
2775template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
2779 BL_PROFILE(
"FabArray::invert(numerator, region, comp, num_comp, nghost)");
2783 auto const& fa = this->arrays();
2788 fa[box_no](i,j,k,n+comp) = numerator / fa[box_no](i,j,k,n+comp);
2798#pragma omp parallel if (Gpu::notInLaunchRegion())
2802 const Box& bx = mfi.growntilebox(nghost) & region;
2804 auto fab = this->array(mfi);
2807 fab(i,j,k,n+comp) = numerator / fab(i,j,k,n+comp);
2832template <class F, std::enable_if_t<IsBaseFab<F>::value,
int> FOO>
2834 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
2844 auto const& yma = y.
arrays();
2845 auto const& xma =
x.const_arrays();
2849 yma[box_no](i,j,k,ycomp+n) += a * xma[box_no](i,j,k,xcomp+n);
2858#pragma omp parallel if (Gpu::notInLaunchRegion())
2862 const Box& bx = mfi.growntilebox(nghost);
2865 auto const& xfab =
x.const_array(mfi);
2866 auto const& yfab = y.
array(mfi);
2869 yfab(i,j,k,ycomp+n) += a * xfab(i,j,k,xcomp+n);
2877template <class F, std::enable_if_t<IsBaseFab<F>::value,
int> FOO>
2880 int xcomp,
int ycomp,
int ncomp,
IntVect const& nghost)
2890 auto const& yfa = y.
arrays();
2891 auto const& xfa =
x.const_arrays();
2895 yfa[box_no](i,j,k,n+ycomp) = xfa[box_no](i,j,k,n+xcomp)
2896 + a * yfa[box_no](i,j,k,n+ycomp);
2905#pragma omp parallel if (Gpu::notInLaunchRegion())
2909 const Box& bx = mfi.growntilebox(nghost);
2910 auto const& xFab =
x.const_array(mfi);
2911 auto const& yFab = y.
array(mfi);
2914 yFab(i,j,k,n+ycomp) = xFab(i,j,k,n+xcomp)
2915 + a * yFab(i,j,k,n+ycomp);
2922template <class F, std::enable_if_t<IsBaseFab<F>::value,
int> FOO>
2927 int dstcomp,
int numcomp,
const IntVect& nghost)
2939 auto const& dstma = dst.
arrays();
2940 auto const& xma =
x.const_arrays();
2945 dstma[box_no](i,j,k,dstcomp+n) = a*xma[box_no](i,j,k,xcomp+n)
2946 +
b*yma[box_no](i,j,k,ycomp+n);
2955#pragma omp parallel if (Gpu::notInLaunchRegion())
2959 const Box& bx = mfi.growntilebox(nghost);
2960 auto const& xfab =
x.const_array(mfi);
2962 auto const& dfab = dst.
array(mfi);
2965 dfab(i,j,k,dstcomp+n) = a*xfab(i,j,k,xcomp+n) +
b*yfab(i,j,k,ycomp+n);
2972template <
typename BUF>
2977 if ( n_grow.max() > 0 ) {
2979 FillBoundary_finish<BUF>();
2984template <
typename BUF>
2989 if ( n_grow.max() > 0 ) {
2990 FillBoundary_nowait<BUF>(0,
nComp(), n_grow, period, cross);
2991 FillBoundary_finish<BUF>();
2996template <
typename BUF>
3002 "FillBoundary: asked to fill more ghost cells than we have");
3003 if ( nghost.
max() > 0 ) {
3004 FillBoundary_nowait<BUF>(0,
nComp(), nghost, period, cross);
3005 FillBoundary_finish<BUF>();
3010template <
typename BUF>
3015 if ( n_grow.max() > 0 ) {
3017 FillBoundary_finish<BUF>();
3022template <
typename BUF>
3027 if ( n_grow.max() > 0 ) {
3028 FillBoundary_nowait<BUF>(scomp, ncomp, n_grow, period, cross);
3029 FillBoundary_finish<BUF>();
3034template <
typename BUF>
3041 "FillBoundary: asked to fill more ghost cells than we have");
3042 if ( nghost.
max() > 0 ) {
3043 FillBoundary_nowait<BUF>(scomp, ncomp, nghost, period, cross);
3044 FillBoundary_finish<BUF>();
3049template <
typename BUF>
3057template <
typename BUF>
3061 FillBoundary_nowait<BUF>(0,
nComp(),
nGrowVect(), period, cross);
3065template <
typename BUF>
3069 FillBoundary_nowait<BUF>(0,
nComp(), nghost, period, cross);
3073template <
typename BUF>
3084 BL_PROFILE(
"FabArray::FillBoundaryAndSync()");
3085 if (n_grow.max() > 0 || !is_cell_centered()) {
3086 FillBoundaryAndSync_nowait(0,
nComp(), n_grow, period);
3087 FillBoundaryAndSync_finish();
3096 BL_PROFILE(
"FabArray::FillBoundaryAndSync()");
3097 if (nghost.
max() > 0 || !is_cell_centered()) {
3098 FillBoundaryAndSync_nowait(scomp, ncomp, nghost, period);
3099 FillBoundaryAndSync_finish();
3116 FBEP_nowait(scomp, ncomp, nghost, period,
false,
false,
true);
3124 FillBoundary_finish();
3132 if (!is_cell_centered()) {
3143 if (!is_cell_centered()) {
3161 FBEP_nowait(scomp, ncomp,
IntVect(0), period,
false,
false,
true);
3169 FillBoundary_finish();
3176 SumBoundary(0, n_comp,
IntVect(0), period);
3183 SumBoundary(scomp, ncomp,
IntVect(0), period);
3190 SumBoundary(scomp, ncomp, this->
nGrowVect(), nghost, period);
3199 SumBoundary_nowait(scomp, ncomp, src_nghost, dst_nghost, period);
3200 SumBoundary_finish();
3207 SumBoundary_nowait(0, n_comp,
IntVect(0), period);
3214 SumBoundary_nowait(scomp, ncomp,
IntVect(0), period);
3221 SumBoundary_nowait(scomp, ncomp, this->
nGrowVect(), nghost, period);
3228 BL_PROFILE(
"FabArray<FAB>::SumBoundary_nowait()");
3235 amrex::Copy(*tmp, *
this, scomp, 0, ncomp, src_nghost);
3236 this->
setVal(
typename FAB::value_type(0), scomp, ncomp, dst_nghost);
3237 this->ParallelCopy_nowait(*tmp,0,scomp,ncomp,src_nghost,dst_nghost,period,
FabArrayBase::ADD);
3240 if (!this->pcd) {
delete tmp; }
3247 BL_PROFILE(
"FabArray<FAB>::SumBoundary_finish()");
3253 this->ParallelCopy_finish();
3264 FillBoundary_finish();
3274 FBEP_nowait(scomp, ncomp,
nGrowVect(), period,
false,
true);
3275 FillBoundary_finish();
3286 FBEP_nowait(scomp, ncomp, nghost, period,
false,
true);
3287 FillBoundary_finish();
3292template <
typename BUF>
3296 FBEP_nowait<BUF>(scomp, ncomp,
nGrowVect(), period, cross);
3300template <
typename BUF>
3305 FBEP_nowait<BUF>(scomp, ncomp, nghost, period, cross);
3309template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>Z>
3317 int ncomp = this->
nComp();
3321 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
3323 domain.
grow(i, ngrow[i]);
3329 auto const& fa = this->arrays();
3333 auto const& fab = fa[box_no];
3337 fab(i,j,k,n) = interior;
3338 }
else if (domain.
contains(i,j,k)) {
3339 fab(i,j,k,n) = notcovered;
3341 fab(i,j,k,n) = physbnd;
3351#pragma omp parallel if (Gpu::notInLaunchRegion())
3355 auto const& fab = this->array(mfi);
3356 Box const& fbx = mfi.growntilebox();
3357 Box const& gbx = fbx & domain;
3358 Box const& vbx = mfi.validbox();
3362 fab(i,j,k,n) = interior;
3364 fab(i,j,k,n) = notcovered;
3366 fab(i,j,k,n) = physbnd;
3377template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
3381 BL_PROFILE(
"FabArray::setVal(val, thecmd, scomp, ncomp)");
3386 CMD_local_setVal_gpu(val, thecmd, scomp, ncomp);
3387 CMD_remote_setVal_gpu(val, thecmd, scomp, ncomp);
3395 auto N_locs =
static_cast<int>(LocTags.size());
3397#pragma omp parallel for if (thecmd.m_threadsafe_loc)
3399 for (
int i = 0; i < N_locs; ++i) {
3401 (*this)[tag.
dstIndex].template setVal<RunOn::Host>(val, tag.
dbox, scomp, ncomp);
3404 for (
const auto & RcvTag : RcvTags) {
3405 auto N =
static_cast<int>(RcvTag.second.size());
3407#pragma omp parallel for if (thecmd.m_threadsafe_rcv)
3409 for (
int i = 0; i < N; ++i) {
3411 (*this)[tag.
dstIndex].template setVal<RunOn::Host>(val, tag.
dbox, scomp, ncomp);
3418template <class F, std::enable_if_t<IsBaseFab<F>::value,
int>>
3426#pragma omp parallel if (thecmd.m_threadsafe_rcv)
3435 auto N_locs =
static_cast<int>(LocTags.size());
3436 for (
int i = 0; i < N_locs; ++i) {
3441 for (
const auto & RcvTag : RcvTags) {
3442 auto N =
static_cast<int>(RcvTag.second.size());
3443 for (
int i = 0; i < N; ++i) {
3452template <typename F, std::enable_if_t<IsBaseFab<F>::value,
int> FOO>
3453typename F::value_type
3455 [[maybe_unused]]
bool ignore_covered)
const
3459 using RT =
typename F::value_type;
3464 if ( this->is_cell_centered() && this->hasEBFabFactory() && ignore_covered )
3470 auto const& flagsma = flags.const_arrays();
3471 auto const& ma = this->const_arrays();
3475 if (flagsma[box_no](i,j,k).isCovered()) {
3479 auto const& a = ma[box_no];
3480 for (
int n = 0; n < ncomp; ++n) {
3481 tmp =
amrex::max(tmp, std::abs(a(i,j,k,comp+n)));
3490#pragma omp parallel reduction(max:nm0)
3493 Box const& bx = mfi.growntilebox(nghost);
3495 auto const& flag = flags.const_array(mfi);
3496 auto const& a = this->const_array(mfi);
3499 if (!flag(i,j,k).isCovered()) {
3500 nm0 = std::max(nm0, std::abs(a(i,j,k,comp+n)));
3512 auto const& ma = this->const_arrays();
3516 return std::abs(ma[box_no](i,j,k,comp+n));
3522#pragma omp parallel reduction(max:nm0)
3525 Box const& bx = mfi.growntilebox(nghost);
3526 auto const& a = this->const_array(mfi);
3529 nm0 = std::max(nm0, std::abs(a(i,j,k,comp+n)));
3543template <typename IFAB, typename F, std::enable_if_t<IsBaseFab<F>::value,
int> FOO>
3544typename F::value_type
3546 IntVect const& nghost,
bool local)
const
3550 using RT =
typename F::value_type;
3556 auto const& ma = this->const_arrays();
3557 auto const& maskma =
mask.const_arrays();
3561 if (maskma[box_no](i,j,k)) {
3563 auto const& a = ma[box_no];
3564 for (
int n = 0; n < ncomp; ++n) {
3565 tmp =
amrex::max(tmp, std::abs(a(i,j,k,comp+n)));
3576#pragma omp parallel reduction(max:nm0)
3579 Box const& bx = mfi.growntilebox(nghost);
3580 auto const& a = this->const_array(mfi);
3581 auto const& mskfab =
mask.const_array(mfi);
3584 if (mskfab(i,j,k)) {
3585 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:251
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_RESTRICT
Definition AMReX_Extension.H:37
#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:1089
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
int MPI_Comm
Definition AMReX_ccse-mpi.H:47
if(!(yy_init))
Definition amrex_iparser.lex.nolint.H:935
A virtual base class for objects that manage their own dynamic memory allocation.
Definition AMReX_Arena.H:100
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:183
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:550
AMREX_GPU_HOST_DEVICE IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:146
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & smallEnd() const &noexcept
Get the smallend of the BoxND.
Definition AMReX_Box.H:105
AMREX_GPU_HOST_DEVICE BoxND & grow(int i) noexcept
Definition AMReX_Box.H:627
AMREX_GPU_HOST_DEVICE bool ok() const noexcept
Checks if it is a proper BoxND (including a valid type).
Definition AMReX_Box.H:200
AMREX_GPU_HOST_DEVICE bool contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is contained within BoxND.
Definition AMReX_Box.H:204
AMREX_GPU_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:1046
Definition AMReX_FabFactory.H:76
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:41
Definition AMReX_EBFabFactory.H:24
const FabArray< EBCellFlagFab > & getMultiEBCellFlagFab() const noexcept
Definition AMReX_EBFabFactory.H:50
bool isAllRegular() const noexcept
Definition AMReX_EBFabFactory.cpp:148
Base class for FabArray.
Definition AMReX_FabArrayBase.H:41
IntVect nGrowVect() const noexcept
Definition AMReX_FabArrayBase.H:79
Vector< int > indexArray
Definition AMReX_FabArrayBase.H:445
static bool getAllocSingleChunk()
Definition AMReX_FabArrayBase.H:727
bool isFusingCandidate() const noexcept
Is this a good candidate for kernel fusing?
FabArrayBase & operator=(const FabArrayBase &rhs)=default
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, int ngrow)
CopyComTag::CopyComTagsContainer CopyComTagsContainer
Definition AMReX_FabArrayBase.H:219
CopyComTag::MapOfCopyComTagContainers MapOfCopyComTagContainers
Definition AMReX_FabArrayBase.H:220
const DistributionMapping & DistributionMap() const noexcept
Return constant reference to associated DistributionMapping.
Definition AMReX_FabArrayBase.H:130
int local_size() const noexcept
Return the number of local FABs in the FabArray.
Definition AMReX_FabArrayBase.H:112
CpOp
parallel copy or add
Definition AMReX_FabArrayBase.H:393
@ ADD
Definition AMReX_FabArrayBase.H:393
@ COPY
Definition AMReX_FabArrayBase.H:393
DistributionMapping distributionMap
Definition AMReX_FabArrayBase.H:444
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:82
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:94
static AMREX_EXPORT FabArrayStats m_FA_stats
Definition AMReX_FabArrayBase.H:723
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:344
void ParallelCopyToGhost_finish()
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:2126
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:1004
void setFab(const MFIter &mfi, FAB &&elem)
Explicitly set the FAB associated with mfi in the FabArray to point to elem.
Definition AMReX_FabArray.H:2191
F::value_type sum(int comp, IntVect const &nghost, bool local=false) const
Returns the sum of component "comp".
Definition AMReX_FabArray.H:2361
void EnforcePeriodicity(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Definition AMReX_FabArray.H:3281
void abs(int comp, int ncomp, int nghost=0)
Definition AMReX_FabArray.H:2543
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:1015
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:584
void * m_dp_arrays
Definition AMReX_FabArray.H:1344
void FBEP_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross, bool enforce_periodicity_only=false, bool override_sync=false)
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)
void ParallelCopy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:840
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:2169
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:1474
void FillBoundary(const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:2998
const FabFactory< FAB > & Factory() const noexcept
Definition AMReX_FabArray.H:442
void mult(value_type val, const Box ®ion, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2701
void invert(value_type numerator, const Box ®ion, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2777
void prefetchToDevice(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:550
void FillBoundary_nowait(const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3059
void shift(const IntVect &v)
Shift the boxarray by vector v.
Definition AMReX_FabArray.H:2816
bool ok() const
Return true if the FabArray is well-defined. That is, the FabArray has a BoxArray and DistributionMap...
Definition AMReX_FabArray.H:1907
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi, int start_comp) const noexcept
Definition AMReX_FabArray.H:596
const FAB & operator[](const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:506
void CMD_local_setVal_gpu(value_type x, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FBI.H:332
void CMD_remote_setVal_gpu(value_type x, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FBI.H:362
void ParallelAdd_nowait(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:851
void setDomainBndry(value_type val, int strt_comp, int ncomp, const Geometry &geom)
Set ncomp values outside the Geometry domain to val, starting at start_comp.
Definition AMReX_FabArray.H:2330
FabArray(FabArray< FAB > &&rhs) noexcept
Definition AMReX_FabArray.H:1842
Array4< typename FabArray< FAB >::value_type const > array(int K, int start_comp) const noexcept
Definition AMReX_FabArray.H:608
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:1806
bool defined(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:1547
void setVal(value_type val, const CommMetaData &thecmd, int scomp, int ncomp)
Definition AMReX_FabArray.H:3379
void setVal(value_type val, const Box ®ion, int comp, int ncomp, const IntVect &nghost)
Definition AMReX_FabArray.H:2494
void OverrideSync_nowait(int scomp, int ncomp, const Periodicity &period)
Definition AMReX_FabArray.H:3158
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())
void FillBoundary_test()
Definition AMReX_FabArrayCommI.H:886
void ParallelCopy_finish()
void setVal(value_type val, const Box ®ion, int comp, int ncomp, int nghost=0)
Set the value of num_comp components in the valid region of each FAB in the FabArray,...
Definition AMReX_FabArray.H:2482
FAB & get(int K) noexcept
Return a reference to the FAB associated with the Kth element.
Definition AMReX_FabArray.H:527
void setVal(value_type val, int comp, int ncomp, const IntVect &nghost)
Definition AMReX_FabArray.H:2440
void OverrideSync(const Periodicity &period=Periodicity::NonPeriodic())
Synchronize nodal data. The synchronization will override valid regions by the intersecting valid reg...
Definition AMReX_FabArray.H:3129
void FillBoundary(bool cross=false)
Copy on intersection within a FabArray. Data is copied from valid regions to intersecting regions of ...
Definition AMReX_FabArray.H:2974
FAB const * fabPtr(int K) const noexcept
Definition AMReX_FabArray.H:1589
void abs(int comp, int ncomp, const IntVect &nghost)
Definition AMReX_FabArray.H:2551
void clear_arrays()
Definition AMReX_FabArray.H:1633
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:922
void SumBoundary(const Periodicity &period=Periodicity::NonPeriodic())
Sum values in overlapped cells. The destination is limited to valid cells.
Definition AMReX_FabArray.H:3174
Long m_single_chunk_size
Definition AMReX_FabArray.H:1334
FAB & get(const MFIter &mfi) noexcept
Returns a reference to the FAB associated mfi.
Definition AMReX_FabArray.H:515
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:2924
void OverrideSync_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3151
AMREX_NODISCARD FAB * release(const MFIter &mfi)
Release ownership of the FAB. This function is not thread safe.
Definition AMReX_FabArray.H:1670
AMREX_NODISCARD FAB * release(int K)
Release ownership of the FAB. This function is not thread safe.
Definition AMReX_FabArray.H:1650
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:3454
void setDomainBndry(value_type val, const Geometry &geom)
Set all values outside the Geometry domain to val.
Definition AMReX_FabArray.H:2322
std::unique_ptr< PCData< FAB > > pcd
Definition AMReX_FabArray.H:1471
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:1942
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:951
std::unique_ptr< FBData< FAB > > fbd
Definition AMReX_FabArray.H:1470
std::unique_ptr< detail::SingleChunkArena > m_single_chunk_arena
Definition AMReX_FabArray.H:1333
FabArray(const FabArray< FAB > &rhs, MakeType maketype, int scomp, int ncomp)
Definition AMReX_FabArray.H:1820
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:837
FAB fab_type
Definition AMReX_FabArray.H:357
void setVal(value_type val, const IntVect &nghost)
Definition AMReX_FabArray.H:1759
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:3311
void OverrideSync(int scomp, int ncomp, const Periodicity &period)
Synchronize nodal data. The synchronization will override valid regions by the intersecting valid reg...
Definition AMReX_FabArray.H:3140
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:1733
bool SharedMemory() const noexcept
Definition AMReX_FabArray.H:1402
LayoutData< int > RecvLayoutMask(const CommMetaData &thecmd)
Definition AMReX_FabArray.H:3420
void FillBoundary(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3036
void FillBoundary_nowait(const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3067
Vector< std::string > m_tags
Definition AMReX_FabArray.H:1350
void ParallelCopyToGhost_nowait(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic())
void FB_local_copy_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:211
void invert(value_type numerator, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2741
void FB_local_copy_gpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:272
static void unpack_recv_buffer_cpu(FabArray< FAB > &dst, int dcomp, int ncomp, Vector< char * > const &recv_data, Vector< std::size_t > const &recv_size, Vector< const CopyComTagsContainer * > const &recv_cctc, CpOp op, bool is_thread_safe)
void ParallelAdd_nowait(const FabArray< FAB > &src, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:890
void PC_local_gpu(const CPC &thecpc, FabArray< FAB > const &src, int scomp, int dcomp, int ncomp, CpOp op)
Definition AMReX_PCI.H:88
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:560
Arena * arena() const noexcept
Definition AMReX_FabArray.H:445
void setFab_assert(int K, FAB const &fab) const
Definition AMReX_FabArray.H:2114
Array4< typename FabArray< FAB >::value_type const > const_array(int K) const noexcept
Definition AMReX_FabArray.H:590
void plus(value_type val, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2589
DataAllocator m_dallocator
Definition AMReX_FabArray.H:1332
void FillBoundaryAndSync(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Fill ghost cells and synchronize nodal data. Ghost regions are filled with data from the intersecting...
Definition AMReX_FabArray.H:3093
void copy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:846
void FillBoundaryAndSync_finish()
Definition AMReX_FabArray.H:3121
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:961
void SumBoundary_nowait(int scomp, int ncomp, IntVect const &src_nghost, IntVect const &dst_nghost, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3226
void SumBoundary_nowait(int scomp, int ncomp, IntVect const &nghost, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3219
void FillBoundary_nowait(bool cross=false)
Definition AMReX_FabArray.H:3051
void FillBoundary(const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:2986
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:2879
void clear()
Releases FAB memory in the FabArray.
Definition AMReX_FabArray.H:1689
void FillBoundary_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3302
const Vector< std::string > & tags() const noexcept
Definition AMReX_FabArray.H:447
void FillBoundary(int scomp, int ncomp, bool cross=false)
Same as FillBoundary(), but only copies ncomp components starting at scomp.
Definition AMReX_FabArray.H:3012
void FillBoundary_nowait(int scomp, int ncomp, bool cross=false)
Definition AMReX_FabArray.H:3075
Array4< typename FabArray< FAB >::value_type > array(const MFIter &mfi) noexcept
Definition AMReX_FabArray.H:566
value_type * singleChunkPtr() noexcept
Definition AMReX_FabArray.H:460
std::vector< FAB * > m_fabs_v
The data.
Definition AMReX_FabArray.H:1341
void setBndry(value_type val)
Set all values in the boundary region to val.
Definition AMReX_FabArray.H:2213
void SumBoundary(int scomp, int ncomp, IntVect const &nghost, const Periodicity &period=Periodicity::NonPeriodic())
Sum values in overlapped cells. The destination is limited to valid + ngrow cells.
Definition AMReX_FabArray.H:3188
void FillBoundaryAndSync(const Periodicity &period=Periodicity::NonPeriodic())
Fill ghost cells and synchronize nodal data. Ghost regions are filled with data from the intersecting...
Definition AMReX_FabArray.H:3082
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:914
bool define_function_called
has define() been called?
Definition AMReX_FabArray.H:1337
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:867
FabArray() noexcept
Constructs an empty FabArray<FAB>.
Definition AMReX_FabArray.H:1781
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)
bool defined(int K) const noexcept
Definition AMReX_FabArray.H:1534
FAB * fabPtr(int K) noexcept
Definition AMReX_FabArray.H:1580
void SumBoundary(int scomp, int ncomp, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3181
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:905
const FAB & atLocalIdx(int L) const noexcept
Definition AMReX_FabArray.H:531
std::unique_ptr< FabFactory< FAB > > m_factory
Definition AMReX_FabArray.H:1331
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:859
void setVal(value_type val)
Set all components in the entire region of each FAB to val.
Definition AMReX_FabArray.H:2412
void setVal(value_type val, int comp, int ncomp, int nghost=0)
Set the value of num_comp components in the valid region of each FAB in the FabArray,...
Definition AMReX_FabArray.H:2429
typename std::vector< FAB * >::iterator Iterator
Definition AMReX_FabArray.H:1405
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:882
MultiArray4< typename FabArray< FAB >::value_type > arrays() noexcept
Definition AMReX_FabArray.H:632
MultiArray4< typename FabArray< FAB >::value_type const > arrays() const noexcept
Definition AMReX_FabArray.H:639
void setVal(value_type val, int nghost)
Set all components in the valid region of each FAB in the FabArray to val, including nghost boundary ...
Definition AMReX_FabArray.H:1751
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:2404
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:941
void setBndry(value_type val, int strt_comp, int ncomp)
Set ncomp values in the boundary region, starting at start_comp to val.
Definition AMReX_FabArray.H:2221
void SumBoundary(int scomp, int ncomp, IntVect const &src_nghost, IntVect const &dst_nghost, const Periodicity &period=Periodicity::NonPeriodic())
Sum values in overlapped cells. For computing the overlap, the dst is grown by dst_ngrow,...
Definition AMReX_FabArray.H:3195
void setVal(value_type val, const Box ®ion, const IntVect &nghost)
Definition AMReX_FabArray.H:1775
void FillBoundary_nowait(int scomp, int ncomp, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3294
const FAB & get(const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:509
void SumBoundary_finish()
Definition AMReX_FabArray.H:3245
void SumBoundary_nowait(int scomp, int ncomp, const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3212
std::size_t singleChunkSize() const noexcept
Definition AMReX_FabArray.H:472
void mult(value_type val, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2665
void ParallelCopy_nowait(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY, const FabArrayBase::CPC *a_cpc=nullptr, bool to_ghost_cells_only=false)
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:2833
MultiArray4< value_type > m_arrays
Definition AMReX_FabArray.H:1347
void AllocFabs(const FabFactory< FAB > &factory, Arena *ar, const Vector< std::string > &tags, bool alloc_single_chunk)
Definition AMReX_FabArray.H:1987
void FillBoundaryAndSync_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3105
Array4< typename FabArray< FAB >::value_type const > const_array(int K, int start_comp) const noexcept
Definition AMReX_FabArray.H:626
void FillBoundaryAndSync_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period)
Definition AMReX_FabArray.H:3112
Array4< typename FabArray< FAB >::value_type > array(int K) noexcept
Definition AMReX_FabArray.H:578
void * m_hp_arrays
Definition AMReX_FabArray.H:1346
ShMem shmem
Definition AMReX_FabArray.H:1400
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:1742
void setFab(int boxno, FAB &&elem)
Explicitly set the Kth FAB in the FabArray to point to elem.
Definition AMReX_FabArray.H:2148
FabArray< FAB > & operator=(FabArray< FAB > &&rhs) noexcept
Definition AMReX_FabArray.H:1868
MultiArray4< value_type const > m_const_arrays
Definition AMReX_FabArray.H:1348
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:873
bool hasEBFabFactory() const noexcept
Definition AMReX_FabArray.H:449
Array4< typename FabArray< FAB >::value_type const > array(int K) const noexcept
Definition AMReX_FabArray.H:572
bool isAllRegular() const noexcept
Definition AMReX_FabArray.H:474
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi, int start_comp) const noexcept
Definition AMReX_FabArray.H:620
void plus(value_type val, const Box ®ion, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2625
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)
void build_arrays() const
Definition AMReX_FabArray.H:1599
void SumBoundary_nowait(const Periodicity &period=Periodicity::NonPeriodic())
Definition AMReX_FabArray.H:3205
void ParallelCopy(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY, const FabArrayBase::CPC *a_cpc=nullptr)
FAB * fabPtr(const MFIter &mfi) noexcept
Return pointer to FAB.
Definition AMReX_FabArray.H:1560
Array4< typename FabArray< FAB >::value_type > array(const MFIter &mfi, int start_comp) noexcept
Definition AMReX_FabArray.H:602
void copyTo(FAB &dest, int scomp, int dcomp, int ncomp, int nghost=0) const
Copy the values contained in the intersection of the num_comp component valid + nghost region of this...
void EnforcePeriodicity(const Periodicity &period)
Fill ghost cells with values from their corresponding cells across periodic boundaries,...
Definition AMReX_FabArray.H:3259
void OverrideSync_finish()
Definition AMReX_FabArray.H:3166
void FillBoundary(int scomp, int ncomp, const Periodicity &period, bool cross=false)
Definition AMReX_FabArray.H:3024
MultiArray4< typename FabArray< FAB >::value_type const > const_arrays() const noexcept
Definition AMReX_FabArray.H:646
void prefetchToHost(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:540
FAB & atLocalIdx(int L) noexcept
Return a reference to the FAB associated with local index L.
Definition AMReX_FabArray.H:530
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:1954
F::value_type norminf(FabArray< IFAB > const &mask, int comp, int ncomp, IntVect const &nghost, bool local=false) const
Return infinity norm in masked region.
Definition AMReX_FabArray.H:3545
void ParallelCopy_nowait(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:854
void EnforcePeriodicity(int scomp, int ncomp, const Periodicity &period)
Definition AMReX_FabArray.H:3270
void PC_local_cpu(const CPC &thecpc, FabArray< FAB > const &src, int scomp, int dcomp, int ncomp, CpOp op)
Definition AMReX_PCI.H:6
const FAB & get(int K) const noexcept
Return a constant reference to the FAB associated with the Kth element.
Definition AMReX_FabArray.H:521
void FillBoundary_finish()
FAB const * fabPtr(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:1570
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:896
Array4< typename FabArray< FAB >::value_type > array(int K, int start_comp) noexcept
Definition AMReX_FabArray.H:614
bool isDefined() const
Definition AMReX_FabArray.H:1935
void setVal(value_type val, const Box ®ion, int nghost)
Set all components in the valid region of each FAB in the FabArray to val, including nghost boundary ...
Definition AMReX_FabArray.H:1767
value_type const * singleChunkPtr() const noexcept
Definition AMReX_FabArray.H:466
~FabArray()
The destructor – deletes all FABs in the array.
Definition AMReX_FabArray.H:1899
Definition AMReX_FabFactory.H:50
virtual AMREX_NODISCARD FabFactory< FAB > * clone() const =0
virtual AMREX_NODISCARD FAB * create(const Box &box, int ncomps, const FabInfo &info, int box_index) const =0
virtual AMREX_NODISCARD Long nBytes(const Box &box, int ncomps, int) const
Definition AMReX_FabFactory.H:64
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:73
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:210
bool isPeriodic(int dir) const noexcept
Is the domain periodic in the specified direction?
Definition AMReX_Geometry.H:331
Definition AMReX_Tuple.H:93
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE 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:441
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE 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:391
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE 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:670
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int max() const noexcept
maximum (no absolute values) value
Definition AMReX_IntVect.H:212
a one-thingy-per-box distributed object
Definition AMReX_LayoutData.H:13
Definition AMReX_MFIter.H:57
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:141
int index() const noexcept
The index into the underlying BoxArray of the current FAB.
Definition AMReX_MFIter.H:144
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:159
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:27
Long size() const noexcept
Definition AMReX_Vector.H:50
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:237
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:86
bool inNoSyncRegion() noexcept
Definition AMReX_GpuControl.H:146
void htod_memcpy(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:293
void Min(KeyValuePair< K, V > &vi, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:152
void Sum(T &v, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:204
void Max(KeyValuePair< K, V > &vi, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:126
MPI_Comm CommunicatorSub() noexcept
sub-communicator for current frame
Definition AMReX_ParallelContext.H:70
int MyProc() noexcept
return the rank number local to the current Parallel Context
Definition AMReX_ParallelDescriptor.H:125
int MyTeamLead() noexcept
Definition AMReX_ParallelDescriptor.H:309
int TeamSize() noexcept
Definition AMReX_ParallelDescriptor.H:294
const ProcessTeam & MyTeam() noexcept
Definition AMReX_ParallelDescriptor.H:349
Definition AMReX_Amr.cpp:49
MakeType
Definition AMReX_MakeType.H:7
@ make_alias
Definition AMReX_MakeType.H:7
int nComp(FabArrayBase const &fa)
std::enable_if_t< std::is_integral_v< T > > ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:191
std::unique_ptr< char, TheFaArenaDeleter > TheFaArenaPointer
Definition AMReX_FabArray.H:104
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
IntVect nGrowVect(FabArrayBase const &fa)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Returns a BoxND with different type.
Definition AMReX_Box.H:1435
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.
Definition AMReX_ParReduce.H:47
void Copy(FabArray< DFAB > &dst, FabArray< SFAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:179
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T abs(const GpuComplex< T > &a_z) noexcept
Return the absolute value of a complex number.
Definition AMReX_GpuComplex.H:356
Long nBytesOwned(T const &) noexcept
Definition AMReX_FabArray.H:58
Arena * The_Comms_Arena()
Definition AMReX_Arena.cpp:676
IntVectND< AMREX_SPACEDIM > IntVect
Definition AMReX_BaseFwd.H:30
AMREX_GPU_HOST_DEVICE constexpr GpuTupleElement< I, GpuTuple< Ts... > >::type & get(GpuTuple< Ts... > &tup) noexcept
Definition AMReX_Tuple.H:179
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:127
void setBndry(MF &dst, typename MF::value_type val, int scomp, int ncomp)
dst = val in ghost cells.
Definition AMReX_FabArrayUtility.H:1815
bool TilingIfNotGPU() noexcept
Definition AMReX_MFIter.H:12
void Add(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:240
Arena * The_Pinned_Arena()
Definition AMReX_Arena.cpp:656
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:35
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition AMReX.cpp:230
void OverrideSync_finish(FabArray< FAB > &fa)
Definition AMReX_FabArrayUtility.H:1382
void update_fab_stats(Long n, Long s, size_t szt) noexcept
Definition AMReX_BaseFab.cpp:144
void setVal(MF &dst, typename MF::value_type val)
dst = val
Definition AMReX_FabArrayUtility.H:1808
Arena * The_Arena()
Definition AMReX_Arena.cpp:616
BoxArray const & boxArray(FabArrayBase const &fa)
void OverrideSync_nowait(FabArray< FAB > &fa, FabArray< IFAB > const &msk, const Periodicity &period)
Definition AMReX_FabArrayUtility.H:1335
Definition AMReX_TagParallelFor.H:57
Definition AMReX_Array4.H:61
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:108
const FabArrayBase::FB * fb
Definition AMReX_FabArray.H:110
char * the_recv_data
Definition AMReX_FabArray.H:115
Vector< MPI_Request > recv_reqs
Definition AMReX_FabArray.H:120
Vector< char * > recv_data
Definition AMReX_FabArray.H:118
Vector< MPI_Status > recv_stat
Definition AMReX_FabArray.H:121
int scomp
Definition AMReX_FabArray.H:111
Vector< int > recv_from
Definition AMReX_FabArray.H:117
char * the_send_data
Definition AMReX_FabArray.H:116
Vector< MPI_Request > send_reqs
Definition AMReX_FabArray.H:124
Vector< char * > send_data
Definition AMReX_FabArray.H:123
Vector< std::size_t > recv_size
Definition AMReX_FabArray.H:119
int ncomp
Definition AMReX_FabArray.H:112
int tag
Definition AMReX_FabArray.H:125
parallel copy or add
Definition AMReX_FabArrayBase.H:536
Used by a bunch of routines when communicating via MPI.
Definition AMReX_FabArrayBase.H:194
Box dbox
Definition AMReX_FabArrayBase.H:195
int dstIndex
Definition AMReX_FabArrayBase.H:197
FillBoundary.
Definition AMReX_FabArrayBase.H:487
void recordBuild() noexcept
Definition AMReX_FabArrayBase.H:701
Definition AMReX_FabArray.H:347
FAB value_type
Definition AMReX_FabArray.H:348
for shared memory
Definition AMReX_FabArray.H:1353
ShMem(ShMem &&rhs) noexcept
Definition AMReX_FabArray.H:1367
Long n_values
Definition AMReX_FabArray.H:1394
Long n_points
Definition AMReX_FabArray.H:1395
bool alloc
Definition AMReX_FabArray.H:1393
ShMem & operator=(ShMem &&rhs) noexcept
Definition AMReX_FabArray.H:1378
ShMem(const ShMem &)=delete
Definition AMReX_FabFactory.H:27
FabInfo & SetShared(bool s) noexcept
Definition AMReX_FabFactory.H:37
FabInfo & SetAlloc(bool a) noexcept
Definition AMReX_FabFactory.H:32
FabInfo & SetArena(Arena *ar) noexcept
Definition AMReX_FabFactory.H:42
Definition AMReX_TypeTraits.H:18
FabArray memory allocation information.
Definition AMReX_FabArray.H:66
MFInfo & SetTag(T &&t, Ts &&... ts) noexcept
Definition AMReX_FabArray.H:92
MFInfo & SetTag(const std::string &t) noexcept
Definition AMReX_FabArray.H:86
Arena * arena
Definition AMReX_FabArray.H:70
MFInfo & SetArena(Arena *ar) noexcept
Definition AMReX_FabArray.H:77
MFInfo & SetTag() noexcept
Definition AMReX_FabArray.H:79
bool alloc
Definition AMReX_FabArray.H:68
MFInfo & SetAlloc(bool a) noexcept
Definition AMReX_FabArray.H:73
bool alloc_single_chunk
Definition AMReX_FabArray.H:69
MFInfo & SetAllocSingleChunk(bool a) noexcept
Definition AMReX_FabArray.H:75
Vector< std::string > tags
Definition AMReX_FabArray.H:71
MFInfo & SetTag(const char *t) noexcept
Definition AMReX_FabArray.H:81
Definition AMReX_FabArray.H:152
Array4< T > const *AMREX_RESTRICT dp
Definition AMReX_FabArray.H:166
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Array4< T > const & operator[](int li) const noexcept
Definition AMReX_FabArray.H:154
Array4< T > const *AMREX_RESTRICT hp
Definition AMReX_FabArray.H:168
Definition AMReX_FabArray.H:131
int actual_n_rcvs
Definition AMReX_FabArray.H:137
Vector< std::size_t > recv_size
Definition AMReX_FabArray.H:144
int DC
Definition AMReX_FabArray.H:138
Vector< MPI_Request > send_reqs
Definition AMReX_FabArray.H:146
int tag
Definition AMReX_FabArray.H:136
const FabArray< FAB > * src
Definition AMReX_FabArray.H:134
char * the_recv_data
Definition AMReX_FabArray.H:140
FabArrayBase::CpOp op
Definition AMReX_FabArray.H:135
Vector< MPI_Request > recv_reqs
Definition AMReX_FabArray.H:145
char * the_send_data
Definition AMReX_FabArray.H:141
const FabArrayBase::CPC * cpc
Definition AMReX_FabArray.H:133
Vector< int > recv_from
Definition AMReX_FabArray.H:142
int NC
Definition AMReX_FabArray.H:138
int SC
Definition AMReX_FabArray.H:138
Vector< char * > recv_data
Definition AMReX_FabArray.H:143
void MemoryBarrier() const
memory fence
Definition AMReX_ParallelDescriptor.H:157
const team_t & get() const
Definition AMReX_ParallelDescriptor.H:185
Definition AMReX_FabArray.H:98
char * pointer
Definition AMReX_FabArray.H:99
void operator()(pointer p) const noexcept
Definition AMReX_FabArray.H:100
Struct for holding types.
Definition AMReX_TypeList.H:12