Actual source code: petscsys.h

petsc-3.5.4 2015-05-23
Report Typos and Errors
  1: !
  2: !
  3: !  Base include file for Fortran use of the PETSc package.
  4: !
  5: #include "petscconf.h"
 6:  #include petscversion.h
 7:  #include finclude/petscsysdef.h

  9: #if !defined(PETSC_AVOID_MPIF_H)
 10: #include "mpif.h"
 11: #endif

 13: ! ------------------------------------------------------------------------
 14: !     Non Common block Stuff declared first
 15: !
 16: !     Flags
 17: !
 18:       PetscBool  PETSC_TRUE
 19:       PetscBool  PETSC_FALSE
 20: #if defined(PETSC_FORTRAN_PETSCTRUTH_INT)
 21:       parameter (PETSC_TRUE = 1,PETSC_FALSE = 0)
 22: #else
 23:       parameter (PETSC_TRUE = .true.,PETSC_FALSE = .false.)
 24: #endif
 25:       PetscInt   PETSC_DECIDE,PETSC_DETERMINE
 26:       parameter (PETSC_DECIDE=-1,PETSC_DETERMINE=-1)

 28:       PetscInt  PETSC_DEFAULT_INTEGER
 29:       parameter (PETSC_DEFAULT_INTEGER = -2)

 31:       PetscReal PETSC_DEFAULT_REAL
 32:       parameter (PETSC_DEFAULT_REAL=-2.0d0)

 34:       PetscEnum PETSC_FP_TRAP_OFF
 35:       PetscEnum PETSC_FP_TRAP_ON
 36:       parameter (PETSC_FP_TRAP_OFF = 0,PETSC_FP_TRAP_ON = 1)



 40: !
 41: !     Default PetscViewers.
 42: !
 43:       PetscFortranAddr PETSC_VIEWER_DRAW_WORLD
 44:       PetscFortranAddr PETSC_VIEWER_DRAW_SELF
 45:       PetscFortranAddr PETSC_VIEWER_SOCKET_WORLD
 46:       PetscFortranAddr PETSC_VIEWER_SOCKET_SELF
 47:       PetscFortranAddr PETSC_VIEWER_STDOUT_WORLD
 48:       PetscFortranAddr PETSC_VIEWER_STDOUT_SELF
 49:       PetscFortranAddr PETSC_VIEWER_STDERR_WORLD
 50:       PetscFortranAddr PETSC_VIEWER_STDERR_SELF
 51:       PetscFortranAddr PETSC_VIEWER_BINARY_WORLD
 52:       PetscFortranAddr PETSC_VIEWER_BINARY_SELF
 53:       PetscFortranAddr PETSC_VIEWER_MATLAB_WORLD
 54:       PetscFortranAddr PETSC_VIEWER_MATLAB_SELF

 56: !
 57: !     The numbers used below should match those in
 58: !     petsc-private/fortranimpl.h
 59: !
 60:       parameter (PETSC_VIEWER_DRAW_WORLD   = 4)
 61:       parameter (PETSC_VIEWER_DRAW_SELF    = 5)
 62:       parameter (PETSC_VIEWER_SOCKET_WORLD = 6)
 63:       parameter (PETSC_VIEWER_SOCKET_SELF  = 7)
 64:       parameter (PETSC_VIEWER_STDOUT_WORLD = 8)
 65:       parameter (PETSC_VIEWER_STDOUT_SELF  = 9)
 66:       parameter (PETSC_VIEWER_STDERR_WORLD = 10)
 67:       parameter (PETSC_VIEWER_STDERR_SELF  = 11)
 68:       parameter (PETSC_VIEWER_BINARY_WORLD = 12)
 69:       parameter (PETSC_VIEWER_BINARY_SELF  = 13)
 70:       parameter (PETSC_VIEWER_MATLAB_WORLD = 14)
 71:       parameter (PETSC_VIEWER_MATLAB_SELF  = 15)
 72: !
 73: !     PETSc DataTypes
 74: !
 75:       PetscEnum PETSC_INT
 76:       PetscEnum PETSC_DOUBLE
 77:       PetscEnum PETSC_COMPLEX
 78:       PetscEnum PETSC_LONG
 79:       PetscEnum PETSC_SHORT
 80:       PetscEnum PETSC_FLOAT
 81:       PetscEnum PETSC_CHAR
 82:       PetscEnum PETSC_BIT_LOGICAL
 83:       PetscEnum PETSC_ENUM
 84:       PetscEnum PETSC_BOOL
 85:       PetscEnum PETSC___FLOAT128

 87: #if defined(PETSC_USE_REAL_SINGLE)
 88: #define PETSC_REAL PETSC_FLOAT
 89: #elif defined(PETSC_USE_REAL___FLOAT128)
 90: #define PETSC_REAL PETSC___FLOAT128
 91: #else
 92: #define PETSC_REAL PETSC_DOUBLE
 93: #endif
 94: #define PETSC_FORTRANADDR PETSC_LONG

 96:       parameter (PETSC_INT=0,PETSC_DOUBLE=1,PETSC_COMPLEX=2)
 97:       parameter (PETSC_LONG=3,PETSC_SHORT=4,PETSC_FLOAT=5)
 98:       parameter (PETSC_CHAR=6,PETSC_BIT_LOGICAL=7,PETSC_ENUM=8)
 99:       parameter (PETSC_BOOL=9,PETSC___FLOAT128=10)
