Actual source code: ex5f.h

  1: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !             Include file for program ex5f.F
  3: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4: !
  5: !  This program uses CPP for preprocessing, as indicated by the use of
  6: !  PETSc include files in the directory petsc/include/finclude.  This
  7: !  convention enables use of the CPP preprocessor, which allows the use
  8: !  of the #include statements that define PETSc objects and variables.
  9: !
 10: !  Use of the conventional Fortran include statements is also supported
 11: !  In this case, the PETsc include files are located in the directory
 12: !  petsc/include/foldinclude.
 13: !
 14: !  Since one must be very careful to include each file no more than once
 15: !  in a Fortran routine, application programmers must explicitly list
 16: !  each file needed for the various PETSc components within their
 17: !  program (unlike the C/C++ interface).
 18: !
 19: !  See the Fortran section of the PETSc users manual for details.
 20: !
 21: !  The following include statements are generally used in SNES Fortran
 22: !  programs:
 23: !     petscsys.h  - base PETSc routines
 24: !     petscvec.h    - vectors
 25: !     petscmat.h    - matrices
 26: !     petscksp.h    - Krylov subspace methods
 27: !     petscpc.h     - preconditioners
 28: !     petscsnes.h   - SNES interface
 29: !  In addition, we need the following for use of distributed arrays
 30: !     petscda.h     - distributed arrays (DAs)

 32:  #include finclude/petscsys.h
 33:  #include finclude/petscvec.h
 34:  #include finclude/petscda.h
 35:  #include finclude/petscis.h
 36:  #include finclude/petscmat.h
 37:  #include finclude/petscksp.h
 38:  #include finclude/petscpc.h
 39:  #include finclude/petscsnes.h

 41: !  Common blocks:
 42: !  In this example we use common blocks to store data needed by the
 43: !  application-provided call-back routines, FormJacobian() and
 44: !  FormFunction().  Note that we can store (pointers to)
 45: !  PETSc objects within these common blocks.
 46: !
 47: !  common /params/ - contains parameters for the global application
 48: !     mx, my   - global discretization in x- and y-directions
 49: !     lambda   - nonlinearity parameter
 50: !
 51: !  common /pdata/  - contains some parallel data
 52: !     da       - distributed array
 53: !     rank     - processor rank within communicator
 54: !     size     - number of processors
 55: !     xs, ys   - local starting grid indices (no ghost points)
 56: !     xm, ym   - widths of local grid (no ghost points)
 57: !     gxs, gys - local starting grid indices (including ghost points)
 58: !     gxm, gym - widths of local grid (including ghost points)

 60:       DA      da
 61:       PetscInt xs,xe,xm,gxs,gxe,gxm
 62:       PetscInt ys,ye,ym,gys,gye,gym
 63:       PetscInt mx,my
 64:       PetscMPIInt rank,size
 65:       double precision lambda

 67:       common /params/ lambda,mx,my
 68:       common /pdata/  xs,xe,xm,gxs,gxe,gxm
 69:       common /pdata/  ys,ye,ym,gys,gye,gym
 70:       common /pdata/  da,rank,size

 72: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -