Each particle is represented by a structure
typedef struct { double x, y, z; double mass; } Particle;Although this cannot be guaranteed, on most systems this structure will be stored simply as 4 double precision numbers. Hence our MPI type declaration:
MPI_Type_contiguous ( 4, MPI_DOUBLE, &particle_type ); MPI_Type_commit ( &particle_type );The second call requests MPI to optimise handling of
MPI_Datatype particle_type
if possible.