Skip to content

Commit

Permalink
Fix sumToLine for multiple components (#4266)
Browse files Browse the repository at this point in the history
* Fix comment.

* Fix the size of the device vector.
  • Loading branch information
WeiqunZhang authored Dec 16, 2024
1 parent 7111355 commit bdb4be3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Src/Base/AMReX_MultiFabUtil.H
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ namespace amrex
* Return a HostVector that contains the sum of the given MultiFab data in the plane
* with the given normal direction. The size of the vector is
* domain.length(direction) x ncomp. The vector is actually a 2D array, where the
* element for component icomp at spatial index k is at [icomp*ncomp+k].
* element for component icomp at spatial index k is at [icomp+ncomp*k].
*
* \param mf MultiFab data for summing
* \param icomp starting component
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_MultiFabUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ namespace amrex
#ifdef AMREX_USE_GPU
if (Gpu::inLaunchRegion())
{
Gpu::DeviceVector<Real> dv(domain.length(direction), Real(0.0));
Gpu::DeviceVector<Real> dv(hv.size(), Real(0.0));
Real* p = dv.data();

for (MFIter mfi(mf); mfi.isValid(); ++mfi) {
Expand Down

0 comments on commit bdb4be3

Please sign in to comment.