Skip to content

Commit

Permalink
add templating for the cell bilinear interpolators (AMReX-Codes#2979)
Browse files Browse the repository at this point in the history
This templates the `mf_cell_bilin_interp` functions so that the
interpolators can be used with `BaseFab`s of arbitrary type.
  • Loading branch information
bsrunnels authored Oct 10, 2022
1 parent e4ab048 commit 2d87a4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Src/AmrCore/AMReX_MFInterp_1D_C.H
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ void mf_cell_cons_lin_interp_sph (int i, int ns, Array4<Real> const& fine, int f
+ xoff * slope(ic,0,0,ns);
}

template<typename T>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void mf_cell_bilin_interp (int i, int, int, int n, Array4<Real> const& fine, int fcomp,
Array4<Real const> const& crse, int ccomp, IntVect const& ratio) noexcept
void mf_cell_bilin_interp (int i, int, int, int n, Array4<T> const& fine, int fcomp,
Array4<T const> const& crse, int ccomp, IntVect const& ratio) noexcept
{
int ic = amrex::coarsen(i,ratio[0]);
int ioff = i - ic*ratio[0];
Expand Down
5 changes: 3 additions & 2 deletions Src/AmrCore/AMReX_MFInterp_2D_C.H
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ void mf_cell_cons_lin_interp_rz (int i, int j, int ns, Array4<Real> const& fine,
+ yoff * slope(ic,jc,0,ns+ncomp);
}

template<typename T>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void mf_cell_bilin_interp (int i, int j, int, int n, Array4<Real> const& fine, int fcomp,
Array4<Real const> const& crse, int ccomp, IntVect const& ratio) noexcept
void mf_cell_bilin_interp (int i, int j, int, int n, Array4<T> const& fine, int fcomp,
Array4<T const> const& crse, int ccomp, IntVect const& ratio) noexcept
{
int ic = amrex::coarsen(i,ratio[0]);
int jc = amrex::coarsen(j,ratio[1]);
Expand Down
5 changes: 3 additions & 2 deletions Src/AmrCore/AMReX_MFInterp_3D_C.H
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ void mf_cell_cons_lin_interp (int i, int j, int k, int ns, Array4<Real> const& f
+ zoff * slope(ic,jc,kc,ns+ncomp*2);
}

template<typename T>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void mf_cell_bilin_interp (int i, int j, int k, int n, Array4<Real> const& fine, int fcomp,
Array4<Real const> const& crse, int ccomp, IntVect const& ratio) noexcept
void mf_cell_bilin_interp (int i, int j, int k, int n, Array4<T> const& fine, int fcomp,
Array4<T const> const& crse, int ccomp, IntVect const& ratio) noexcept
{
int ic = amrex::coarsen(i,ratio[0]);
int jc = amrex::coarsen(j,ratio[1]);
Expand Down

0 comments on commit 2d87a4c

Please sign in to comment.