<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 31, 2012, at 1:23 PM, Jed Brown wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Tue, Jan 31, 2012 at 04:11, Hui Zhang <span dir="ltr"><<a href="mailto:mike.hui.zhang@hotmail.com">mike.hui.zhang@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Suppose using MatCreate() and MatSetSizes() we obtain a Mat A, and then<br>
using VecCreate() and VecSetSizes() with the same rows' arguments as A<br>
we obtain a Vec b. Let A_i (b_i) consists of the rows owned by processor i.<br>
<br>
Can I believe that under the ordering of petsc, the following equality holds,<br>
A= [A_0<br>
A_1<br>
...<br>
A_N],<br>
b= [b_0<br>
b_1<br>
...<br>
b_N],<br>
i.e. A_i, b_i with smaller i--the processor number goes first?<br></blockquote><div><br></div><div>Matrices and vectors always have contiguous row partitions, yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
My question comes from assembly of linear system. Suppose under my application<br>
ordering(AO) the system is Ax=b. I can get an AO from A using<br>
<br>
MatGetOwnershipRanges(A,&Istart,&Iend);<br>
AOCreateBasic( -, -,app_ind, Istart..Iend, &ao_1);<br>
<br>
and assemble A. Under the petsc ordering, A becomes P_1*A mathematically,</blockquote><div><br></div><div>I don't think I follow. This AO does not transform A in any way. You can use the AO to translate application indices to PETSc indices to give to MatSetValues().</div>
<div><br></div><div>In most cases, I would recommend redistributing the mesh according to the partition and then using local indices (e.g. MatSetValuesLocal()) during assembly. You might use AO for that setup step, but it usually doesn't make sense to use _during_ assembly.</div></div></blockquote><div><br></div><div>thanks, do you mean that it is faster to use LocaltoGlobalMapping & SetValuesLocal</div><div>than to use AO & SetValues globally? Is there a big difference in performance?</div><div><br></div><div><br></div><blockquote type="cite"><div class="gmail_quote">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> with<br>
P_1 the permutation corresponding to ao_1. In a similar way, we have that b<br>
becomes P_2 b under the petsc ordering. I want to make sure P_1 and P_2 are<br>
the same so arises my question.<br>
<br>
Thanks a lot!<br>
<font color="#888888">Hui<br>
<br>
<br>
</font></blockquote></div><br>
</blockquote></div><br></body></html>