Actual source code: ex2f.h
1: ! "$Id: ex2f.h,v 1.9 2000/05/05 22:19:01 balay Exp $"
2: ! This file contains include statements and a user-defined
3: ! common block for application-specific data. This file is
4: ! included in each routine within the program ex2f.
5: !
6: ! The following include statements are generally used in TS Fortran
7: ! programs:
8: ! petsc.h - base PETSc routines
9: ! petscvec.h - vectors
10: ! petscmat.h - matrices
11: ! petscksp.h - Krylov subspace methods
12: ! petscpc.h - preconditioners
13: ! petscsles.h - SLES interface
14: ! petscsnes.h - SNES interface
15: ! petscts.h - TS interface
16: ! petscviewer.h - viewers
17: ! petscdraw.h - drawing
18: ! In addition, we need the following for use of distributed arrays
19: ! petscda.h - distributed arrays (DAs)
20: ! Other include statements may be needed if using additional PETSc
21: ! routines in a Fortran program, e.g.,
22: ! petscis.h - index sets
24: #include include/finclude/petsc.h
25: #include include/finclude/petscvec.h
26: #include include/finclude/petscda.h
27: #include include/finclude/petscmat.h
28: #include include/finclude/petscksp.h
29: #include include/finclude/petscpc.h
30: #include include/finclude/petscsles.h
31: #include include/finclude/petscsnes.h
32: #include include/finclude/petscts.h
33: #include include/finclude/petscviewer.h
34: #include include/finclude/petscdraw.h
36: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37: !
38: ! The application context to contain data needed by the
39: ! application-provided call-back routines, RHSFunction(),
40: ! RHSJacobian(), Monitor(). In this example the application context
41: ! is a Fortran common block, /appctx/. Note that we can store
42: ! (pointers to) PETSc objects within this common block.
43: ! appctx: M - total number of grid points
44: ! da - distributed array
45: ! localwork - local work vector (including ghost points)
46: ! solution - solution vector
47: ! comm - communicator
48: ! rank - processor rank within communicator
49: ! size - number of processors
50: ! debug - flag (1 indicates debugging printouts)
51: !
52: ! Store other misc problem parameters in common block /params/
53: ! h - mesh width h = 1/(M-1)
54: !
55: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
56: ! Common block data:
57: DA da
58: Vec localwork,solution,u_local
59: integer M,rank,size,debug
60: double precision h,zero_d0,one_d0,two_d0,four_d0
61: MPI_Comm comm
63: common /params/ h,zero_d0,one_d0,two_d0,four_d0
64: common /appctx/ M,debug,da,localwork,solution
65: common /appctx/ u_local,comm,rank,size
67: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -