Actual source code: petsc.h

      1: !
      2: !
      3: !  Base include file for Fortran use of the PETSc package.
      4: !
      5: #include "petscconf.h"

      7: #if !defined(PETSC_AVOID_MPIF_H) && !defined(PETSC_AVOID_DECLARATIONS)
      8: #include "mpif.h"
      9: #endif

     11:  #include finclude/petscdef.h

     13: #if !defined (PETSC_AVOID_DECLARATIONS)
     14: ! ------------------------------------------------------------------------
     15: !     Non Common block Stuff declared first
     16: !
     17: !     Flags
     18: !
     19:       PetscEnum   PETSC_TRUE,PETSC_FALSE
     20:       PetscEnum   PETSC_YES,PETSC_NO
     21:       parameter (PETSC_TRUE = 1,PETSC_FALSE = 0)
     22:       parameter (PETSC_YES=1, PETSC_NO=0)

     24:       PetscInt   PETSC_DECIDE,PETSC_DETERMINE
     25:       parameter (PETSC_DECIDE=-1,PETSC_DETERMINE=-1)

     27:       PetscInt  PETSC_DEFAULT_INTEGER
     28:       parameter (PETSC_DEFAULT_INTEGER = -2)

     30:       PetscFortranDouble PETSC_DEFAULT_DOUBLE_PRECISION
     31:       parameter (PETSC_DEFAULT_DOUBLE_PRECISION=-2.0d0)

     33:       PetscEnum   PETSC_FP_TRAP_OFF,PETSC_FP_TRAP_ON
     34:       parameter (PETSC_FP_TRAP_OFF = 0,PETSC_FP_TRAP_ON = 1)

     38: !
     39: !     Default PetscViewers.
     40: !
     41:       PetscFortranAddr PETSC_VIEWER_DRAW_WORLD
     42:       PetscFortranAddr PETSC_VIEWER_DRAW_SELF
     43:       PetscFortranAddr PETSC_VIEWER_SOCKET_WORLD
     44:       PetscFortranAddr PETSC_VIEWER_SOCKET_SELF
     45:       PetscFortranAddr PETSC_VIEWER_STDOUT_WORLD
     46:       PetscFortranAddr PETSC_VIEWER_STDOUT_SELF
     47:       PetscFortranAddr PETSC_VIEWER_STDERR_WORLD
     48:       PetscFortranAddr PETSC_VIEWER_STDERR_SELF
     49:       PetscFortranAddr PETSC_VIEWER_BINARY_WORLD
     50:       PetscFortranAddr PETSC_VIEWER_BINARY_SELF
     51:       PetscFortranAddr PETSC_VIEWER_MATLAB_WORLD
     52:       PetscFortranAddr PETSC_VIEWER_MATLAB_SELF

     54: !
     55: !     The numbers used below should match those in
     56: !     src/fortran/custom/zpetsc.h
     57: !
     58:       parameter (PETSC_VIEWER_DRAW_WORLD   = -4)
     59:       parameter (PETSC_VIEWER_DRAW_SELF    = -5)
     60:       parameter (PETSC_VIEWER_SOCKET_WORLD = -6)
     61:       parameter (PETSC_VIEWER_SOCKET_SELF  = -7)
     62:       parameter (PETSC_VIEWER_STDOUT_WORLD = -8)
     63:       parameter (PETSC_VIEWER_STDOUT_SELF  = -9)
     64:       parameter (PETSC_VIEWER_STDERR_WORLD = -10)
     65:       parameter (PETSC_VIEWER_STDERR_SELF  = -11)
     66:       parameter (PETSC_VIEWER_BINARY_WORLD = -12)
     67:       parameter (PETSC_VIEWER_BINARY_SELF  = -13)
     68:       parameter (PETSC_VIEWER_MATLAB_WORLD = -14)
     69:       parameter (PETSC_VIEWER_MATLAB_SELF  = -15)
     70: !
     71: !     PETSc DataTypes
     72: !
     73:       PetscEnum PETSC_INT,PETSC_DOUBLE,PETSC_COMPLEX
     74:       PetscEnum PETSC_LONG,PETSC_SHORT,PETSC_FLOAT
     75:       PetscEnum PETSC_CHAR,PETSC_LOGICAL

     77:       parameter (PETSC_INT=0,PETSC_DOUBLE=1,PETSC_COMPLEX=2)
     78:       parameter (PETSC_LONG=3,PETSC_SHORT=4,PETSC_FLOAT=5)
     79:       parameter (PETSC_CHAR=6,PETSC_LOGICAL=7)
     80: !
     81: ! ------------------------------------------------------------------------
     82: !     PETSc mathematics include file. Defines certain basic mathematical
     83: !    constants and functions for working with single and double precision
     84: !    floating point numbers as well as complex and integers.
     85: !
     86: !     Representation of complex i
     87: !
     88:       PetscFortranComplex PETSC_i
     89:       parameter (PETSC_i = (0.0d0,1.0d0))
     90: !
     91: !     Basic constants
     92: !
     93:       PetscFortranDouble PETSC_PI,PETSC_DEGREES_TO_RADIANS
     94:       PetscFortranDouble PETSC_MAX,PETSC_MIN

     96:       parameter (PETSC_PI = 3.14159265358979323846264d0)
     97:       parameter (PETSC_DEGREES_TO_RADIANS = 0.01745329251994d0)
     98:       parameter (PETSC_MAX = 1.d300,PETSC_MIN = -1.d300)

    100:       PetscFortranDouble PETSC_MACHINE_EPSILON
    101:       PetscFortranDouble PETSC_SQRT_MACHINE_EPSILON
    102:       PetscFortranDouble PETSC_SMALL

    104: #if defined(PETSC_USE_SINGLE)
    105:       parameter (PETSC_MACHINE_EPSILON = 1.e-7)
    106:       parameter (PETSC_SQRT_MACHINE_EPSILON = 3.e-4)
    107:       parameter (PETSC_SMALL = 1.e-5)
    108: #else
    109:       parameter (PETSC_MACHINE_EPSILON = 1.d-14)
    110:       parameter (PETSC_SQRT_MACHINE_EPSILON = 1.d-7)
    111:       parameter (PETSC_SMALL = 1.d-10)
    112: #endif
    113: !
    114: ! ----------------------------------------------------------------------------
    115: !    BEGIN COMMON-BLOCK VARIABLES
    116: !
    117: !
    118: !     PETSc world communicator
    119: !
    120:       MPI_Comm PETSC_COMM_WORLD,PETSC_COMM_SELF
    121: !
    122: !     Fortran Null
    123: !
    124:       PetscChar(80)       PETSC_NULL_CHARACTER
    125:       PetscInt            PETSC_NULL_INTEGER
    126:       PetscFortranDouble  PETSC_NULL_DOUBLE
    127:       PetscInt            PETSC_NULL
    128:       PetscObject         PETSC_NULL_OBJECT
    129: !
    130: !      A PETSC_NULL_FUNCTION pointer
    131: !
    132:       external PETSC_NULL_FUNCTION
    133:       PetscScalar   PETSC_NULL_SCALAR
    134:       PetscReal     PETSC_NULL_REAL
    135: !
    136: !     Common Block to store some of the PETSc constants.
    137: !     which can be set - only at runtime.
    138: !
    139: !
    140: !     A string should be in a different common block
    141: !
    142:       common /petscfortran1/ PETSC_NULL_CHARACTER
    143:       common /petscfortran2/ PETSC_NULL_INTEGER
    144:       common /petscfortran3/ PETSC_NULL
    145:       common /petscfortran4/ PETSC_NULL_SCALAR
    146:       common /petscfortran5/ PETSC_NULL_DOUBLE
    147:       common /petscfortran6/ PETSC_NULL_REAL
    148:       common /petscfortran7/ PETSC_COMM_WORLD,PETSC_COMM_SELF
    149:       common /petscfortran8/ PETSC_NULL_OBJECT
    150: !
    151: !     Possible arguments to PetscPushErrorHandler()
    152: !
    153:       external PETSCTRACEBACKERRORHANDLER
    154:       external PETSCABORTERRORHANDLER
    155:       external PETSCEMACSCLIENTERRORHANDLER
    156:       external PETSCATTACHDEBUGGERERRORHANDLER
    157:       external PETSCIGNOREERRORHANDLER

    159:
    160: !    END COMMON-BLOCK VARIABLES
    161: ! ----------------------------------------------------------------------------

    163: #endif