Thanks, I will try MatGetSubMatrix for this matter...<br><br>
<div class="gmail_quote">On Sat, Oct 1, 2011 at 4:23 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 02:33, 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">
<div>I want to copy some elements of a calculated matrix (A) into another matrix (B) with DIFFERENT_NONZERO_PATTERN.</div></blockquote>
<div><br></div></div>
<div>Which &quot;some elements&quot;?</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">
<div>How could I efficiently do this?</div>
<div>Is this should be done after or before matrix assembly of (A)?</div></blockquote>
<div><br></div></div>
<div>You can only copy after assembling A.</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">
<div>Then, what is the sparse pattern of the matrix (A) after assembling and how is the correct access into its elements?</div></blockquote></div></div><br>
<div>You probably want MatGetSubMatrix().</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>