Actual source code: petscdef.h

      1: !
      2: !
      3: !  Part of the base include file for Fortran use of PETSc.
      4: !  Note: This file should contain only define statements and
      5: !  not the declaration of variables.

      7: ! No spaces for #defines as some compilers (PGI) also adds
      8: ! those additional spaces during preprocessing - bad for fixed format
      9: !
     10: #if !defined (__PETSCDEF_H)
     12: !
     13: #include "petscconf.h"
     14: !
     15: #define MPI_Comm integer
     16: !
     17: #define PetscEnum integer
     18: !
     19: #define PetscTruth PetscEnum
     20: #define PetscDataType PetscEnum
     21: #define PetscFPTrap PetscEnum

     23: #define PetscErrorCode integer
     24: #define PetscCookie integer
     25: #define PetscEvent integer
     26: #define PetscMPIInt integer
     27: !
     28: !
     29: ! The real*8,complex*16 notatiton is used so that the
     30: ! PETSc double/complex variables are not affected by
     31: ! compiler options like -r4,-r8, sometimes invoked
     32: ! by the user. NAG compiler does not like integer*4,real*8
     33: !
     34: !

     38: #if (PETSC_SIZEOF_VOID_P == 8)
     39: #define PetscFortranAddr integer*8
     40: #define PetscOffset integer*8
     41: #elif defined (PETSC_MISSING_FORTRANSTAR)
     42: #define PetscOffset integer
     43: #define PetscFortranAddr integer
     44: #else
     45: #define PetscOffset integer*4
     46: #define PetscFortranAddr integer*4
     47: #endif

     49: #if defined(PETSC_USE_64BIT_INT)
     50: #define PetscInt integer*8
     51: #elif defined (PETSC_MISSING_FORTRANSTAR)
     52: #define PetscInt integer
     53: #else
     54: #define PetscInt integer*4
     55: #endif

     58: #if defined (PETSC_MISSING_FORTRANSTAR)
     59: #define PetscFortranFloat real
     60: #define PetscFortranDouble double precision
     61: #define PetscFortranComplex complex (KIND=SELECTED_REAL_KIND(14))
     62: #define PetscChar(a) character(len = a) ::
     63: #else
     64: #define PetscFortranFloat real*4
     65: #define PetscFortranDouble real*8
     66: #define PetscFortranComplex complex*16
     67: #define PetscChar(a) character*(a)
     68: #endif

     70: #if defined(PETSC_USE_COMPLEX)
     71: #define PETSC_SCALAR PETSC_COMPLEX
     72: #else
     73: #if defined(PETSC_USE_SINGLE)
     74: #define PETSC_SCALAR PETSC_FLOAT
     75: #else
     76: #define PETSC_SCALAR PETSC_DOUBLE
     77: #endif
     78: #endif
     79: !
     80: !     Macro for templating between real and complex
     81: !
     82: #if defined(PETSC_USE_COMPLEX)
     83: #define PetscScalar PetscFortranComplex
     84: !
     85: ! F90 uses real(), conjg() when KIND parameter is used.
     86: !
     87: #if defined (PETSC_MISSING_DREAL)
     88: #define PetscRealPart(a) real(a)
     89: #define PetscConj(a) conjg(a)
     90: #else
     91: #define PetscRealPart(a) dreal(a)
     92: #define PetscConj(a) dconjg(a)
     93: #endif
     94: #define MPIU_SCALAR MPI_DOUBLE_COMPLEX
     95: #else
     96: #if defined (PETSC_USE_SINGLE)
     97: #define PetscScalar PetscFortranFloat
     98: #else
     99: #define PetscScalar PetscFortranDouble
    100: #endif
    101: #define PetscRealPart(a) a
    102: #define PetscConj(a) a
    103: #define MPIU_SCALAR MPI_DOUBLE_PRECISION
    104: #endif

    106: #if defined (PETSC_USE_SINGLE)
    107: #define PetscReal PetscFortranFloat
    108: #else
    109: #define PetscReal PetscFortranDouble
    110: #endif

    112: !
    113: !    Allows the matrix Fortran Kernels to work with single precision
    114: !    matrix data structures
    115: !
    116: #if defined(PETSC_USE_COMPLEX)
    117: #define MatScalar PetscScalar
    118: #elif defined(PETSC_USE_MAT_SINGLE)
    119: #define MatScalar real*4
    120: #else
    121: #define MatScalar PetscScalar
    122: #endif
    123: !
    124: !     Declare PETSC_NULL_OBJECT
    125: !
    126: !
    127: !     PetscLogDouble variables are used to contain double precision numbers
    128: !     that are not used in the numerical computations, but rather in logging,
    129: !     timing etc.
    130: !
    131: #define PetscObject PetscFortranAddr
    132: #define PetscLogDouble PetscFortranDouble
    133: !
    134: !     Macros for error checking
    135: !
    136: #if defined(PETSC_USE_DEBUG)
    137: #define SETERRQ(n,s,ierr) call MPI_Abort(PETSC_COMM_WORLD,n,ierr)
    138: #define CHKERRQ(n) if (n .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,n,n)
    139: #define CHKMEMQ call chkmemfortran(__LINE__,__FILE__,ierr)
    140: #else
    141: #define SETERRQ(n,s,ierr)
    142: #define CHKERRQ(n)
    143: #define CHKMEMQ
    144: #endif

    146: #define PetscMatlabEngine PetscFortranAddr

    148: #if defined(PETSC_STDCALL)
    149: #define PETSC_DEC_ATTRIBUTES(A,B) DEC$ ATTRIBUTESC, ALIAS:B ::A
    150: #else
    151: #define PETSC_DEC_ATTRIBUTES(A,B)
    152: #endif

    154: #endif