Actual source code: petscdef.h
1: !
2: ! $Id: petscdef.h,v 1.31 2001/09/04 15:42:43 balay 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_VOID_P == 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 PetscFortranFloat real
52: #define PetscFortranDouble double precision
53: #define PetscFortranComplex complex (KIND=SELECTED_REAL_KIND(14))
54: #define PetscChar(a) character(len = a) ::
55: #else
56: #define PetscFortranFloat real*4
57: #define PetscFortranDouble real*8
58: #define PetscFortranComplex complex*16
59: #define PetscChar(a) character*(a)
60: #endif
62: #if defined(PETSC_USE_COMPLEX)
63: #define PETSC_SCALAR PETSC_COMPLEX
64: #else
65: #if defined(PETSC_USE_SINGLE)
66: #define PETSC_SCALAR PETSC_FLOAT
67: #else
68: #define PETSC_SCALAR PETSC_DOUBLE
69: #endif
70: #endif
71: !
72: ! Macro for templating between real and complex
73: !
74: #if defined(PETSC_USE_COMPLEX)
75: #define PetscScalar PetscFortranComplex
76: !
77: ! F90 uses real(), conjg() when KIND parameter is used.
78: !
79: #if defined (PETSC_MISSING_DREAL)
80: #define PetscRealPart(a) real(a)
81: #define PetscConj(a) conjg(a)
82: #else
83: #define PetscRealPart(a) dreal(a)
84: #define PetscConj(a) dconjg(a)
85: #endif
86: #define MPIU_SCALAR MPI_DOUBLE_COMPLEX
87: #else
88: #if defined (PETSC_USE_SINGLE)
89: #define PetscScalar PetscFortranFloat
90: #else
91: #define PetscScalar PetscFortranDouble
92: #endif
93: #define PetscRealPart(a) a
94: #define PetscConj(a) a
95: #define MPIU_SCALAR MPI_DOUBLE_PRECISION
96: #endif
98: #if defined (PETSC_USE_SINGLE)
99: #define PetscReal PetscFortranFloat
100: #else
101: #define PetscReal PetscFortranDouble
102: #endif
104: !
105: ! Allows the matrix Fortran Kernels to work with single precision
106: ! matrix data structures
107: !
108: #if defined(PETSC_USE_COMPLEX)
109: #define MatScalar PetscScalar
110: #elif defined(PETSC_USE_MAT_SINGLE)
111: #define MatScalar real*4
112: #else
113: #define MatScalar PetscScalar
114: #endif
115: !
116: ! Declare PETSC_NULL_OBJECT
117: !
118: #define PETSC_NULL_OBJECT PETSC_NULL_INTEGER
119: !
120: ! PetscLogDouble variables are used to contain double precision numbers
121: ! that are not used in the numerical computations, but rather in logging,
122: ! timing etc.
123: !
124: #define PetscObject PetscFortranAddr
125: #define PetscLogDouble PetscFortranDouble
126: !
127: ! Macros for error checking
128: !
129: #if defined(PETSC_USE_DEBUG)
130: #define SETERRQ(n,s,ierr) call MPI_Abort(PETSC_COMM_WORLD,n,ierr)
131: #define CHKERRQ(n) if (n .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,n,n)
132: #define CHKMEMQ call chkmemfortran(__LINE__,__FILE__)
133: #define CHKMEMA CHKMEMQ
134: #else
135: #define SETERRQ(n,s)
136: #define CHKERRQ(n)
137: #define CHKMEMQ
138: #define CHKMEMA
139: #endif
141: #define PetscMatlabEngine PetscFortranAddr
143: #if defined(PETSC_STDCALL)
144: #define PETSC_DEC_ATTRIBUTES(A,B) DEC$ ATTRIBUTESC, ALIAS:B ::A
145: #else
146: #define PETSC_DEC_ATTRIBUTES(A,B)
147: #endif
149: #endif