Skip to content

Commit

Permalink
STL: Make the fill(MultiFab) function work with non-nodal types
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Nov 7, 2024
1 parent 34d3eda commit 9a40f85
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Src/EB/AMReX_EB_STL_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,11 @@ STLtools::fill (MultiFab& mf, IntVect const& nghost, Geometry const& geom,
const auto plo = geom.ProbLoArray();
const auto dx = geom.CellSizeArray();

auto ixt = mf.ixType();
RealVect offset(AMREX_D_DECL(ixt.cellCentered(0) ? 0.5_rt : 0.0_rt,
ixt.cellCentered(1) ? 0.5_rt : 0.0_rt,
ixt.cellCentered(2) ? 0.5_rt : 0.0_rt));

const Triangle* tri_pts = m_tri_pts_d.data();
XDim3 ptmin = m_ptmin;
XDim3 ptmax = m_ptmax;
Expand All @@ -650,12 +655,12 @@ STLtools::fill (MultiFab& mf, IntVect const& nghost, Geometry const& geom,
[=] AMREX_GPU_DEVICE (int box_no, int i, int j, int k, auto control) noexcept
{
Real coords[3];
coords[0]=plo[0]+static_cast<Real>(i)*dx[0];
coords[1]=plo[1]+static_cast<Real>(j)*dx[1];
coords[0]=plo[0]+(static_cast<Real>(i)+offset[0])*dx[0];
coords[1]=plo[1]+(static_cast<Real>(j)+offset[1])*dx[1];
#if (AMREX_SPACEDIM == 2)
coords[2]=Real(0.);
#else
coords[2]=plo[2]+static_cast<Real>(k)*dx[2];
coords[2]=plo[2]+(static_cast<Real>(k)+offset[2])*dx[2];
#endif
int num_intersects=0;
if (coords[0] >= ptmin.x && coords[0] <= ptmax.x &&
Expand Down

0 comments on commit 9a40f85

Please sign in to comment.