7 #ifndef ABLASTR_COARSEN_SAMPLE_H_
8 #define ABLASTR_COARSEN_SAMPLE_H_
60 using namespace amrex::literals;
63 const int ic[3] = {
i, j, k };
66 int np[3], idx_min[3];
69 for (
int l = 0; l < 3; ++l ) {
70 if (
cr[l] == 1 ) { np[l] = 1+amrex::Math::abs(sf[l]-sc[l]);
71 }
else { np[l] = 2-sf[l]; }
75 for (
int l = 0; l < 3; ++l ) {
76 if (
cr[l] == 1 ) { idx_min[l] = ic[l]-sc[l]*(1-sf[l]);
77 }
else { idx_min[l] = ic[l]*
cr[l]+
static_cast<int>(
cr[l]/2)*(1-sc[l])-(1-sf[l]); }
81 const int numx = np[0];
82 const int numy = np[1];
83 const int numz = np[2];
84 const int imin = idx_min[0];
85 const int jmin = idx_min[1];
86 const int kmin = idx_min[2];
87 amrex::Real
const wx = 1.0_rt /
static_cast<amrex::Real
>(numx);
88 amrex::Real
const wy = 1.0_rt /
static_cast<amrex::Real
>(numy);
89 amrex::Real
const wz = 1.0_rt /
static_cast<amrex::Real
>(numz);
92 amrex::Real
c = 0.0_rt;
93 for (
int kref = 0; kref < numz; ++kref) {
94 for (
int jref = 0; jref < numy; ++jref) {
95 for (
int iref = 0; iref < numx; ++iref) {
97 const int jj = jmin+jref;
98 const int kk = kmin+kref;
99 c += wx*wy*wz*arr_src(
ii,
jj,kk,comp);
#define AMREX_FORCE_INLINE
Definition: sample.cpp:28
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Interp(amrex::Array4< amrex::Real const > const &arr_src, amrex::GpuArray< int, 3 > const &sf, amrex::GpuArray< int, 3 > const &sc, amrex::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: sample.H:49
void Coarsen(amrex::MultiFab &mf_dst, const amrex::MultiFab &mf_src, const int dcomp, const int scomp, const int ncomp, const int ngrow, const amrex::IntVect crse_ratio)
Stores in the coarsened MultiFab mf_dst the values obtained by interpolating the data contained in th...
Definition: sample.cpp:83
void Loop(amrex::MultiFab &mf_dst, const amrex::MultiFab &mf_src, const int dcomp, const int scomp, const int ncomp, const amrex::IntVect ngrowvect, const amrex::IntVect crse_ratio)
Loops over the boxes of the coarsened MultiFab mf_dst and fills them by interpolating the data contai...
Definition: sample.cpp:30
static constexpr auto c
vacuum speed of light [m/s]
Definition: constant.H:44
i
Definition: check_interp_points_and_weights.py:174
ii
Definition: check_interp_points_and_weights.py:148
jj
Definition: check_interp_points_and_weights.py:160
imin
Definition: check_interp_points_and_weights.py:124
cr
TODO Coarsening for IO: interpolation points and weights def coarsening_points_and_weights_for_IO( i,...
Definition: check_interp_points_and_weights.py:101