Computes the bounds of the sub-block form the bounds of the parent block. Each sub-block gets about the same number of grid points in each direction.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | coord(3) |
Coordinates of MPI rank on MPI grid |
||
| integer, | intent(in) | :: | Nb(3) |
Number of blocks in each direction |
||
| integer, | intent(in) | :: | minlo(3) |
Global lo bounds |
||
| integer, | intent(in) | :: | maxhi(3) |
Global hi bounds |
||
| integer, | intent(out) | :: | sublo(3) |
lo bounds of sub-block |
||
| integer, | intent(out) | :: | subhi(3) |
hi bounds of sub-block |
pure subroutine block_obj_SubDivideBlock(coord,Nb,minlo,maxhi,sublo,subhi) !> Computes the bounds of the sub-block form ! the bounds of the parent block. Each sub-block ! gets about the same number of grid points in each ! direction. implicit none integer, intent(in) :: coord(3) !! Coordinates of MPI rank on MPI grid integer, intent(in) :: Nb(3) !! Number of blocks in each direction integer, intent(in) :: minlo(3) !! Global lo bounds integer, intent(in) :: maxhi(3) !! Global hi bounds integer, intent(out) :: sublo(3) !! lo bounds of sub-block integer, intent(out) :: subhi(3) !! hi bounds of sub-block ! Work variables integer :: q(3) integer :: r(3) integer :: dir ! Number of grid points per sub-block in each direction q = (maxhi - minlo + 1)/Nb r = mod(maxhi - minlo + 1,Nb) ! Set the lo and hi bounds do dir=1,3 if (coord(dir).le.r(dir)) then sublo(dir) = minlo(dir) + (coord(dir)-1)*(q(dir)+1) subhi(dir) = sublo(dir)-1 + q(dir)+1 else sublo(dir) = minlo(dir) + (coord(dir)-1)*q(dir)+r(dir) subhi(dir) = sublo(dir)-1 + q(dir) end if end do return end subroutine block_obj_SubDivideBlock