title: How to create new Type in MPI
body: <p>I am new to MPI and I want to create a new datatype for <code>Residence</code> <code>struct</code>.  I just want to see if I can create the new type right way.
      struct Residence
      {
          double  x;
          double y;
      };</p>
  
  <p>My new MPI Type </p>
  
  <pre><code>MPI_Datatype createRecType()
  {
      // Set-up the arguments for the type constructor
      MPI_Datatype new_type;
  
      int count = 2;
      int blocklens[] = { 1,1 };
  
      MPI_Aint indices[2];
      //indices[0]=0;
      MPI_Type_extent( MPI_DOUBLE, &amp;indices[0] );
      MPI_Type_extent( MPI_DOUBLE, &amp;indices[1] );
  
      MPI_Datatype old_types[] = {MPI_DOUBLE,MPI_DOUBLE};
  
      MPI_Type_struct(count,blocklens,indices,old_types,&amp;new_type);
      MPI_Type_commit(&amp;new_type);
  
  }
  </code></pre>