<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Thanks, Smith. I understand the functionalities of the AOCreate<font size="2">,<span style="font-size:10pt">
</span></font><span>AOApplicationToPetsc()</span>, they can be used to basicially convert old global indices to new indices. But my next question will be how can they cooperate with the sparse matrix? As I understand, these objects behave kind of like maps,
but I don't know how to pass this information when I create the global stiffness matrix or add value to the global stiffness matrix. </p>
<p><br>
</p>
<p>Best,</p>
<p>Dongyu<br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Smith, Barry F. <bsmith@mcs.anl.gov><br>
<b>Sent:</b> Wednesday, July 3, 2019 9:02:21 PM<br>
<b>To:</b> Matthew Knepley<br>
<b>Cc:</b> Dongyu Liu - CITG; petsc-users@mcs.anl.gov<br>
<b>Subject:</b> Re: [petsc-users] How to create a mapping of global to local indices?</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText"><br>
Note that number ingof vertices/nodes whatever is just an arbitrary label; no one is better or more fundamental than another. In your code's interaction with PETSc vectors and matrices you must use the contiguous numbering, in your mesh management code you
can do whatever you want.<br>
<br>
There are routines AOCreate(), AOApplicationToPetsc() etc that you can, if you choose, use to renumber the vertices/nodes in your mesh data structure to match those used by PETSc vectors/matrices.<br>
<br>
<br>
Barry<br>
<br>
<br>
> On Jul 3, 2019, at 12:55 PM, Matthew Knepley via petsc-users <petsc-users@mcs.anl.gov> wrote:<br>
> <br>
> On Wed, Jul 3, 2019 at 9:07 AM Dongyu Liu - CITG via petsc-users <petsc-users@mcs.anl.gov> wrote:<br>
> 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?<br>
> <br>
> Yes.<br>
> <br>
> or is there any alternative?<br>
> <br>
> No.<br>
> <br>
> Thanks,<br>
> <br>
> Matt <br>
> <br>
> <br>
> Dongyu<br>
> <br>
> From: Mark Adams <mfadams@lbl.gov><br>
> Sent: Wednesday, July 3, 2019 3:54:49 PM<br>
> To: Dongyu Liu - CITG<br>
> Cc: petsc-users@mcs.anl.gov<br>
> Subject: Re: [petsc-users] How to create a mapping of global to local indices?<br>
> <br>
> 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.
<br>
> <br>
> You can use:<br>
> PetscErrorCode MatGetOwnershipRange(Mat mat,PetscInt *m,PetscInt *n)<br>
> 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)).<br>
> <br>
> Mark<br>
> <br>
> <br>
> On Wed, Jul 3, 2019 at 9:11 AM Dongyu Liu - CITG via petsc-users <petsc-users@mcs.anl.gov> wrote:<br>
> Hi,<br>
> <br>
> <br>
> <br>
> 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.<br>
> <br>
> <br>
> <br>
> 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?<br>
> <br>
> <br>
> <br>
> 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?<br>
> <br>
> <br>
> <br>
> Best,<br>
> <br>
> <br>
> <br>
> Dongyu<br>
> <br>
> <br>
> <br>
> <br>
> <br>
> -- <br>
> 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<br>
> <br>
> <a href="https://www.cse.buffalo.edu/~knepley/">https://www.cse.buffalo.edu/~knepley/</a><br>
<br>
</div>
</span></font>
</body>
</html>