dbcsr_get_global_vrow_map Subroutine

private subroutine dbcsr_get_global_vrow_map(imgdist, vrow_map)

Determines mapping from global to virtual local rows

Arguments

Type IntentOptional Attributes Name
type(dbcsr_imagedistribution_obj), intent(inout) :: imgdist

mapping for this image distribution

type(array_i1d_obj), intent(out) :: vrow_map

mapping to local rows


Source Code

   SUBROUTINE dbcsr_get_global_vrow_map(imgdist, vrow_map)
      !! Determines mapping from global to virtual local rows

      TYPE(dbcsr_imagedistribution_obj), INTENT(INOUT)   :: imgdist
         !! mapping for this image distribution
      TYPE(array_i1d_obj), INTENT(OUT)                   :: vrow_map
         !! mapping to local rows

      CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_get_global_vrow_map'

      INTEGER                                            :: error_handle, nvprows
      INTEGER, DIMENSION(:), POINTER, CONTIGUOUS         :: rmap, vrow_dist

      IF (careful_mod) CALL timeset(routineN, error_handle)
      ! If the current local row mappings do not exist, create them.
      IF (.NOT. imgdist%i%has_global_vrow_map) THEN
         vrow_dist => array_data(imgdist%i%vrow_dist)
         ALLOCATE (rmap(SIZE(vrow_dist)))
         nvprows = dbcsr_mp_nprows(dbcsr_distribution_mp(imgdist%i%main)) &
                   *imgdist%i%row_decimation
         CALL map_all_local_elements(rmap, vrow_dist, nvprows)
         CALL array_new(imgdist%i%global_vrow_map, rmap, gift=.TRUE.)
         imgdist%i%has_global_vrow_map = .TRUE.
      ELSE
         IF (careful_mod .AND. .NOT. array_exists(imgdist%i%global_vrow_map)) &
            DBCSR_ABORT("Row map does not exist.")
      END IF
      vrow_map = imgdist%i%global_vrow_map
      IF (careful_mod) CALL timestop(error_handle)
   END SUBROUTINE dbcsr_get_global_vrow_map