Actual source code: petscsys.h

      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 :: PetscReal_Private = 1.0
     14:       Integer,Parameter   :: PETSC_REAL_KIND = Selected_Real_Kind(Precision(PetscReal_Private))

     16:       type :: tPetscObject
     17:         PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
     18:       end type tPetscObject
     19:       PetscObject, parameter :: PETSC_NULL_OBJECT = tPetscObject(0)
     20: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     21: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_OBJECT
     22: #endif

     24:       type, extends(tPetscObject) :: tPetscOptions
     25:       end type tPetscOptions
     26:       PetscOptions, parameter :: PETSC_NULL_OPTIONS = tPetscOptions(0)
     27: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     28: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_OPTIONS
     29: #endif

     31:       type, extends(tPetscObject) :: tPetscBench
     32:       end type tPetscBench
     33:       PetscBench, parameter :: PETSC_NULL_BENCH = tPetscBench(0)
     34: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     35: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_BENCH
     36: #endif

     38:       type :: tPetscDevice
     39:         PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
     40:       end type tPetscDevice
     41:       PetscDevice, parameter :: PETSC_NULL_DEVICE = tPetscDevice(0)
     42: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     43: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_DEVICE
     44: #endif

     46:       type, extends(tPetscObject) :: tPetscDeviceContext
     47:       end type tPetscDeviceContext
     48:       PetscDeviceContext, parameter :: PETSC_NULL_DEVICE_CONTEXT = tPetscDeviceContext(0)
     49: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     50: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL__DEVICE_CONTEXT
     51: #endif

     53:       type, extends(tPetscObject) :: tPetscMatlabEngine
     54:       end type tPetscMatlabEngine
     55:       PetscMatlabEngine, parameter :: PETSC_NULL_MATLAB_ENGINE = tPetscMatlabEngine(0)
     56: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     57: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_MATLAB_ENGINE
     58: #endif
     59: ! ------------------------------------------------------------------------
     60: !     Non Common block Stuff declared first
     61: !
     62: !     Flags
     63: !
     64:       PetscBool, parameter :: PETSC_TRUE = .true.
     65:       PetscBool, parameter :: PETSC_FALSE = .false.

     67:       PetscBool3, parameter :: PETSC_BOOL3_TRUE = 1
     68:       PetscBool3, parameter :: PETSC_BOOL3_FALSE = 0
     69:       PetscBool3, parameter :: PETSC_BOOL3_UNKNOWN = -1

     71:       PetscInt, parameter :: PETSC_DECIDE = -1
     72:       PetscInt, parameter :: PETSC_DECIDE_INTEGER = -1
     73:       PetscReal, parameter :: PETSC_DECIDE_REAL = -1.0d0
     74: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     75: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE
     76: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE_INTEGER
     77: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE_REAL
     78: #endif

     80:       PetscInt, parameter :: PETSC_DETERMINE = -1
     81:       PetscInt, parameter :: PETSC_DETERMINE_INTEGER = -1
     82:       PetscReal, parameter :: PETSC_DETERMINE_REAL = -1.0d0
     83: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     84: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE
     85: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE_INTEGER
     86: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE_REAL
     87: #endif

     89:       PetscInt, parameter :: PETSC_CURRENT = -2
     90:       PetscInt, parameter :: PETSC_CURRENT_INTEGER = -2
     91:       PetscReal, parameter :: PETSC_CURRENT_REAL = -2.0d0
     92: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
     93: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT
     94: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT_INTEGER
     95: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT_REAL
     96: #endif

     98:       PetscInt, parameter :: PETSC_DEFAULT = -2
     99:       PetscInt, parameter :: PETSC_DEFAULT_INTEGER = -2
    100:       PetscReal, parameter :: PETSC_DEFAULT_REAL = -2.0d0
    101: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
    102: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT
    103: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_INTEGER
    104: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_REAL
    105: #endif

    107:       PetscEnum, parameter :: PETSC_FP_TRAP_OFF = 0
    108:       PetscEnum, parameter :: PETSC_FP_TRAP_ON = 55
    109:       PetscEnum, parameter :: PETSC_FP_TRAP_INDIV = 1
    110:       PetscEnum, parameter :: PETSC_FP_TRAP_FLTOPERR = 2
    111:       PetscEnum, parameter :: PETSC_FP_TRAP_FLTOVF = 4
    112:       PetscEnum, parameter :: PETSC_FP_TRAP_FLTUND = 8
    113:       PetscEnum, parameter :: PETSC_FP_TRAP_FLTDIV = 16
    114:       PetscEnum, parameter :: PETSC_FP_TRAP_FLTINEX =32

    116:       PetscFortranAddr, parameter :: PETSC_STDOUT = 0
    117: !
    118: !     PETSc DataTypes
    119: !
    120: #if defined(PETSC_USE_REAL_SINGLE)
    121: #define PETSC_REAL PETSC_FLOAT
    122: #elif defined(PETSC_USE_REAL___FLOAT128)
    123: #define PETSC_REAL PETSC___FLOAT128
    124: #else
    125: #define PETSC_REAL PETSC_DOUBLE
    126: #endif
    127: #define PETSC_FORTRANADDR PETSC_LONG

    129:       PetscEnum, parameter :: PETSC_DATATYPE_UNKNOWN = 0
    130:       PetscEnum, parameter :: PETSC_DOUBLE = 1
    131:       PetscEnum, parameter :: PETSC_COMPLEX = 2
    132:       PetscEnum, parameter :: PETSC_LONG = 3
    133:       PetscEnum, parameter :: PETSC_SHORT = 4
    134:       PetscEnum, parameter :: PETSC_FLOAT = 5
    135:       PetscEnum, parameter :: PETSC_CHAR = 6
    136:       PetscEnum, parameter :: PETSC_BIT_LOGICAL = 7
    137:       PetscEnum, parameter :: PETSC_ENUM = 8
    138:       PetscEnum, parameter :: PETSC_BOOL = 9
    139:       PetscEnum, parameter :: PETSC___FLOAT128 = 10
    140:       PetscEnum, parameter :: PETSC_OBJECT = 11
    141:       PetscEnum, parameter :: PETSC_FUNCTION = 12
    142:       PetscEnum, parameter :: PETSC_STRING = 13
    143:       PetscEnum, parameter :: PETSC___FP16 = 14
    144:       PetscEnum, parameter :: PETSC_STRUCT = 15
    145:       PetscEnum, parameter :: PETSC_INT = 16
    146: !
    147: !
    148: !
    149:       PetscEnum, parameter :: PETSC_COPY_VALUES = 0
    150:       PetscEnum, parameter :: PETSC_OWN_POINTER = 1
    151:       PetscEnum, parameter :: PETSC_USE_POINTER = 2
    152: !
    153: ! ------------------------------------------------------------------------
    154: !     PETSc mathematics include file. Defines certain basic mathematical
    155: !    constants and functions for working with single and double precision
    156: !    floating point numbers as well as complex and integers.
    157: !
    158: !     Representation of complex i
    159: !
    160: #if defined(PETSC_USE_REAL_SINGLE)
    161:       PetscFortranComplex, parameter :: PETSC_i = (0.0e0,1.0e0)
    162: #else
    163:       PetscFortranComplex, parameter :: PETSC_i = (0.0d0,1.0d0)
    164: #endif

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

    183: ! ----------------------------------------------------------------------------
    184: !
    185: !     Random numbers
    186: !
    187:       type, extends(tPetscObject) :: tPetscRandom
    188:       end type tPetscRandom
    189:       PetscRandom, parameter :: PETSC_NULL_RANDOM = tPetscRandom(0)
    190: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
    191: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_RANDOM
    192: #endif
    193: !
    194: #define PETSCRAND 'rand'
    195: #define PETSCRAND48 'rand48'
    196: #define PETSCSPRNG 'sprng'
    197: #define PETSCRANDER48 'rander48'
    198: !
    199: !
    200: !
    201:       PetscEnum, parameter :: PETSC_BINARY_INT_SIZE = 4
    202:       PetscEnum, parameter :: PETSC_BINARY_FLOAT_SIZE = 4
    203:       PetscEnum, parameter :: PETSC_BINARY_CHAR_SIZE = 1
    204:       PetscEnum, parameter :: PETSC_BINARY_SHORT_SIZE = 2
    205:       PetscEnum, parameter :: PETSC_BINARY_DOUBLE_SIZE = 8
    206: #if defined(PETSC_USE_COMPLEX)
    207:       PetscEnum, parameter :: PETSC_BINARY_SCALAR_SIZE = 16
    208: #else
    209:       PetscEnum, parameter :: PETSC_BINARY_SCALAR_SIZE = 8
    210: #endif

    212:       PetscEnum, parameter :: PETSC_BINARY_SEEK_SET = 0
    213:       PetscEnum, parameter :: PETSC_BINARY_SEEK_CUR = 1
    214:       PetscEnum, parameter :: PETSC_BINARY_SEEK_END = 2

    216:       PetscEnum, parameter :: PETSC_BUILDTWOSIDED_ALLREDUCE = 0
    217:       PetscEnum, parameter :: PETSC_BUILDTWOSIDED_IBARRIER = 1
    218:       PetscEnum, parameter :: PETSC_BUILDTWOSIDED_REDSCATTER = 2

    220:       type tPetscSubcomm
    221:         PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
    222:       end type tPetscSubcomm
    223:       PetscSubcomm, parameter :: PETSC_NULL_SUBCOMM = tPetscSubcomm(0)
    224: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
    225: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_SUBCOMM
    226: #endif
    227: !
    228: !     PetscSubcommType
    229: !
    230:       PetscEnum, parameter :: PETSC_SUBCOMM_GENERAL = 0
    231:       PetscEnum, parameter :: PETSC_SUBCOMM_CONTIGUOUS = 1
    232:       PetscEnum, parameter :: PETSC_SUBCOMM_INTERLACED = 2

    234: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
    235: !DEC$ ATTRIBUTES DLLEXPORT::PetscReal_Private
    236: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_REAL_KIND
    237: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_TRUE
    238: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FALSE
    239: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FP_TRAP_OFF
    240: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FP_TRAP_ON
    241: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STDOUT
    242: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_INT
    243: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DOUBLE
    244: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_COMPLEX
    245: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_LONG
    246: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SHORT
    247: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FLOAT
    248: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_CHAR
    249: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BIT_LOGICAL
    250: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_ENUM
    251: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BOOL
    252: !DEC$ ATTRIBUTES DLLEXPORT::PETSC___FLOAT128
    253: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_OBJECT
    254: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FUNCTION
    255: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STRING
    256: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STRUC
    257: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DATATYPE_UNKNOWN
    258: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_COPY_VALUES
    259: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_OWN_POINTER
    260: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_USE_POINTER
    261: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_i
    262: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_INT_SIZE
    263: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_FLOAT_SIZE
    264: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_CHAR_SIZE
    265: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SHORT_SIZE
    266: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_DOUBLE_SIZE
    267: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SCALAR_SIZE
    268: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_SET
    269: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_CUR
    270: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_END
    271: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_ALLREDUCE
    272: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_IBARRIER
    273: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_REDSCATTER
    274: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_GENERAL
    275: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_CONTIGUOUS
    276: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_INTERLACED
    277: #endif

    279: ! ----------------------------------------------------------------------------
    280: !
    281: !     PetscInfoCommFlag Enum
    282: !
    283: !
    284: !     PetscInfoCommFlag
    285: !
    286:       PetscEnum PETSC_INFO_COMM_ALL
    287:       PetscEnum PETSC_INFO_COMM_NO_SELF
    288:       PetscEnum PETSC_INFO_COMM_ONLY_SELF
    289:       parameter(PETSC_INFO_COMM_ALL=-1)
    290:       parameter(PETSC_INFO_COMM_NO_SELF=0)
    291:       parameter(PETSC_INFO_COMM_ONLY_SELF=1)