1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "Average.H"
using namespace amrex;
void
Average::ToCellCenter ( MultiFab& mf_out,
const MultiFab& mf_in,
const int dcomp,
const int ngrow,
const int scomp,
const int ncomp )
{
#ifdef _OPENMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
// Loop over boxes (or tiles if not on GPU)
for (MFIter mfi( mf_out, TilingIfNotGPU() ); mfi.isValid(); ++mfi)
{
const Box bx = mfi.growntilebox( ngrow );
Array4<Real> const& mf_out_arr = mf_out.array( mfi );
Array4<Real const> const& mf_in_arr = mf_in.const_array( mfi );
const IntVect stag = mf_in.boxArray().ixType().ixType();
ParallelFor( bx, ncomp,
[=] AMREX_GPU_DEVICE( int i, int j, int k, int n )
{
mf_out_arr(i,j,k,n+dcomp) = Average::ToCellCenter( mf_in_arr, stag, i, j, k, n+scomp );
} );
}
}
|