title: Efficient way of making data contiguous to transfer it among nodes
body: <pre><code>struct Face
  {
      // Matrixd is 1D representation of 2D matrix
      std::array &lt; Matrixd&lt;5,5&gt;, 2 &gt; M;
  };
  
  std::vector &lt;Face&gt; face;
  </code></pre>
  
  <p>I have a distributed for-loop among nodes. After all nodes finish working on their elements I would like to transfer corresponding elements among nodes. But AFAIK to use <code>MPI_Allgatherv</code> the data should be contiguous. First of all, I switched to 1D representation of 2D matrices (I was using [][] notation before). Now I want to make <code>face.M</code> to be contiguous. I am thinking to copy all elements of say, M[0] to an <code>std::array</code> an transfer that among nodes. Is this way efficient? To give an idea of number of data I work with, if I have 20k cells, at maximum I have 20k*3=60k faces. I might have a million of cells, too.</p>