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: !     petscsnes.h   - SNES interface
 14: !     petscts.h     - TS interface
 15: !     petscviewer.h - viewers
 16: !     petscdraw.h   - drawing
 17: !  In addition, we need the following for use of distributed arrays
 18: !     petscda.h     - distributed arrays (DAs)
 19: !  Other include statements may be needed if using additional PETSc
 20: !  routines in a Fortran program, e.g.,
 21: !     petscis.h     - index sets

 23:  #include include/finclude/petsc.h
 24:  #include include/finclude/petscvec.h
 25:  #include include/finclude/petscda.h
 26:  #include include/finclude/petscmat.h
 27:  #include include/finclude/petscksp.h
 28:  #include include/finclude/petscpc.h
 29:  #include include/finclude/petscsnes.h
 30:  #include include/finclude/petscts.h
 31:  #include include/finclude/petscviewer.h
 32:  #include 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:       DA               da
 56:       Vec              localwork,solution,u_local
 57:       integer          M,rank,size,debug
 58:       double precision h,zero_d0,one_d0,two_d0,four_d0
 59:       MPI_Comm         comm

 61:       common /params/ h,zero_d0,one_d0,two_d0,four_d0
 62:       common /appctx/ M,debug,da,localwork,solution
 63:       common /appctx/ u_local,comm,rank,size

 65: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -