Actual source code: petsc.h

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

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

     12:  #include finclude/petscdef.h

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

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

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

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

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

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

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

     79: #if defined(PETSC_USE_SINGLE)
     80: #define PETSC_REAL PETSC_FLOAT
     81: #elif defined(PETSC_USE_LONG_DOUBLE)
     82: #define PETSC_REAL PETSC_LONG_DOUBLE
     83: #elif defined(PETSC_USE_INT)
     84: #define PETSC_REAL PETSC_INT
     85: #else
     86: #define PETSC_REAL PETSC_DOUBLE
     87: #endif
     88: #define PETSC_FORTRANADDR PETSC_LONG

     90:       parameter (PETSC_INT=0,PETSC_DOUBLE=1,PETSC_COMPLEX=2)
     91:       parameter (PETSC_LONG=3,PETSC_SHORT=4,PETSC_FLOAT=5)
     92:       parameter (PETSC_CHAR=6,PETSC_LOGICAL=7,PETSC_ENUM=8)
     93:       parameter (PETSC_TRUTH=9,PETSC_LONG_DOUBLE=10)
     94: !
     95: ! ------------------------------------------------------------------------
     96: !     PETSc mathematics include file. Defines certain basic mathematical
     97: !    constants and functions for working with single and double precision
     98: !    floating point numbers as well as complex and integers.
     99: !
    100: !     Representation of complex i
    101: !
    102:       PetscFortranComplex PETSC_i
    103:       parameter (PETSC_i = (0.0d0,1.0d0))
    104: !
    105: !     Basic constants
    106: !
    107:       PetscFortranDouble PETSC_PI
    108:       PetscFortranDouble PETSC_DEGREES_TO_RADIANS
    109:       PetscFortranDouble PETSC_MAX
    110:       PetscFortranDouble PETSC_MIN

    112:       parameter (PETSC_PI = 3.14159265358979323846264d0)
    113:       parameter (PETSC_DEGREES_TO_RADIANS = 0.01745329251994d0)
    114:       parameter (PETSC_MAX = 1.d300,PETSC_MIN = -1.d300)

    116:       PetscFortranDouble PETSC_MACHINE_EPSILON
    117:       PetscFortranDouble PETSC_SQRT_MACHINE_EPSILON
    118:       PetscFortranDouble PETSC_SMALL

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

    175:
    176: !    END COMMON-BLOCK VARIABLES
    177: ! ----------------------------------------------------------------------------

    179: #endif