frame_block_limit Subroutine

private elemental subroutine frame_block_limit(block_size, block_offset, first_limit, last_limit, frame_size, frame_offset)

Determines the effect of limits on a block

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: block_size

size of block global offset of block lower limit upper limit

integer, intent(in) :: block_offset

size of block global offset of block lower limit upper limit

integer, intent(in) :: first_limit

size of block global offset of block lower limit upper limit

integer, intent(in) :: last_limit

size of block global offset of block lower limit upper limit

integer, intent(out) :: frame_size

size of block region within the limits starting position of the block region that is within the limits

integer, intent(out) :: frame_offset

size of block region within the limits starting position of the block region that is within the limits


Source Code

   ELEMENTAL SUBROUTINE frame_block_limit(block_size, block_offset, &
                                          first_limit, last_limit, &
                                          frame_size, frame_offset)
      !! Determines the effect of limits on a block

      INTEGER, INTENT(IN)                                :: block_size, block_offset, first_limit, &
                                                            last_limit
         !! size of block
         !! global offset of block
         !! lower limit
         !! upper limit
      INTEGER, INTENT(OUT)                               :: frame_size, frame_offset
         !! size of block region within the limits
         !! starting position of the block region that is within the limits

      INTEGER                                            :: f, l

      f = MAX(block_offset, first_limit)
      l = MIN(block_offset + block_size - 1, last_limit)
      frame_size = MAX(l - f + 1, 0)
      frame_offset = MIN(f - block_offset + 1, block_size)
   END SUBROUTINE frame_block_limit