1 #ifndef ERF_SEB_LAND_MASK_H_
2 #define ERF_SEB_LAND_MASK_H_
7 #include <AMReX_Array4.H>
8 #include <AMReX_FabArrayBase.H>
9 #include <AMReX_GpuQualifiers.H>
10 #include <AMReX_MFIter.H>
11 #include <AMReX_iMultiFab.H>
31 amrex::Array4<const int>
arr;
34 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
35 bool water (
int i,
int j)
const noexcept {
return on &&
arr(i, j, 0) == 0; }
46 if (mask ==
nullptr) {
return; }
47 if (mask->boxArray() != field.boxArray() || mask->DistributionMap() != field.DistributionMap()) {
48 amrex::Abort(std::string(who) +
": the land mask is not on the level's 2D grids");
57 v.
on = (mask !=
nullptr);
58 if (v.
on) { v.
arr = mask->const_array(mfi); }
69 [[nodiscard]]
inline bool
72 return mask !=
nullptr && mask->min(0) == 0;
SEBLandMaskView seb_land_mask_view(const amrex::iMultiFab *mask, const amrex::MFIter &mfi)
The view of mask on the box of mfi; off when mask is nullptr.
Definition: ERF_SEBLandMask.H:54
bool seb_land_mask_has_water(const amrex::iMultiFab *mask)
True when mask holds a water column on any rank; false for nullptr.
Definition: ERF_SEBLandMask.H:70
void seb_assert_land_mask_layout(const amrex::iMultiFab *mask, const amrex::FabArrayBase &field, const char *who)
Stop when mask is given and is not on the grids of field.
Definition: ERF_SEBLandMask.H:43
The land mask of one box, for a device kernel. Captured by value.
Definition: ERF_SEBLandMask.H:29
amrex::Array4< const int > arr
Definition: ERF_SEBLandMask.H:31
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool water(int i, int j) const noexcept
True when the balance does not run on column (i, j).
Definition: ERF_SEBLandMask.H:35
bool on
Definition: ERF_SEBLandMask.H:30