100: !
101: !
102: !
103:       PetscEnum PETSC_COPY_VALUES
104:       PetscEnum PETSC_OWN_POINTER
105:       PetscEnum PETSC_USE_POINTER

107:       parameter (PETSC_COPY_VALUES = 0)
108:       parameter (PETSC_OWN_POINTER = 1)
109:       parameter (PETSC_USE_POINTER = 2)
110: !
111: ! ------------------------------------------------------------------------
112: !     PETSc mathematics include file. Defines certain basic mathematical
113: !    constants and functions for working with single and double precision
114: !    floating point numbers as well as complex and integers.
115: !
116: !     Representation of complex i
117: !
118:       PetscFortranComplex PETSC_i
119: #if defined(PETSC_USE_REAL_SINGLE)
120:       parameter (PETSC_i = (0.0e0,1.0e0))
121: #else
122:       parameter (PETSC_i = (0.0d0,1.0d0))
123: #endif

125: !
126: ! ----------------------------------------------------------------------------
127: !    BEGIN PETSc aliases for MPI_ constants
128: !
129: !   These values for __float128 are handled in the common block (below)
130: !     and transmitted from the C code
131: !
132: #if !defined(PETSC_USE_REAL___FLOAT128)
133:       integer MPIU_REAL
134: #if defined (PETSC_USE_REAL_SINGLE)
135:       parameter (MPIU_REAL = MPI_REAL)
136: #else
137:       parameter(MPIU_REAL = MPI_DOUBLE_PRECISION)
138: #endif

140:       integer MPIU_SUM
141:       parameter (MPIU_SUM = MPI_SUM)

143:       integer MPIU_SCALAR
144: #if defined(PETSC_USE_COMPLEX)
145: #if defined (PETSC_USE_REAL_SINGLE)
146:       parameter(MPIU_SCALAR = MPI_COMPLEX)
147: #else
148:       parameter(MPIU_SCALAR = MPI_DOUBLE_COMPLEX)
149: #endif
150: #else
151: #if defined (PETSC_USE_REAL_SINGLE)
152:       parameter (MPIU_SCALAR = MPI_REAL)
153: #else
154:       parameter(MPIU_SCALAR = MPI_DOUBLE_PRECISION)
155: #endif
156: #endif
157: #endif

159:       integer MPIU_INTEGER
160: #if defined(PETSC_USE_64BIT_INDICES)
161:       parameter(MPIU_INTEGER = MPI_INTEGER8)
162: #else
163:       parameter(MPIU_INTEGER = MPI_INTEGER)
164: #endif

166: !
167: ! ----------------------------------------------------------------------------
168: !    BEGIN COMMON-BLOCK VARIABLES
169: !
170: !
171: !     PETSc world communicator
172: !
173:       MPI_Comm PETSC_COMM_WORLD
174:       MPI_Comm PETSC_COMM_SELF
175: !
176: !     Fortran Null
177: !
178:       PetscChar(80)       PETSC_NULL_CHARACTER
179:       PetscInt            PETSC_NULL_INTEGER
180:       PetscFortranDouble  PETSC_NULL_DOUBLE
181:       PetscObject         PETSC_NULL_OBJECT
182: !
183: !      A PETSC_NULL_FUNCTION pointer
184: !
185:       external PETSC_NULL_FUNCTION
186:       PetscScalar   PETSC_NULL_SCALAR
187:       PetscReal     PETSC_NULL_REAL
188:       PetscBool     PETSC_NULL_BOOL
189: !
190: #if defined(PETSC_USE_REAL___FLOAT128)
191:       integer MPIU_REAL
192:       integer MPIU_SCALAR
193:       integer MPIU_SUM
194: #endif
195: !
196: !
197: !
198: !     Basic math constants
199: !
200:       PetscReal PETSC_PI
201:       PetscReal PETSC_MAX_REAL
202:       PetscReal PETSC_MIN_REAL
203:       PetscReal PETSC_MACHINE_EPSILON
204:       PetscReal PETSC_SQRT_MACHINE_EPSILON
205:       PetscReal PETSC_SMALL
206:       PetscReal PETSC_INFINITY
207:       PetscReal PETSC_NINFINITY

