Type MPI_CHARACTER



next up previous contents
Next: Data Conversion Up: Type Matching Rules Previous: Type Matching Rules

Type MPI_CHARACTER

MPI_CHARACTER

The type MPI_CHARACTER matches one character of a Fortran variable of MPI_CHARACTER type CHARACTER, rather then the entire character string stored in the variable. Fortran variables of type CHARACTER or substrings are transferred as if they were arrays of characters. This is illustrated in the example below.

Example 2.6 Transfer of Fortran CHARACTERS
CHARACTER* 10 a
CHARACTER* 10 b

CALL MPI_COMM_RANK(comm, rank, ierr)
IF (rank.EQ.0) THEN
    CALL MPI_SEND(a, 5, MPI_CHARACTER, 1, tag, comm, ierr)
ELSE IF (rank.EQ.1) THEN
    CALL MPI_RECV(b(6:10), 5, MPI_CHARACTER, 0, tag, comm, status, ierr)
END IF



Jack Dongarra
Fri Sep 1 06:16:55 EDT 1995