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 Long 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);
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;
1663 this->copy<RunOn::Device>(rhs, this->
domain, scomp, this->
domain, 0, ncomp);
1667 this->copy<RunOn::Host>(rhs, this->
domain, scomp, this->
domain, 0, ncomp);
1678 : dptr(p), domain(bx), nvar(ncomp), truesize(bx.numPts()*ncomp)
1684 : dptr(const_cast<T*>(p)), domain(bx), nvar(ncomp), truesize(bx.numPts()*ncomp)
1693 nvar(a.nComp()), truesize(a.size())
1701 nvar(a.nComp()), truesize(a.size())
1706 : dptr(
const_cast<T*
>(a.p)),
1709 nvar(a.nComp()), truesize(a.size())
1714 : dptr(
const_cast<T*
>(a.p)),
1717 nvar(a.nComp()), truesize(a.size())
1729 dptr(rhs.dptr), domain(rhs.domain),
1730 nvar(rhs.nvar), truesize(rhs.truesize),
1731 ptr_owner(rhs.ptr_owner), shared_memory(rhs.shared_memory)
1733 , alloc_stream(rhs.alloc_stream)
1737 rhs.ptr_owner =
false;
1746 DataAllocator::operator=(rhs);
1748 domain = rhs.domain;
1750 truesize = rhs.truesize;
1751 ptr_owner = rhs.ptr_owner;
1752 shared_memory = rhs.shared_memory;
1754 alloc_stream = rhs.alloc_stream;
1758 rhs.ptr_owner =
false;
1764template <RunOn run_on>
1779 if (ar ==
nullptr) {
1788 else if (this->dptr ==
nullptr || !this->ptr_owner)
1790 if (this->shared_memory) {
1791 amrex::Abort(
"BaseFab::resize: BaseFab in shared memory cannot increase size");
1794 this->dptr =
nullptr;
1797 else if (this->nvar*this->domain.numPts() > this->truesize
1799 || (arena()->isStreamOrderedArena() && alloc_stream !=
Gpu::gpuStream())
1803 if (this->shared_memory) {
1804 amrex::Abort(
"BaseFab::resize: BaseFab in shared memory cannot increase size");
1815requires (std::is_trivially_destructible_v<U>)
1821 o = this->ptr_owner;
1822 this->ptr_owner =
false;
1823 if (o && this->dptr) {
1824 if (this->nvar > 0) {
1833 return Elixir((o ? this->dptr :
nullptr), this->arena());
1845 if (this->ptr_owner)
1847 if (this->shared_memory)
1849 amrex::Abort(
"BaseFab::clear: BaseFab cannot be owner of shared memory");
1855 this->arena()->streamOrderedFree(this->dptr, alloc_stream);
1857 this->free(this->dptr);
1860 if (this->nvar > 0) {
1867 this->dptr =
nullptr;
1873std::unique_ptr<T,DataDeleter>
1876 std::unique_ptr<T,DataDeleter> r(
nullptr,
DataDeleter{this->arena()});
1877 if (this->dptr && this->ptr_owner) {
1878 r.reset(this->dptr);
1879 this->ptr_owner =
false;
1880 if (this->nvar > 0) {
1890template <RunOn run_on>
1895 void* dst)
const noexcept
1906 d(i,j,k,n) = s(i,j,k,n+srccomp);
1908 return sizeof(T)*d.
size();
1917template <RunOn run_on,
typename BUF>
1922 const void* src)
noexcept
1934 d(i,j,k,n+dstcomp) =
static_cast<T
>(s(i,j,k,n));
1936 return sizeof(BUF)*s.
size();
1945template <RunOn run_on,
typename BUF>
1950 const void* src)
noexcept
1962 d(i,j,k,n+dstcomp) +=
static_cast<T
>(s(i,j,k,n));
1964 return sizeof(BUF)*s.
size();
1973template <RunOn run_on>
1981template <RunOn run_on>
1985 this->abs<run_on>(this->domain,0,this->nvar);
1989template <RunOn run_on>
1993 this->abs<run_on>(this->domain,comp,numcomp);
1997template <RunOn run_on>
2004 a(i,j,k,n+comp) = std::abs(a(i,j,k,n+comp));
2009template <RunOn run_on>
2012 int scomp,
int ncomp)
const noexcept
2014 BL_ASSERT(this->domain.contains(subbox));
2015 BL_ASSERT(scomp >= 0 && scomp + ncomp <= this->nvar);
2025 reduce_op.
eval(subbox, reduce_data,
2030 for (
int n = 0; n < ncomp; ++n) {
2036 ReduceTuple hv = reduce_data.
value(reduce_op);
2037 r = amrex::get<0>(hv);
2041 amrex::LoopOnCpu(subbox, ncomp, [=,&r] (
int i,
int j,
int k,
int n)
noexcept
2044 Real t =
static_cast<Real>(std::abs(a(i,j,k,n+scomp)));
2053template <RunOn run_on>
2057 return norm<run_on>(this->domain,p,comp,numcomp);
2061template <RunOn run_on>
2065 BL_ASSERT(this->domain.contains(subbox));
2066 BL_ASSERT(comp >= 0 && comp + numcomp <= this->nvar);
2076 reduce_op.
eval(subbox, reduce_data,
2080 for (
int n = 0; n < numcomp; ++n) {
2085 ReduceTuple hv = reduce_data.
value(reduce_op);
2086 nrm = amrex::get<0>(hv);
2087 }
else if (p == 1) {
2091 reduce_op.
eval(subbox, reduce_data,
2095 for (
int n = 0; n < numcomp; ++n) {
2096 t +=
static_cast<Real>(std::abs(a(i,j,k,n+comp)));
2100 ReduceTuple hv = reduce_data.
value(reduce_op);
2101 nrm = amrex::get<0>(hv);
2102 }
else if (p == 2) {
2106 reduce_op.
eval(subbox, reduce_data,
2110 for (
int n = 0; n < numcomp; ++n) {
2111 t +=
static_cast<Real>(a(i,j,k,n+comp)*a(i,j,k,n+comp));
2115 ReduceTuple hv = reduce_data.
value(reduce_op);
2116 nrm = amrex::get<0>(hv);
2124 amrex::LoopOnCpu(subbox, numcomp, [=,&nrm] (
int i,
int j,
int k,
int n)
noexcept
2126 Real t =
static_cast<Real>(std::abs(a(i,j,k,n+comp)));
2129 }
else if (p == 1) {
2130 amrex::LoopOnCpu(subbox, numcomp, [=,&nrm] (
int i,
int j,
int k,
int n)
noexcept
2132 nrm += std::abs(a(i,j,k,n+comp));
2134 }
else if (p == 2) {
2135 amrex::LoopOnCpu(subbox, numcomp, [=,&nrm] (
int i,
int j,
int k,
int n)
noexcept
2137 nrm += a(i,j,k,n+comp)*a(i,j,k,n+comp);
2148template <RunOn run_on>
2152 return this->min<run_on>(this->domain,comp);
2156template <RunOn run_on>
2165 using ReduceTuple =
typename decltype(reduce_data)::Type;
2166 reduce_op.
eval(subbox, reduce_data,
2169 return { a(i,j,k) };
2171 ReduceTuple hv = reduce_data.
value(reduce_op);
2172 return amrex::get<0>(hv);
2176 T r = std::numeric_limits<T>::max();
2186template <RunOn run_on>
2190 return this->max<run_on>(this->domain,comp);
2194template <RunOn run_on>
2203 using ReduceTuple =
typename decltype(reduce_data)::Type;
2204 reduce_op.
eval(subbox, reduce_data,
2207 return { a(i,j,k) };
2209 ReduceTuple hv = reduce_data.
value(reduce_op);
2210 return amrex::get<0>(hv);
2214 T r = std::numeric_limits<T>::lowest();
2224template <RunOn run_on>
2228 return this->minmax<run_on>(this->domain,comp);
2232template <RunOn run_on>
2241 using ReduceTuple =
typename decltype(reduce_data)::Type;
2242 reduce_op.
eval(subbox, reduce_data,
2245 auto const x = a(i,j,k);
2248 ReduceTuple hv = reduce_data.
value(reduce_op);
2249 return std::make_pair(amrex::get<0>(hv), amrex::get<1>(hv));
2253 T rmax = std::numeric_limits<T>::lowest();
2254 T rmin = std::numeric_limits<T>::max();
2257 auto const x = a(i,j,k);
2261 return std::make_pair(rmin,rmax);
2266template <RunOn run_on>
2270 return this->maxabs<run_on>(this->domain,comp);
2274template <RunOn run_on>
2283 using ReduceTuple =
typename decltype(reduce_data)::Type;
2284 reduce_op.
eval(subbox, reduce_data,
2287 return { std::abs(a(i,j,k)) };
2289 ReduceTuple hv = reduce_data.
value(reduce_op);
2290 return amrex::get<0>(hv);
2305template <RunOn run_on>
2313 std::numeric_limits<int>::lowest(),
2314 std::numeric_limits<int>::lowest())};
2321 if ((*flag == 0) && (a(i,j,k) == value)) {
2344template <RunOn run_on>
2348 return this->minIndex<run_on>(this->domain,comp);
2352template <RunOn run_on>
2356 T min_val = this->min<run_on>(subbox, comp);
2357 return this->indexFromValue<run_on>(subbox, comp, min_val);
2361template <RunOn run_on>
2365 min_val = this->min<run_on>(subbox, comp);
2366 min_idx = this->indexFromValue<run_on>(subbox, comp, min_val);
2370template <RunOn run_on>
2374 return this->maxIndex<run_on>(this->domain,comp);
2378template <RunOn run_on>
2382 T max_val = this->max<run_on>(subbox, comp);
2383 return this->indexFromValue<run_on>(subbox, comp, max_val);
2387template <RunOn run_on>
2391 max_val = this->max<run_on>(subbox, comp);
2392 max_idx = this->indexFromValue<run_on>(subbox, comp, max_val);
2396template <RunOn run_on>
2400 mask.resize(this->domain,1);
2408 using ReduceTuple =
typename decltype(reduce_data)::Type;
2409 reduce_op.
eval(this->domain, reduce_data,
2413 if (a(i,j,k) < val) {
2422 ReduceTuple hv = reduce_data.
value(reduce_op);
2423 cnt = amrex::get<0>(hv);
2429 if (a(i,j,k) < val) {
2442template <RunOn run_on>
2446 mask.resize(this->domain,1);
2454 using ReduceTuple =
typename decltype(reduce_data)::Type;
2455 reduce_op.
eval(this->domain, reduce_data,
2459 if (a(i,j,k) <= val) {
2468 ReduceTuple hv = reduce_data.
value(reduce_op);
2469 cnt = amrex::get<0>(hv);
2475 if (a(i,j,k) <= val) {
2488template <RunOn run_on>
2492 mask.resize(this->domain,1);
2500 using ReduceTuple =
typename decltype(reduce_data)::Type;
2501 reduce_op.
eval(this->domain, reduce_data,
2505 if (a(i,j,k) == val) {
2514 ReduceTuple hv = reduce_data.
value(reduce_op);
2515 cnt = amrex::get<0>(hv);
2521 if (a(i,j,k) == val) {
2534template <RunOn run_on>
2538 mask.resize(this->domain,1);
2546 using ReduceTuple =
typename decltype(reduce_data)::Type;
2547 reduce_op.
eval(this->domain, reduce_data,
2551 if (a(i,j,k) > val) {
2560 ReduceTuple hv = reduce_data.
value(reduce_op);
2561 cnt = amrex::get<0>(hv);
2567 if (a(i,j,k) > val) {
2580template <RunOn run_on>
2584 mask.resize(this->domain,1);
2592 using ReduceTuple =
typename decltype(reduce_data)::Type;
2593 reduce_op.
eval(this->domain, reduce_data,
2597 if (a(i,j,k) >= val) {
2606 ReduceTuple hv = reduce_data.
value(reduce_op);
2607 cnt = amrex::get<0>(hv);
2613 if (a(i,j,k) >= val) {
2626template <RunOn run_on>
2630 Box ovlp(this->domain);
2632 return ovlp.
ok() ? this->atomicAdd<run_on>(
x,ovlp,ovlp,0,0,this->nvar) : *
this;
2636template <RunOn run_on>
2639 int srccomp,
int destcomp,
int numcomp)
noexcept
2646 BL_ASSERT( srccomp >= 0 && srccomp+numcomp <=
x.nComp());
2663template <RunOn run_on>
2667 Box ovlp(this->domain);
2669 return ovlp.
ok() ? saxpy<run_on>(a,
x,ovlp,ovlp,0,0,this->nvar) : *
this;
2673template <RunOn run_on>
2676 const Box& srcbox,
const Box& destbox,
2677 int srccomp,
int destcomp,
int numcomp)
noexcept
2684 BL_ASSERT( srccomp >= 0 && srccomp+numcomp <=
x.nComp());
2694 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);
2701template <RunOn run_on>
2709 BL_ASSERT( comp1 >= 0 && comp1+numcomp <= src1.nComp());
2710 BL_ASSERT( comp2 >= 0 && comp2+numcomp <= src2.nComp());
2718 d(i,j,k,n+destcomp) += s1(i,j,k,n+comp1) * s2(i,j,k,n+comp2);
2725template <RunOn run_on>
2730 int comp,
int numcomp)
noexcept
2740 BL_ASSERT(comp1 >= 0 && comp1+numcomp <= f1.nComp());
2741 BL_ASSERT(comp2 >= 0 && comp2+numcomp <= f2.nComp());
2750 const Dim3 off1{.
x = slo1.x-
dlo.x, .y = slo1.y-
dlo.y, .z = slo1.z-
dlo.z};
2751 const Dim3 off2{.
x = slo2.x-
dlo.x, .y = slo2.y-
dlo.y, .z = slo2.z-
dlo.z};
2755 d(i,j,k,n+comp) = alpha*s1(i+off1.x,j+off1.y,k+off1.z,n+comp1)
2756 +
beta*s2(i+off2.x,j+off2.y,k+off2.z,n+comp2);
2762template <RunOn run_on>
2766 int numcomp)
const noexcept
2773 BL_ASSERT(ycomp >= 0 && ycomp+numcomp <=
y.nComp());
2779 const Dim3 offset{.
x = ylo.x-xlo.x, .y = ylo.y-xlo.y, .z = ylo.z-xlo.z};
2787 using ReduceTuple =
typename decltype(reduce_data)::Type;
2788 reduce_op.
eval(xbx, reduce_data,
2792 for (
int n = 0; n < numcomp; ++n) {
2797 ReduceTuple hv = reduce_data.
value(reduce_op);
2798 r = amrex::get<0>(hv);
2812template <RunOn run_on>
2816 int numcomp)
const noexcept
2823 BL_ASSERT(ycomp >= 0 && ycomp+numcomp <=
y.nComp());
2829 const Dim3 offset{.
x = ylo.x-xlo.x, .y = ylo.y-xlo.y, .z = ylo.z-xlo.z};
2839 using ReduceTuple =
typename decltype(reduce_data)::Type;
2840 reduce_op.
eval(xbx, reduce_data,
2843 int m =
static_cast<int>(
static_cast<bool>(ma(i,j,k)));
2845 for (
int n = 0; n < numcomp; ++n) {
2850 ReduceTuple hv = reduce_data.
value(reduce_op);
2851 r = amrex::get<0>(hv);
2857 int m =
static_cast<int>(
static_cast<bool>(ma(i,j,k)));
2866template <RunOn run_on>
2874template <RunOn run_on>
2882template <RunOn run_on>
2886 return this->negate<run_on>(this->domain,
DestComp{comp},
NumComps{numcomp});
2890template <RunOn run_on>
2898template <RunOn run_on>
2902 return this->invert<run_on>(r, this->domain,
DestComp{comp},
NumComps{numcomp});
2906template <RunOn run_on>
2914template <RunOn run_on>
2918 return this->plus<run_on>(r, this->domain,
DestComp{comp},
NumComps{numcomp});
2922template <RunOn run_on>
2930template <RunOn run_on>
2938template <RunOn run_on>
2942 Box ovlp(this->domain);
2944 return ovlp.
ok() ? this->atomicAdd<run_on>(src,ovlp,ovlp,srccomp,destcomp,numcomp) : *
this;
2948template <RunOn run_on>
2951 int numcomp)
noexcept
2957template <RunOn run_on>
2960 int numcomp)
noexcept
2962 Box ovlp(this->domain);
2965 return ovlp.
ok() ? this->atomicAdd<run_on>(src,ovlp,ovlp,srccomp,destcomp,numcomp) : *
this;
2969template <RunOn run_on>
2972 int srccomp,
int destcomp,
int numcomp)
noexcept
2978 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
2997template <RunOn run_on,
typename T>
3000 const Box& srcbox,
const Box& destbox,
3001 int srccomp,
int destcomp,
int numcomp)
noexcept
3010 T* p = d.
ptr(i,j,k,n+destcomp);
3015template <RunOn run_on,
typename T>
3016requires (!HasAtomicAdd<T>::value)
3017void basefab_atomic_add (BaseFab<T>& dfab,
const BaseFab<T>& sfab,
3018 const Box& srcbox,
const Box& destbox,
3019 int srccomp,
int destcomp,
int numcomp)
3028template <RunOn run_on>
3031 int srccomp,
int destcomp,
int numcomp)
noexcept
3037 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3040 detail::basefab_atomic_add<run_on>(*
this, src, srcbox, destbox,
3041 srccomp, destcomp, numcomp);
3047template <RunOn run_on>
3050 int srccomp,
int destcomp,
int numcomp)
noexcept
3052#if defined(AMREX_USE_OMP) && (AMREX_SPACEDIM > 1)
3053#if defined(AMREX_USE_GPU)
3060 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3087 for (
int ip = 0; ip < nplanes; ++ip) {
3092 int planes_left = nplanes;
3093 while (planes_left > 0) {
3095 auto const m = mm + plo;
3096 auto* lock = OpenMP::get_lock(m);
3097 if (omp_test_lock(lock))
3101 if (planedim == 1) {
3109 for (
int n = 0; n < numcomp; ++n) {
3110 for (
int k = lo.z; k <= hi.z; ++k) {
3111 for (
int j = lo.y; j <= hi.y; ++j) {
3115 for (
int ii = 0; ii < len.x; ++ii) {
3116 pdst[ii] += psrc[ii];
3124 omp_unset_lock(lock);
3125 if (planes_left == 0) {
break; }
3129 for (
int ip = 0; ip < nplanes; ++ip) {
3130 int new_mm = (mm+ip) % nplanes;
3131 if ( !
mask[new_mm] ) {
3142#if defined(AMREX_USE_GPU)
3144 return this->
template atomicAdd<run_on>(src, srcbox, destbox, srccomp, destcomp, numcomp);
3148 return this->
template atomicAdd<run_on>(src, srcbox, destbox, srccomp, destcomp, numcomp);
3153template <RunOn run_on>
3161template <RunOn run_on>
3169template <RunOn run_on>
3172 int srccomp,
int destcomp,
int numcomp)
noexcept
3178 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3195template <RunOn run_on>
3199 return this->mult<run_on>(r, this->domain,
DestComp{comp},
NumComps{numcomp});
3203template <RunOn run_on>
3211template <RunOn run_on>
3219template <RunOn run_on>
3227template <RunOn run_on>
3230 int srccomp,
int destcomp,
int numcomp)
noexcept
3236 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3253template <RunOn run_on>
3257 return this->divide<run_on>(r, this->domain,
DestComp{comp},
NumComps{numcomp});
3261template <RunOn run_on>
3269template <RunOn run_on>
3277template <RunOn run_on>
3285template <RunOn run_on>
3288 int srccomp,
int destcomp,
int numcomp)
noexcept
3294 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3311template <RunOn run_on>
3315 Box ovlp(this->domain);
3317 return ovlp.
ok() ? this->protected_divide<run_on>(src,ovlp,ovlp,0,0,this->nvar) : *
this;
3321template <RunOn run_on>
3325 Box ovlp(this->domain);
3327 return ovlp.
ok() ? this->protected_divide<run_on>(src,ovlp,ovlp,srccomp,destcomp,numcomp) : *
this;
3331template <RunOn run_on>
3334 int numcomp)
noexcept
3336 Box ovlp(this->domain);
3339 return ovlp.
ok() ? this->protected_divide<run_on>(src,ovlp,ovlp,srccomp,destcomp,numcomp) : *
this;
3343template <RunOn run_on>
3346 int srccomp,
int destcomp,
int numcomp)
noexcept
3352 BL_ASSERT(srccomp >= 0 && srccomp+numcomp <= src.nComp());
3363 d(i,j,k,n+destcomp) /= s(i+offset.x,j+offset.y,k+offset.z,n+srccomp);
3381template <RunOn run_on>
3386 const Box& b,
int comp,
int numcomp)
noexcept
3389 return copy<run_on>(f1,b1,comp1,b,comp,numcomp);
3391 return copy<run_on>(f2,b2,comp2,b,comp,numcomp);
3393 Real alpha = (t2-t)/(t2-t1);
3395 return linComb<run_on>(f1,b1,comp1,f2,b2,comp2,alpha,
beta,b,comp,numcomp);
3400template <RunOn run_on>
3405 const Box& b,
int comp,
int numcomp)
noexcept
3408 return copy<run_on>(f1,b,comp1,b,comp,numcomp);
3410 return copy<run_on>(f2,b,comp2,b,comp,numcomp);
3412 Real alpha = (t2-t)/(t2-t1);
3414 return linComb<run_on>(f1,b,comp1,f2,b,comp2,alpha,
beta,b,comp,numcomp);
3423template <RunOn run_on>
3427 this->setVal<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3431template <RunOn run_on>
3435 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3439 a(i,j,k,n+dcomp.i) = x;
3444template <RunOn run_on>
3452template <RunOn run_on>
3456 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3461 if (m(i,j,k)) { a(i,j,k,n+dcomp.i) = val; }
3466template <RunOn run_on>
3474template <RunOn run_on>
3478 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3483 if (!m(i,j,k)) { a(i,j,k,n+dcomp.i) = val; }
3488template <RunOn run_on>
3493 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
3498 for (
int n = dcomp.i; n < ncomp.n+dcomp.i; ++n) {
3507 for (
auto const& b : b_lst) {
3508 this->setVal<RunOn::Host>(
x, b, dcomp, ncomp);
3514template <RunOn run_on>
3523template <RunOn run_on>
3529 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3530 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3538 d(i,j,k,n+dcomp.i) = s(i,j,k,n+scomp.i);
3545template <RunOn run_on>
3549 return this->plus<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3553template <RunOn run_on>
3557 return this->plus<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3561template <RunOn run_on>
3565 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3570 a(i,j,k,n+dcomp.i) += val;
3577template <RunOn run_on>
3585template <RunOn run_on>
3593template <RunOn run_on>
3599 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3600 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3608 d(i,j,k,n+dcomp.i) += s(i,j,k,n+scomp.i);
3615template <RunOn run_on>
3619 return this->minus<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3623template <RunOn run_on>
3627 return this->minus<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3631template <RunOn run_on>
3635 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3640 a(i,j,k,n+dcomp.i) -= val;
3647template <RunOn run_on>
3655template <RunOn run_on>
3663template <RunOn run_on>
3669 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3670 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3678 d(i,j,k,n+dcomp.i) -= s(i,j,k,n+scomp.i);
3685template <RunOn run_on>
3689 return this->mult<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3693template <RunOn run_on>
3697 return this->mult<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3701template <RunOn run_on>
3705 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3710 a(i,j,k,n+dcomp.i) *= val;
3717template <RunOn run_on>
3725template <RunOn run_on>
3733template <RunOn run_on>
3739 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3740 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3748 d(i,j,k,n+dcomp.i) *= s(i,j,k,n+scomp.i);
3755template <RunOn run_on>
3759 return this->divide<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3763template <RunOn run_on>
3767 return this->divide<run_on>(val, this->domain,
DestComp{0},
NumComps{this->nvar});
3771template <RunOn run_on>
3775 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3780 a(i,j,k,n+dcomp.i) /= val;
3787template <RunOn run_on>
3795template <RunOn run_on>
3803template <RunOn run_on>
3809 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3810 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3818 d(i,j,k,n+dcomp.i) /= s(i,j,k,n+scomp.i);
3825template <RunOn run_on>
3829 return this->negate<run_on>(this->domain,
DestComp{0},
NumComps{this->nvar});
3833template <RunOn run_on>
3837 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3842 a(i,j,k,n+dcomp.i) = -a(i,j,k,n+dcomp.i);
3849template <RunOn run_on>
3853 return this->invert<run_on>(r, this->domain,
DestComp{0},
NumComps{this->nvar});
3857template <RunOn run_on>
3861 BL_ASSERT(dcomp.i >= 0 && dcomp.i + ncomp.n <= this->nvar);
3866 a(i,j,k,n+dcomp.i) = r / a(i,j,k,n+dcomp.i);
3873template <RunOn run_on>
3877 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3882 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
3885 using ReduceTuple =
typename decltype(reduce_data)::Type;
3886 reduce_op.
eval(bx, reduce_data,
3890 for (
int n = 0; n < ncomp.n; ++n) {
3891 t += a(i,j,k,n+dcomp.i);
3895 ReduceTuple hv = reduce_data.
value(reduce_op);
3896 r = amrex::get<0>(hv);
3902 r += a(i,j,k,n+dcomp.i);
3910template <RunOn run_on>
3915 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
3916 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3922 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
3925 using ReduceTuple =
typename decltype(reduce_data)::Type;
3926 reduce_op.
eval(bx, reduce_data,
3930 for (
int n = 0; n < ncomp.n; ++n) {
3931 t += d(i,j,k,n+dcomp.i) * s(i,j,k,n+scomp.i);
3935 ReduceTuple hv = reduce_data.
value(reduce_op);
3936 r = amrex::get<0>(hv);
3942 r += d(i,j,k,n+dcomp.i) * s(i,j,k,n+scomp.i);
3950template <RunOn run_on>
3959template <RunOn run_on>
3963 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
3968 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
3971 using ReduceTuple =
typename decltype(reduce_data)::Type;
3972 reduce_op.
eval(bx, reduce_data,
3976 for (
int n = 0; n < ncomp.n; ++n) {
3977 t += a(i,j,k,n+dcomp.i)*a(i,j,k,n+dcomp.i);
3981 ReduceTuple hv = reduce_data.
value(reduce_op);
3982 r = amrex::get<0>(hv);
3988 r += a(i,j,k,n+dcomp.i)*a(i,j,k,n+dcomp.i);
3996template <RunOn run_on>
4003 AMREX_ASSERT(scomp.i >= 0 && scomp.i+ncomp.n <= src.nvar);
4004 AMREX_ASSERT(dcomp.i >= 0 && dcomp.i+ncomp.n <= this->nvar);
4011 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
4014 using ReduceTuple =
typename decltype(reduce_data)::Type;
4015 reduce_op.
eval(bx, reduce_data,
4019 T mi =
static_cast<T
>(
static_cast<int>(
static_cast<bool>(m(i,j,k))));
4020 for (
int n = 0; n < ncomp.n; ++n) {
4021 t += d(i,j,k,n+dcomp.i)*s(i,j,k,n+scomp.i)*mi;
4025 ReduceTuple hv = reduce_data.
value(reduce_op);
4026 r = amrex::get<0>(hv);
4032 int mi = static_cast<int>(static_cast<bool>(m(i,j,k)));
4033 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
Convenience header for the core AMReX GPU facilities.
int idir
Definition AMReX_HypreMLABecLap.cpp:1135
Array4< int const > offset
Definition AMReX_HypreMLABecLap.cpp:1131
Real * pdst
Definition AMReX_HypreMLABecLap.cpp:1132
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
GpuArray< Real, 3 > beta
Definition AMReX_MLEBNodeFDLaplacian.cpp:1099
GpuArray< int, 3 > dhi
Definition AMReX_MLEBNodeFDLaplacian.cpp:1100
GpuArray< int, 3 > dlo
Definition AMReX_MLEBNodeFDLaplacian.cpp:1100
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:2582
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:2638
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:3525
T sum(int comp, int numcomp=1) const noexcept
Returns sum of given component of FAB state vector.
Definition AMReX_BaseFab.H:2868
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:2011
BaseFab< T > & divide(T const &val) noexcept
Scalar division on the whole domain and all components.
Definition AMReX_BaseFab.H:3757
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:3665
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:3049
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:1892
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:1947
std::size_t nBytesOwned() const noexcept
Definition AMReX_BaseFab.H:334
BaseFab< T > & copy(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3516
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:2703
BaseFab< T > & minus(T const &val) noexcept
Scalar subtraction on the whole domain and all components.
Definition AMReX_BaseFab.H:3617
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:2398
BaseFab< T > & plus(T const &val) noexcept
Scalar addition on the whole domain and all components.
Definition AMReX_BaseFab.H:3547
BaseFab< T > & mult(T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3703
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:3735
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:2727
void define()
Allocates memory for the BaseFab<T>.
Definition AMReX_BaseFab.H:1596
BaseFab< T > & operator*=(T const &val) noexcept
Definition AMReX_BaseFab.H:3695
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:1774
void clear()
The function returns the BaseFab to the invalid state. The memory is freed.
Definition AMReX_BaseFab.H:1838
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:3197
BaseFab< T > & atomicAdd(const BaseFab< T > &x) noexcept
Atomic FAB addition (a[i] <- a[i] + b[i]).
Definition AMReX_BaseFab.H:2628
int maskEQ(BaseFab< int > &mask, T const &val, int comp=0) const noexcept
Mark cells with value equal to val.
Definition AMReX_BaseFab.H:2490
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:1874
void setVal(T const &x, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3433
BaseFab< T > & operator-=(T const &val) noexcept
Definition AMReX_BaseFab.H:3625
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:3454
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:2307
BaseFab< T > & mult(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3719
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:2444
void setValIf(T const &val, const BaseFab< int > &mask) noexcept
Definition AMReX_BaseFab.H:3446
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:3595
void setValIfNot(T const &val, const BaseFab< int > &mask) noexcept
Definition AMReX_BaseFab.H:3468
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:2675
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:1919
BaseFab< T > & negate() noexcept
on the whole domain and all components
Definition AMReX_BaseFab.H:3827
BaseFab< T > & minus(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3649
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:3155
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:2268
Elixir elixir() noexcept
Transfer owned storage to an Elixir when running in a GPU launch region.
Definition AMReX_BaseFab.H:1817
BaseFab< T > & operator+=(T const &val) noexcept
Definition AMReX_BaseFab.H:3555
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:3490
BaseFab< T > & minus(T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
Do nothing if bx is empty.
Definition AMReX_BaseFab.H:3633
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:3425
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:3773
T max(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2188
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:2764
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:3255
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:3765
std::pair< T, T > minmax(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2226
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:2924
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:3476
BaseFab< T > & mult(T const &val) noexcept
Scalar multiplication on the whole domain and all components.
Definition AMReX_BaseFab.H:3687
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:3805
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:1721
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:2372
BaseFab< T > & protected_divide(const BaseFab< T > &src) noexcept
Divide wherever "src" is "true" or "non-zero".
Definition AMReX_BaseFab.H:3313
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:2908
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:2536
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:2814
BaseFab< T > & plus(const BaseFab< T > &src) noexcept
Definition AMReX_BaseFab.H:3579
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:3789
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:2150
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:1975
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:3383
IntVect minIndex(int comp=0) const noexcept
Definition AMReX_BaseFab.H:2346
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:1983
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:3563
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:2055
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:104
static int deviceId() noexcept
Definition AMReX_GpuDevice.cpp:697
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:672
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:734
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
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:1365
__host__ __device__ Dim3 length(Array4< T > const &a) noexcept
Return the spatial extents of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1379
__host__ __device__ Dim3 lbound(Array4< T > const &a) noexcept
Return the inclusive lower bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1351
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
__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:186
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
int nComp(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.nComp().
Definition AMReX_FabArrayBase.cpp:2860
BoxList boxDiff(const Box &b1in, const Box &b2)
Returns a BoxList defining the complement of b2 in b1in.
Definition AMReX_BoxList.cpp:599
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:236
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:242
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:289
__host__ __device__ constexpr std::size_t size() const noexcept
Total number of elements in the ArrayND's index region.
Definition AMReX_Array4.H:643
__host__ __device__ T * ptr(idx... i) const noexcept
Multi-index ptr() for accessing pointer to element.
Definition AMReX_Array4.H:561
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