209: !
210: !     Common Block to store some of the PETSc constants.
211: !     which can be set - only at runtime.
212: !
213:       common /petscfortran1/ PETSC_NULL_CHARACTER
214:       common /petscfortran2/ PETSC_NULL_INTEGER
215:       common /petscfortran4/ PETSC_NULL_SCALAR
216:       common /petscfortran5/ PETSC_NULL_DOUBLE
217:       common /petscfortran6/ PETSC_NULL_REAL
218:       common /petscfortran7/ PETSC_NULL_BOOL
219:       common /petscfortran8/ PETSC_NULL_OBJECT
220:       common /petscfortran9/ PETSC_COMM_WORLD
221:       common /petscfortran10/ PETSC_COMM_SELF
222: #if defined(PETSC_USE_REAL___FLOAT128)
223:       common /petscfortran11/ MPIU_REAL
224:       common /petscfortran12/ MPIU_SCALAR
225:       common /petscfortran13/ MPIU_SUM
226: #endif
227:       common /petscfortran14/ PETSC_PI
228:       common /petscfortran15/ PETSC_MAX_REAL
229:       common /petscfortran16/ PETSC_MIN_REAL
230:       common /petscfortran17/ PETSC_MACHINE_EPSILON
231:       common /petscfortran18/ PETSC_SQRT_MACHINE_EPSILON
232:       common /petscfortran19/ PETSC_SMALL
233:       common /petscfortran20/ PETSC_INFINITY
234:       common /petscfortran21/ PETSC_NINFINITY

236: !
237: !     Possible arguments to PetscPushErrorHandler()
238: !
239:       external PETSCTRACEBACKERRORHANDLER
240:       external PETSCABORTERRORHANDLER
241:       external PETSCEMACSCLIENTERRORHANDLER
242:       external PETSCATTACHDEBUGGERERRORHANDLER
243:       external PETSCIGNOREERRORHANDLER
244: !
245:       external  PetscIsInfOrNanScalar
246:       external  PetscIsInfOrNanReal
247:       PetscBool PetscIsInfOrNanScalar
248:       PetscBool PetscIsInfOrNanReal


251: !    END COMMON-BLOCK VARIABLES
252: ! ----------------------------------------------------------------------------
253: !
254: !
255: !     Random numbers
256: !
257: #define PETSCRAND 'rand'
258: #define PETSCRAND48 'rand48'
259: #define PETSCSPRNG 'sprng'
260: !
261: !
262: !
263:       PetscEnum PETSC_BINARY_INT_SIZE
264:       PetscEnum PETSC_BINARY_FLOAT_SIZE
265:       PetscEnum PETSC_BINARY_CHAR_SIZE
266:       PetscEnum PETSC_BINARY_SHORT_SIZE
267:       PetscEnum PETSC_BINARY_DOUBLE_SIZE
268:       PetscEnum PETSC_BINARY_SCALAR_SIZE

270:       parameter (PETSC_BINARY_INT_SIZE = 4)
271:       parameter (PETSC_BINARY_FLOAT_SIZE = 4)
272:       parameter (PETSC_BINARY_CHAR_SIZE = 1)
273:       parameter (PETSC_BINARY_SHORT_SIZE = 2)
274:       parameter (PETSC_BINARY_DOUBLE_SIZE = 8)
275: #if defined(PETSC_USE_COMPLEX)
276:       parameter (PETSC_BINARY_SCALAR_SIZE = 16)
277: #else
278:       parameter (PETSC_BINARY_SCALAR_SIZE = 8)
279: #endif

281:       PetscEnum PETSC_BINARY_SEEK_SET
282:       PetscEnum PETSC_BINARY_SEEK_CUR
283:       PetscEnum PETSC_BINARY_SEEK_END

285:       parameter (PETSC_BINARY_SEEK_SET = 0,PETSC_BINARY_SEEK_CUR = 1)
286:       parameter (PETSC_BINARY_SEEK_END = 2)

288:       PetscEnum PETSC_BUILDTWOSIDED_ALLREDUCE
289:       PetscEnum PETSC_BUILDTWOSIDED_IBARRIER
290:       parameter (PETSC_BUILDTWOSIDED_ALLREDUCE = 0)
291:       parameter (PETSC_BUILDTWOSIDED_IBARRIER = 1)
292: !