INCLUDE 'mpif.h' INTEGER TYPES(3), DISPLS(3), LENS(3), NEWTYPE INTEGER STATUS(MPI_STATUS_SIZE), COUNT, ELEMENTS DOUBLE PRECISION A(3) INTEGER B(5) INTEGER*1 C(7) DATA LENS/1, 1, 1/ DATA A/3*(1.D0)/, B/5*(123)/, C/7*(15)/ * CALL MPI_INIT(IERR) * CALL MPI_TYPE_CONTIGUOUS(3, MPI_DOUBLE_PRECISION, TYPES(1), IERR) CALL MPI_TYPE_CONTIGUOUS(5, MPI_INTEGER, TYPES(2), IERR) CALL MPI_TYPE_CONTIGUOUS(7, MPI_BYTE, TYPES(3), IERR) CALL MPI_ADDRESS(A, DISPLS(1), IERR) CALL MPI_ADDRESS(B, DISPLS(2), IERR) CALL MPI_ADDRESS(C, DISPLS(3), IERR) CALL MPI_TYPE_STRUCT(3, LENS, DISPLS, TYPES, NEWTYPE, IERR) CALL MPI_TYPE_COMMIT(NEWTYPE, IERR) CALL MPI_SENDRECV_REPLACE(MPI_BOTTOM, 1, NEWTYPE, 0, 0, 0, 0, + MPI_COMM_SELF, STATUS, IERR) CALL MPI_GET_COUNT(STATUS, NEWTYPE, COUNT, IERR) CALL MPI_GET_ELEMENTS(STATUS, NEWTYPE, ELEMENTS, IERR) PRINT *, 'COUNT=', COUNT, ' ELEMENTS=', ELEMENTS CALL MPI_TYPE_FREE(NEWTYPE, IERR) CALL MPI_FINALIZE(IERR) * STOP END