6namespace amrex::MFUtil {
14 struct SymmetricGhost {
15 static void copy (T & target,
const T & source,
int nc,
int ng) {
16 target.ParallelCopy(source, 0, 0, nc, ng, ng);
25 struct AsymmetricGhost {
26 static void copy (T & target,
const T & source,
int nc,
int ng) {
27 target.ParallelCopy(source, 0, 0, nc, 0, ng);
37 template<
typename T,
template<
typename>
class Cpy>
38 T duplicate(
const BoxArray & ba,
const DistributionMapping & dm,
const T & mf_in) {
40 int ng = mf_in.nGrow();
41 int nc = mf_in.nComp();
43 T mf_out(ba, dm, nc, ng);
45 Cpy<T>::copy(mf_out, mf_in, nc, ng);
57 template<
typename T,
template<
typename>
class Cpy>
58 T duplicate(
const BoxArray & ba,
const DistributionMapping & dm,
const T & mf_in,
59 const Periodicity & periodicity) {
61 T mf_out = duplicate<T, Cpy>(ba, dm, mf_in);
62 mf_out.FillBoundary(periodicity);
73 T regrid(
const BoxArray & ba,
const DistributionMapping & dm,
74 const T & mf_in,
bool regrid_ghost =
false ) {
77 T mf_out = duplicate<T, SymmetricGhost>(ba, dm, mf_in);
80 T mf_out = duplicate<T, AsymmetricGhost>(ba, dm, mf_in);
92 void regrid( T & mf_out,
const BoxArray & ba,
const DistributionMapping & dm,
93 const T & mf_in,
bool regrid_ghost =
false ) {
95 int ng = mf_in.nGrow();
96 int nc = mf_in.nComp();
98 mf_out.define(ba, dm, nc, ng);
99 if (regrid_ghost) { SymmetricGhost<T>::copy(mf_out, mf_in, nc, ng); }
100 else { AsymmetricGhost<T>::copy(mf_out, mf_in, nc, ng); }
109 void regrid( T & mf_out,
const BoxArray & ba,
const DistributionMapping & dm,
110 const FabFactory<FArrayBox> & eb_factory,
111 const T & mf_in,
bool regrid_ghost =
false ) {
113 int ng = mf_in.nGrow();
114 int nc = mf_in.nComp();
116 mf_out.define(ba, dm, nc, ng, MFInfo(), eb_factory);
117 if (regrid_ghost) { SymmetricGhost<T>::copy(mf_out, mf_in, nc, ng); }
118 else { AsymmetricGhost<T>::copy(mf_out, mf_in, nc, ng); }
void copy(HostToDevice, InIter begin, InIter end, OutIter result) noexcept
A host-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous st...
Definition AMReX_GpuContainers.H:128