Determines mapping from global to local rows
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_distribution_obj), | intent(inout) | :: | dist |
mapping for this distribution |
||
type(array_i1d_obj), | intent(out) | :: | row_map |
mapping to local rows |
SUBROUTINE dbcsr_get_global_row_map(dist, row_map)
!! Determines mapping from global to local rows
TYPE(dbcsr_distribution_obj), INTENT(INOUT) :: dist
!! mapping for this distribution
TYPE(array_i1d_obj), INTENT(OUT) :: row_map
!! mapping to local rows
CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_get_global_row_map'
INTEGER :: error_handle, nprows
INTEGER, DIMENSION(:), POINTER, CONTIGUOUS :: rmap, row_dist
CALL timeset(routineN, error_handle)
! If the current local row mappings do not exist, create them.
IF (.NOT. dist%d%has_global_row_map) THEN
row_dist => dbcsr_distribution_row_dist(dist)
ALLOCATE (rmap(SIZE(row_dist)))
nprows = dbcsr_mp_nprows(dbcsr_distribution_mp(dist))
CALL map_all_local_elements(rmap, row_dist, nprows)
CALL array_new(dist%d%global_row_map, rmap, gift=.TRUE.)
dist%d%has_global_row_map = .TRUE.
ELSE
IF (careful_mod .AND. .NOT. array_exists(dist%d%global_row_map)) &
DBCSR_ABORT("Row map does not exist.")
END IF
row_map = dist%d%global_row_map
CALL timestop(error_handle)
END SUBROUTINE dbcsr_get_global_row_map