dbcsr_get_global_col_map Subroutine

private subroutine dbcsr_get_global_col_map(dist, col_map)

Determines mapping from global to local columns

Arguments

Type IntentOptional Attributes Name
type(dbcsr_distribution_obj), intent(inout) :: dist

mapping for this distribution

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

mapping to local columns


Source Code

   SUBROUTINE dbcsr_get_global_col_map(dist, col_map)
      !! Determines mapping from global to local columns

      TYPE(dbcsr_distribution_obj), INTENT(INOUT)        :: dist
         !! mapping for this distribution
      TYPE(array_i1d_obj), INTENT(OUT)                   :: col_map
         !! mapping to local columns

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

      INTEGER                                            :: error_handle, npcols
      INTEGER, DIMENSION(:), POINTER, CONTIGUOUS         :: cmap, col_dist

      CALL timeset(routineN, error_handle)
      ! If the current local col mappings do not exist, create them.
      IF (.NOT. dist%d%has_global_col_map) THEN
         col_dist => dbcsr_distribution_col_dist(dist)
         ALLOCATE (cmap(SIZE(col_dist)))
         npcols = dbcsr_mp_npcols(dbcsr_distribution_mp(dist))
         CALL map_all_local_elements(cmap, col_dist, npcols)
         CALL array_new(dist%d%global_col_map, cmap, gift=.TRUE.)
         dist%d%has_global_col_map = .TRUE.
      ELSE
         IF (careful_mod .AND. .NOT. array_exists(dist%d%global_col_map)) &
            DBCSR_ABORT("Column map does not exist.")
      END IF
      col_map = dist%d%global_col_map
      CALL timestop(error_handle)
   END SUBROUTINE dbcsr_get_global_col_map