Actual source code: ex7f.F
1: !
2: ! "$Id: ex7f.F,v 1.22 2001/08/22 18:00:07 balay Exp $";
3: !
4: subroutine ex7f(vec,comm)
6: #include include/finclude/petsc.h
7: #include include/finclude/petscvec.h
8: !
9: ! This routine demonstates how a computational module may be written
10: ! in Fortran and called from a C routine, passing down PETSc objects.
11: !
13: PetscScalar two
14: Vec vec
15: MPI_Comm comm
16: integer ierr,rank
18: two = 2.0
20: !
21: ! The Objects vec,comm created in a C routine are now
22: ! used in fortran routines.
23: !
24: call VecSet(two,vec,ierr)
25: call MPI_Comm_rank(comm,rank,ierr)
27: !
28: ! Now call C routine from Fortran, passing in the vector, communicator
29: !
30: call ex7c(vec,comm,ierr)
31: !
32: ! IO from the fortran routines may cause all kinds of
33: ! grief while linking. *_SYS_LIB in PETSC_ARCH/variables is supporsed
34: ! to take care of it.
35: !
36: 100 format ('[',i1,']',' Calling VecView from Fortran')
37: write(6,100) rank
38: !
39: ! Now Call a Petsc Routine from Fortran
40: !
41: call VecView(vec,PETSC_VIEWER_STDOUT_WORLD,ierr)
42: return
43: end
45: