<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 2, 2018 at 3:00 PM, Danyang Su <span dir="ltr"><<a href="mailto:danyang.su@gmail.com" target="_blank">danyang.su@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p>On 18-03-02 10:58 AM, Matthew Knepley
      wrote:<br></p>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Fri, Mar 2, 2018 at 1:41 PM,
            Danyang Su <span dir="ltr"><<a href="mailto:danyang.su@gmail.com" target="_blank">danyang.su@gmail.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF"> <br>
                <div class="gmail-m_-2214224469709245128gmail-m_-4654060630000521438moz-cite-prefix">On
                  18-02-19 03:30 PM, Matthew Knepley wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div class="gmail_extra">
                      <div class="gmail_quote">On Mon, Feb 19, 2018 at
                        3:11 PM, Danyang Su <span dir="ltr"><<a href="mailto:danyang.su@gmail.com" target="_blank">danyang.su@gmail.com</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Matt,<br>
                          <br>
                          Would you please let me know how to check if a
                          cell is local owned? When overlap is 0 in
                          DMPlexDistribute, all the cells are local
                          owned. How about overlap > 0? It sounds
                          like impossible to check by node because a
                          cell can be local owned even if none of the
                          nodes in this cell is local owned.<br>
                        </blockquote>
                        <div><br>
                        </div>
                        <div>If a cell is in the PetscSF, then it is not
                          locally owned. The local nodes in the SF are
                          sorted, so I use</div>
                        <div>PetscFindInt (<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscFindInt.html" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>petsc-current/docs/manualpages<wbr>/Sys/PetscFindInt.html</a>).</div>
                      </div>
                    </div>
                  </div>
                </blockquote>
                Hi Matt,<br>
                <br>
                Would you please give me a little more about how to mark
                the ghost cells when overlap > 0? What do you mean a
                cell is in the PetscSF? I use PetscSFView to export the
                graph (original mesh file pile.vtk) and it exports all
                the cells, including the ghost cells (PETScSFView.txt).<br>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>Yes, I will send you some sample code when I get time.
              The first problem is that you are looking at a different
              PetscSF. This looks like the</div>
            <div>one returned by DMPlexDistribute(). This is mapping the
              serial mesh to the parallel mesh. You want</div>
            <div><br>
            </div>
            <div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMGetPointSF.html" target="_blank">http://www.mcs.anl.gov/<wbr>petsc/petsc-current/docs/<wbr>manualpages/DM/DMGetPointSF.<wbr>html</a></div>
            <div><br>
            </div>
            <div>Then you can look at</div>
            <div><br>
            </div>
            <div>  <a href="https://bitbucket.org/petsc/petsc/src/1788fc36644e622df8cb1a0de85676ccc5af0239/src/dm/impls/plex/plexsubmesh.c?at=master&fileviewer=file-view-default#plexsubmesh.c-683" target="_blank">https://bitbucket.org/petsc/<wbr>petsc/src/<wbr>1788fc36644e622df8cb1a0de85676<wbr>ccc5af0239/src/dm/impls/plex/<wbr>plexsubmesh.c?at=master&<wbr>fileviewer=file-view-default#<wbr>plexsubmesh.c-683</a></div>
            <div><br>
            </div>
            <div>I get the pointSF, get out the list of leaves, and find
              points in it using PetscFindInt()</div>
          </div>
        </div>
      </div>
    </blockquote>
    Hi Matt,<br>
    By using the local dm, I can get the PetscSF I want, as shown below.
    Now I need to get the number of ghost cells or local cells (here
    4944) or number of leaves (here 825) for each processor. I try to
    use PetscSFGetGraph to get number of leaves in Fortran. After
    including "petscsf.h", I got compilation error saying "You need a
    ISO C conforming compiler to use the glibc headers". Is there any
    alternative way to do this? I do not need the ghost-neighbor
    mapping, but just the number of local owned cells.<br></div></blockquote><div><br></div><div>Also, make sure you are using the latest Fortran style for PETSc:</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
      [0] Number of roots=11449, leaves=825, remote ranks=1<br>
      [0] 4944 <- (1,0)<br>
      [0] 4945 <- (1,28)<br>
      [0] 4946 <- (1,56)<br>
    ...<br>
      [1] Number of roots=11695, leaves=538, remote ranks=1<br>
      [1] 5056 <- (0,21)<br>
      [1] 5057 <- (0,43)<br>
      [1] 5058 <- (0,65)<br>
      [1] 5059 <- (0,87)<br>
    <br>
    In file included from /usr/include/features.h:375:0,<br>
                     from /usr/include/stdio.h:28,<br>
                     from
    /home/dsu/Soft/PETSc/petsc-3.<wbr>8.3/include/petscsys.h:175,<br>
                     from
    /home/dsu/Soft/PETSc/petsc-3.<wbr>8.3/include/petscsf.h:7,<br>
                     from ../../solver/solver_ddmethod.<wbr>F90:4837:<br>
    /usr/include/x86_64-linux-gnu/<wbr>sys/cdefs.h:30:3: error: #error "You
    need a ISO C conforming compile\<br>
    r to use the glibc headers"<br>
     # error "You need a ISO C conforming compiler to use the glibc
    headers"<br></div></blockquote><div><br></div><div>Can you send this to <a href="mailto:petsc-maint@mcs.anl.gov">petsc-maint@mcs.anl.gov</a>? It looks like a build problem that can be fixed.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    Thanks,<br>
    <br>
    Danyang<br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>  Thanks,</div>
            <div><br>
            </div>
            <div>    Matt</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF"> Thanks,<br>
                <br>
                Danyang <br>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div class="gmail_extra">
                      <div class="gmail_quote">
                        <div><br>
                        </div>
                        <div>  Thanks,</div>
                        <div><br>
                        </div>
                        <div>    Matt</div>
                        <div> </div>
                        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Thanks,<br>
                          <br>
                          Danyang<span class="gmail-HOEnZb"><font color="#888888"><span class="gmail-m_-2214224469709245128gmail-HOEnZb"><font color="#888888"><br>
                            </font></span></font></span></blockquote><span class="gmail-HOEnZb"><font color="#888888">
                        <span class="gmail-m_-2214224469709245128gmail-HOEnZb"><font color="#888888">
                          </font></span></font></span></div><span class="gmail-HOEnZb"><font color="#888888">
                      <span class="gmail-m_-2214224469709245128gmail-HOEnZb"><font color="#888888">
                          -- <br>
                          <div class="gmail-m_-2214224469709245128gmail-m_-4654060630000521438gmail-m_-8557986044721592658gmail_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 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></font></span></div><span class="gmail-HOEnZb"><font color="#888888">
                  </font></span></div><span class="gmail-HOEnZb"><font color="#888888">
                </font></span></blockquote><span class="gmail-HOEnZb"><font color="#888888">
                <br>
              </font></span></div><span class="gmail-HOEnZb"><font color="#888888">
            </font></span></blockquote><span class="gmail-HOEnZb"><font color="#888888">
          </font></span></div><span class="gmail-HOEnZb"><font color="#888888">
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div class="gmail-m_-2214224469709245128gmail_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 href="http://www.caam.rice.edu/%7Emk51/" target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</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="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 href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>