title: Derived data type in MPI java
body: <p>I am newbie in mpi java, and I want to construct a derived datatype formed by n strings. The idea is send a set of (derived) data to each processor. I have read these doc, <a href="https://www.open-mpi.org/papers/mpi-java-spec/mpiJava-spec.pdf" rel="nofollow">https://www.open-mpi.org/papers/mpi-java-spec/mpiJava-spec.pdf</a>, but I am unable to create a valid code.</p>
  
  <p>Could you give me some feedback?</p>
  
  <hr>
  
  <p>@rlegendi I put some code,but I am totally blocked cos' I am not how to proceed.</p>
  
  <pre><code>class Data{
     char[] data1;
     char[] data2;
  
     public Data(String d1, String d2)
     {
          this.data1 = d1.toCharArray();
          this.data2 = d2.toCharArray();
     }
  }
  
  class testMPI{
       MPI.Init(argv);
       int myRank = MPI.COMM_WORLD.getRank();
       int nProcs = MPI.COMM_WORLD.getSize();
  
       Data[] myData = new Data[4]; 
       myData[0] = new Data("d1", "this is a test");
       ....
       myData[3] = new Data("the third data", "this is another test");
  
  
       // How to create teh derivated data to send a part of myData[] to several processes???
       if (myRank == 0)
       {
             // calculate offset and chunk
             // send myData[0] and [1] to proc#1 and myData[2] and [3] to proc#2
             for (i=1 ; i &lt; nProcs; i++)
                    MPI.COMM_WORLD.send(myData[offset], chunk, MPI.OBJECT??, i, 1);
       }
       else
             MPI.COMM_WORLD.receive(recv, chunk, MPI.OBJECT??, i, 1);
  }
  </code></pre>
  
  <p>So what I don't understand is how to create a derivated MPI datatype to transfer a part of the array to each processor.</p>