<div dir="ltr"><div dir="ltr">On Wed, Jul 3, 2019 at 9:07 AM Dongyu Liu - CITG via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</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>

<div id="gmail-m_-6791799277939116722divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Thank you, Mark. My question is if I have some node indices like [0, 1, 3, 8, 9] handled by the current processor, is that necessary to renumber these indices to something like 0 to 4?</p></div></div></blockquote><div>Yes.</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><div id="gmail-m_-6791799277939116722divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr"><p> or is there any alternative?</p></div></div></blockquote><div>No.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div id="gmail-m_-6791799277939116722divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p><br>
</p>
<p>Dongyu<br>
</p>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-6791799277939116722divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>><br>
<b>Sent:</b> Wednesday, July 3, 2019 3:54:49 PM<br>
<b>To:</b> Dongyu Liu - CITG<br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br>
<b>Subject:</b> Re: [petsc-users] How to create a mapping of global to local indices?</font>
<div> </div>
</div>
<div>
<div dir="ltr">PETSc matrices and vectors are created with a local size n or global size N and PETSC_DECIDE instead of n. The global PETSc indices are ordered from 0 to n_0 - 1 where n_0 is the number of equations on process 0. This numbering continues for
 all processes. 
<div><br>
</div>
<div>You can use:</div>
<div>
<pre style="color:rgb(0,0,0)"><a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode" target="_blank">PetscErrorCode</a> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetOwnershipRange.html#MatGetOwnershipRange" target="_blank">MatGetOwnershipRange</a>(<a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/Mat.html#Mat" target="_blank">Mat</a> mat,<a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInt.html#PetscInt" target="_blank">PetscInt</a> *m,<a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInt.html#PetscInt" target="_blank">PetscInt</a> *n)</pre>
To see what your local global indices are (rows m to n-1 are on this process and so its the local indices are 0 to (n-m-1)).</div>
<div><br>
</div>
<div>Mark</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Jul 3, 2019 at 9:11 AM Dongyu Liu - CITG via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
</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 id="gmail-m_-6791799277939116722gmail-m_5482428908103257510divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>I am running a FEM program using PETSc. In the beginning,  the mesh is partitioned in gmsh, and we read the partitioned mesh using our own reader.</p>
<p><br>
</p>
<p>Now my question is: How can I get a global to local indices mapping? and do I need to renumber the indices after I read the partitioned mesh?</p>
<p><br>
</p>
<p>From my understanding, the rows handled by each processor should be consecutive, but the indices of nodes which I directly read from a gmsh file are not. Is this an issue?</p>
<p><br>
</p>
<p>Best,</p>
<p><br>
</p>
<p>Dongyu<br>
</p>
<p><br>
</p>
</div>
</div>
</blockquote>
</div>
</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>