1 #ifndef WARPX_COARSEN_IO_H_ 2 #define WARPX_COARSEN_IO_H_ 5 #include <AMReX_Math.H> 30 Real
Interp ( Array4<Real const>
const& arr_src,
31 GpuArray<int,3>
const& sf,
32 GpuArray<int,3>
const& sc,
33 GpuArray<int,3>
const&
cr,
40 const int ic[3] = {
i, j, k };
43 int np[3], idx_min[3];
46 for (
int l = 0; l < 3; ++l ) {
47 if ( cr[l] == 1 ) np[l] = 1+amrex::Math::abs(sf[l]-sc[l]);
52 for (
int l = 0; l < 3; ++l ) {
53 if ( cr[l] == 1 ) idx_min[l] = ic[l]-sc[l]*(1-sf[l]);
54 else idx_min[l] = ic[l]*cr[l]+
static_cast<int>(cr[l]/2)*(1-sc[l])-(1-sf[l]);
58 const int numx = np[0];
59 const int numy = np[1];
60 const int numz = np[2];
61 const int imin = idx_min[0];
62 const int jmin = idx_min[1];
63 const int kmin = idx_min[2];
69 for (
int kref = 0; kref < numz; ++kref) {
70 for (
int jref = 0; jref < numy; ++jref) {
71 for (
int iref = 0; iref < numx; ++iref) {
75 wx = 1.0_rt/
static_cast<Real
>(numx);
76 wy = 1.0_rt/
static_cast<Real
>(numy);
77 wz = 1.0_rt/
static_cast<Real
>(numz);
78 c += wx*wy*wz*arr_src(ii,jj,kk,comp);
104 void Loop ( MultiFab& mf_dst,
105 const MultiFab& mf_src,
110 const IntVect crse_ratio=IntVect(1) );
131 void Coarsen ( MultiFab& mf_dst,
132 const MultiFab& mf_src,
137 const IntVect crse_ratio=IntVect(1) );
140 #endif // WARPX_COARSEN_IO_H_
imin
Definition: check_interp_points_and_weights.py:121
void Coarsen(MultiFab &mf_dst, const MultiFab &mf_src, const int dcomp, const int scomp, const int ncomp, const int ngrow, const IntVect crse_ratio=IntVect(1))
Stores in the coarsened MultiFab mf_dst the values obtained by interpolating the data contained in th...
Definition: CoarsenIO.cpp:73
Definition: CoarsenIO.H:7
ii
Definition: check_interp_points_and_weights.py:145
i
Definition: check_interp_points_and_weights.py:171
AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real Interp(Array4< Real const > const &arr_src, GpuArray< int, 3 > const &sf, GpuArray< int, 3 > const &sc, GpuArray< int, 3 > const &cr, const int i, const int j, const int k, const int comp)
Interpolates the floating point data contained in the source Array4 arr_src, extracted from a fine Mu...
Definition: CoarsenIO.H:30
jj
Definition: check_interp_points_and_weights.py:157
cr
TODO Coarsening for IO: interpolation points and weights def coarsening_points_and_weights_for_IO( i...
Definition: check_interp_points_and_weights.py:98
void Loop(MultiFab &mf_dst, const MultiFab &mf_src, const int dcomp, const int scomp, const int ncomp, const int ngrow, const IntVect crse_ratio=IntVect(1))
Loops over the boxes of the coarsened MultiFab mf_dst and fills them by interpolating the data contai...
Definition: CoarsenIO.cpp:6