[petsc-users] confusion about MatSetValues(A, ,ADD_VALUES);

丁老师 ztdepyahoo at 163.com
Fri May 31 10:43:11 CDT 2013


I write a simple c procedure to test the MatSetValues.  the main body of procedure is like this
        
     int row=1;
     int col=10;
     double v=1.0;
   
     MatSetValues(A,1,&row,1,&col,&v,INSERT_VALUES);
      MatSetValues(A,1,&row,1,&row,&v,ADD_VALUES);
      MatSetValues(A,1,&col,1,&col,&v,ADD_VALUES);


   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);


I run with 4 cpus, when i view the matrix, the diagonal value is wrong ,it is 1 not 4.0. but if i delete the code "MatSetValues(A,1,&row,1,&col,&v,INSERT_VALUES)", it can gives me the correct answer.


  could you please tell me the reason. 
Regards.
thank you very much.

















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


More information about the petsc-users mailing list