next up previous
Next: Communicating the data Up: Particle migration Previous: Creating the particle datatype

Creating the send and receive datatypes


Creating the Send/Receive Datatypes

MPI_Datatype Sendtype;
int npart, scount, i, rightedge;
int Pindex[100], Pblock[100];

scount = 0;
for (i=0;i<npart;i++)
   if (particle[i].x[0] > rightedge){
      Pindex[scount] = i; Pblock[scount] = 1;
      scount++;}

ierr = MPI_Type_index (scount, Pblock, Pindex,
                       Ptype, &Sendtype);
ierr = MPI_Type_commit (&Sendtype);
ierr = MPI_Type_commit (&Ptype);



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