MatSetValue() takes a PetscScalar, but you declared s as PetscInt. Matt
On Tue, Mar 3, 2009 at 2:51 PM, Damian Kaleta <damian.kaleta at mail.utexas.edu > wrote: > Hi > > I have a hard time implementing very simple program using fortran. The same > code works perfectly for me in C. > > Here is a source code: > > program main > implicit none > > > #include "/home/damian/petsc-2.3.3-p15/include/finclude/petsc.h" > #include "/home/damian/petsc-2.3.3-p15/include/finclude/petscpc.h" > #include "/home/damian/petsc-2.3.3-p15/include/finclude/petscsys.h" > #include "/home/damian/petsc-2.3.3-p15/include/finclude/petscvec.h" > #include "/home/damian/petsc-2.3.3-p15/include/finclude/petscmat.h" > > > PetscErrorCode::pierr > Mat::zpastp > PetscInt::s > > s=3 > > call PetscInitialize(PETSC_NULL_CHARACTER,pierr) > call MatCreateSeqAIJ(PETSC_COMM_SELF, 10, 10, 1, PETSC_NULL_INTEGER, > zpastp, pierr) > > call MatSetValue(zpastp, 2, 2, s, INSERT_VALUES,pierr) > > call MatAssemblyBegin(zpastp,MAT_FINAL_ASSEMBLY,pierr) > call MatAssemblyEnd(zpastp,MAT_FINAL_ASSEMBLY,pierr) > > call MatView(zpastp, PETSC_VIEWER_STDOUT_SELF, pierr) > call MatDestroy(zpastp,pierr) > call PetscFinalize(pierr) > > end > > > and the result: > [damian at utcem001 pet]$ ./ex4f > row 0: > row 1: > row 2: (2, 1.4822e-323) > row 3: > row 4: > row 5: > row 6: > row 7: > row 8: > row 9: > > why don't I get 3 ? But some number close to zero ? I build PETSc to use > integers. > > > Thanks, > Damian > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090303/33a8c086/attachment.htm>
