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