<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>That's working just fine. I don't know if that could be useful
      for someone, just in case here is the methodology :</p>
    <p>I got the cell-vertex connectivity from the function
      DMPlexWriteTopology_Vertices_HDF5_Static of
      petsc/src/dm/impls/plex/plexhdf5.c. The interesting result is in
      cellIS.</p>
    <p>The vertex coordinates are from the function
      DMPlexWriteCoordinates_HDF5_Static of the same file. The global
      numering is just by adding  the position of the vertex in the Vec
      + all the other ones from previous proc numbers.<br>
    </p>
    The cell global numbering is trivial : we use the function
    DMPlexGetCellNumbering.<br>
    <br>
    The global numbering is quite strange, but is consistant. Here is
    some examples, for 2x2 Cells (4 vertex per cell).<br>
    I attach a text file for a better reading<br>
    On 1 processor, we have :<br>
    6-----7-----8<br>
    |      |       |<br>
    |  2  |  3  |<br>
    |      |       |<br>
    3-----4-----5<br>
    |       |      |<br>
    |  0  |  1   |<br>
    |       |      |<br>
    0-----1-----2<br>
    <br>
    On 2 processors we have :<br>
    0-----1-----2<br>
    |       |      |<br>
    |  0  |  1  |<br>
    |       |     |<br>
    6-----7-----8<br>
    |       |     |<br>
    |  2  |  3  |<br>
    |       |     |<br>
    3-----4-----5<br>
    Cells 0 and 1 are on proc 0; 2 and 3 are on proc 1.<br>
    <br>
    On 4 processors we have :<br>
    0-----1-----2<br>
    |       |     |<br>
    |  0  |  1  |<br>
    |       |     |<br>
    7-----8-----4<br>
    |       |     |<br>
    |  3  |  2  |<br>
    |       |     |<br>
    5-----6-----3 <br>
    <br>
    On cell per proc : cell 0 on proc 0, cell 1 on proc 1, ...<br>
    <br>
    The text file (edit with notepad++) contains all the ISView for
    understanding purpose.<br>
    <br>
    Matthew, many thanks for the help !!<br>
    <br>
    Regards,<br>
    <br>
    Yann<br>
    <br>
    <div class="moz-cite-prefix">Le 20/12/2017 à 17:40, Matthew Knepley
      a écrit :<br>
    </div>
    <blockquote
