fortran basic code

Damian Kaleta damian.kaleta at mail.utexas.edu
Tue Mar 3 14:51:52 CST 2009


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


More information about the petsc-users mailing list