dbcsr_distribution_new_template Subroutine

private subroutine dbcsr_distribution_new_template(dist, template, group, pgrid, row_dist, col_dist, reuse_arrays)

Creates new distribution from a template distribution

Arguments

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

distribution

type(dbcsr_distribution_obj), intent(in), optional :: template
type(mp_comm_type), intent(in), optional :: group
integer, optional, DIMENSION(:, :), POINTER :: pgrid
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: row_dist
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: col_dist
logical, intent(in), optional :: reuse_arrays

Source Code

   SUBROUTINE dbcsr_distribution_new_template(dist, template, group, pgrid, row_dist, col_dist, &
                                              reuse_arrays)
      !! Creates new distribution from a template distribution

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

      TYPE(dbcsr_mp_obj)                                 :: mp_env

      IF (PRESENT(pgrid) .AND. .NOT. PRESENT(group)) &
         DBCSR_ABORT("pgrid can only be supplied together with group")

      IF (PRESENT(template)) THEN
         mp_env = template%d%mp_env
         IF (PRESENT(group)) &
            DBCSR_ABORT("dbcsr_distribution_new called with template and group")
         IF (PRESENT(pgrid)) &
            DBCSR_ABORT("dbcsr_distribution_new called with template and pgrid")
      ELSE IF (PRESENT(group)) THEN
         CALL dbcsr_mp_new(mp_env, group, pgrid)
      ELSE
         DBCSR_ABORT("dbcsr_distribution_new: neither template nor group supplied")
      END IF

      CALL dbcsr_distribution_new_low(dist, mp_env, &
                                      row_dist_block=row_dist, &
                                      col_dist_block=col_dist, &
                                      reuse_arrays=reuse_arrays)

      IF (.NOT. PRESENT(template)) &
         CALL dbcsr_mp_release(mp_env)

   END SUBROUTINE dbcsr_distribution_new_template