cite="mid:CAMYG4Gkqa5ioa=uw0xQ4PJ2xXSrdWZ1+fhTAh1Ps161UqbcftA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Wed, Dec 20, 2017 at 11:08 AM,
            Yann JOBIC <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:yann.jobic@univ-amu.fr" target="_blank">yann.jobic@univ-amu.fr</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000">
                <div
                  class="m_-7806503419130730542m_-2865967129517278233moz-cite-prefix">On
                  12/19/2017 05:50 PM, Matthew Knepley wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div class="gmail_extra">
                      <div class="gmail_quote">On Tue, Dec 19, 2017 at
                        11:40 AM, Yann JOBIC <span dir="ltr"><<a
                            moz-do-not-send="true"
                            href="mailto:yann.jobic@univ-amu.fr"
                            target="_blank">yann.jobic@univ-amu.fr</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">Hello,<br>
                          <br>
                          We want to extract the cell connectivity from
                          a DMPlex. We have no problem for a sequential
                          run.<br>
                        </blockquote>
                        <div><br>
                        </div>
                        <div>Do you want it on disk? If so, you can just
                          DMView() for HDF5. That outputs the
                          connectivity in a global numbering.</div>
                        <div>I can show you the calls I use inside if
                          you want. </div>
                      </div>
                    </div>
                  </div>
                </blockquote>
                I looked at the code, specifically
                DMPlexWriteTopology_Vertices_H<wbr>DF5_Static<br>
                cellIS should have what i want. <br>
                However it seems that it is not the case. Do i look at
                the right spot in the code ?<br>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>cellIS has the entire connectivity. You sound like you
              want cell-vertex only. You could get that by just</div>
            <div><br>
            </div>
            <div>  DMPlexUninterpolate(dm, &udm);</div>
            <div>  <get your cellIS from udm></div>
            <div>  DMDestroy(&udm);</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> I also looked at
                DMPlexGetCellNumbering, which does exactly what i want
                for the global numbering of Cells, even if the ordering
                is different for different number of processors.<br>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>Yes.</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> When i use
                DMPlexGetVertexNumbering, i've got negative values,
                which is correctly handeled by
                DMPlexWriteTopology_Vertices_H<wbr>DF5_Static, but i
                really don't understand this part.<br>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>There are no shared cells in your partition, so you get
              all positive numbers. You have shared vertices, so the
              negative numbers are for vertices</div>
            <div>you do not own. If the negative number is n, the
              corresponding global number is -(n+1). Notice that the
              transformation is 1-1 and its square is I.</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> I succeed in having
                the coordinates, but maybe not in the right order. I
                reused DMPlexWriteCoordinates_HDF5_St<wbr>atic, which
                create a Vec of vertex coordinates, but i couldn't
                understand the order of vertex coordinate linked (or
                not) with DMPlexWriteTopology_Vertices_H<wbr>DF5_Static.
                The number of local coordinates is also strange, and
                does not correspond to the cell's topology. <br>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>It matches the order of the global numbering.</div>
            <div><br>
            </div>
            <div>  Thanks</div>
            <div><br>
            </div>
            <div>    Matt</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> Thanks for the
                help!<br>
                <br>
                Regards,<br>
                <br>
                Yann<br>
                <br>
                <br>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div class="gmail_extra">
                      <div class="gmail_quote">
                        <div>I usually put</div>
                        <div><br>
                        </div>
                        <div>  DMViewFromOptions(dm, NULL, "-dm_view")</div>
                        <div><br>
                        </div>
                        <div>Then</div>
                        <div><br>
                        </div>
                        <div>  -dm_view hdf5:mesh.h5</div>
                        <div><br>
                        </div>
                        <div>  Thanks,</div>
                        <div><br>
                        </div>
                        <div>    Matt</div>
                        <div> </div>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex"> However for parallel
                          ones, we need to get the node numbering in the
                          global ordering, as when we distribute the
                          mesh, we only have local nodes, and thus local
                          numbering.<br>
                          <br>
                          It seems that we should use
                          DMGetLocalToGlobalMapping (we are using
                          Fortran with Petsc 3.8p3). However, we get the
                          running error :<br>
                          <br>
                          [0]PETSC ERROR: No support for this operation
                          for this object type<br>
                          [0]PETSC ERROR: DM can not create
                          LocalToGlobalMapping<br>
                          <br>
                          Is it the right way to do it ?<br>
                          <br>
                          Many thanks,<br>
                          <br>
                          Regards,<br>
                          <br>
                          Yann<br>
                          <br>
                        </blockquote>
                      </div>
                      <br>
                      <br clear="all">
                      <span class="m_-7806503419130730542HOEnZb"><font
                          color="#888888">
                          <div><br>
                          </div>
                          -- <br>
                          <div
                            class="m_-7806503419130730542m_-2865967129517278233gmail_signature"
                            data-smartmail="gmail_signature">
                            <div dir="ltr">
                              <div>
                                <div dir="ltr">
                                  <div>What most experimenters take for
                                    granted before they begin their
                                    experiments is infinitely more
                                    interesting than any results to
                                    which their experiments lead.<br>
                                    -- Norbert Wiener</div>
                                  <div><br>
                                  </div>
                                  <div><a moz-do-not-send="true"
                                      href="http://www.caam.rice.edu/%7Emk51/"
                                      target="_blank">https://www.cse.buffalo.edu/~k<wbr>nepley/</a><br>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </font></span></div>
                  </div>
                </blockquote>
                <br>
              </div>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div class="m_-7806503419130730542gmail_signature"
            data-smartmail="gmail_signature">
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div>What most experimenters take for granted before
                    they begin their experiments is infinitely more
                    interesting than any results to which their
                    experiments lead.<br>
                    -- Norbert Wiener</div>
                  <div><br>
                  </div>
                  <div><a moz-do-not-send="true"
                      href="http://www.caam.rice.edu/%7Emk51/"
                      target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</a><br>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>