map_all_local_elements Subroutine

private pure subroutine map_all_local_elements(global_elements, bin_distribution, nbins)

Points to local virtual elements. All elements are mapped at once. Therefore an entry in the resulting array can be used as a lookup index for any of the local element arrays. The distribution itself tells into which array to look.

Arguments

TypeIntentOptionalAttributesName
integer, intent(out), DIMENSION(:):: global_elements

enumerated local elements

integer, intent(in), DIMENSION(:):: bin_distribution

distribution of elements to bins

integer, intent(in) :: nbins

number of bins


Contents


Source Code

   PURE SUBROUTINE map_all_local_elements(global_elements, &
                                          bin_distribution, nbins)
      !! Points to local virtual elements.
      !! All elements are mapped at once.  Therefore an entry in the
      !! resulting array can be used as a lookup index for any of the local
      !! element arrays.  The distribution itself tells into which array to
      !! look.

      INTEGER, DIMENSION(:), INTENT(OUT)                 :: global_elements
         !! enumerated local elements
      INTEGER, DIMENSION(:), INTENT(IN)                  :: bin_distribution
         !! distribution of elements to bins
      INTEGER, INTENT(IN)                                :: nbins
         !! number of bins

      INTEGER                                            :: bin, el
      INTEGER, DIMENSION(0:nbins - 1)                      :: nlve

      nlve(:) = 0
      DO el = 1, SIZE(bin_distribution)
         bin = bin_distribution(el)
         nlve(bin) = nlve(bin) + 1
         global_elements(el) = nlve(bin)
      END DO
   END SUBROUTINE map_all_local_elements