[petsc-users] Problem using MatSetValue with SeqAIJ. Values not being inserted.

Shitij Bhargava shitij.cse at gmail.com
Mon Jul 16 03:23:31 CDT 2012


Hi all !!

I am using Fortan and petsc 3.2-p7.

I am creating the array as:
*call
MatCreateSeqAIJ(PETSC_COMM_SELF,natoms,natoms,PETSC_DECIDE,PETSC_NULL,bonds,ierr)
*

And then inserting elements as:
*call MatSetValue(bonds,temp_int1-1,temp_int2-1,1,INSERT_VALUES,ierr)*

I even did:
*call MatSetValue(bonds,1,8,35,INSERT_VALUES,ierr)*

then I finalize the matrix by these:
*call MatAssemblyBegin(bonds,MAT_FINAL_ASSEMBLY,ierr)*
*call MatAssemblyEnd(bonds,MAT_FINAL_ASSEMBLY,ierr)*

But none of these values show up when I view the matrix by this:
*call MatView(bonds,PETSC_VIEWER_STDOUT_SELF,ierr)*

It's output is the following:
Matrix Object: 1 MPI processes
  type: seqaij
row 0: (0, 2.47033e-323)  (1, 2.8034e-85)  (4, 2.8034e-85)  (5, 2.8034e-85)
 (6, 2.8034e-85)
row 1: (0, 2.8034e-85)  (2, 2.8034e-85)  (7, 2.8034e-85)  (8, 1.6976e-313)
row 2: (1, 2.8034e-85)  (3, 2.8034e-85)  (9, 2.8034e-85)
row 3: (2, 2.8034e-85)
row 4: (0, 2.8034e-85)
row 5: (0, 2.8034e-85)
row 6: (0, 2.8034e-85)
row 7: (1, 2.8034e-85)
row 8: (1, 2.8034e-85)
..............

Why are the values not being inserted? (Even at (1,8), 35 is not there.)

Thank you in advance !!

Shitij
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120716/e79da8d4/attachment.html>


More information about the petsc-users mailing list