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 tPetscOptions
     17:         PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
     18:       end type tPetscOptions

     20:       PetscOptions, parameter :: PETSC_NULL_OPTIONS = tPetscOptions(0)

     22: ! ------------------------------------------------------------------------
     23: !     Non Common block Stuff declared first
     24: !
     25: !     Flags
     26: !
     27:       PetscBool, parameter :: PETSC_TRUE = .true.
     28:       PetscBool, parameter :: PETSC_FALSE = .false.

     30:       PetscInt, parameter :: PETSC_DECIDE = -1
     31:       PetscInt, parameter :: PETSC_DETERMINE = -1
     32:       PetscInt, parameter :: PETSC_DEFAULT_INTEGER = -2

     34:       PetscReal, parameter :: PETSC_DEFAULT_REAL = -2.0d0

     36:       PetscEnum, parameter :: PETSC_FP_TRAP_OFF = 0
     37:       PetscEnum, parameter :: PETSC_FP_TRAP_ON = 1

     39:       PetscFortranAddr, parameter :: PETSC_STDOUT = 0
     40: !
     41: !     PETSc DataTypes
     42: !
     43: #if defined(PETSC_USE_REAL_SINGLE)
     44: #define PETSC_REAL PETSC_FLOAT
     45: #elif defined(PETSC_USE_REAL___FLOAT128)
     46: #define PETSC_REAL PETSC___FLOAT128
     47: #else
     48: #define PETSC_REAL PETSC_DOUBLE
     49: #endif
     50: #define PETSC_FORTRANADDR PETSC_LONG

     52:       PetscEnum, parameter :: PETSC_DATATYPE_UNKNOWN = 0
     53:       PetscEnum, parameter :: PETSC_DOUBLE = 1
     54:       PetscEnum, parameter :: PETSC_COMPLEX = 2
     55:       PetscEnum, parameter :: PETSC_LONG = 3
     56:       PetscEnum, parameter :: PETSC_SHORT = 4
     57:       PetscEnum, parameter :: PETSC_FLOAT = 5
     58:       PetscEnum, parameter :: PETSC_CHAR = 6
     59:       PetscEnum, parameter :: PETSC_BIT_LOGICAL = 7
     60:       PetscEnum, parameter :: PETSC_ENUM = 8
     61:       PetscEnum, parameter :: PETSC_BOOL = 9
     62:       PetscEnum, parameter :: PETSC___FLOAT128 = 10
     63:       PetscEnum, parameter :: PETSC_OBJECT = 11
     64:       PetscEnum, parameter :: PETSC_FUNCTION = 12
     65:       PetscEnum, parameter :: PETSC_STRING = 13
     66:       PetscEnum, parameter :: PETSC___FP16 = 14
     67:       PetscEnum, parameter :: PETSC_STRUCT = 15
     68:       PetscEnum, parameter :: PETSC_INT = 16
     69: !
     70: !
     71: !
     72:       PetscEnum, parameter :: PETSC_COPY_VALUES = 0
     73:       PetscEnum, parameter :: PETSC_OWN_POINTER = 1
     74:       PetscEnum, parameter :: PETSC_USE_POINTER = 2
     75: !
     76: ! ------------------------------------------------------------------------
     77: !     PETSc mathematics include file. Defines certain basic mathematical
     78: !    constants and functions for working with single and double precision
     79: !    floating point numbers as well as complex and integers.
     80: !
     81: !     Representation of complex i
     82: !
     83: #if defined(PETSC_USE_REAL_SINGLE)
     84:       PetscFortranComplex, parameter :: PETSC_i = (0.0e0,1.0e0)
     85: #else
     86:       PetscFortranComplex, parameter :: PETSC_i = (0.0d0,1.0d0)
     87: #endif

     89: !      A PETSC_NULL_FUNCTION pointer
     90: !
     91:       external PETSC_NULL_FUNCTION
     92: !
     93: !     Possible arguments to PetscPushErrorHandler()
     94: !
     95:       external PETSCTRACEBACKERRORHANDLER
     96:       external PETSCABORTERRORHANDLER
     97:       external PETSCEMACSCLIENTERRORHANDLER
     98:       external PETSCATTACHDEBUGGERERRORHANDLER
     99:       external PETSCIGNOREERRORHANDLER
    100: !
    101:       external  PetscIsInfOrNanScalar
    102:       external  PetscIsInfOrNanReal
    103:       PetscBool PetscIsInfOrNanScalar
    104:       PetscBool PetscIsInfOrNanReal

    106: ! ----------------------------------------------------------------------------
    107: !
    108: !     Random numbers
    109: !
    110:       type tPetscRandom
    111:         sequence
    112:         PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
    113:       end type tPetscRandom

    115:       PetscRandom, parameter :: PETSC_NULL_RANDOM = tPetscRandom(0)
    116: !
    117: #define PETSCRAND 'rand'
    118: #define PETSCRAND48 'rand48'
    119: #define PETSCSPRNG 'sprng'
    120: #define PETSCRANDER48 'rander48'
    121: !
    122: !
    123: !
    124:       PetscEnum, parameter :: PETSC_BINARY_INT_SIZE = 4
    125:       PetscEnum, parameter :: PETSC_BINARY_FLOAT_SIZE = 4
    126:       PetscEnum, parameter :: PETSC_BINARY_CHAR_SIZE = 1
    127:       PetscEnum, parameter :: PETSC_BINARY_SHORT_SIZE = 2
    128:       PetscEnum, parameter :: PETSC_BINARY_DOUBLE_SIZE = 8
    129: #if defined(PETSC_USE_COMPLEX)
    130:       PetscEnum, parameter :: PETSC_BINARY_SCALAR_SIZE = 16
    131: #else
    132:       PetscEnum, parameter :: PETSC_BINARY_SCALAR_SIZE = 8
    133: #endif

    135:       PetscEnum, parameter :: PETSC_BINARY_SEEK_SET = 0
    136:       PetscEnum, parameter :: PETSC_BINARY_SEEK_CUR = 1
    137:       PetscEnum, parameter :: PETSC_BINARY_SEEK_END = 2

    139:       PetscEnum, parameter :: PETSC_BUILDTWOSIDED_ALLREDUCE = 0
    140:       PetscEnum, parameter :: PETSC_BUILDTWOSIDED_IBARRIER = 1
    141:       PetscEnum, parameter :: PETSC_BUILDTWOSIDED_REDSCATTER = 2

    143:       type tPetscSubcomm
    144:         sequence
    145:         PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
    146:       end type tPetscSubcomm

    148:       PetscSubcomm, parameter :: PETSC_NULL_SUBCOMM = tPetscSubcomm(0)

    150: !
    151: !     PetscSubcommType
    152: !
    153:       PetscEnum, parameter :: PETSC_SUBCOMM_GENERAL = 0
    154:       PetscEnum, parameter :: PETSC_SUBCOMM_CONTIGUOUS = 1
    155:       PetscEnum, parameter :: PETSC_SUBCOMM_INTERLACED = 2

    157: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
    158: !DEC$ ATTRIBUTES DLLEXPORT::PetscReal_Private
    159: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_REAL_KIND
    160: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_OPTIONS
    161: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_TRUE
    162: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FALSE
    163: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE
    164: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE
    165: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_INTEGER
    166: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_REAL
    167: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FP_TRAP_OFF
    168: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FP_TRAP_ON
    169: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STDOUT
    170: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_INT
    171: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DOUBLE
    172: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_COMPLEX
    173: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_LONG
    174: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SHORT
    175: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FLOAT
    176: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_CHAR
    177: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BIT_LOGICAL
    178: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_ENUM
    179: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BOOL
    180: !DEC$ ATTRIBUTES DLLEXPORT::PETSC___FLOAT128
    181: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_OBJECT
    182: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FUNCTION
    183: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STRING
    184: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STRUC
    185: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DATATYPE_UNKNOWN
    186: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_COPY_VALUES
    187: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_OWN_POINTER
    188: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_USE_POINTER
    189: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_i
    190: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_RANDOM
    191: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_INT_SIZE
    192: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_FLOAT_SIZE
    193: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_CHAR_SIZE
    194: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SHORT_SIZE
    195: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_DOUBLE_SIZE
    196: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SCALAR_SIZE
    197: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_SET
    198: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_CUR
    199: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_END
    200: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_ALLREDUCE
    201: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_IBARRIER
    202: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_REDSCATTER
    203: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_GENERAL
    204: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_CONTIGUOUS
    205: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_INTERLACED
    206: #endif

    208: ! ----------------------------------------------------------------------------
    209: !
    210: !     PetscInfoCommFlag Enum
    211: !
    212: !
    213: !     PetscInfoCommFlag
    214: !
    215:       PetscEnum PETSC_INFO_COMM_ALL
    216:       PetscEnum PETSC_INFO_COMM_NO_SELF
    217:       PetscEnum PETSC_INFO_COMM_ONLY_SELF
    218:       parameter(PETSC_INFO_COMM_ALL=-1)
    219:       parameter(PETSC_INFO_COMM_NO_SELF=0)
    220:       parameter(PETSC_INFO_COMM_ONLY_SELF=1)