mg_get_face_coords Subroutine

public subroutine mg_get_face_coords(box, nb, nc, x)

Get coordinates at the face of a box

Arguments

Type IntentOptional Attributes Name
type(mg_box_t), intent(in) :: box
integer, intent(in) :: nb
integer, intent(in) :: nc
real(kind=dp), intent(out) :: x(nc,nc,3)

Source Code

  subroutine mg_get_face_coords(box, nb, nc, x)
    type(mg_box_t), intent(in) :: box
    integer, intent(in)        :: nb
    integer, intent(in)        :: nc
    real(dp), intent(out)      :: x(nc, nc, 3)
    integer                    :: i, j, ixs(3-1)
    integer                    :: nb_dim
    real(dp)                   :: rmin(3)

    nb_dim = mg_neighb_dim(nb)

    ! Determine directions perpendicular to neighbor
    ixs = [(i, i = 1, 3-1)]
    ixs(nb_dim:) = ixs(nb_dim:) + 1

    rmin = box%r_min
    if (.not. mg_neighb_low(nb)) then
       rmin(nb_dim) = rmin(nb_dim) + box%dr(nb_dim) * nc
    end if

    do j = 1, nc
       do i = 1, nc
          x(i, j, :) = rmin
          x(i, j, ixs) = x(i, j, ixs) + ([i, j] - 0.5d0) * box%dr(ixs)
       end do
    end do
  end subroutine mg_get_face_coords