find_all_local_elements Subroutine

public subroutine find_all_local_elements(local_elements, bin_distribution, nbins)

Finds the 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

Type IntentOptional Attributes Name
type(array_i1d_obj), intent(inout), DIMENSION(0:nbins - 1) :: local_elements

local virtual elements

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

distribution of elements to bins

integer, intent(in) :: nbins

number of bins


Source Code

   SUBROUTINE find_all_local_elements(local_elements, &
                                      bin_distribution, nbins)
      !! Finds the 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, INTENT(IN)                                :: nbins
         !! number of bins
      INTEGER, DIMENSION(:), INTENT(IN)                  :: bin_distribution
         !! distribution of elements to bins
      TYPE(array_i1d_obj), DIMENSION(0:nbins - 1), &
         INTENT(INOUT)                                   :: local_elements
         !! local virtual elements

      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
         local_elements(bin)%low%data(nlve(bin)) = el
      END DO
   END SUBROUTINE find_all_local_elements