1#ifndef AMREX_BASEFAB_H_
2#define AMREX_BASEFAB_H_
3#include <AMReX_Config.H>
49extern std::atomic<Long> atomic_total_bytes_allocated_in_fabs;
50extern std::atomic<Long> atomic_total_bytes_allocated_in_fabs_hwm;
51extern std::atomic<Long> atomic_total_cells_allocated_in_fabs;
52extern std::atomic<Long> atomic_total_cells_allocated_in_fabs_hwm;
53extern Long private_total_bytes_allocated_in_fabs;
54extern Long private_total_bytes_allocated_in_fabs_hwm;
55extern Long private_total_cells_allocated_in_fabs;
56extern Long private_total_cells_allocated_in_fabs_hwm;
58#pragma omp threadprivate(private_total_bytes_allocated_in_fabs)
59#pragma omp threadprivate(private_total_bytes_allocated_in_fabs_hwm)
60#pragma omp threadprivate(private_total_cells_allocated_in_fabs)
61#pragma omp threadprivate(private_total_cells_allocated_in_fabs_hwm)
140 if constexpr (!std::is_trivially_default_constructible_v<T>) {
161 if constexpr (!std::is_trivially_destructible_v<T>) {
240 bool shared = false,
Arena* ar =
nullptr);
319 requires (std::is_trivially_destructible_v<U>)
332 [[nodiscard]] std::
size_t nBytes () const noexcept {
return this->
truesize*
sizeof(T); }
339 [[nodiscard]] std::size_t
nBytes (
const Box& bx,
int ncomps)
const noexcept
340 {
return bx.numPts() *
sizeof(T) * ncomps; }
343 [[nodiscard]]
int nComp () const noexcept {
return this->
nvar; }
346 [[nodiscard]]
const int*
nCompPtr() const noexcept {
347 return &(this->
nvar);
357 [[nodiscard]]
const Box&
box () const noexcept {
return this->
domain; }
418 [[nodiscard]] T*
dataPtr (
int n = 0) noexcept {
427 [[nodiscard]]
const T*
dataPtr (
int n = 0) const noexcept {
601 void getVal (T* data,
const IntVect& pos,
int N,
int numcomp)
const noexcept;
605 template <RunOn run_on AMREX_DEFAULT_RUNON>
606 requires (std::is_same_v<T,float> || std::is_same_v<T,double>)
615 template <RunOn run_on AMREX_DEFAULT_RUNON>
616 void setVal (T
const&
x,
const Box& bx,
int dcomp,
int ncomp)
noexcept;
618 template <RunOn run_on AMREX_DEFAULT_RUNON>
653 const
Box& destbox,
int destcomp,
int numcomp) noexcept;
663 int numcomp = 1) noexcept;
676 int numcomp,
void* dst) const noexcept;
681 int numcomp, const
void* src) noexcept;
686 int numcomp, const
void* src) noexcept;
723 [[nodiscard]]
Real norm (
int p,
int scomp = 0,
int numcomp = 1) const;
727 [[nodiscard]]
Real norm (const
Box& subbox,
int p,
int scomp = 0,
int numcomp = 1) const;
733 void abs (
int comp,
int numcomp=1) noexcept;
738 void abs (const
Box& subbox,
int comp = 0,
int numcomp=1) noexcept;
743 [[nodiscard]] T
min (
int comp = 0) const noexcept;
748 [[nodiscard]] T
min (const
Box& subbox,
int comp = 0) const noexcept;
753 [[nodiscard]] T
max (
int comp = 0) const noexcept;
758 [[nodiscard]] T
max (const
Box& subbox,
int comp = 0) const noexcept;
763 [[nodiscard]] std::pair<T,T>
minmax (
int comp = 0) const noexcept;
768 [[nodiscard]] std::pair<T,T>
minmax (const
Box& subbox,
int comp = 0) const noexcept;
773 [[nodiscard]] T
maxabs (
int comp = 0) const noexcept;
778 [[nodiscard]] T
maxabs (const
Box& subbox,
int comp = 0) const noexcept;
846 [[nodiscard]] T
sum (
int comp,
int numcomp = 1) const noexcept;
849 [[nodiscard]] T
sum (const
Box& subbox,
int comp,
int numcomp = 1) const noexcept;
893 int srccomp,
int destcomp,
int numcomp=1) noexcept;
913 int numcomp=1) noexcept;
920 int srccomp,
int destcomp,
int numcomp=1) noexcept;
929 int srccomp,
int destcomp,
int numcomp) noexcept;
934 int srccomp,
int destcomp,
int numcomp=1) noexcept;
942 int srccomp,
int destcomp,
int numcomp=1) noexcept;
947 const
BaseFab<T>& src1,
int comp1,
948 const
BaseFab<T>& src2,
int comp2) noexcept;
964 int numcomp=1) noexcept;
971 int srccomp,
int destcomp,
int numcomp=1) noexcept;
995 int numcomp=1) noexcept;
1003 int srccomp,
int destcomp,
int numcomp=1) noexcept;
1028 int numcomp=1) noexcept;
1035 int srccomp,
int destcomp,
int numcomp=1) noexcept;
1060 int numcomp=1) noexcept;
1069 int srccomp,
int destcomp,
int numcomp=1) noexcept;
1083 const
BaseFab<T>& f2, const
Box& b2,
int comp2,
1085 const
Box& b,
int comp,
int numcomp = 1) noexcept;
1090 const
BaseFab<T>& f2,
int comp2,
1092 const
Box& b,
int comp,
int numcomp = 1) noexcept;
1105 const
BaseFab<T>& f2, const
Box& b2,
int comp2,
1107 int comp,
int numcomp = 1) noexcept;
1112 int numcomp = 1) const noexcept;
1117 int numcomp) const noexcept;
1127 template <RunOn run_on AMREX_DEFAULT_RUNON>
1131 template <RunOn run_on AMREX_DEFAULT_RUNON>
1134 template <RunOn run_on AMREX_DEFAULT_RUNON>
1138 template <RunOn run_on AMREX_DEFAULT_RUNON>
1141 template <RunOn run_on AMREX_DEFAULT_RUNON>
1145 template <RunOn run_on AMREX_DEFAULT_RUNON>
1149 template <RunOn run_on AMREX_DEFAULT_RUNON>
1157 template <RunOn run_on AMREX_DEFAULT_RUNON>
1161 template <RunOn run_on AMREX_DEFAULT_RUNON>
1165 template <RunOn run_on AMREX_DEFAULT_RUNON>
1168 template <RunOn run_on AMREX_DEFAULT_RUNON>
1172 template <RunOn run_on AMREX_DEFAULT_RUNON>
1179 template <RunOn run_on AMREX_DEFAULT_RUNON>
1182 template <RunOn run_on AMREX_DEFAULT_RUNON>
1186 template <RunOn run_on AMREX_DEFAULT_RUNON>
1190 template <RunOn run_on AMREX_DEFAULT_RUNON>
1193 template <RunOn run_on AMREX_DEFAULT_RUNON>
1197 template <RunOn run_on AMREX_DEFAULT_RUNON>
1204 template <RunOn run_on AMREX_DEFAULT_RUNON>
1207 template <RunOn run_on AMREX_DEFAULT_RUNON>
1211 template <RunOn run_on AMREX_DEFAULT_RUNON>
1215 template <RunOn run_on AMREX_DEFAULT_RUNON>
1218 template <RunOn run_on AMREX_DEFAULT_RUNON>
1222 template <RunOn run_on AMREX_DEFAULT_RUNON>
1229 template <RunOn run_on AMREX_DEFAULT_RUNON>
1232 template <RunOn run_on AMREX_DEFAULT_RUNON>
1236 template <RunOn run_on AMREX_DEFAULT_RUNON>
1240 template <RunOn run_on AMREX_DEFAULT_RUNON>
1243 template <RunOn run_on AMREX_DEFAULT_RUNON>
1247 template <RunOn run_on AMREX_DEFAULT_RUNON>
1254 template <RunOn run_on AMREX_DEFAULT_RUNON>
1257 template <RunOn run_on AMREX_DEFAULT_RUNON>
1261 template <RunOn run_on AMREX_DEFAULT_RUNON>
1265 template <RunOn run_on AMREX_DEFAULT_RUNON>
1288 [[nodiscard]] T
dot (const
Box& bx,
int destcomp,
int numcomp) const noexcept;
1324 return this->dptr + (this->domain.index(p)+n*this->domain.numPts());
1337 return this->dptr + (this->domain.index(p)+n*this->domain.numPts());
1345 if (this->arena()->isManaged()) {
1346#if defined(AMREX_USE_SYCL)
1351#elif defined(AMREX_USE_CUDA) && !defined(_WIN32)
1353 std::size_t s =
sizeof(T)*this->nvar*this->domain.numPts();
1354#if defined(CUDART_VERSION) && (CUDART_VERSION >= 13000)
1355 cudaMemLocation location = {};
1356 location.type = cudaMemLocationTypeHost;
1365#elif defined(AMREX_USE_HIP)
1377 if (this->arena()->isManaged()) {
1378#if defined(AMREX_USE_SYCL)
1379 std::size_t s =
sizeof(T)*this->nvar*this->domain.numPts();
1380 auto& q = Gpu::Device::streamQueue();
1381 q.submit([&] (sycl::handler& h) { h.prefetch(this->dptr, s); });
1382#elif defined(AMREX_USE_CUDA) && !defined(_WIN32)
1384 std::size_t s =
sizeof(T)*this->nvar*this->domain.numPts();
1385#if defined(CUDART_VERSION) && (CUDART_VERSION >= 13000)
1386 cudaMemLocation location = {};
1387 location.type = cudaMemLocationTypeDevice;
1397#elif defined(AMREX_USE_HIP)
1414 return this->dptr[this->domain.index(p)+n*this->domain.numPts()];
1425 return this->dptr[this->domain.index(p)];
1438 return this->dptr[this->domain.index(p)+n*this->domain.numPts()];
1449 return this->dptr[this->domain.index(p)];
1457 int numcomp)
const noexcept
1459 const int loc = this->domain.index(pos);
1460 const Long sz = this->domain.numPts();
1465 for (
int k = 0; k < numcomp; k++) {
1466 data[k] = this->dptr[loc+(n+k)*sz];
1473 const IntVect& pos)
const noexcept
1475 getVal(data,pos,0,this->nvar);
1511template <RunOn run_on>
1512requires (std::is_same_v<T,float> || std::is_same_v<T,double>)
1516 amrex::fill_snan<run_on>(this->dptr, this->truesize);
1520template <RunOn run_on>
1528template <RunOn run_on>
1536template <RunOn run_on>
1544template <RunOn run_on>
1552template <RunOn run_on>
1555 const Box& destbox,
int destcomp,
int numcomp)
noexcept
1561 AMREX_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
1562 AMREX_ASSERT(destcomp >= 0 && destcomp+numcomp <= this->nvar);
1568 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
1579template <RunOn run_on>
1587template <RunOn run_on>
1601 if (this->nvar == 0) {
return; }
1602 AMREX_ASSERT(std::numeric_limits<Long>::max()/this->nvar > this->domain.numPts());
1604 this->truesize = this->nvar*this->domain.numPts();
1605 this->ptr_owner =
true;
1606 this->dptr =
static_cast<T*
>(this->alloc(this->truesize*
sizeof(T)));
1615 if constexpr (std::is_same_v<T,float> || std::is_same_v<T,double>) {
1619 this->
template fill_snan<RunOn::Device>();
1624 this->
template fill_snan<RunOn::Host>();
1644 :
DataAllocator{ar}, domain(bx), nvar(n), shared_memory(shared)
1652 dptr(const_cast<T*>(rhs.dataPtr(scomp))),
1653 domain(rhs.domain), nvar(ncomp),
1654 truesize(ncomp*rhs.domain.numPts())
1659 this->
dptr =
nullptr;
1661 this->copy<RunOn::Device>(rhs, this->
domain, scomp, this->
domain, 0, ncomp);
1671 : dptr(p), domain(bx), nvar(ncomp), truesize(bx.numPts()*ncomp)
1677 : dptr(const_cast<T*>(p)), domain(bx), nvar(ncomp), truesize(bx.numPts()*ncomp)
1686 nvar(a.nComp()), truesize(a.size())
1694 nvar(a.nComp()), truesize(a.size())
1699 : dptr(
const_cast<T*
>(a.p)),
1702 nvar(a.nComp()), truesize(a.size())
1707 : dptr(
const_cast<T*
>(a.p)),
1710 nvar(a.nComp()), truesize(a.size())
1722 dptr(rhs.dptr), domain(rhs.domain),
1723 nvar(rhs.nvar), truesize(rhs.truesize),
1724 ptr_owner(rhs.ptr_owner), shared_memory(rhs.shared_memory)
1726 , alloc_stream(rhs.alloc_stream)
1730 rhs.ptr_owner =
false;
1739 DataAllocator::operator=(rhs);
1741 domain = rhs.domain;
1743 truesize = rhs.truesize;
1744 ptr_owner = rhs.ptr_owner;
1745 shared_memory = rhs.shared_memory;
1747 alloc_stream = rhs.alloc_stream;
1751 rhs.ptr_owner =
false;
1757template <RunOn run_on>
1772 if (ar ==
nullptr) {
1781 else if (this->dptr ==
nullptr || !this->ptr_owner)
1783 if (this->shared_memory) {
1784 amrex::Abort(
"BaseFab::resize: BaseFab in shared memory cannot increase size");
1787 this->dptr =
nullptr;
1790 else if (this->nvar*this->domain.numPts() > this->truesize
1792 || (arena()->isStreamOrderedArena() && alloc_stream !=
Gpu::gpuStream())
1796 if (this->shared_memory) {
1797 amrex::Abort(
"BaseFab::resize: BaseFab in shared memory cannot increase size");
1808requires (std::is_trivially_destructible_v<U>)
1814 o = this->ptr_owner;
1815 this->ptr_owner =
false;
1816 if (o && this->dptr) {
1817 if (this->nvar > 1) {
1826 return Elixir((o ? this->dptr :
nullptr), this->arena());
1838 if (this->ptr_owner)
1840 if (this->shared_memory)
1842 amrex::Abort(
"BaseFab::clear: BaseFab cannot be owner of shared memory");
1848 this->arena()->streamOrderedFree(this->dptr, alloc_stream);
1850 this->free(this->dptr);
1853 if (this->nvar > 1) {
1860 this->dptr =
nullptr;
1866std::unique_ptr<T,DataDeleter>
1869 std::unique_ptr<T,DataDeleter> r(
nullptr,
DataDeleter{this->arena()});
1870 if (this->dptr && this->ptr_owner) {
1871 r.reset(this->dptr);
1872 this->ptr_owner =
false;
1873 if (this->nvar > 1) {
1883template <RunOn run_on>
1888 void* dst)
const noexcept
1899 d(i,j,k,n) = s(i,j,k,n+srccomp);
1901 return sizeof(T)*d.
size();
1910template <RunOn run_on,
typename BUF>
1915 const void* src)
noexcept
1927 d(i,j,k,n+dstcomp) =
static_cast<T
>(s(i,j,k,n));
1929 return sizeof(BUF)*s.
size();
1938template <RunOn run_on,
typename BUF>
1943 const void* src)
noexcept
1955 d(i,j,k,n+dstcomp) +=
static_cast<T
>(s(i,j,k,n));
1957 return sizeof(BUF)*s.
size();
1966template <RunOn run_on>
1974template <RunOn run_on>
1978 this->abs<run_on>(this->domain,0,this->nvar);
1982template <RunOn run_on>
1986 this->abs<run_on>(this->domain,comp,numcomp);
1990template <RunOn run_on>
1997 a(i,j,k,n+comp) = std::abs(a(i,j,k,n+comp));
2002template <RunOn run_on>
2005 int scomp,
int ncomp)
const noexcept
2007 BL_ASSERT(this->domain.contains(subbox));
2008 BL_ASSERT(scomp >= 0 && scomp + ncomp <= this->nvar);
2018 reduce_op.
eval(subbox, reduce_data,
2023 for (
int n = 0; n < ncomp; ++n) {
2029 ReduceTuple hv = reduce_data.
value(reduce_op);
2030 r = amrex::get<0>(hv);
2034 amrex::LoopOnCpu(subbox, ncomp, [=,&r] (
int i,
int j,
int k,
int n)
noexcept
2037 Real t =
static_cast<Real>(std::abs(a(i,j,k,n+scomp)));
2046template <RunOn run_on>
2050 return norm<run_on>(this->domain,p,comp,numcomp);
2054template <RunOn run_on>
2058 BL_ASSERT(this->domain.contains(subbox));
2059 BL_ASSERT(comp >= 0 && comp + numcomp <= this->nvar);
2069 reduce_op.
eval(subbox, reduce_data,
2073 for (
int n = 0; n < numcomp; ++n) {
2078 ReduceTuple hv = reduce_data.
value(reduce_op);
2079 nrm = amrex::get<0>(hv);
2080 }
else if (p == 1) {
2084 reduce_op.
eval(subbox, reduce_data,
2088 for (
int n = 0; n < numcomp; ++n) {
2089 t +=
static_cast<Real>(std::abs(a(i,j,k,n+comp)));
2093 ReduceTuple hv = reduce_data.
value(reduce_op);
2094 nrm = amrex::get<0>(hv);
2095 }
else if (p == 2) {
2099 reduce_op.
eval(subbox, reduce_data,
2103 for (
int n = 0; n < numcomp; ++n) {
2104 t +=
static_cast<Real>(a(i,j,k,n+comp)*a(i,j,k,n+comp));
2108 ReduceTuple hv = reduce_data.
value(reduce_op);
2109 nrm = amrex::get<0>(hv);
2117 amrex::LoopOnCpu(subbox, numcomp, [=,&nrm] (
int i,
int j,
int k,
int n)
noexcept
2119 Real t =
static_cast<Real>(std::abs(a(i,j,k,n+comp)));
2122 }
else if (p == 1) {
2123 amrex::LoopOnCpu(subbox, numcomp, [=,&nrm] (
int i,
int j,
int k,
int n)
noexcept
2125 nrm += std::abs(a(i,j,k,n+comp));
2127 }
else if (p == 2) {
2128 amrex::LoopOnCpu(subbox, numcomp, [=,&nrm] (
int i,
int j,
int k,
int n)
noexcept
2130 nrm += a(i,j,k,n+comp)*a(i,j,k,n+comp);
2141template <RunOn run_on>
2145 return this->min<run_on>(this->domain,comp);
2149template <RunOn run_on>
2158 using ReduceTuple =
typename decltype(reduce_data)::Type;
2159 reduce_op.
eval(subbox, reduce_data,
2162 return { a(i,j,k) };
2164 ReduceTuple hv = reduce_data.
value(reduce_op);
2165 return amrex::get<0>(hv);
2169 T r = std::numeric_limits<T>::max();
2179template <RunOn run_on>
2183 return this->max<run_on>(this->domain,comp);
2187template <RunOn run_on>
2196 using ReduceTuple =
typename decltype(reduce_data)::Type;
2197 reduce_op.
eval(subbox, reduce_data,
2200 return { a(i,j,k) };
2202 ReduceTuple hv = reduce_data.
value(reduce_op);
2203 return amrex::get<0>(hv);
2207 T r = std::numeric_limits<T>::lowest();
2217template <RunOn run_on>
2221 return this->minmax<run_on>(this->domain,comp);
2225template <RunOn run_on>
2234 using ReduceTuple =
typename decltype(reduce_data)::Type;
2235 reduce_op.
eval(subbox, reduce_data,
2238 auto const x = a(i,j,k);
2241 ReduceTuple hv = reduce_data.
value(reduce_op);
2242 return std::make_pair(amrex::get<0>(hv), amrex::get<1>(hv));
2246 T rmax = std::numeric_limits<T>::lowest();
2247 T rmin = std::numeric_limits<T>::max();
2250 auto const x = a(i,j,k);
2254 return std::make_pair(rmin,rmax);
2259template <RunOn run_on>
2263 return this->maxabs<run_on>(this->domain,comp);
2267template <RunOn run_on>
2276 using ReduceTuple =
typename decltype(reduce_data)::Type;
2277 reduce_op.
eval(subbox, reduce_data,
2280 return { std::abs(a(i,j,k)) };
2282 ReduceTuple hv = reduce_data.
value(reduce_op);
2283 return amrex::get<0>(hv);
2298template <RunOn run_on>
2306 std::numeric_limits<int>::lowest(),
2307 std::numeric_limits<int>::lowest())};
2314 if ((*flag == 0) && (a(i,j,k) == value)) {
2337template <RunOn run_on>
2341 return this->minIndex<run_on>(this->domain,comp);
2345template <RunOn run_on>
2349 T min_val = this->min<run_on>(subbox, comp);
2350 return this->indexFromValue<run_on>(subbox, comp, min_val);
2354template <RunOn run_on>
2358 min_val = this->min<run_on>(subbox, comp);
2359 min_idx = this->indexFromValue<run_on>(subbox, comp, min_val);
2363template <RunOn run_on>
2367 return this->maxIndex<run_on>(this->domain,comp);
2371template <RunOn run_on>
2375 T max_val = this->max<run_on>(subbox, comp);
2376 return this->indexFromValue<run_on>(subbox, comp, max_val);
2380template <RunOn run_on>
2384 max_val = this->max<run_on>(subbox, comp);
2385 max_idx = this->indexFromValue<run_on>(subbox, comp, max_val);
2389template <RunOn run_on>
2393 mask.resize(this->domain,1);
2401 using ReduceTuple =
typename decltype(reduce_data)::Type;
2402 reduce_op.
eval(this->domain, reduce_data,
2406 if (a(i,j,k) < val) {
2415 ReduceTuple hv = reduce_data.
value(reduce_op);
2416 cnt = amrex::get<0>(hv);
2422 if (a(i,j,k) < val) {
2435template <RunOn run_on>
2439 mask.resize(this->domain,1);
2447 using ReduceTuple =
typename decltype(reduce_data)::Type;
2448 reduce_op.
eval(this->domain, reduce_data,
2452 if (a(i,j,k) <= val) {
2461 ReduceTuple hv = reduce_data.
value(reduce_op);
2462 cnt = amrex::get<0>(hv);
2468 if (a(i,j,k) <= val) {
2481template <RunOn run_on>
2485 mask.resize(this->domain,1);
2493 using ReduceTuple =
typename decltype(reduce_data)::Type;
2494 reduce_op.
eval(this->domain, reduce_data,
2498 if (a(i,j,k) == val) {
2507 ReduceTuple hv = reduce_data.
value(reduce_op);
2508 cnt = amrex::get<0>(hv);
2514 if (a(i,j,k) == val) {
2527template <RunOn run_on>
2531 mask.resize(this->domain,1);
2539 using ReduceTuple =
typename decltype(reduce_data)::Type;
2540 reduce_op.
eval(this->domain, reduce_data,
2544 if (a(i,j,k) > val) {
2553 ReduceTuple hv = reduce_data.
value(reduce_op);
2554 cnt = amrex::get<0>(hv);
2560 if (a(i,j,k) > val) {
2573template <RunOn run_on>
2577 mask.resize(this->domain,1);
2585 using ReduceTuple =
typename decltype(reduce_data)::Type;
2586 reduce_op.
eval(this->domain, reduce_data,
2590 if (a(i,j,k) >= val) {
2599 ReduceTuple hv = reduce_data.
value(reduce_op);
2600 cnt = amrex::get<0>(hv);
2606 if (a(i,j,k) >= val) {
2619template <RunOn run_on>
2623 Box ovlp(this->domain);
2625 return ovlp.
ok() ? this->atomicAdd<run_on>(
x,ovlp,ovlp,0,0,this->nvar) : *
this;
2629template <RunOn run_on>
2632 int srccomp,
int destcomp,
int numcomp)
noexcept
2639 BL_ASSERT( srccomp >= 0 && srccomp+numcomp <=
x.nComp());
2646 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
2656template <RunOn run_on>
2660 Box ovlp(this->domain);
2662 return ovlp.
ok() ? saxpy<run_on>(a,
x,ovlp,ovlp,0,0,this->nvar) : *
this;
2666template <RunOn run_on>
2669 const Box& srcbox,
const Box& destbox,
2670 int srccomp,
int destcomp,
int numcomp)
noexcept
2677 BL_ASSERT( srccomp >= 0 && srccomp+numcomp <=
x.nComp());
2684 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
2687 d(i,j,k,n+destcomp) = s(i+
offset.x,j+
offset.y,k+
offset.z,n+srccomp) + a*d(i,j,k,n+destcomp);
2694template <RunOn run_on>
2702 BL_ASSERT( comp1 >= 0 && comp1+numcomp <= src1.nComp());
2703 BL_ASSERT( comp2 >= 0 && comp2+numcomp <= src2.nComp());
2711 d(i,j,k,n+destcomp) += s1(i,j,k,n+comp1) * s2(i,j,k,n+comp2);
2718template <RunOn run_on>
2723 int comp,
int numcomp)
noexcept
2733 BL_ASSERT(comp1 >= 0 && comp1+numcomp <= f1.nComp());
2734 BL_ASSERT(comp2 >= 0 && comp2+numcomp <= f2.nComp());
2743 const Dim3 off1{.
x = slo1.x-dlo.x, .y = slo1.y-dlo.y, .z = slo1.z-dlo.z};
2744 const Dim3 off2{.
x = slo2.x-dlo.x, .y = slo2.y-dlo.y, .z = slo2.z-dlo.z};
2748 d(i,j,k,n+comp) = alpha*s1(i+off1.x,j+off1.y,k+off1.z,n+comp1)
2749 + beta*s2(i+off2.x,j+off2.y,k+off2.z,n+comp2);
2755template <RunOn run_on>
2759 int numcomp)
const noexcept
2766 BL_ASSERT(ycomp >= 0 && ycomp+numcomp <=
y.nComp());
2772 const Dim3 offset{.
x = ylo.x-xlo.x, .y = ylo.y-xlo.y, .z = ylo.z-xlo.z};
2780 using ReduceTuple =
typename decltype(reduce_data)::Type;
2781 reduce_op.
eval(xbx, reduce_data,
2785 for (
int n = 0; n < numcomp; ++n) {
2790 ReduceTuple hv = reduce_data.
value(reduce_op);
2791 r = amrex::get<0>(hv);
2805template <RunOn run_on>
2809 int numcomp)
const noexcept
2816 BL_ASSERT(ycomp >= 0 && ycomp+numcomp <=
y.nComp());
2822 const Dim3 offset{.
x = ylo.x-xlo.x, .y = ylo.y-xlo.y, .z = ylo.z-xlo.z};
2832 using ReduceTuple =
typename decltype(reduce_data)::Type;
2833 reduce_op.
eval(xbx, reduce_data,
2836 int m =
static_cast<int>(
static_cast<bool>(ma(i,j,k)));
2838 for (
int n = 0; n < numcomp; ++n) {
2843 ReduceTuple hv = reduce_data.
value(reduce_op);
2844 r = amrex::get<0>(hv);
2850 int m =
static_cast<int>(
static_cast<bool>(ma(i,j,k)));
2859template <RunOn run_on>
2867template <RunOn run_on>
2875template <RunOn run_on>
2879 return this->negate<run_on>(this->domain,
DestComp{comp},
NumComps{numcomp});
2883template <RunOn run_on>
2891template <RunOn run_on>
2895 return this->invert<run_on>(r, this->domain,
DestComp{comp},
NumComps{numcomp});
2899template <RunOn run_on>
2907template <RunOn run_on>
2911 return this->plus<run_on>(r, this->domain,
DestComp{comp},
NumComps{numcomp});
2915template <RunOn run_on>
2923template <RunOn run_on>
2931template <RunOn run_on>
2935 Box ovlp(this->domain);
2937 return ovlp.
ok() ? this->atomicAdd<run_on>(src,ovlp,ovlp,srccomp,destcomp,numcomp) : *
this;
2941template <RunOn run_on>
2944 int numcomp)
noexcept
2950template <RunOn run_on>
2953 int numcomp)
noexcept
2955 Box ovlp(this->domain);
2958 return ovlp.
ok() ? this->atomicAdd<run_on>(src,ovlp,ovlp,srccomp,destcomp,numcomp) : *
this;
2962template <RunOn run_on>
2965 int srccomp,
int destcomp,
int numcomp)
noexcept
2971 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
2978 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
2990template <RunOn run_on,
typename T>
2993 const Box& srcbox,
const Box& destbox,
2994 int srccomp,
int destcomp,
int numcomp)
noexcept
3000 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
3003 T* p = d.
ptr(i,j,k,n+destcomp);
3008template <RunOn run_on,
typename T>
3009requires (!HasAtomicAdd<T>::value)
3010void basefab_atomic_add (BaseFab<T>& dfab,
const BaseFab<T>& sfab,
3011 const Box& srcbox,
const Box& destbox,
3012 int srccomp,
int destcomp,
int numcomp)
3021template <RunOn run_on>
3024 int srccomp,
int destcomp,
int numcomp)
noexcept
3030 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3033 detail::basefab_atomic_add<run_on>(*
this, src, srcbox, destbox,
3034 srccomp, destcomp, numcomp);
3040template <RunOn run_on>
3043 int srccomp,
int destcomp,
int numcomp)
noexcept
3045#if defined(AMREX_USE_OMP) && (AMREX_SPACEDIM > 1)
3046#if defined(AMREX_USE_GPU)
3053 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3062 Dim3 const offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
3078 for (
int ip = 0; ip < nplanes; ++ip) {
3083 int planes_left = nplanes;
3084 while (planes_left > 0) {
3086 auto const m = mm + plo;
3087 auto* lock = OpenMP::get_lock(m);
3088 if (omp_test_lock(lock))
3092 if (planedim == 1) {
3100 for (
int n = 0; n < numcomp; ++n) {
3101 for (
int k = lo.z; k <= hi.z; ++k) {
3102 for (
int j = lo.y; j <= hi.y; ++j) {
3103 auto *
pdst = d.
ptr(dlo.x,j ,k ,n+destcomp);
3106 for (
int ii = 0; ii < len.x; ++ii) {
3107 pdst[ii] += psrc[ii];
3115 omp_unset_lock(lock);
3116 if (planes_left == 0) {
break; }
3120 for (
int ip = 0; ip < nplanes; ++ip) {
3121 int new_mm = (mm+ip) % nplanes;
3122 if ( !
mask[new_mm] ) {
3133#if defined(AMREX_USE_GPU)
3135 return this->
template atomicAdd<run_on>(src, srcbox, destbox, srccomp, destcomp, numcomp);
3139 return this->
template atomicAdd<run_on>(src, srcbox, destbox, srccomp, destcomp, numcomp);
3144template <RunOn run_on>
3152template <RunOn run_on>
3160template <RunOn run_on>
3163 int srccomp,
int destcomp,
int numcomp)
noexcept
3169 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3176 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
3186template <RunOn run_on>
3190 return this->mult<run_on>(r, this->domain,
DestComp{comp},
NumComps{numcomp});
3194template <RunOn run_on>
3202template <RunOn run_on>
3210template <RunOn run_on>
3218template <RunOn run_on>
3221 int srccomp,
int destcomp,
int numcomp)
noexcept
3227 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3234 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
3244template <RunOn run_on>
3248 return this->divide<run_on>(r, this->domain,
DestComp{comp},
NumComps{numcomp});
3252template <RunOn run_on>
3260template <RunOn run_on>
3268template <RunOn run_on>
3276template <RunOn run_on>
3279 int srccomp,
int destcomp,
int numcomp)
noexcept
3285 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3292 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
3302template <RunOn run_on>
3306 Box ovlp(this->domain);
3308 return ovlp.
ok() ? this->protected_divide<run_on>(src,ovlp,ovlp,0,0,this->nvar) : *
this;
3312template <RunOn run_on>
3316 Box ovlp(this->domain);
3318 return ovlp.
ok() ? this->protected_divide<run_on>(src,ovlp,ovlp,srccomp,destcomp,numcomp) : *
this;
3322template <RunOn run_on>
3325 int numcomp)
noexcept
3327 Box ovlp(this->domain);
3330 return ovlp.
ok() ? this->protected_divide<run_on>(src,ovlp,ovlp,srccomp,destcomp,numcomp) : *
this;
3334template <RunOn run_on>
3337 int srccomp,
int destcomp,
int numcomp)
noexcept
3343 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3350 const Dim3 offset{.
x = slo.x-dlo.x, .y = slo.y-dlo.y, .z = slo.z-dlo.z};
3354 d(i,j,k,n+destcomp) /= s(i+offset.x,j+offset.y,k+offset.z,n+srccomp);
3372template <RunOn run_on>
3377 const Box& b,
int comp,
int numcomp)
noexcept
3380 return copy<run_on>(f1,b1,comp1,b,comp,numcomp);
3382 return copy<run_on>(f2,b2,comp2,b,comp,numcomp);
3384 Real alpha = (t2-t)/(t2-t1);
3385 Real beta = (t-t1)/(t2-t1);
3386 return linComb<run_on>(f1,b1,comp1,f2,b2,comp2,alpha,beta,b,comp,numcomp);
3391template <RunOn run_on>
3396 const Box& b,
int comp,
int numcomp)
noexcept
3399 return copy<run_on>(f1,b,comp1,b,comp,numcomp);
3401 return copy<run_on>(f2,b,comp2,b,comp,numcomp);
3403 Real alpha = (t2-t)/(t2-t1);
3404 Real beta = (t-t1)/(t2-t1);
3405 return linComb<run_on>(f1,b,comp1,f2,b,comp2,alpha,beta,b,comp,numcomp);
3414template <RunOn run_on>
3418 this->setVal<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3422template <RunOn run_on>
3426 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3430 a(i,j,k,n+dcomp.i) = x;
3435template <RunOn run_on>
3443template <RunOn run_on>
3447 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3452 if (m(i,j,k)) { a(i,j,k,n+dcomp.i) = val; }
3457template <RunOn run_on>
3465template <RunOn run_on>
3469 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3474 if (!m(i,j,k)) { a(i,j,k,n+dcomp.i) = val; }
3479template <RunOn run_on>
3484 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
3489 for (
int n = dcomp.i; n < ncomp.n+dcomp.i; ++n) {
3498 for (
auto const& b : b_lst) {
3499 this->setVal<RunOn::Host>(
x, b, dcomp, ncomp);
3505template <RunOn run_on>
3514template <RunOn run_on>
3520 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3521 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3529 d(i,j,k,n+dcomp.i) = s(i,j,k,n+scomp.i);
3536template <RunOn run_on>
3540 return this->plus<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3544template <RunOn run_on>
3548 return this->plus<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3552template <RunOn run_on>
3556 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3561 a(i,j,k,n+dcomp.i) += val;
3568template <RunOn run_on>
3576template <RunOn run_on>
3584template <RunOn run_on>
3590 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3591 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3599 d(i,j,k,n+dcomp.i) += s(i,j,k,n+scomp.i);
3606template <RunOn run_on>
3610 return this->minus<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3614template <RunOn run_on>
3618 return this->minus<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3622template <RunOn run_on>
3626 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3631 a(i,j,k,n+dcomp.i) -= val;
3638template <RunOn run_on>
3646template <RunOn run_on>
3654template <RunOn run_on>
3660 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3661 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3669 d(i,j,k,n+dcomp.i) -= s(i,j,k,n+scomp.i);
3676template <RunOn run_on>
3680 return this->mult<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3684template <RunOn run_on>
3688 return this->mult<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3692template <RunOn run_on>
3696 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3701 a(i,j,k,n+dcomp.i) *= val;
3708template <RunOn run_on>
3716template <RunOn run_on>
3724template <RunOn run_on>
3730 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3731 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3739 d(i,j,k,n+dcomp.i) *= s(i,j,k,n+scomp.i);
3746template <RunOn run_on>
3750 return this->divide<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3754template <RunOn run_on>
3758 return this->divide<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3762template <RunOn run_on>
3766 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3771 a(i,j,k,n+dcomp.i) /= val;
3778template <RunOn run_on>
3786template <RunOn run_on>
3794template <RunOn run_on>
3800 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3801 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3809 d(i,j,k,n+dcomp.i) /= s(i,j,k,n+scomp.i);
3816template <RunOn run_on>
3820 return this->negate<run_on>(this->domain,
DestComp{0},
NumComps{this->nvar});
3824template <RunOn run_on>
3828 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3833 a(i,j,k,n+dcomp.i) = -a(i,j,k,n+dcomp.i);
3840template <RunOn run_on>
3844 return this->invert<run_on>(r, this->domain,
DestComp{0},
NumComps{this->nvar});
3848template <RunOn run_on>
3852 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3857 a(i,j,k,n+dcomp.i) = r / a(i,j,k,n+dcomp.i);
3864template <RunOn run_on>
3868 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3873 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
3876 using ReduceTuple =
typename decltype(reduce_data)::Type;
3877 reduce_op.
eval(bx, reduce_data,
3881 for (
int n = 0; n < ncomp.n; ++n) {
3882 t += a(i,j,k,n+dcomp.i);
3886 ReduceTuple hv = reduce_data.
value(reduce_op);
3887 r = amrex::get<0>(hv);
3893 r += a(i,j,k,n+dcomp.i);
3901template <RunOn run_on>
3906 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3907 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3913 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
3916 using ReduceTuple =
typename decltype(reduce_data)::Type;
3917 reduce_op.
eval(bx, reduce_data,
3921 for (
int n = 0; n < ncomp.n; ++n) {
3922 t += d(i,j,k,n+dcomp.i) * s(i,j,k,n+scomp.i);
3926 ReduceTuple hv = reduce_data.
value(reduce_op);
3927 r = amrex::get<0>(hv);
3933 r += d(i,j,k,n+dcomp.i) * s(i,j,k,n+scomp.i);
3941template <RunOn run_on>
3950template <RunOn run_on>
3954 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3959 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
3962 using ReduceTuple =
typename decltype(reduce_data)::Type;
3963 reduce_op.
eval(bx, reduce_data,
3967 for (
int n = 0; n < ncomp.n; ++n) {
3968 t += a(i,j,k,n+dcomp.i)*a(i,j,k,n+dcomp.i);
3972 ReduceTuple hv = reduce_data.
value(reduce_op);
3973 r = amrex::get<0>(hv);
3979 r += a(i,j,k,n+dcomp.i)*a(i,j,k,n+dcomp.i);
3987template <RunOn run_on>
3994 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3995 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
4002 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
4005 using ReduceTuple =
typename decltype(reduce_data)::Type;
4006 reduce_op.
eval(bx, reduce_data,
4010 T mi =
static_cast<T
>(
static_cast<int>(
static_cast<bool>(m(i,j,k))));
4011 for (
int n = 0; n < ncomp.n; ++n) {
4012 t += d(i,j,k,n+dcomp.i)*s(i,j,k,n+scomp.i)*mi;
4016 ReduceTuple hv = reduce_data.
value(reduce_op);
4017 r = amrex::get<0>(hv);
4023 int mi = static_cast<int>(static_cast<bool>(m(i,j,k)));
4024 r += d(i,j,k,n+dcomp.i)*s(i,j,k,n+scomp.i)*mi;
General-purpose algorithm utilities available on both host and device.
Fixed-size array types for use on GPU and CPU.
Aligned CPU heap-backed implementation of the Arena interface.
Assertion macros used across AMReX for runtime consistency checks.
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
Iterator over all IntVects in a Box.
A list of Boxes sharing a common IndexType.
Integer-lattice boxes and helpers for defining index-space regions.
Coalescing first-fit dynamic memory arena.
Lightweight Arena-backed allocator and deleter helpers.
Compiler- and backend-specific extension macros (e.g., restrict, SIMD, inline).
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:124
#define AMREX_DEFAULT_RUNON
Definition AMReX_GpuControl.H:69
#define AMREX_CUDA_SAFE_CALL(call)
Definition AMReX_GpuError.H:73
#define AMREX_HOST_DEVICE_FOR_1D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:105
#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(where_to_run, box, nc, i, j, k, n, block)
Definition AMReX_GpuLaunch.nolint.H:75
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
int idir
Definition AMReX_HypreMLABecLap.cpp:1133
Array4< int const > offset
Definition AMReX_HypreMLABecLap.cpp:1129
Real * pdst
Definition AMReX_HypreMLABecLap.cpp:1130
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
void amrex_mempool_free(void *p)
Definition AMReX_MemPool.cpp:80
void * amrex_mempool_alloc(size_t nbytes)
Definition AMReX_MemPool.cpp:74
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:172
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
Abstract base class for memory arenas.
Definition AMReX_Arena.H:153
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:222
int maskGE(BaseFab< int > &mask, T const &val, int comp=0) const noexcept
Mark cells with value greater than or equal to val.
Definition AMReX_BaseFab.H:2575
BaseFab< T > & saxpy(T a, const BaseFab< T > &x, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
FAB SAXPY (y[i] <- y[i] + a * x[i]), in place.
Definition AMReX_BaseFab.H:2631
Array4< T const > const_array() const noexcept
Return a const-qualified Array4 view over all components.
Definition AMReX_BaseFab.H:547
BaseFab< T > & copy(const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx does not intersect with src fab.
Definition AMReX_BaseFab.H:3516
T sum(int comp, int numcomp=1) const noexcept
Returns sum of given component of FAB state vector.
Definition AMReX_BaseFab.H:2861
gpuStream_t alloc_stream
Definition AMReX_BaseFab.H:1310
Real norminfmask(const Box &subbox, const BaseFab< int > &mask, int scomp=0, int ncomp=1) const noexcept
Definition AMReX_BaseFab.H:2004
BaseFab< T > & divide(T const &val) noexcept
Scalar division on the whole domain and all components.
Definition AMReX_BaseFab.H:3748
const int * hiVect() const noexcept
Returns the upper corner of the domain.
Definition AMReX_BaseFab.H:392
BaseFab< T > & minus(const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx does not intersect with src fab.
Definition AMReX_BaseFab.H:3656
BaseFab< T > & lockAdd(const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp) noexcept
Atomically add srcbox region of src FAB to destbox region of this FAB. The srcbox and destbox must be...
Definition AMReX_BaseFab.H:3042
static void Initialize()
Initialize static tracking/profiling metadata used by all BaseFabs.
std::size_t copyToMem(const Box &srcbox, int srccomp, int numcomp, void *dst) const noexcept
Copy from the srcbox of this Fab to raw memory and return the number of bytes copied.
Definition AMReX_BaseFab.H:1885
std::size_t addFromMem(const Box &dstbox, int dstcomp, int numcomp, const void *src) noexcept
Add from raw memory to the dstbox of this Fab and return the number of bytes copied.
Definition AMReX_BaseFab.H:1940
std::size_t nBytesOwned() const noexcept
Definition AMReX_BaseFab.H:334
BaseFab< T > & copy(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3507
BaseFab< T > & addproduct(const Box &destbox, int destcomp, int numcomp, const BaseFab< T > &src1, int comp1, const BaseFab< T > &src2, int comp2) noexcept
y[i] <- y[i] + x1[i] * x2[i])
Definition AMReX_BaseFab.H:2696
BaseFab< T > & minus(T const &val) noexcept
Scalar subtraction on the whole domain and all components.
Definition AMReX_BaseFab.H:3608
int maskLT(BaseFab< int > &mask, T const &val, int comp=0) const noexcept
Compute mask array with value of 1 in cells where BaseFab has value less than val,...
Definition AMReX_BaseFab.H:2391
BaseFab< T > & plus(T const &val) noexcept
Scalar addition on the whole domain and all components.
Definition AMReX_BaseFab.H:3538
BaseFab< T > & mult(T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3694
BaseFab< T > & mult(const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx does not intersect with src fab.
Definition AMReX_BaseFab.H:3726
std::size_t nBytes(const Box &bx, int ncomps) const noexcept
Returns bytes used in the Box for those components.
Definition AMReX_BaseFab.H:339
void setPtr(T *p, Long sz) noexcept
Attach externally allocated storage without taking ownership.
Definition AMReX_BaseFab.H:457
BaseFab< T > & linComb(const BaseFab< T > &f1, const Box &b1, int comp1, const BaseFab< T > &f2, const Box &b2, int comp2, Real alpha, Real beta, const Box &b, int comp, int numcomp=1) noexcept
Linear combination. Result is alpha*f1 + beta*f2. Data is taken from b1 region of f1,...
Definition AMReX_BaseFab.H:2720
void define()
Allocates memory for the BaseFab<T>.
Definition AMReX_BaseFab.H:1596
BaseFab< T > & operator*=(T const &val) noexcept
Definition AMReX_BaseFab.H:3686
void resize(const Box &b, int N=1, Arena *ar=nullptr)
This function resizes a BaseFab so it covers the Box b with N components.
Definition AMReX_BaseFab.H:1767
void clear()
The function returns the BaseFab to the invalid state. The memory is freed.
Definition AMReX_BaseFab.H:1831
const IntVect & smallEnd() const noexcept
Returns the lower corner of the domain See class Box for analogue.
Definition AMReX_BaseFab.H:369
BaseFab< T > & mult(T const &r, int comp, int numcomp=1) noexcept
Scalar multiplication applied to selected components over the entire domain.
Definition AMReX_BaseFab.H:3188
BaseFab< T > & atomicAdd(const BaseFab< T > &x) noexcept
Atomic FAB addition (a[i] <- a[i] + b[i]).
Definition AMReX_BaseFab.H:2621
int maskEQ(BaseFab< int > &mask, T const &val, int comp=0) const noexcept
Mark cells with value equal to val.
Definition AMReX_BaseFab.H:2483
const int * loVect() const noexcept
Returns the lower corner of the domain.
Definition AMReX_BaseFab.H:382
bool contains(const BaseFab< T > &fab) const noexcept
Returns true if the domain of fab is totally contained within the domain of this BaseFab.
Definition AMReX_BaseFab.H:398
bool isAllocated() const noexcept
Returns true if the data for the FAB has been allocated.
Definition AMReX_BaseFab.H:577
std::unique_ptr< T, DataDeleter > release() noexcept
Release ownership of memory.
Definition AMReX_BaseFab.H:1867
void setVal(T const &x, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3424
BaseFab< T > & operator-=(T const &val) noexcept
Definition AMReX_BaseFab.H:3616
const Box & box() const noexcept
Returns the domain (box) where the array is defined.
Definition AMReX_BaseFab.H:357
void setValIf(T const &val, Box const &bx, const BaseFab< int > &mask, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3445
static void Finalize()
Release static tracking/profiling metadata allocated by Initialize().
Array4< T > array() noexcept
Create a mutable Array4 view over all components.
Definition AMReX_BaseFab.H:510
IntVect indexFromValue(const Box &subbox, int comp, T const &value) const noexcept
Definition AMReX_BaseFab.H:2300
BaseFab< T > & mult(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3710
bool shared_memory
Is the memory allocated in shared memory?
Definition AMReX_BaseFab.H:1308
int maskLE(BaseFab< int > &mask, T const &val, int comp=0) const noexcept
Mark cells with value <= val.
Definition AMReX_BaseFab.H:2437
void setValIf(T const &val, const BaseFab< int > &mask) noexcept
Definition AMReX_BaseFab.H:3437
BaseFab< T > & plus(const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx does not intersect with src fab.
Definition AMReX_BaseFab.H:3586
void setValIfNot(T const &val, const BaseFab< int > &mask) noexcept
Definition AMReX_BaseFab.H:3459
BaseFab< T > & xpay(T a, const BaseFab< T > &x, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
FAB XPAY (y[i] <- x[i] + a * y[i])
Definition AMReX_BaseFab.H:2668
T & operator()(const IntVect &p, int N) noexcept
Returns a reference to the Nth component value defined at position p in the domain....
Definition AMReX_BaseFab.H:1407
std::size_t nBytes() const noexcept
Returns how many bytes used.
Definition AMReX_BaseFab.H:332
std::size_t copyFromMem(const Box &dstbox, int dstcomp, int numcomp, const void *src) noexcept
Copy from raw memory to the dstbox of this Fab and return the number of bytes copied.
Definition AMReX_BaseFab.H:1912
BaseFab< T > & negate() noexcept
on the whole domain and all components
Definition AMReX_BaseFab.H:3818
BaseFab< T > & minus(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3640
BaseFab< T > & minus(const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1) noexcept
Subtract src components (srccomp:srccomp+numcomp-1) to this FABs components (destcomp:destcomp+numcom...
Definition AMReX_BaseFab.H:3146
T value_type
Definition AMReX_BaseFab.H:227
void SetBoxType(const IndexType &typ) noexcept
Change the Box type without change the length.
Definition AMReX_BaseFab.H:1120
Array4< T const > array() const noexcept
Create an Array4 view over all components.
Definition AMReX_BaseFab.H:475
T maxabs(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2261
Elixir elixir() noexcept
Transfer owned storage to an Elixir when running in a GPU launch region.
Definition AMReX_BaseFab.H:1810
BaseFab< T > & operator+=(T const &val) noexcept
Definition AMReX_BaseFab.H:3546
void setComplement(T const &x, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
setVal on the complement of bx in the fab's domain
Definition AMReX_BaseFab.H:3481
BaseFab< T > & minus(T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3624
Long truesize
nvar*numpts that was allocated on heap.
Definition AMReX_BaseFab.H:1306
void setVal(T const &val) noexcept
Set value on the whole domain and all components.
Definition AMReX_BaseFab.H:3416
const int * nCompPtr() const noexcept
for calls to fortran.
Definition AMReX_BaseFab.H:346
Array4< T const > const_array(int start_comp, int num_comps) const noexcept
Return a const-qualified Array4 view spanning num_comps components.
Definition AMReX_BaseFab.H:571
Box domain
My index space.
Definition AMReX_BaseFab.H:1304
void fill_snan() noexcept
Definition AMReX_BaseFab.H:1514
bool contains(const Box &bx) const noexcept
Returns true if bx is totally contained within the domain of this BaseFab.
Definition AMReX_BaseFab.H:407
T * dptr
The data pointer.
Definition AMReX_BaseFab.H:1303
BaseFab< T > & shift(const IntVect &v) noexcept
Perform shifts upon the domain of the BaseFab. They are completely analogous to the corresponding Box...
Definition AMReX_BaseFab.H:1480
BaseFab< T > & divide(T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3764
T max(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2181
BaseFab< T > & copy(const BaseFab< T > &src, const Box &srcbox, int srccomp, const Box &destbox, int destcomp, int numcomp) noexcept
The copy functions copy the contents of one BaseFab into another. The destination BaseFab is always t...
Definition AMReX_BaseFab.H:1554
Array4< T > array(int start_comp, int num_comps) noexcept
Mutable overload spanning num_comps components.
Definition AMReX_BaseFab.H:535
int nvar
Number components.
Definition AMReX_BaseFab.H:1305
T dot(const Box &xbx, int xcomp, const BaseFab< T > &y, const Box &ybx, int ycomp, int numcomp=1) const noexcept
Dot product of x (i.e.,this) and y.
Definition AMReX_BaseFab.H:2757
BaseFab< T > & divide(T const &r, int comp, int numcomp=1) noexcept
Divide selected components by a scalar across the entire domain.
Definition AMReX_BaseFab.H:3246
Array4< T const > array(int start_comp) const noexcept
Create a sliced Array4 view beginning at component start_comp.
Definition AMReX_BaseFab.H:487
BaseFab< T > & operator/=(T const &val) noexcept
Definition AMReX_BaseFab.H:3756
std::pair< T, T > minmax(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2219
Array4< T const > const_array(int start_comp) const noexcept
Return a const-qualified Array4 view beginning at component start_comp.
Definition AMReX_BaseFab.H:559
void setVal(T const &x, const Box &bx, int dcomp, int ncomp) noexcept
The setVal functions set sub-regions in the BaseFab to a constant value. This most general form speci...
Definition AMReX_BaseFab.H:1538
Long size() const noexcept
Returns the total number of points of all components.
Definition AMReX_BaseFab.H:354
BaseFab< T > & plus(T const &r, const Box &b, int comp=0, int numcomp=1) noexcept
Scalar addition (a[i] <- a[i] + r), most general.
Definition AMReX_BaseFab.H:2917
BaseFab< T > & operator=(const BaseFab< T > &rhs)=delete
void getVal(T *data, const IntVect &pos, int N, int numcomp) const noexcept
This function puts numcomp component values, starting at component N, from position pos in the domain...
Definition AMReX_BaseFab.H:1454
const IntVect & bigEnd() const noexcept
Returns the upper corner of the domain. See class Box for analogue.
Definition AMReX_BaseFab.H:372
Array4< T > array(int start_comp) noexcept
Mutable overload selecting components starting at start_comp.
Definition AMReX_BaseFab.H:522
Long numPts() const noexcept
Returns the number of points.
Definition AMReX_BaseFab.H:351
const T * dataPtr(int n=0) const noexcept
Const-qualified variant of dataPtr().
Definition AMReX_BaseFab.H:427
void setValIfNot(T const &val, Box const &bx, const BaseFab< int > &mask, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3467
BaseFab< T > & mult(T const &val) noexcept
Scalar multiplication on the whole domain and all components.
Definition AMReX_BaseFab.H:3678
BaseFab< T > & divide(const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx does not intersect with src fab.
Definition AMReX_BaseFab.H:3796
void setValIfNot(T const &val, const Box &bx, const BaseFab< int > &mask, int nstart, int num) noexcept
Definition AMReX_BaseFab.H:1546
BaseFab< T > & shiftHalf(int dir, int n_cell) noexcept
Perform shifts upon the domain of the BaseFab. They are completely analogous to the corresponding Box...
Definition AMReX_BaseFab.H:1504
void setVal(T const &x, const Box &bx, int N=0) noexcept
Set a single component N over bx to x.
Definition AMReX_BaseFab.H:1522
void prefetchToDevice() const noexcept
Advise the runtime to migrate storage to the active device.
Definition AMReX_BaseFab.H:1374
T * dataPtr(int n=0) noexcept
Returns a pointer to an object of type T that is the value of the Nth component associated with the c...
Definition AMReX_BaseFab.H:418
bool ptr_owner
Owner of T*?
Definition AMReX_BaseFab.H:1307
virtual ~BaseFab() noexcept
The destructor deletes the array memory.
Definition AMReX_BaseFab.H:1714
IntVect length() const noexcept
Returns a pointer to an array of SPACEDIM integers giving the length of the domain in each direction.
Definition AMReX_BaseFab.H:363
IntVect maxIndex(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2365
BaseFab< T > & protected_divide(const BaseFab< T > &src) noexcept
Divide wherever "src" is "true" or "non-zero".
Definition AMReX_BaseFab.H:3304
friend class BaseFab
Definition AMReX_BaseFab.H:225
BaseFab< T > & invert(T const &r, const Box &b, int comp=0, int numcomp=1) noexcept
Most general version, specify subbox and which components.
Definition AMReX_BaseFab.H:2901
Array4< T const > array(int start_comp, int num_comps) const noexcept
Create a sliced Array4 view spanning num_comps components.
Definition AMReX_BaseFab.H:500
int nComp() const noexcept
Returns the number of components.
Definition AMReX_BaseFab.H:343
int maskGT(BaseFab< int > &mask, T const &val, int comp=0) const noexcept
Mark cells with value greater than val.
Definition AMReX_BaseFab.H:2529
T dotmask(const BaseFab< int > &mask, const Box &xbx, int xcomp, const BaseFab< T > &y, const Box &ybx, int ycomp, int numcomp) const noexcept
Definition AMReX_BaseFab.H:2807
BaseFab< T > & plus(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3570
BaseFab() noexcept=default
Construct an empty BaseFab, which must be resized (see BaseFab::resize) before use.
BaseFab< T > & divide(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3780
void prefetchToHost() const noexcept
Advise the runtime to migrate storage to the host.
Definition AMReX_BaseFab.H:1342
T min(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2143
void setComplement(T const &x, const Box &b, int ns, int num) noexcept
This function is analogous to the fourth form of setVal above, except that instead of setting values ...
Definition AMReX_BaseFab.H:1968
BaseFab< T > & linInterp(const BaseFab< T > &f1, const Box &b1, int comp1, const BaseFab< T > &f2, const Box &b2, int comp2, Real t1, Real t2, Real t, const Box &b, int comp, int numcomp=1) noexcept
Linear interpolation / extrapolation. Result is (t2-t)/(t2-t1)*f1 + (t-t1)/(t2-t1)*f2 Data is taken f...
Definition AMReX_BaseFab.H:3374
IntVect minIndex(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2339
T * dataPtr(const IntVect &p, int n=0) noexcept
Return a pointer to the element at spatial index p and component n.
Definition AMReX_BaseFab.H:1317
void abs() noexcept
Compute absolute value for all components of this FAB.
Definition AMReX_BaseFab.H:1976
void getVal(T *data, const IntVect &pos) const noexcept
Copy all components beginning at component 0.
Definition AMReX_BaseFab.H:1472
BaseFab< T > & plus(T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3554
Real norm(int p, int scomp=0, int numcomp=1) const
Compute the Lp-norm of this FAB using components (scomp : scomp+ncomp-1). p < 0 -> ERROR p = 0 -> inf...
Definition AMReX_BaseFab.H:2048
A list of Boxes sharing a common IndexType.
Definition AMReX_BoxList.H:109
__host__ __device__ const IntVectND< dim > & bigEnd() const &noexcept
Return the inclusive upper bound of the box.
Definition AMReX_Box.H:136
__host__ __device__ const int * hiVect() const &noexcept
Return a pointer to the high-end coordinates (useful for Fortran calls).
Definition AMReX_Box.H:210
__host__ __device__ Long numPts() const noexcept
Return the number of points contained in the BoxND.
Definition AMReX_Box.H:385
__host__ __device__ bool sameSize(const BoxND &b) const noexcept
Return true is Boxes same size, ie translates of each other,. It is an error if they have different t...
Definition AMReX_Box.H:312
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:167
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:233
__host__ __device__ const int * loVect() const &noexcept
Return a pointer to the low-end coordinates (useful for Fortran calls).
Definition AMReX_Box.H:205
__host__ __device__ BoxND & setType(const IndexTypeND< dim > &t) noexcept
Set indexing type.
Definition AMReX_Box.H:534
__host__ __device__ bool ok() const noexcept
Return true if high bounds are >= low bounds and the index type is valid.
Definition AMReX_Box.H:229
__host__ __device__ const IntVectND< dim > & smallEnd() const &noexcept
Return the inclusive lower bound of the box.
Definition AMReX_Box.H:124
GPU-compatible tuple.
Definition AMReX_Tuple.H:98
static int deviceId() noexcept
Definition AMReX_GpuDevice.cpp:692
static int devicePropMajor() noexcept
Definition AMReX_GpuDevice.H:203
Definition AMReX_GpuElixir.H:13
__host__ static __device__ constexpr IntVectND< dim > TheMinVector() noexcept
Definition AMReX_IntVect.H:819
Dynamically allocated vector for trivially copyable data.
Definition AMReX_PODVector.H:308
T * data() noexcept
Definition AMReX_PODVector.H:666
Definition AMReX_Reduce.H:438
Type value()
Definition AMReX_Reduce.H:473
Definition AMReX_Reduce.H:597
void eval(MF const &mf, IntVect const &nghost, D &reduce_data, F &&f)
Definition AMReX_Reduce.H:731
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
amrex_long Long
Definition AMReX_INT.H:30
__host__ __device__ Dim3 ubound(Array4< T > const &a) noexcept
Return the inclusive upper bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1364
__host__ __device__ Dim3 length(Array4< T > const &a) noexcept
Return the spatial extents of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1378
__host__ __device__ Dim3 lbound(Array4< T > const &a) noexcept
Return the inclusive lower bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1350
std::array< T, N > Array
Definition AMReX_Array.H:31
__host__ __device__ constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:31
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:53
__host__ __device__ bool almostEqual(T x, T y, int ulp=2)
Definition AMReX_Algorithm.H:139
__host__ __device__ AMREX_FORCE_INLINE T Exch(T *address, T val) noexcept
Definition AMReX_GpuAtomic.H:487
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:310
void dtoh_memcpy_async(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:435
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:88
bool notInLaunchRegion() noexcept
Definition AMReX_GpuControl.H:89
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:421
gpuStream_t gpuStream() noexcept
Definition AMReX_GpuDevice.H:291
__host__ __device__ AMREX_FORCE_INLINE void Add(T *const sum, T const value) noexcept
Definition AMReX_GpuAtomic.H:640
Definition AMReX_Amr.cpp:50
MakeType
Definition AMReX_MakeType.H:7
@ make_deep_copy
Definition AMReX_MakeType.H:7
@ make_alias
Definition AMReX_MakeType.H:7
__host__ __device__ void ignore_unused(const Ts &...)
No-op helper that marks variables as intentionally unused.
Definition AMReX.H:259
int nComp(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2852
__host__ __device__ Array4< T > makeArray4(T *p, Box const &bx, int ncomp) noexcept
Definition AMReX_BaseFab.H:123
RunOn
Definition AMReX_GpuControl.H:65
__host__ __device__ Dim3 begin(BoxND< dim > const &box) noexcept
Return the iterator begin coordinate of box as Dim3.
Definition AMReX_Box.H:2239
cudaStream_t gpuStream_t
Definition AMReX_GpuControl.H:79
bool InitSNaN() noexcept
Whether new allocations are filled with signaling NaNs when enabled.
Definition AMReX.cpp:185
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
Long TotalBytesAllocatedInFabs() noexcept
Total bytes currently held by all BaseFab instances on this rank.
Definition AMReX_BaseFab.cpp:66
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:35
void BaseFab_Initialize()
Initialize BaseFab subsystem resources (profilers, stats counters, etc.).
Definition AMReX_BaseFab.cpp:30
void BaseFab_Finalize()
Release any BaseFab subsystem resources.
Definition AMReX_BaseFab.cpp:59
void ResetTotalBytesAllocatedInFabsHWM() noexcept
Reset the byte high-water mark reported by TotalBytesAllocatedInFabsHWM().
Definition AMReX_BaseFab.cpp:134
BoxList boxDiff(const Box &b1in, const Box &b2)
Returns a BoxList defining the complement of b2 in b1in.
Definition AMReX_BoxList.cpp:597
void placementNew(T *const ptr, Long n)
Start the lifetime of objects in a preallocated buffer.
Definition AMReX_BaseFab.H:137
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
Long TotalBytesAllocatedInFabsHWM() noexcept
High-water mark of BaseFab bytes since the last reset.
Definition AMReX_BaseFab.cpp:83
void placementDelete(T *const ptr, Long n)
Destroy objects previously constructed via placementNew.
Definition AMReX_BaseFab.H:158
Long TotalCellsAllocatedInFabsHWM() noexcept
High-water mark of Real BaseFab grid-point count since the last reset.
Definition AMReX_BaseFab.cpp:117
Long TotalCellsAllocatedInFabs() noexcept
Total spatial grid points (numPts) tracked for Real BaseFabs on this rank.
Definition AMReX_BaseFab.cpp:100
void Error(const std::string &msg)
Print a message to stderr and abort the program.
Definition AMReX.cpp:235
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:241
void LoopOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition AMReX_Loop.H:365
__host__ __device__ Dim3 end(BoxND< dim > const &box) noexcept
Return the iterator end coordinate of box as Dim3.
Definition AMReX_Box.H:2257
void update_fab_stats(Long n, Long s, size_t szt) noexcept
Definition AMReX_BaseFab.cpp:146
A multidimensional array accessor.
Definition AMReX_Array4.H:288
__host__ __device__ constexpr std::size_t size() const noexcept
Total number of elements in the ArrayND's index region.
Definition AMReX_Array4.H:642
__host__ __device__ T * ptr(idx... i) const noexcept
Multi-index ptr() for accessing pointer to element.
Definition AMReX_Array4.H:560
Lightweight allocator/deallocator backed by an Arena.
Definition AMReX_DataAllocator.H:21
void * alloc(std::size_t sz) const noexcept
Allocate sz bytes from the arena.
Definition AMReX_DataAllocator.H:31
Arena * arena() const noexcept
Return the stored arena, or The_Arena() if none was set.
Definition AMReX_DataAllocator.H:41
Custom deleter that returns memory to an Arena.
Definition AMReX_DataAllocator.H:53
Destination-component descriptor.
Definition AMReX_BaseFab.H:107
int i
Definition AMReX_BaseFab.H:110
__host__ __device__ DestComp(int ai) noexcept
Definition AMReX_BaseFab.H:109
A simple struct holding 3 int values for a 3D index.
Definition AMReX_Dim3.H:24
int x
Definition AMReX_Dim3.H:24
Definition AMReX_TypeTraits.H:51
Number-of-components descriptor.
Definition AMReX_BaseFab.H:114
__host__ __device__ NumComps(int an) noexcept
Definition AMReX_BaseFab.H:116
int n
Definition AMReX_BaseFab.H:117
Source-component descriptor.
Definition AMReX_BaseFab.H:100
__host__ __device__ SrcComp(int ai) noexcept
Definition AMReX_BaseFab.H:102
int i
Definition AMReX_BaseFab.H:103