Actual source code: petscdef.h
1: !
2: ! $Id: petscdef.h,v 1.26 2001/01/17 22:29:15 bsmith Exp $;
3: !
4: ! Part of the base include file for Fortran use of PETSc.
5: ! Note: This file should contain only define statements and
6: ! not the declaration of variables.
8: ! No spaces for #defines as some compilers (PGI) also adds
9: ! those additional spaces during preprocessing - bad for fixed format
10: !
11: #if !defined (__PETSCDEF_H)
13: !
14: #include "petscconf.h"
15: !
16: #define MPI_Comm integer
17: !
18: #define PetscTruth integer
19: #define PetscDataType integer
20: #define PetscFPTrap integer
21: !
22: !
23: ! The real*8,complex*16 notatiton is used so that the
24: ! PETSc double/complex variables are not affected by
25: ! compiler options like -r4,-r8, sometimes invoked
26: ! by the user. NAG compiler does not like integer*4,real*8
27: !
28: ! ???? All integers should also be changed to PetscFortranInt ?????
29: !
31: #if (PETSC_SIZEOF_VOIDP == 8)
32: #define PetscOffset integer*8
33: #define PetscFortranAddr integer*8
34: #elif defined (PETSC_MISSING_FORTRANSTAR)
35: #define PetscOffset integer
36: #define PetscFortranAddr integer
37: #else
38: #define PetscOffset integer*4
39: #define PetscFortranAddr integer*4
40: #endif
42: #if (PETSC_SIZEOF_INT == 8)
43: #define PetscFortranInt integer*8
44: #elif defined (PETSC_MISSING_FORTRANSTAR)
45: #define PetscFortranInt integer
46: #else
47: #define PetscFortranInt integer*4
48: #endif
50: #if defined (PETSC_MISSING_FORTRANSTAR)
51: #define PetscFortranDouble double precision
52: #define PetscFortranComplex complex (KIND=SELECTED_REAL_KIND(14))
53: #else
54: #define PetscFortranDouble real*8
55: #define PetscFortranComplex complex*16
56: #endif
58: #if defined(PETSC_USE_COMPLEX)
59: #define PETSC_SCALAR PETSC_COMPLEX
60: #else
61: #define PETSC_SCALAR PETSC_DOUBLE
62: #endif
63: !
64: ! Macro for templating between real and complex
65: !
66: #if defined(PETSC_USE_COMPLEX)
67: #define Scalar PetscFortranComplex
68: !
69: ! F90 uses real(), conjg() when KIND parameter is used.
70: !
71: #if defined (PETSC_MISSING_DREAL)
72: #define PetscRealPart(a) real(a)
73: #define PetscConj(a) conjg(a)
74: #else
75: #define PetscRealPart(a) dreal(a)
76: #define PetscConj(a) dconjg(a)
77: #endif
78: #define MPIU_SCALAR MPI_DOUBLE_COMPLEX
79: #else
80: #define Scalar PetscFortranDouble
81: #define PetscRealPart(a) a
82: #define PetscConj(a) a
83: #define MPIU_SCALAR MPI_DOUBLE_PRECISION
84: #endif
85: !
86: ! Allows the matrix Fortran Kernels to work with single precision
87: ! matrix data structures
88: !
89: #if defined(PETSC_USE_COMPLEX)
90: #define MatScalar Scalar
91: #elif defined(PETSC_USE_MAT_SINGLE)
92: #define MatScalar real*4
93: #else
94: #define MatScalar Scalar
95: #endif
96: !
97: ! Declare PETSC_NULL_OBJECT
98: !
99: #define PETSC_NULL_OBJECT PETSC_NULL_INTEGER
100: !
101: ! PetscLogDouble variables are used to contain double precision numbers
102: ! that are not used in the numerical computations, but rather in logging,
103: ! timing etc.
104: !
105: #define PetscObject PetscFortranAddr
106: #define PetscLogDouble PetscFortranDouble
107: !
108: ! Macros for error checking
109: !
110: #if defined(PETSC_USE_DEBUG)
111: #define SETERRQ(n,s,ierr) call MPI_Abort(PETSC_COMM_WORLD,n,ierr)
112: #define CHKERRQ(n) if (n .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,n,n)
113: #define CHKMEMQ call chkmemfortran(__LINE__,__FILE__)
114: #define CHKMEMA CHKMEMQ
115: #else
116: #define SETERRQ(n,s)
117: #define CHKERRQ(n)
118: #define CHKMEMQ
119: #define CHKMEMA
120: #endif
122: #define PetscMatlabEngine PetscFortranAddr
124: #endif