next up previous
Next: Creating the send and Up: Particle migration Previous: Skeleton code for migration

Creating the particle datatype


Creating the Particle Datatype

struct Pstruct {double x[3]; double v[3]; int k;}
     particle[100];
MPI_Datatype Stype[3], Dtype3, Ptype;
int Sblock[3] = {1, 1, 1};
int Sindex[3];
MPI_Aint sized3;

ierr = MPI_Type_contiguous (3, MPI_DOUBLE, &Dtype3);
ierr = MPI_Type_extent (Dtype3, &sized3);
Sindex[0] = 0;
Sindex[1] = sized3;
Sindex[2] = sized3*2;
Stype[0]  = Dtype3;
Stype[1]  = Dtype3;
Stype[2]  = MPI_INT;
ierr = MPI_Type_struct (3, Sblock, Sindex, 
                        Stype, &Ptype);



David W Walker
Mon Jan 20 11:10:22 GMT 1997