owns_index Function

public elemental function owns_index(partition, idx) result(owned)

Whether this part owns a one-dimensional unit of work

Arguments

Type IntentOptional Attributes Name
type(work_partition), intent(in), optional :: partition

Work partition, absent selects the complete work

integer, intent(in) :: idx

One-based index of the unit of work

Return Value logical

Whether this part owns the unit of work


Source Code

elemental function owns_index(partition, idx) result(owned)

   !> Work partition, absent selects the complete work
   type(work_partition), intent(in), optional :: partition

   !> One-based index of the unit of work
   integer, intent(in) :: idx

   !> Whether this part owns the unit of work
   logical :: owned

   owned = .true.
   if (.not.present(partition)) return

   owned = partition%nparts == 1 .or. &
      & modulo(idx - 1, partition%nparts) == partition%part

end function owns_index