FUNCTION mp_type_make_struct(subtypes, &
vector_descriptor, index_descriptor) &
RESULT(type_descriptor)
TYPE(mp_type_descriptor_type), &
DIMENSION(:), INTENT(IN) :: subtypes
INTEGER, DIMENSION(2), INTENT(IN), &
OPTIONAL :: vector_descriptor
TYPE(mp_indexing_meta_type), &
INTENT(IN), OPTIONAL :: index_descriptor
TYPE(mp_type_descriptor_type) :: type_descriptor
CHARACTER(LEN=*), PARAMETER :: routineN = 'mp_type_make_struct'
INTEGER :: i, ierr, n
#if defined(__parallel)
INTEGER(kind=mpi_address_kind), &
ALLOCATABLE, DIMENSION(:) :: displacements
#endif
INTEGER, DIMENSION(SIZE(subtypes)) :: lengths
MPI_DATA_TYPE, DIMENSION(SIZE(subtypes)) :: old_types
ierr = 0
n = SIZE(subtypes)
!type_descriptor%mpi_type_handle = MPI_DATATYPE_NULL
type_descriptor%length = 1
#if defined(__parallel)
CALL mpi_get_address(MPI_BOTTOM, type_descriptor%base, ierr)
IF (ierr /= 0) &
DBCSR_ABORT("MPI_get_address @ "//routineN)
ALLOCATE (displacements(n))
#endif
type_descriptor%vector_descriptor(1:2) = 1
type_descriptor%has_indexing = .FALSE.
ALLOCATE (type_descriptor%subtype(n))
type_descriptor%subtype(:) = subtypes(:)
DO i = 1, SIZE(subtypes)
#if defined(__parallel)
displacements(i) = subtypes(i)%base
#endif
old_types(i) = subtypes(i)%type_handle
lengths(i) = subtypes(i)%length
END DO
#if defined(__parallel)
CALL MPI_Type_create_struct(n, &
lengths, displacements, old_types, &
type_descriptor%type_handle, ierr)
IF (ierr /= 0) &
DBCSR_ABORT("MPI_Type_create_struct @ "//routineN)
CALL MPI_Type_commit(type_descriptor%type_handle, ierr)
IF (ierr /= 0) &
DBCSR_ABORT("MPI_Type_commit @ "//routineN)
#endif
IF (PRESENT(vector_descriptor) .OR. PRESENT(index_descriptor)) THEN
DBCSR_ABORT(routineN//" Vectors and indices NYI")
END IF
END FUNCTION mp_type_make_struct