<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 21.03.2011 12:37, Jed Brown wrote:
<blockquote
cite="mid:AANLkTikLobfCnr2TifTSYotH2Ohdj8Wx8O2f33xxj1ZE@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Mon, Mar 21, 2011 at 12:31, Alexander
Grayver <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:agrayver@gfz-potsdam.de">agrayver@gfz-potsdam.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
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: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
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>
</blockquote>
Thanks Jed, it looks simple enough for me (PETSc is great). <br>
<br>
One more question. I get matrix J out of MatMatMult operation and
then I have to add L matrix up, wouldn't there be a conflict using
MatAssemblyBegin/MatAssemblyEnd again? Generally, is it allowed to
set new values into the matrix after MatAssemblyBegin/MatAssemblyEnd
already has been done once?<br>
<br>
Thanks a lot.<br>
</body>
</html>