<div>OK. All I am concering is:</div>
<div> </div>
<div>1- define matrix A in sparse format AIJ.</div>
<div>2- Get the content of A.</div>
<div>3- change the content of A for some elements</div>
<div>4- Restore the changed matrix back into origin.</div>
<div> </div>
<div>I test MatGetArray( Mat A, PetscScalar* a ) but I couldnt find the correct content of matrix by using a[i*n+j]. I need to know how to access the elements of an assembled sparse matrix.<br><br></div>
<div>Am I clear now?</div>
<div> </div>
<div>Thanks</div>
<div>Behzad</div>
<div> </div>
<div class="gmail_quote">On Sat, Oct 1, 2011 at 6:56 PM, Jed Brown <span dir="ltr">&lt;<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="gmail_quote">
<div class="im">On Sat, Oct 1, 2011 at 10:23, behzad baghapour <span dir="ltr">&lt;<a href="mailto:behzad.baghapour@gmail.com" target="_blank">behzad.baghapour@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I meant by MatAssembly, the global indices of matrix elements (related to a dense format) which is changed into sparse one.</blockquote>

<div><br></div></div>
<div>I don&#39;t understand what you mean. It doesn&#39;t make sense to convert &quot;dense&quot; indices into sparse ones.</div>
<div class="im">
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">So what would be right pattern to read the content of the Matrix from MatGetArray if I know that the original matrix is created by AIJ?</blockquote>
</div></div><br>
<div>Use MatGetRow() if you need access to this. (The internal data structures are different in parallel and serial, so accessing them directly is bad.)</div></blockquote></div><br><br clear="all"><br>-- <br>==================================<br>
Behzad Baghapour<br>Ph.D. Candidate, Mechecanical Engineering<br>University of Tehran, Tehran, Iran<br><a href="https://sites.google.com/site/behzadbaghapour" target="_blank">https://sites.google.com/site/behzadbaghapour</a><br>
Fax: 0098-21-88020741<br>==================================<br><br>