<div dir="ltr"><div dir="ltr">On Wed, Jul 13, 2022 at 10:17 PM Bora Jeong <<a href="mailto:boraj1021@gmail.com">boraj1021@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear petsc team,<div> <br>I am a user of DMPlex for a finite volume code and there is a necessity to know global index of each cell. Here the global index means the indexing that can be found from a mesh file itself without distribution over processors. It seems petsc community denotes this indexing term as "natural". <br><br>What I want to do is to create a local array (not petsc vector but just an array variable in the program) to map distributed cell ID to natual cell ID, for example, an array "A"; <br>A(distributed_node_ID) = natural_node_ID<br><br>There are some petsc functions to support mapping between global and natural vectors. However, I just need to define the array "A" as above example. To achieve this, what is a proper/smart way? In other words, how can I extract the natural_cell_ID from a distributed local_cell_ID? <br><br>I turned on DMSetUseNatural(DM, PETSC_TRUE) before distribution, but after this, defining all the required section and star forest objects to get natural and global vectors seems not that direct way for my purpose, which is just to extract the above mapping array "A". Can I get any comments about it?<br></div></div></blockquote><div><br></div><div>There is only one thing created, the sfNatural PetscSF object, which you can get with DMGetNaturalSF(). The roots of this SF are</div><div>the global numbers of dofs stored in PETSc vectors, and the leaves are natural numbers for these dofs. Thus, when we map global</div><div>vectors to natural vectors in DMPlexGlobalToNaturalBegin/End(), we call PetscSFBcastBegin/End(). Mapping natural to global we call</div><div>PetscSFReduceBegin/End(). You could pull the information out of the SF using PetscSFGetGraph() if you want.</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 dir="ltr"><div>Regards<br>Mo<br></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><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.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>