Skip to content

Commit

Permalink
MultiArray4: add conversion operator to bool (#3957)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed May 24, 2024
1 parent 523c11e commit 345cb88
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Src/Base/AMReX_FabArray.H
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ struct MultiArray4
AMREX_IF_ON_HOST((return hp[li];))
}

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
explicit operator bool() const noexcept {
AMREX_IF_ON_DEVICE((return dp != nullptr;))
AMREX_IF_ON_HOST((return hp != nullptr;))
}

#ifdef AMREX_USE_GPU
Array4<T> const* AMREX_RESTRICT dp = nullptr;
#endif
Expand Down

0 comments on commit 345cb88

Please sign in to comment.