<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
I'm trying to insert values into my PETSc matrix using MatSetValues.<br>
<br>
I tried using:<br>
<br>
<i>do ijk=ijk_xyz_sta,ijk_xyz_end</i><i><br>
</i><i><br>
</i><i> II = ijk - 1 !Fortran shift to 0-based</i><i><br>
</i><i> </i><i><br>
</i><i> call
MatSetValues(A_semi_xyz,1,II,7,int_semi_xyz(ijk,1:7),semi_mat_xyz(ijk,1:7),INSERT_VALUES,ierr)</i><i><br>
</i><i><br>
</i><i>end do</i><br>
<br>
where ijk_xyz_sta/ijk_xyz_end are the starting/end index<br>
<br>
int_semi_xyz(ijk,1:7) stores the 7 column global indices<br>
<br>
semi_mat_xyz has the corresponding values.<br>
<br>
This work well but I'm trying to call MatSetValues in 1 statement,
it failed. I tried:<br>
<br>
<i>do ijk = 1,ijk_xyz_end-ijk_xyz_sta</i><i><br>
</i><i><br>
</i><i> rows(ijk) = ijk_xyz_sta + ijk - 1</i><i> !to get row's
global indices<br>
</i><i> </i><i><br>
</i><i>end do</i><i><br>
</i><i><br>
</i><i>call
MatSetValues(A_semi_xyz,ijk_xyz_end-ijk_xyz_sta,rows,7,int_semi_xyz(ijk_xyz_sta+1:ijk_xyz_end,1:7),semi_mat_xyz(ijk_xyz_sta+1:ijk_xyz_end,1:7),INSERT_VALUES,ierr)</i><br>
<br>
but when I use MatView, the values are in the wrong locations.<br>
<br>
May I know what's wrong?<br>
<br>
Thanks<br>
<pre class="moz-signature" cols="72">--
Yours sincerely,
TAY wee-beng</pre>
</body>
</html>