dbcsr_distribution_new Subroutine

public subroutine dbcsr_distribution_new(dist, template, group, pgrid, row_dist, col_dist, reuse_arrays)

Creates new distribution from blockr distributions

Arguments

TypeIntentOptionalAttributesName
type(dbcsr_distribution_type), intent(out) :: dist

distribution

type(dbcsr_distribution_type), intent(in), optional :: template
integer, intent(in), optional :: group
integer, optional DIMENSION(:, :), POINTER:: pgrid
integer, intent(inout), DIMENSION(:), POINTER:: row_dist
integer, intent(inout), DIMENSION(:), POINTER:: col_dist
logical, intent(in), optional :: reuse_arrays

Contents


Source Code

   SUBROUTINE dbcsr_distribution_new(dist, template, group, pgrid, row_dist, col_dist, &
                                     reuse_arrays)
      !! Creates new distribution from blockr distributions

      TYPE(dbcsr_distribution_type), INTENT(OUT)         :: dist
      !! distribution
      TYPE(dbcsr_distribution_type), INTENT(IN), &
         OPTIONAL                                        :: template
      INTEGER, INTENT(IN), OPTIONAL                      :: group
      INTEGER, DIMENSION(:, :), OPTIONAL, POINTER        :: pgrid
      INTEGER, DIMENSION(:), INTENT(INOUT), POINTER      :: row_dist, col_dist
      LOGICAL, INTENT(IN), OPTIONAL                      :: reuse_arrays

      INTEGER, DIMENSION(:), POINTER, CONTIGUOUS         :: cont_row_dist, cont_col_dist

      ! Make the arrays contiguous, avoid change in the API
      ALLOCATE (cont_row_dist(SIZE(row_dist)), cont_col_dist(SIZE(col_dist)))
      cont_row_dist(:) = row_dist(:)
      cont_col_dist(:) = col_dist(:)

      IF (PRESENT(reuse_arrays)) THEN
         IF (reuse_arrays) THEN
            DEALLOCATE (row_dist, col_dist)
            NULLIFY (row_dist, col_dist)
         END IF
      END IF

      IF (PRESENT(template)) THEN
         call dbcsr_distribution_new_prv(dist%prv, template%prv, group, pgrid, cont_row_dist, cont_col_dist, &
                                         reuse_arrays=.TRUE.)
      ELSE
         call dbcsr_distribution_new_prv(dist%prv, group=group, pgrid=pgrid, row_dist=cont_row_dist, col_dist=cont_col_dist, &
                                         reuse_arrays=.TRUE.)
      END IF
   END SUBROUTINE dbcsr_distribution_new