Actual source code: petscsys.h
petsc-3.10.5 2019-03-28
Report Typos and Errors

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

      9: !
     10: !    The following block allows one to write constants that match the
     11: !    precision of PetscReal as, for example,  x = .7_PETSC_REAL_KIND
     12: !
     13:        PetscReal,Parameter ::                                                 &
     14:      &                        PetscReal_Private = 1.0
     15:        Integer,Parameter   :: PETSC_REAL_KIND                                 &
     16:      &  = Selected_Real_Kind(Precision(PetscReal_Private))

     19: #if !defined(PETSC_AVOID_MPIF_H)
     20: #if defined(PETSC_HAVE_MPIUNI)
     21: #include "petsc/mpiuni/mpif.h"
     22: #else
     23: #include "mpif.h"
     24: #endif
     25: #endif

     27:       type tPetscOptions
     28:         PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
     29:       end type tPetscOptions

     31:       PetscOptions, parameter :: PETSC_NULL_OPTIONS =                        &
     32:      &                           tPetscOptions(0)

     34: ! ------------------------------------------------------------------------
     35: !     Non Common block Stuff declared first
     36: !
     37: !     Flags
     38: !
     39:       PetscBool  PETSC_TRUE
     40:       PetscBool  PETSC_FALSE
     41: #if defined(PETSC_FORTRAN_PETSCTRUTH_INT)
     42:       parameter (PETSC_TRUE = 1,PETSC_FALSE = 0)
     43: #else
     44:       parameter (PETSC_TRUE = .true.,PETSC_FALSE = .false.)
     45: #endif
     46:       PetscInt   PETSC_DECIDE,PETSC_DETERMINE
     47:       parameter (PETSC_DECIDE=-1,PETSC_DETERMINE=-1)

     49:       PetscInt  PETSC_DEFAULT_INTEGER
     50:       parameter (PETSC_DEFAULT_INTEGER = -2)

     52:       PetscReal PETSC_DEFAULT_REAL
     53:       parameter (PETSC_DEFAULT_REAL=-2.0d0)

     55:       PetscEnum PETSC_FP_TRAP_OFF
     56:       PetscEnum PETSC_FP_TRAP_ON
     57:       parameter (PETSC_FP_TRAP_OFF = 0,PETSC_FP_TRAP_ON = 1)

     59:       PetscFortranAddr PETSC_STDOUT

     61:       parameter (PETSC_STDOUT  = 0)
     62: !
     63: !     PETSc DataTypes
     64: !
     65:       PetscEnum PETSC_INT
     66:       PetscEnum PETSC_DOUBLE
     67:       PetscEnum PETSC_COMPLEX
     68:       PetscEnum PETSC_LONG
     69:       PetscEnum PETSC_SHORT
     70:       PetscEnum PETSC_FLOAT
     71:       PetscEnum PETSC_CHAR
     72:       PetscEnum PETSC_BIT_LOGICAL
     73:       PetscEnum PETSC_ENUM
     74:       PetscEnum PETSC_BOOL
     75:       PetscEnum PETSC___FLOAT128
     76:       PetscEnum PETSC_OBJECT
     77:       PetscEnum PETSC_FUNCTION
     78:       PetscEnum PETSC_STRING
     79:       PetscEnum PETSC_STRUCT
     80:       PetscEnum PETSC_DATATYPE_UNKNOWN

     82: #if defined(PETSC_USE_REAL_SINGLE)
     83: #define PETSC_REAL PETSC_FLOAT
     84: #elif defined(PETSC_USE_REAL___FLOAT128)
     85: #define PETSC_REAL PETSC___FLOAT128
     86: #else
     87: #define PETSC_REAL PETSC_DOUBLE
     88: #endif
     89: #define PETSC_FORTRANADDR PETSC_LONG

     91:       parameter (PETSC_INT=0,PETSC_DOUBLE=1,PETSC_COMPLEX=2)
     92:       parameter (PETSC_LONG=3,PETSC_SHORT=4,PETSC_FLOAT=5)
     93:       parameter (PETSC_CHAR=6,PETSC_BIT_LOGICAL=7,PETSC_ENUM=8)
     94:       parameter (PETSC_BOOL=9,PETSC___FLOAT128=10)
     95:       parameter (PETSC_OBJECT=11,PETSC_FUNCTION=12)
     96:       parameter (PETSC_STRING=12,PETSC_STRUCT=13)
     97:       parameter (PETSC_DATATYPE_UNKNOWN=14)
     98: !
     99: !
    100: !
    101:       PetscEnum PETSC_COPY_VALUES
    102:       PetscEnum PETSC_OWN_POINTER
    103:       PetscEnum PETSC_USE_POINTER

    105:       parameter (PETSC_COPY_VALUES = 0)
    106:       parameter (PETSC_OWN_POINTER = 1)
    107:       parameter (PETSC_USE_POINTER = 2)
    108: !
    109: ! ------------------------------------------------------------------------
    110: !     PETSc mathematics include file. Defines certain basic mathematical
    111: !    constants and functions for working with single and double precision
    112: !    floating point numbers as well as complex and integers.
    113: !
    114: !     Representation of complex i
    115: !
    116:       PetscFortranComplex PETSC_i
    117: #if defined(PETSC_USE_REAL_SINGLE)
    118:       parameter (PETSC_i = (0.0e0,1.0e0))
    119: #else
    120:       parameter (PETSC_i = (0.0d0,1.0d0))
    121: #endif

    123: !
    124: ! ----------------------------------------------------------------------------
    125: !    BEGIN PETSc aliases for MPI_ constants
    126: !
    127: !   These values for __float128 are handled in the common block (below)
    128: !     and transmitted from the C code
    129: !
    130: #if !defined(PETSC_USE_REAL___FLOAT128)
    131:       integer MPIU_REAL
    132: #if defined (PETSC_USE_REAL_SINGLE)
    133:       parameter (MPIU_REAL = MPI_REAL)
    134: #else
    135:       parameter(MPIU_REAL = MPI_DOUBLE_PRECISION)
    136: #endif

    138:       integer MPIU_SUM
    139:       parameter (MPIU_SUM = MPI_SUM)

    141:       integer MPIU_SCALAR
    142: #if defined(PETSC_USE_COMPLEX)
    143: #if defined (PETSC_USE_REAL_SINGLE)
    144:       parameter(MPIU_SCALAR = MPI_COMPLEX)
    145: #else
    146:       parameter(MPIU_SCALAR = MPI_DOUBLE_COMPLEX)
    147: #endif
    148: #else
    149: #if defined (PETSC_USE_REAL_SINGLE)
    150:       parameter (MPIU_SCALAR = MPI_REAL)
    151: #else
    152:       parameter(MPIU_SCALAR = MPI_DOUBLE_PRECISION)
    153: #endif
    154: #endif
    155: #endif

    157:       integer MPIU_INTEGER
    158: #if defined(PETSC_USE_64BIT_INDICES)
    159:       parameter(MPIU_INTEGER = MPI_INTEGER8)
    160: #else
    161:       parameter(MPIU_INTEGER = MPI_INTEGER)
    162: #endif

    164: !      A PETSC_NULL_FUNCTION pointer
    165: !
    166:       external PETSC_NULL_FUNCTION
    167: !
    168: !     Possible arguments to PetscPushErrorHandler()
    169: !
    170:       external PETSCTRACEBACKERRORHANDLER
    171:       external PETSCABORTERRORHANDLER
    172:       external PETSCEMACSCLIENTERRORHANDLER
    173:       external PETSCATTACHDEBUGGERERRORHANDLER
    174:       external PETSCIGNOREERRORHANDLER
    175: !
    176:       external  PetscIsInfOrNanScalar
    177:       external  PetscIsInfOrNanReal
    178:       PetscBool PetscIsInfOrNanScalar
    179:       PetscBool PetscIsInfOrNanReal

    182: ! ----------------------------------------------------------------------------
    183: !
    184: !     Random numbers
    185: !
    186:       type tPetscRandom
    187:         sequence
    188:         PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
    189:       end type tPetscRandom

    191:       PetscRandom, parameter :: PETSC_NULL_RANDOM                                  &
    192:      &             = tPetscRandom(0)
    193: !
    194: #define PETSCRAND 'rand'
    195: #define PETSCRAND48 'rand48'
    196: #define PETSCSPRNG 'sprng'
    197: #define PETSCRANDER48 'rander48'
    198: !
    199: !
    200: !
    201:       PetscEnum PETSC_BINARY_INT_SIZE
    202:       PetscEnum PETSC_BINARY_FLOAT_SIZE
    203:       PetscEnum PETSC_BINARY_CHAR_SIZE
    204:       PetscEnum PETSC_BINARY_SHORT_SIZE
    205:       PetscEnum PETSC_BINARY_DOUBLE_SIZE
    206:       PetscEnum PETSC_BINARY_SCALAR_SIZE

    208:       parameter (PETSC_BINARY_INT_SIZE = 4)
    209:       parameter (PETSC_BINARY_FLOAT_SIZE = 4)
    210:       parameter (PETSC_BINARY_CHAR_SIZE = 1)
    211:       parameter (PETSC_BINARY_SHORT_SIZE = 2)
    212:       parameter (PETSC_BINARY_DOUBLE_SIZE = 8)
    213: #if defined(PETSC_USE_COMPLEX)
    214:       parameter (PETSC_BINARY_SCALAR_SIZE = 16)
    215: #else
    216:       parameter (PETSC_BINARY_SCALAR_SIZE = 8)
    217: #endif

    219:       PetscEnum PETSC_BINARY_SEEK_SET
    220:       PetscEnum PETSC_BINARY_SEEK_CUR
    221:       PetscEnum PETSC_BINARY_SEEK_END

    223:       parameter (PETSC_BINARY_SEEK_SET = 0,PETSC_BINARY_SEEK_CUR = 1)
    224:       parameter (PETSC_BINARY_SEEK_END = 2)

    226:       PetscEnum PETSC_BUILDTWOSIDED_ALLREDUCE
    227:       PetscEnum PETSC_BUILDTWOSIDED_IBARRIER
    228:       PetscEnum PETSC_BUILDTWOSIDED_REDSCATTER
    229:       parameter (PETSC_BUILDTWOSIDED_ALLREDUCE = 0)
    230:       parameter (PETSC_BUILDTWOSIDED_IBARRIER = 1)
    231:       parameter (PETSC_BUILDTWOSIDED_REDSCATTER = 2)
    232: !
    233: !     PetscSubcommType
    234: !
    235:       PetscEnum PETSC_SUBCOMM_GENERAL
    236:       PetscEnum PETSC_SUBCOMM_CONTIGUOUS
    237:       PetscEnum PETSC_SUBCOMM_INTERLACED
    238:       parameter(PETSC_SUBCOMM_GENERAL=0)
    239:       parameter(PETSC_SUBCOMM_CONTIGUOUS=1)
    240:       parameter(PETSC_SUBCOMM_INTERLACED=2)

    242: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
    243: !DEC$ ATTRIBUTES DLLEXPORT::PetscReal_Private
    244: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_REAL_KIND
    245: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_OPTIONS
    246: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_TRUE
    247: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FALSE
    248: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE
    249: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE
    250: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_INTEGER
    251: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_REAL
    252: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FP_TRAP_OFF
    253: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FP_TRAP_ON
    254: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STDOUT
    255: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_INT
    256: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DOUBLE
    257: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_COMPLEX
    258: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_LONG
    259: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SHORT
    260: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FLOAT
    261: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_CHAR
    262: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BIT_LOGICAL
    263: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_ENUM
    264: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BOOL
    265: !DEC$ ATTRIBUTES DLLEXPORT::PETSC___FLOAT128
    266: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_OBJECT
    267: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FUNCTION
    268: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STRING
    269: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STRUC
    270: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DATATYPE_UNKNOWN
    271: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_COPY_VALUES
    272: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_OWN_POINTER
    273: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_USE_POINTER
    274: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_i
    275: !DEC$ ATTRIBUTES DLLEXPORT::MPIU_REAL
    276: !DEC$ ATTRIBUTES DLLEXPORT::MPIU_SUM
    277: !DEC$ ATTRIBUTES DLLEXPORT::MPIU_SCALAR
    278: !DEC$ ATTRIBUTES DLLEXPORT::MPIU_INTEGER
    279: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_RANDOM
    280: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_INT_SIZE
    281: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_FLOAT_SIZE
    282: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_CHAR_SIZE
    283: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SHORT_SIZE
    284: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_DOUBLE_SIZE
    285: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SCALAR_SIZE
    286: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_SET
    287: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_CUR
    288: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_END
    289: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_ALLREDUCE
    290: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_IBARRIER
    291: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_REDSCATTER
    292: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_GENERAL
    293: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_CONTIGUOUS
    294: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_INTERLACED
    295: #endif
    296: !
    297: ! include other sys components
    298: !
    299: #include "../src/sys/f90-mod/petscerror.h"
    300: #include "../src/sys/f90-mod/petsclog.h"
    301: #include "../src/sys/f90-mod/petscbag.h"