diag_mask_bbox Function

public function diag_mask_bbox(grid, i0, i1, j0, j1, name) result(m)

Index-based bounding box (test-only). Weight = 1 inside the closed interval [i0,i1] × [j0,j1], 0 outside. Indices 1-based and inclusive; ghost cells count if inside the box.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
integer, intent(in) :: i0
integer, intent(in) :: i1
integer, intent(in) :: j0
integer, intent(in) :: j1
character(len=*), intent(in), optional :: name

Return Value type(diag_mask_t)


Calls

proc~~diag_mask_bbox~~CallsGraph proc~diag_mask_bbox diag_mask_bbox proc~recompute_total_area recompute_total_area proc~diag_mask_bbox->proc~recompute_total_area

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j

Source Code

   function diag_mask_bbox(grid, i0, i1, j0, j1, name) result(m)
      !! Index-based bounding box (test-only). Weight = 1 inside the
      !! closed interval `[i0,i1] × [j0,j1]`, 0 outside. Indices 1-based
      !! and inclusive; ghost cells count if inside the box.
      type(hgrid_t), intent(in) :: grid
      integer, intent(in) :: i0, i1, j0, j1
      character(len=*), intent(in), optional :: name
      type(diag_mask_t) :: m
      integer :: i, j
      m%name = "bbox"
      if (present(name)) m%name = name
      m%nx = grid%nx_total
      m%ny = grid%ny_total
      allocate (m%weight(m%nx, m%ny), source=0.0_wp)
      do j = max(1, j0), min(m%ny, j1)
         do i = max(1, i0), min(m%nx, i1)
            m%weight(i, j) = 1.0_wp
         end do
      end do
      call recompute_total_area(m, grid%dx, grid%dy)
   end function diag_mask_bbox