7 #ifndef ABLASTR_COARSEN_SAMPLE_H_
8 #define ABLASTR_COARSEN_SAMPLE_H_
61 using namespace amrex::literals;
64 const int ic[3] = {
i, j, k };
67 int np[3], idx_min[3];
70 for (
int l = 0; l < 3; ++l ) {
71 if (
cr[l] == 1 ) np[l] = 1+amrex::Math::abs(sf[l]-sc[l]);
76 for (
int l = 0; l < 3; ++l ) {
77 if (
cr[l] == 1 ) idx_min[l] = ic[l]-sc[l]*(1-sf[l]);
78 else idx_min[l] = ic[l]*
cr[l]+
static_cast<int>(
cr[l]/2)*(1-sc[l])-(1-sf[l]);
82 const int numx = np[0];
83 const int numy = np[1];
84 const int numz = np[2];
85 const int imin = idx_min[0];
86 const int jmin = idx_min[1];
87 const int kmin = idx_min[2];
89 amrex::Real
const wx = 1.0_rt /
static_cast<amrex::Real
>(numx);
90 amrex::Real
const wy = 1.0_rt /
static_cast<amrex::Real
>(numy);
91 amrex::Real
const wz = 1.0_rt /
static_cast<amrex::Real
>(numz);
94 amrex::Real
c = 0.0_rt;
95 for (
int kref = 0; kref < numz; ++kref) {
96 for (
int jref = 0; jref < numy; ++jref) {
97 for (
int iref = 0; iref < numx; ++iref) {
101 c += wx*wy*wz*arr_src(
ii,
jj,kk,comp);
#define AMREX_FORCE_INLINE
Definition: sample.cpp:23
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:25
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:50
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:107
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