1#ifndef AMREX_FABARRAY_UTILITY_H_
2#define AMREX_FABARRAY_UTILITY_H_
3#include <AMReX_Config.H>
13template <
class FAB,
class F,
14 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
15typename FAB::value_type
21template <
class FAB,
class F,
22 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
23typename FAB::value_type
26 using value_type =
typename FAB::value_type;
30#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
34 const Box& bx = mfi.growntilebox(nghost);
45template <
class OP,
class FAB,
class F>
46std::enable_if_t<IsBaseFab<FAB>::value,
47 std::conditional_t<std::is_same<OP,ReduceOpLogicalAnd>::value ||
48 std::is_same<OP,ReduceOpLogicalOr>::value,
49 int,
typename FAB::value_type> >
52 using T = std::conditional_t<std::is_same<OP,ReduceOpLogicalAnd>::value ||
53 std::is_same<OP,ReduceOpLogicalOr>::value,
54 int,
typename FAB::value_type>;
64template <
class OP,
class FAB1,
class FAB2,
class F>
66 std::conditional_t<std::is_same<OP,ReduceOpLogicalAnd>::value ||
67 std::is_same<OP,ReduceOpLogicalOr>::value,
68 int,
typename FAB1::value_type> >
71 using T = std::conditional_t<std::is_same<OP,ReduceOpLogicalAnd>::value ||
72 std::is_same<OP,ReduceOpLogicalOr>::value,
73 int,
typename FAB1::value_type>;
81 ma1[box_no], ma2[box_no])) };
85template <
class OP,
class FAB1,
class FAB2,
class FAB3,
class F>
87 std::conditional_t<std::is_same<OP,ReduceOpLogicalAnd>::value ||
88 std::is_same<OP,ReduceOpLogicalOr>::value,
89 int,
typename FAB1::value_type> >
93 using T = std::conditional_t<std::is_same<OP,ReduceOpLogicalAnd>::value ||
94 std::is_same<OP,ReduceOpLogicalOr>::value,
95 int,
typename FAB1::value_type>;
104 ma1[box_no], ma2[box_no], ma3[box_no])) };
108template <
class FAB,
class F>
109std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB::value_type>
115template <
class FAB,
class F>
116std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB::value_type>
120 amrex::Abort(
"ReduceSum: Launch Region is off. Device lambda cannot be called by host.");
125template <
class FAB,
class F,
126 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
127typename FAB::value_type
131 return fudetail::ReduceMF<ReduceOpSum>(fa, nghost, std::forward<F>(f));
137template <
class FAB,
class F,
138 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
139typename FAB::value_type
146template <
class FAB1,
class FAB2,
class F,
147 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
148typename FAB1::value_type
155template <
class FAB1,
class FAB2,
class F,
156 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
157typename FAB1::value_type
161 using value_type =
typename FAB1::value_type;
165#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
169 const Box& bx = mfi.growntilebox(nghost);
172 sm += f(bx, arr1, arr2);
181template <
class FAB1,
class FAB2,
class F>
182std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
189template <
class FAB1,
class FAB2,
class F>
190std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
195 amrex::Abort(
"ReduceSum: Launch Region is off. Device lambda cannot be called by host.");
200template <
class FAB1,
class FAB2,
class F,
201 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
202typename FAB1::value_type
207 return fudetail::ReduceMF<ReduceOpSum>(fa1,fa2,nghost,std::forward<F>(f));
213template <
class FAB1,
class FAB2,
class F,
214 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
215typename FAB1::value_type
216ReduceSum (FabArray<FAB1>
const& fa1, FabArray<FAB2>
const& fa2,
223template <
class FAB1,
class FAB2,
class FAB3,
class F,
224 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
225typename FAB1::value_type
233template <
class FAB1,
class FAB2,
class FAB3,
class F,
234 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
235typename FAB1::value_type
239 using value_type =
typename FAB1::value_type;
243#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
247 const Box& bx = mfi.growntilebox(nghost);
251 sm += f(bx, arr1, arr2, arr3);
260template <
class FAB1,
class FAB2,
class FAB3,
class F>
261std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
268template <
class FAB1,
class FAB2,
class FAB3,
class F>
269std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
274 amrex::Abort(
"ReduceSum: Launch Region is off. Device lambda cannot be called by host.");
279template <
class FAB1,
class FAB2,
class FAB3,
class F,
280 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
281typename FAB1::value_type
286 return fudetail::ReduceMF<ReduceOpSum>(fa1,fa2,fa3,nghost,std::forward<F>(f));
292template <
class FAB1,
class FAB2,
class FAB3,
class F,
293 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
294typename FAB1::value_type
295ReduceSum (FabArray<FAB1>
const& fa1, FabArray<FAB2>
const& fa2,
296 FabArray<FAB3>
const& fa3,
IntVect const& nghost,
F&& f)
302template <
class FAB,
class F,
303 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
304typename FAB::value_type
311template <
class FAB,
class F,
312 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
313typename FAB::value_type
316 using value_type =
typename FAB::value_type;
317 value_type
r = std::numeric_limits<value_type>::max();
320#pragma omp parallel reduction(min:r)
324 const Box& bx = mfi.growntilebox(nghost);
326 r = std::min(
r, f(bx, arr));
334template <
class FAB,
class F>
335std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB::value_type>
341template <
class FAB,
class F>
342std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB::value_type>
346 amrex::Abort(
"ReduceMin: Launch Region is off. Device lambda cannot be called by host.");
351template <
class FAB,
class F,
352 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
353typename FAB::value_type
357 return fudetail::ReduceMF<ReduceOpMin>(fa, nghost, std::forward<F>(f));
363template <
class FAB,
class F,
364 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
365typename FAB::value_type
372template <
class FAB1,
class FAB2,
class F,
373 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
374typename FAB1::value_type
381template <
class FAB1,
class FAB2,
class F,
382 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
383typename FAB1::value_type
387 using value_type =
typename FAB1::value_type;
388 value_type
r = std::numeric_limits<value_type>::max();
391#pragma omp parallel reduction(min:r)
395 const Box& bx = mfi.growntilebox(nghost);
398 r = std::min(
r, f(bx, arr1, arr2));
407template <
class FAB1,
class FAB2,
class F>
408std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
415template <
class FAB1,
class FAB2,
class F>
416std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
421 amrex::Abort(
"ReduceMin: Launch Region is off. Device lambda cannot be called by host.");
426template <
class FAB1,
class FAB2,
class F,
427 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
428typename FAB1::value_type
433 return fudetail::ReduceMF<ReduceOpMin>(fa1,fa2,nghost,std::forward<F>(f));
439template <
class FAB1,
class FAB2,
class F,
440 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
441typename FAB1::value_type
442ReduceMin (FabArray<FAB1>
const& fa1, FabArray<FAB2>
const& fa2,
449template <
class FAB1,
class FAB2,
class FAB3,
class F,
450 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
451typename FAB1::value_type
459template <
class FAB1,
class FAB2,
class FAB3,
class F,
460 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
461typename FAB1::value_type
465 using value_type =
typename FAB1::value_type;
466 value_type
r = std::numeric_limits<value_type>::max();
469#pragma omp parallel reduction(min:r)
473 const Box& bx = mfi.growntilebox(nghost);
477 r = std::min(
r, f(bx, arr1, arr2, arr3));
486template <
class FAB1,
class FAB2,
class FAB3,
class F>
487std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
494template <
class FAB1,
class FAB2,
class FAB3,
class F>
495std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
500 amrex::Abort(
"ReduceMin: Launch Region is off. Device lambda lambda cannot be called by host.");
505template <
class FAB1,
class FAB2,
class FAB3,
class F,
506 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
507typename FAB1::value_type
512 return fudetail::ReduceMF<ReduceOpMin>(fa1,fa2,fa3,nghost,std::forward<F>(f));
518template <
class FAB1,
class FAB2,
class FAB3,
class F,
519 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
520typename FAB1::value_type
521ReduceMin (FabArray<FAB1>
const& fa1, FabArray<FAB2>
const& fa2,
522 FabArray<FAB3>
const& fa3,
IntVect const& nghost,
F&& f)
528template <
class FAB,
class F,
529 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
530typename FAB::value_type
537template <
class FAB,
class F,
538 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
539typename FAB::value_type
542 using value_type =
typename FAB::value_type;
543 value_type
r = std::numeric_limits<value_type>::lowest();
546#pragma omp parallel reduction(max:r)
550 const Box& bx = mfi.growntilebox(nghost);
552 r = std::max(
r, f(bx, arr));
561template <
class FAB,
class F>
562std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB::value_type>
568template <
class FAB,
class F>
569std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB::value_type>
573 amrex::Abort(
"ReduceMax: Launch Region is off. Device lambda cannot be called by host.");
578template <
class FAB,
class F,
579 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
580typename FAB::value_type
584 return fudetail::ReduceMF<ReduceOpMax>(fa,nghost,std::forward<F>(f));
590template <
class FAB,
class F,
591 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
592typename FAB::value_type
599template <
class FAB1,
class FAB2,
class F,
600 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
601typename FAB1::value_type
608template <
class FAB1,
class FAB2,
class F,
609 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
610typename FAB1::value_type
614 using value_type =
typename FAB1::value_type;
615 value_type
r = std::numeric_limits<value_type>::lowest();
618#pragma omp parallel reduction(max:r)
622 const Box& bx = mfi.growntilebox(nghost);
625 r = std::max(
r, f(bx, arr1, arr2));
634template <
class FAB1,
class FAB2,
class F>
635std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
642template <
class FAB1,
class FAB2,
class F>
643std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
648 amrex::Abort(
"ReduceMax: Launch Region is off. Device lambda cannot be called by host.");
653template <
class FAB1,
class FAB2,
class F,
654 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
655typename FAB1::value_type
660 return fudetail::ReduceMF<ReduceOpMax>(fa1,fa2,nghost,std::forward<F>(f));
666template <
class FAB1,
class FAB2,
class F,
667 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
668typename FAB1::value_type
669ReduceMax (FabArray<FAB1>
const& fa1, FabArray<FAB2>
const& fa2,
676template <
class FAB1,
class FAB2,
class FAB3,
class F,
677 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
678typename FAB1::value_type
686template <
class FAB1,
class FAB2,
class FAB3,
class F,
687 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
688typename FAB1::value_type
692 using value_type =
typename FAB1::value_type;
693 value_type
r = std::numeric_limits<value_type>::lowest();
696#pragma omp parallel reduction(max:r)
700 const Box& bx = mfi.growntilebox(nghost);
704 r = std::max(
r, f(bx, arr1, arr2, arr3));
713template <
class FAB1,
class FAB2,
class FAB3,
class F>
714std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
721template <
class FAB1,
class FAB2,
class FAB3,
class F>
722std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
typename FAB1::value_type>
727 amrex::Abort(
"ReduceMax: Launch Region is off. Device lambda lambda cannot be called by host.");
732template <
class FAB1,
class FAB2,
class FAB3,
class F,
733 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
734typename FAB1::value_type
739 return fudetail::ReduceMF<ReduceOpMax>(fa1,fa2,fa3,nghost,std::forward<F>(f));
745template <
class FAB1,
class FAB2,
class FAB3,
class F,
746 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
747typename FAB1::value_type
748ReduceMax (FabArray<FAB1>
const& fa1, FabArray<FAB2>
const& fa2,
749 FabArray<FAB3>
const& fa3,
IntVect const& nghost,
F&& f)
755template <
class FAB,
class F,
756 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
764template <
class FAB,
class F,
765 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
772#pragma omp parallel reduction(&&:r)
776 const Box& bx = mfi.growntilebox(nghost);
787template <
class FAB,
class F>
788std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
bool>
794template <
class FAB,
class F>
795std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
bool>
799 amrex::Abort(
"ReduceLogicalAnd: Launch Region is off. Device lambda cannot be called by host.");
804template <
class FAB,
class F,
805 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
810 return fudetail::ReduceMF<ReduceOpLogicalAnd>(fa,nghost,std::forward<F>(f));
816template <
class FAB,
class F,
817 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
825template <
class FAB1,
class FAB2,
class F,
826 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
835template <
class FAB1,
class FAB2,
class F,
836 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
844#pragma omp parallel reduction(&&:r)
848 const Box& bx = mfi.growntilebox(nghost);
851 r =
r && f(bx, arr1, arr2);
860template <
class FAB1,
class FAB2,
class F>
861std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
bool>
868template <
class FAB1,
class FAB2,
class F>
869std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
bool>
874 amrex::Abort(
"ReduceLogicalAnd: Luanch Region is off. Device lambda cannot be called by host.");
879template <
class FAB1,
class FAB2,
class F,
880 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
886 return fudetail::ReduceMF<ReduceOpLogicalAnd>(fa1,fa2,nghost,std::forward<F>(f));
892template <
class FAB1,
class FAB2,
class F,
893 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
902template <
class FAB,
class F,
903 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
911template <
class FAB,
class F,
912 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
919#pragma omp parallel reduction(||:r)
923 const Box& bx = mfi.growntilebox(nghost);
934template <
class FAB,
class F>
935std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
bool>
941template <
class FAB,
class F>
942std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
bool>
946 amrex::Abort(
"ReduceLogicalOr: Launch Region is off. Device lambda cannot be called by host.");
951template <
class FAB,
class F,
952 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
957 return fudetail::ReduceMF<ReduceOpLogicalOr>(fa,nghost,std::forward<F>(f));
963template <
class FAB,
class F,
964 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
972template <
class FAB1,
class FAB2,
class F,
973 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
982template <
class FAB1,
class FAB2,
class F,
983 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
991#pragma omp parallel reduction(||:r)
995 const Box& bx = mfi.growntilebox(nghost);
998 r =
r || f(bx, arr1, arr2);
1007template <
class FAB1,
class FAB2,
class F>
1008std::enable_if_t<!amrex::DefinitelyNotHostRunnable<F>::value,
bool>
1015template <
class FAB1,
class FAB2,
class F>
1016std::enable_if_t<amrex::DefinitelyNotHostRunnable<F>::value,
bool>
1021 amrex::Abort(
"ReeuceLogicalOr: Launch Region is off. Device lambda cannot be called by host.");
1026template <
class FAB1,
class FAB2,
class F,
1027 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
1033 return fudetail::ReduceMF<ReduceOpLogicalOr>(fa1,fa2,nghost,std::forward<F>(f));
1039template <
class FAB1,
class FAB2,
class F,
1040 class bar = std::enable_if_t<IsBaseFab<FAB1>::value> >
1049template <class FAB, class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1058 int n = (comp >= 0) ? 1 : mf.
nComp();
1061 auto* dp = pv.
data();
1065 *dp = fab(cell, comp);
1067 for (
int i = 0; i < n; ++i) {
1068 dp[i] = fab(cell,i);
1085 <<
": " << *dp <<
'\n';
1087 std::ostringstream ss;
1089 for (
int i = 0; i < n-1; ++i)
1091 ss << dp[i] <<
", ";
1095 <<
": " << ss.str() <<
'\n';
1102 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1110 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1116 auto const& dstfa = dst.
arrays();
1121 dstfa[box_no](i,j,k,n+dstcomp) -= srcfa[box_no](i,j,k,n+srccomp);
1130#pragma omp parallel if (Gpu::notInLaunchRegion())
1134 const Box& bx = mfi.growntilebox(nghost);
1137 auto const srcFab = src.
array(mfi);
1138 auto dstFab = dst.
array(mfi);
1141 dstFab(i,j,k,n+dstcomp) -= srcFab(i,j,k,n+srccomp);
1150 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1158 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1164 auto const& dstfa = dst.
arrays();
1169 dstfa[box_no](i,j,k,n+dstcomp) *= srcfa[box_no](i,j,k,n+srccomp);
1178#pragma omp parallel if (Gpu::notInLaunchRegion())
1182 const Box& bx = mfi.growntilebox(nghost);
1185 auto const srcFab = src.
array(mfi);
1186 auto dstFab = dst.
array(mfi);
1189 dstFab(i,j,k,n+dstcomp) *= srcFab(i,j,k,n+srccomp);
1198 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1206 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1212 auto const& dstfa = dst.
arrays();
1217 dstfa[box_no](i,j,k,n+dstcomp) /= srcfa[box_no](i,j,k,n+srccomp);
1226#pragma omp parallel if (Gpu::notInLaunchRegion())
1230 const Box& bx = mfi.growntilebox(nghost);
1233 auto const srcFab = src.
array(mfi);
1234 auto dstFab = dst.
array(mfi);
1237 dstFab(i,j,k,n+dstcomp) /= srcFab(i,j,k,n+srccomp);
1245 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1253 class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1259 auto const& fabarr = fa.
arrays();
1263 fabarr[box_no](i,j,k,n+icomp) = std::abs(fabarr[box_no](i,j,k,n+icomp));
1272#pragma omp parallel if (Gpu::notInLaunchRegion())
1276 const Box& bx = mfi.growntilebox(nghost);
1279 auto const& fab = fa.
array(mfi);
1282 fab(i,j,k,n+icomp) = std::abs(fab(i,j,k,n+icomp));
1289template <class FAB, class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1304template <class FAB, class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1320template <class FAB, class IFAB, class bar = std::enable_if_t<IsBaseFab<FAB>::value
1321 && IsBaseFab<IFAB>::value> >
1332template <class FAB, class IFAB, class bar = std::enable_if_t<IsBaseFab<FAB>::value
1333 && IsBaseFab<IFAB>::value> >
1342 const int ncomp = fa.
nComp();
1346 auto const& fabarr = fa.
arrays();
1351 if (!ifabarr[box_no](i,j,k)) { fabarr[box_no](i,j,k,n) = 0; }
1360#pragma omp parallel if (Gpu::notInLaunchRegion())
1364 const Box& bx = mfi.tilebox();
1365 auto fab = fa.
array(mfi);
1366 auto const ifab = msk.
array(mfi);
1369 if (!ifab(i,j,k)) { fab(i,j,k,n) = 0; }
1380template <class FAB, class bar = std::enable_if_t<IsBaseFab<FAB>::value> >
1388 fa.
os_temp->ParallelCopy_finish();
1394template <class FAB, class foo = std::enable_if_t<IsBaseFab<FAB>::value> >
1397 int scomp,
int dcomp,
int ncomp)
1403 void*
pdst = dst[mfi].dataPtr(dcomp);
1404 void const* psrc = src[mfi].dataPtr(scomp);
1412template <class FAB, class foo = std::enable_if_t<IsBaseFab<FAB>::value> >
1419template <class FAB, class foo = std::enable_if_t<IsBaseFab<FAB>::value> >
1422 int scomp,
int dcomp,
int ncomp)
1428 void*
pdst = dst[mfi].dataPtr(dcomp);
1429 void const* psrc = src[mfi].dataPtr(scomp);
1437template <class FAB, class foo = std::enable_if_t<IsBaseFab<FAB>::value> >
1444template <class FAB, class foo = std::enable_if_t<IsBaseFab<FAB>::value> >
1447 typename FAB::value_type value)
1464 if (ma[box_no](i,j,k,comp) == value) {
1481 if (arr(i,j,k,comp) == value) {
1492 int const* tmp = aa.copyToHost();
1508 const Box& bx = mfi.growntilebox(nghost);
1512 if (fab(i,j,k,comp) == value) {
1523#if defined(AMREX_USE_OMP) && defined(_OPENMP) && (_OPENMP < 201307 || (defined(__NVCOMPILER) && __NVCOMPILER_MAJOR__ < 23))
1524#pragma omp critical (amrex_indexfromvalue)
1525#elif defined(AMREX_USE_OMP)
1526#pragma omp atomic capture
1533 if (old ==
false) { loc = priv_loc; }
1552template <typename FAB, std::enable_if_t<IsBaseFab<FAB>::value,
int> FOO = 0>
1553typename FAB::value_type
1555 IntVect const& nghost,
bool local =
false)
1563 using T =
typename FAB::value_type;
1567 auto const& xma =
x.const_arrays();
1573 auto const& xfab = xma[box_no];
1574 auto const& yfab = yma[box_no];
1575 for (
int n = 0; n < ncomp; ++n) {
1576 t += xfab(i,j,k,xcomp+n) * yfab(i,j,k,ycomp+n);
1584#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
1588 Box const& bx = mfi.growntilebox(nghost);
1589 auto const& xfab =
x.const_array(mfi);
1593 sm += xfab(i,j,k,xcomp+n) * yfab(i,j,k,ycomp+n);
1614template <typename FAB, std::enable_if_t<IsBaseFab<FAB>::value,
int> FOO = 0>
1615typename FAB::value_type
1622 using T =
typename FAB::value_type;
1626 auto const& xma =
x.const_arrays();
1631 auto const& xfab = xma[box_no];
1632 for (
int n = 0; n < ncomp; ++n) {
1633 auto v = xfab(i,j,k,xcomp+n);
1642#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
1646 Box const& bx = mfi.growntilebox(nghost);
1647 auto const& xfab =
x.const_array(mfi);
1650 auto v = xfab(i,j,k,xcomp+n);
1675template <
typename IFAB,
typename FAB,
1676 std::enable_if_t<IsBaseFab<FAB>::value && IsBaseFab<IFAB>::value,
int> FOO = 0>
1677typename FAB::value_type
1685 mask.nGrowVect().allGE(nghost));
1689 using T =
typename FAB::value_type;
1693 auto const& mma =
mask.const_arrays();
1694 auto const& xma =
x.const_arrays();
1700 auto m = T(mma[box_no](i,j,k));
1702 auto const& xfab = xma[box_no];
1703 auto const& yfab = yma[box_no];
1704 for (
int n = 0; n < ncomp; ++n) {
1705 t += xfab(i,j,k,xcomp+n) * yfab(i,j,k,ycomp+n);
1714#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
1718 Box const& bx = mfi.growntilebox(nghost);
1719 auto const& mfab =
mask.const_array(mfi);
1720 auto const& xfab =
x.const_array(mfi);
1724 auto m = T(mfab(i,j,k));
1725 sm += m * xfab(i,j,k,xcomp+n) * yfab(i,j,k,ycomp+n);
1747template <
typename IFAB,
typename FAB,
1748 std::enable_if_t<IsBaseFab<FAB>::value && IsBaseFab<IFAB>::value,
int> FOO = 0>
1749typename FAB::value_type
1751 IntVect const& nghost,
bool local =
false)
1755 BL_ASSERT(
x.nGrowVect().allGE(nghost) &&
mask.nGrowVect().allGE(nghost));
1759 using T =
typename FAB::value_type;
1763 auto const& mma =
mask.const_arrays();
1764 auto const& xma =
x.const_arrays();
1769 auto m = T(mma[box_no](i,j,k));
1771 auto const& xfab = xma[box_no];
1772 for (
int n = 0; n < ncomp; ++n) {
1773 auto v = xfab(i,j,k,xcomp+n);
1783#pragma omp parallel if (!system::regtest_reduction) reduction(+:sm)
1787 Box const& bx = mfi.growntilebox(nghost);
1788 auto const& mfab =
mask.const_array(mfi);
1789 auto const& xfab =
x.const_array(mfi);
1792 auto m = T(mfab(i,j,k));
1793 auto v = xfab(i,j,k,xcomp+n);
1807template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1808void setVal (MF& dst,
typename MF::value_type val)
1814template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1815void setBndry (MF& dst,
typename MF::value_type val,
int scomp,
int ncomp)
1817 dst.setBndry(val, scomp, ncomp);
1821template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1822void Scale (MF& dst,
typename MF::value_type val,
int scomp,
int ncomp,
int nghost)
1824 dst.mult(val, scomp, ncomp, nghost);
1828template <
class DMF,
class SMF,
1829 std::enable_if_t<IsMultiFabLike_v<DMF> &&
1830 IsMultiFabLike_v<SMF>,
int> = 0>
1831void LocalCopy (DMF& dst, SMF
const& src,
int scomp,
int dcomp,
1832 int ncomp,
IntVect const& nghost)
1834 amrex::Copy(dst, src, scomp, dcomp, ncomp, nghost);
1838template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1839void LocalAdd (MF& dst, MF
const& src,
int scomp,
int dcomp,
1840 int ncomp,
IntVect const& nghost)
1842 amrex::Add(dst, src, scomp, dcomp, ncomp, nghost);
1846template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1847void Saxpy (MF& dst,
typename MF::value_type a, MF
const& src,
int scomp,
int dcomp,
1848 int ncomp,
IntVect const& nghost)
1850 MF::Saxpy(dst, a, src, scomp, dcomp, ncomp, nghost);
1854template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1855void Xpay (MF& dst,
typename MF::value_type a, MF
const& src,
int scomp,
int dcomp,
1856 int ncomp,
IntVect const& nghost)
1858 MF::Xpay(dst, a, src, scomp, dcomp, ncomp, nghost);
1862template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1864 typename MF::value_type a, MF
const& src_a,
int acomp,
1865 typename MF::value_type
b, MF
const& src_b,
int bcomp,
1866 int dcomp,
int ncomp,
IntVect const& nghost)
1868 MF::LinComb(dst, a, src_a, acomp,
b, src_b, bcomp, dcomp, ncomp, nghost);
1872template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1878 dst.ParallelCopy(src, scomp, dcomp, ncomp, ng_src, ng_dst, period);
1881template <
class MF, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1882[[nodiscard]]
typename MF::value_type
1886 return mf.norminf(scomp, ncomp, nghost, local);
1890template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1893 for (
auto& mf: dst) {
1899template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1902 for (
auto& mf : dst) {
1908template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1912 for (
auto& mf : dst) {
1913 mf.
mult(val, scomp, ncomp, nghost);
1918template <
class DMF,
class SMF, std::size_t N,
1919 std::enable_if_t<IsMultiFabLike_v<DMF> &&
1920 IsMultiFabLike_v<SMF>,
int> = 0>
1922 int ncomp,
IntVect const& nghost)
1924 for (std::size_t i = 0; i < N; ++i) {
1925 amrex::Copy(dst[i], src[i], scomp, dcomp, ncomp, nghost);
1930template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1932 int ncomp,
IntVect const& nghost)
1934 for (std::size_t i = 0; i < N; ++i) {
1935 amrex::Add(dst[i], src[i], scomp, dcomp, ncomp, nghost);
1940template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1942 Array<MF,N> const& src,
int scomp,
int dcomp,
int ncomp,
1945 for (std::size_t i = 0; i < N; ++i) {
1946 MF::Saxpy(dst[i], a, src[i], scomp, dcomp, ncomp, nghost);
1951template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1953 Array<MF,N> const& src,
int scomp,
int dcomp,
int ncomp,
1956 for (std::size_t i = 0; i < N; ++i) {
1957 MF::Xpay(dst[i], a, src[i], scomp, dcomp, ncomp, nghost);
1962template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1964 typename MF::value_type a,
Array<MF,N> const& src_a,
int acomp,
1965 typename MF::value_type
b,
Array<MF,N> const& src_b,
int bcomp,
1966 int dcomp,
int ncomp,
IntVect const& nghost)
1968 for (std::size_t i = 0; i < N; ++i) {
1969 MF::LinComb(dst[i], a, src_a[i], acomp,
b, src_b[i], bcomp, dcomp, ncomp, nghost);
1974template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1976 int scomp,
int dcomp,
int ncomp,
1981 for (std::size_t i = 0; i < N; ++i) {
1982 dst[i].ParallelCopy(src[i], scomp, dcomp, ncomp, ng_src, ng_dst, period);
1986template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF>,
int> = 0>
1987[[nodiscard]]
typename MF::value_type
1991 auto r =
typename MF::value_type(0);
1992 for (std::size_t i = 0; i < N; ++i) {
1993 auto tmp = mf[i].norminf(scomp, ncomp, nghost,
true);
1994 r = std::max(
r,tmp);
2002template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF> && (N > 0),
2006 return mf[0].nComp();
2009template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF> && (N > 0),
2013 return mf[0].nGrowVect();
2016template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF> && (N > 0),
2018[[nodiscard]] BoxArray
const&
2021 return mf[0].boxArray();
2024template <
class MF, std::
size_t N, std::enable_if_t<IsMultiFabLike_v<MF> && (N > 0),
2026[[nodiscard]] DistributionMapping
const&
2029 return mf[0].DistributionMap();
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:551
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:37
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:111
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
Real * pdst
Definition AMReX_HypreMLABecLap.cpp:1090
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
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:129
Print on all processors of the default communicator.
Definition AMReX_Print.H:117
virtual bool isManaged() const
Definition AMReX_Arena.cpp:79
virtual bool isDevice() const
Definition AMReX_Arena.cpp:91
AMREX_GPU_HOST_DEVICE bool ok() const noexcept
Checks if it is a proper BoxND (including a valid type).
Definition AMReX_Box.H:200
AMREX_GPU_HOST_DEVICE bool contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is contained within BoxND.
Definition AMReX_Box.H:204
IntVect nGrowVect() const noexcept
Definition AMReX_FabArrayBase.H:79
bool isFusingCandidate() const noexcept
Is this a good candidate for kernel fusing?
IndexType ixType() const noexcept
Return index type.
Definition AMReX_FabArrayBase.H:85
const DistributionMapping & DistributionMap() const noexcept
Return constant reference to associated DistributionMapping.
Definition AMReX_FabArrayBase.H:130
@ ADD
Definition AMReX_FabArrayBase.H:393
int nComp() const noexcept
Return number of variables (aka components) associated with each point.
Definition AMReX_FabArrayBase.H:82
const BoxArray & boxArray() const noexcept
Return a constant reference to the BoxArray that defines the valid region associated with this FabArr...
Definition AMReX_FabArrayBase.H:94
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:344
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:584
std::unique_ptr< FabArray< FAB > > os_temp
Definition AMReX_FabArray.H:1474
const FabFactory< FAB > & Factory() const noexcept
Definition AMReX_FabArray.H:442
void prefetchToDevice(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:550
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:560
Arena * arena() const noexcept
Definition AMReX_FabArray.H:445
void setBndry(value_type val)
Set all values in the boundary region to val.
Definition AMReX_FabArray.H:2213
void setVal(value_type val)
Set all components in the entire region of each FAB to val.
Definition AMReX_FabArray.H:2412
MultiArray4< typename FabArray< FAB >::value_type > arrays() noexcept
Definition AMReX_FabArray.H:632
void mult(value_type val, int comp, int num_comp, int nghost=0)
Definition AMReX_FabArray.H:2665
MultiArray4< typename FabArray< FAB >::value_type const > const_arrays() const noexcept
Definition AMReX_FabArray.H:646
void prefetchToHost(const MFIter &mfi) const noexcept
Definition AMReX_FabArray.H:540
Definition AMReX_Tuple.H:93
Definition AMReX_GpuBuffer.H:17
T const * data() const noexcept
Definition AMReX_GpuBuffer.H:65
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool cellCentered() const noexcept
True if the IndexTypeND is CELL based in all directions.
Definition AMReX_IndexType.H:101
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheMinVector() noexcept
Definition AMReX_IntVect.H:718
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allGE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is greater than or equal to argument for all components. NOTE: This is NOT a str...
Definition AMReX_IntVect.H:441
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool allGT(const IntVectND< dim > &rhs) const noexcept
Returns true if this is greater than argument for all components. NOTE: This is NOT a strict weak ord...
Definition AMReX_IntVect.H:416
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheZeroVector() noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:670
Definition AMReX_MFIter.H:57
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:141
Definition AMReX_PODVector.H:262
T * data() noexcept
Definition AMReX_PODVector.H:609
This provides length of period for periodic domains. 0 means it is not periodic in that direction....
Definition AMReX_Periodicity.H:17
static const Periodicity & NonPeriodic() noexcept
Definition AMReX_Periodicity.cpp:52
Print & SetPrecision(int p)
Definition AMReX_Print.H:89
@ FAB
Definition AMReX_AmrvisConstants.H:86
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T Exch(T *address, T val) noexcept
Definition AMReX_GpuAtomic.H:485
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:237
void dtoh_memcpy_async(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:265
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:86
bool inNoSyncRegion() noexcept
Definition AMReX_GpuControl.H:146
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:251
void Sum(T &v, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:204
void Max(KeyValuePair< K, V > &vi, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:126
MPI_Comm CommunicatorSub() noexcept
sub-communicator for current frame
Definition AMReX_ParallelContext.H:70
std::enable_if_t<!amrex::DefinitelyNotHostRunnable< F >::value, typename FAB::value_type > ReduceMax_host_wrapper(FabArray< FAB > const &fa, IntVect const &nghost, F &&f)
Definition AMReX_FabArrayUtility.H:563
FAB::value_type ReduceMax_host(FabArray< FAB > const &fa, IntVect const &nghost, F const &f)
Definition AMReX_FabArrayUtility.H:540
std::enable_if_t<!amrex::DefinitelyNotHostRunnable< F >::value, bool > ReduceLogicalAnd_host_wrapper(FabArray< FAB > const &fa, IntVect const &nghost, F &&f)
Definition AMReX_FabArrayUtility.H:789
std::enable_if_t<!amrex::DefinitelyNotHostRunnable< F >::value, bool > ReduceLogicalOr_host_wrapper(FabArray< FAB > const &fa, IntVect const &nghost, F &&f)
Definition AMReX_FabArrayUtility.H:936
std::enable_if_t<!amrex::DefinitelyNotHostRunnable< F >::value, typename FAB::value_type > ReduceSum_host_wrapper(FabArray< FAB > const &fa, IntVect const &nghost, F &&f)
Definition AMReX_FabArrayUtility.H:110
bool ReduceLogicalAnd_host(FabArray< FAB > const &fa, IntVect const &nghost, F const &f)
Definition AMReX_FabArrayUtility.H:767
FAB::value_type ReduceMin_host(FabArray< FAB > const &fa, IntVect const &nghost, F const &f)
Definition AMReX_FabArrayUtility.H:314
std::enable_if_t<!amrex::DefinitelyNotHostRunnable< F >::value, typename FAB::value_type > ReduceMin_host_wrapper(FabArray< FAB > const &fa, IntVect const &nghost, F &&f)
Definition AMReX_FabArrayUtility.H:336
bool ReduceLogicalOr_host(FabArray< FAB > const &fa, IntVect const &nghost, F const &f)
Definition AMReX_FabArrayUtility.H:914
FAB::value_type ReduceSum_host(FabArray< FAB > const &fa, IntVect const &nghost, F const &f)
Definition AMReX_FabArrayUtility.H:24
std::enable_if_t< IsBaseFab< FAB >::value, std::conditional_t< std::is_same< OP, ReduceOpLogicalAnd >::value||std::is_same< OP, ReduceOpLogicalOr >::value, int, typename FAB::value_type > > ReduceMF(FabArray< FAB > const &fa, IntVect const &nghost, F const &f)
Definition AMReX_FabArrayUtility.H:50
Definition AMReX_Amr.cpp:49
MF::value_type norminf(MF const &mf, int scomp, int ncomp, IntVect const &nghost, bool local=false)
Definition AMReX_FabArrayUtility.H:1883
int nComp(FabArrayBase const &fa)
FAB::value_type ReduceMax(FabArray< FAB > const &fa, int nghost, F &&f)
Definition AMReX_FabArrayUtility.H:531
std::enable_if_t< std::is_integral_v< T > > ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:191
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
void Saxpy(MF &dst, typename MF::value_type a, MF const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
dst += a * src
Definition AMReX_FabArrayUtility.H:1847
IntVect nGrowVect(FabArrayBase const &fa)
ReduceData< Ts... >::Type ParReduce(TypeList< Ops... > operation_list, TypeList< Ts... > type_list, FabArray< FAB > const &fa, IntVect const &nghost, F &&f)
Parallel reduce for MultiFab/FabArray.
Definition AMReX_ParReduce.H:47
void LocalCopy(DMF &dst, SMF const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
dst = src
Definition AMReX_FabArrayUtility.H:1831
void printCell(FabArray< FAB > const &mf, const IntVect &cell, int comp=-1, const IntVect &ng=IntVect::TheZeroVector())
Definition AMReX_FabArrayUtility.H:1051
bool ReduceLogicalAnd(FabArray< FAB > const &fa, int nghost, F &&f)
Definition AMReX_FabArrayUtility.H:758
void Abs(FabArray< FAB > &fa, int icomp, int numcomp, int nghost)
Definition AMReX_FabArrayUtility.H:1247
void LocalAdd(MF &dst, MF const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
dst += src
Definition AMReX_FabArrayUtility.H:1839
void Copy(FabArray< DFAB > &dst, FabArray< SFAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:179
void prefetchToDevice(FabArray< FAB > const &fa, const bool synchronous=true)
Definition AMReX_FabArrayUtility.H:1306
void Subtract(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArrayUtility.H:1104
void OverrideSync(FabArray< FAB > &fa, FabArray< IFAB > const &msk, const Periodicity &period)
Definition AMReX_FabArrayUtility.H:1323
bool isMFIterSafe(const FabArrayBase &x, const FabArrayBase &y)
Definition AMReX_MFIter.H:219
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > makeSingleCellBox(int i, int j, int k, IndexTypeND< dim > typ=IndexTypeND< dim >::TheCellType())
Definition AMReX_Box.H:2009
bool ReduceLogicalOr(FabArray< FAB > const &fa, int nghost, F &&f)
Definition AMReX_FabArrayUtility.H:905
IntVectND< AMREX_SPACEDIM > IntVect
Definition AMReX_BaseFwd.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Grow BoxND in all directions by given amount.
Definition AMReX_Box.H:1211
void LinComb(MF &dst, typename MF::value_type a, MF const &src_a, int acomp, typename MF::value_type b, MF const &src_b, int bcomp, int dcomp, int ncomp, IntVect const &nghost)
dst = a*src_a + b*src_b
Definition AMReX_FabArrayUtility.H:1863
FAB::value_type ReduceMin(FabArray< FAB > const &fa, int nghost, F &&f)
Definition AMReX_FabArrayUtility.H:305
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:127
void dtoh_memcpy(FabArray< FAB > &dst, FabArray< FAB > const &src, int scomp, int dcomp, int ncomp)
Definition AMReX_FabArrayUtility.H:1396
void setBndry(MF &dst, typename MF::value_type val, int scomp, int ncomp)
dst = val in ghost cells.
Definition AMReX_FabArrayUtility.H:1815
void single_task(L &&f) noexcept
Definition AMReX_GpuLaunchFunctsC.H:1307
void Divide(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArrayUtility.H:1200
void Xpay(MF &dst, typename MF::value_type a, MF const &src, int scomp, int dcomp, int ncomp, IntVect const &nghost)
dst = src + a * dst
Definition AMReX_FabArrayUtility.H:1855
void Scale(MF &dst, typename MF::value_type val, int scomp, int ncomp, int nghost)
dst *= val
Definition AMReX_FabArrayUtility.H:1822
void prefetchToHost(FabArray< FAB > const &fa, const bool synchronous=true)
Definition AMReX_FabArrayUtility.H:1291
bool TilingIfNotGPU() noexcept
Definition AMReX_MFIter.H:12
void Add(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:240
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition AMReX.cpp:230
const int[]
Definition AMReX_BLProfiler.cpp:1664
void OverrideSync_finish(FabArray< FAB > &fa)
Definition AMReX_FabArrayUtility.H:1382
FAB::value_type Dot(FabArray< FAB > const &x, int xcomp, FabArray< FAB > const &y, int ycomp, int ncomp, IntVect const &nghost, bool local=false)
Compute dot products of two FabArrays.
Definition AMReX_FabArrayUtility.H:1554
void ParallelCopy(MF &dst, MF const &src, int scomp, int dcomp, int ncomp, IntVect const &ng_src=IntVect(0), IntVect const &ng_dst=IntVect(0), Periodicity const &period=Periodicity::NonPeriodic())
dst = src w/ MPI communication
Definition AMReX_FabArrayUtility.H:1873
void htod_memcpy(FabArray< FAB > &dst, FabArray< FAB > const &src, int scomp, int dcomp, int ncomp)
Definition AMReX_FabArrayUtility.H:1421
void setVal(MF &dst, typename MF::value_type val)
dst = val
Definition AMReX_FabArrayUtility.H:1808
void Multiply(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArrayUtility.H:1152
FAB::value_type ReduceSum(FabArray< FAB > const &fa, int nghost, F &&f)
Definition AMReX_FabArrayUtility.H:16
IntVect indexFromValue(FabArray< FAB > const &mf, int comp, IntVect const &nghost, typename FAB::value_type value)
Definition AMReX_FabArrayUtility.H:1446
BoxArray const & boxArray(FabArrayBase const &fa)
void OverrideSync_nowait(FabArray< FAB > &fa, FabArray< IFAB > const &msk, const Periodicity &period)
Definition AMReX_FabArrayUtility.H:1335
std::array< T, N > Array
Definition AMReX_Array.H:24
Definition AMReX_TypeTraits.H:18
FabArray memory allocation information.
Definition AMReX_FabArray.H:66
Definition AMReX_MFIter.H:20
Struct for holding types.
Definition AMReX_TypeList.H:12