<div class="gmail_quote">On Mon, Mar 21, 2011 at 12:31, Alexander Grayver <span dir="ltr"><<a href="mailto:agrayver@gfz-potsdam.de">agrayver@gfz-potsdam.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000">Would I have to rebuild PETSc from scratch to make this wrapper
working?</div></blockquote><div><br></div><div>You would put it in your project and link it with your Fortran code.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000"><div class="im"><br>
<br>
<blockquote type="cite">
<div>Alternatively, the code for this is really simple, just
iterate through the rows of L and insert them into J.</div>
</blockquote></div>
Do you mean using MatGetOwnershipRange+MatGetSubMatrices+MatGetRow?</div></blockquote></div><br><div>Just translate the following (taken from MatAXPY_Basic) to Fortran:</div><div><br></div><div><div> ierr = MatGetSize(X,&m,&n);CHKERRQ(ierr);</div>
<div> ierr = MatGetOwnershipRange(X,&start,&end);CHKERRQ(ierr);</div><div> for (i = start; i < end; i++) {</div><div> ierr = MatGetRow(X,i,&ncols,&row,&vals);CHKERRQ(ierr);</div><div> ierr = MatSetValues(Y,1,&i,ncols,row,vals,ADD_VALUES);CHKERRQ(ierr);</div>
<div> ierr = MatRestoreRow(X,i,&ncols,&row,&vals);CHKERRQ(ierr);</div><div> }</div><div> ierr = MatAssemblyBegin(Y,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);</div><div> ierr = MatAssemblyEnd(Y,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);</div>
</div><div><br></div>