Actual source code: petscsys.h
petsc-3.12.5 2020-03-29
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 :: &
14: & PetscReal_Private = 1.0
15: Integer,Parameter :: PETSC_REAL_KIND &
16: & = Selected_Real_Kind(Precision(PetscReal_Private))
19: #if !defined(PETSC_AVOID_MPIF_H)
20: #if defined(PETSC_HAVE_MPIUNI)
21: #include "petsc/mpiuni/mpif.h"
22: #else
23: #include "mpif.h"
24: #endif
25: #endif
27: type tPetscOptions
28: PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
29: end type tPetscOptions
31: PetscOptions, parameter :: PETSC_NULL_OPTIONS = &
32: & tPetscOptions(0)
34: ! ------------------------------------------------------------------------
35: ! Non Common block Stuff declared first
36: !
37: ! Flags
38: !
39: PetscBool PETSC_TRUE
40: PetscBool PETSC_FALSE
41: parameter (PETSC_TRUE = .true.,PETSC_FALSE = .false.)
42: PetscInt PETSC_DECIDE,PETSC_DETERMINE
43: parameter (PETSC_DECIDE=-1,PETSC_DETERMINE=-1)
45: PetscInt PETSC_DEFAULT_INTEGER
46: parameter (PETSC_DEFAULT_INTEGER = -2)
48: PetscReal PETSC_DEFAULT_REAL
49: parameter (PETSC_DEFAULT_REAL=-2.0d0)
51: PetscEnum PETSC_FP_TRAP_OFF
52: PetscEnum PETSC_FP_TRAP_ON
53: parameter (PETSC_FP_TRAP_OFF = 0,PETSC_FP_TRAP_ON = 1)
55: PetscFortranAddr PETSC_STDOUT
57: parameter (PETSC_STDOUT = 0)
58: !
59: ! PETSc DataTypes
60: !
61: PetscEnum PETSC_INT
62: PetscEnum PETSC_DOUBLE
63: PetscEnum PETSC_COMPLEX
64: PetscEnum PETSC_LONG
65: PetscEnum PETSC_SHORT
66: PetscEnum PETSC_FLOAT
67: PetscEnum PETSC_CHAR
68: PetscEnum PETSC_BIT_LOGICAL
69: PetscEnum PETSC_ENUM
70: PetscEnum PETSC_BOOL
71: PetscEnum PETSC___FLOAT128
72: PetscEnum PETSC_OBJECT
73: PetscEnum PETSC_FUNCTION
74: PetscEnum PETSC_STRING
75: PetscEnum PETSC___FP16
76: PetscEnum PETSC_STRUCT
77: PetscEnum PETSC_DATATYPE_UNKNOWN
79: #if defined(PETSC_USE_REAL_SINGLE)
80: #define PETSC_REAL PETSC_FLOAT
81: #elif defined(PETSC_USE_REAL___FLOAT128)
82: #define PETSC_REAL PETSC___FLOAT128
83: #else
84: #define PETSC_REAL PETSC_DOUBLE
85: #endif
86: #define PETSC_FORTRANADDR PETSC_LONG
88: parameter (PETSC_DATATYPE_UNKNOWN=0)
89: parameter (PETSC_DOUBLE=1,PETSC_COMPLEX=2)
90: parameter (PETSC_LONG=3,PETSC_SHORT=4,PETSC_FLOAT=5)
91: parameter (PETSC_CHAR=6,PETSC_BIT_LOGICAL=7,PETSC_ENUM=8)
92: parameter (PETSC_BOOL=9,PETSC___FLOAT128=10)
93: parameter (PETSC_OBJECT=11,PETSC_FUNCTION=12)
94: parameter (PETSC_STRING=13,PETSC___FP16=14,PETSC_STRUCT=15)
95: parameter (PETSC_INT=16)
96: !
97: !
98: !
99: PetscEnum PETSC_COPY_VALUES
100: PetscEnum PETSC_OWN_POINTER
101: PetscEnum PETSC_USE_POINTER
103: parameter (PETSC_COPY_VALUES = 0)
104: parameter (PETSC_OWN_POINTER = 1)
105: parameter (PETSC_USE_POINTER = 2)
106: !
107: ! ------------------------------------------------------------------------
108: ! PETSc mathematics include file. Defines certain basic mathematical
109: ! constants and functions for working with single and double precision
110: ! floating point numbers as well as complex and integers.
111: !
112: ! Representation of complex i
113: !
114: PetscFortranComplex PETSC_i
115: #if defined(PETSC_USE_REAL_SINGLE)
116: parameter (PETSC_i = (0.0e0,1.0e0))
117: #else
118: parameter (PETSC_i = (0.0d0,1.0d0))
119: #endif
121: !
122: ! ----------------------------------------------------------------------------
123: ! BEGIN PETSc aliases for MPI_ constants
124: !
125: ! These values for __float128 are handled in the common block (below)
126: ! and transmitted from the C code
127: !
128: #if !defined(PETSC_USE_REAL___FLOAT128)
129: integer MPIU_REAL
130: #if defined (PETSC_USE_REAL_SINGLE)
131: parameter (MPIU_REAL = MPI_REAL)
132: #else
133: parameter(MPIU_REAL = MPI_DOUBLE_PRECISION)
134: #endif
136: integer MPIU_SUM
137: parameter (MPIU_SUM = MPI_SUM)
139: integer MPIU_SCALAR
140: #if defined(PETSC_USE_COMPLEX)
141: #if defined (PETSC_USE_REAL_SINGLE)
142: parameter(MPIU_SCALAR = MPI_COMPLEX)
143: #else
144: parameter(MPIU_SCALAR = MPI_DOUBLE_COMPLEX)
145: #endif
146: #else
147: #if defined (PETSC_USE_REAL_SINGLE)
148: parameter (MPIU_SCALAR = MPI_REAL)
149: #else
150: parameter(MPIU_SCALAR = MPI_DOUBLE_PRECISION)
151: #endif
152: #endif
153: #endif
155: integer MPIU_INTEGER
156: #if defined(PETSC_USE_64BIT_INDICES)
157: parameter(MPIU_INTEGER = MPI_INTEGER8)
158: #else
159: parameter(MPIU_INTEGER = MPI_INTEGER)
160: #endif
162: ! A PETSC_NULL_FUNCTION pointer
163: !
164: external PETSC_NULL_FUNCTION
165: !
166: ! Possible arguments to PetscPushErrorHandler()
167: !
168: external PETSCTRACEBACKERRORHANDLER
169: external PETSCABORTERRORHANDLER
170: external PETSCEMACSCLIENTERRORHANDLER
171: external PETSCATTACHDEBUGGERERRORHANDLER
172: external PETSCIGNOREERRORHANDLER
173: !
174: external PetscIsInfOrNanScalar
175: external PetscIsInfOrNanReal
176: PetscBool PetscIsInfOrNanScalar
177: PetscBool PetscIsInfOrNanReal
180: ! ----------------------------------------------------------------------------
181: !
182: ! Random numbers
183: !
184: type tPetscRandom
185: sequence
186: PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
187: end type tPetscRandom
189: PetscRandom, parameter :: PETSC_NULL_RANDOM &
190: & = tPetscRandom(0)
191: !
192: #define PETSCRAND 'rand'
193: #define PETSCRAND48 'rand48'
194: #define PETSCSPRNG 'sprng'
195: #define PETSCRANDER48 'rander48'
196: !
197: !
198: !
199: PetscEnum PETSC_BINARY_INT_SIZE
200: PetscEnum PETSC_BINARY_FLOAT_SIZE
201: PetscEnum PETSC_BINARY_CHAR_SIZE
202: PetscEnum PETSC_BINARY_SHORT_SIZE
203: PetscEnum PETSC_BINARY_DOUBLE_SIZE
204: PetscEnum PETSC_BINARY_SCALAR_SIZE
206: parameter (PETSC_BINARY_INT_SIZE = 4)
207: parameter (PETSC_BINARY_FLOAT_SIZE = 4)
208: parameter (PETSC_BINARY_CHAR_SIZE = 1)
209: parameter (PETSC_BINARY_SHORT_SIZE = 2)
210: parameter (PETSC_BINARY_DOUBLE_SIZE = 8)
211: #if defined(PETSC_USE_COMPLEX)
212: parameter (PETSC_BINARY_SCALAR_SIZE = 16)
213: #else
214: parameter (PETSC_BINARY_SCALAR_SIZE = 8)
215: #endif
217: PetscEnum PETSC_BINARY_SEEK_SET
218: PetscEnum PETSC_BINARY_SEEK_CUR
219: PetscEnum PETSC_BINARY_SEEK_END
221: parameter (PETSC_BINARY_SEEK_SET = 0,PETSC_BINARY_SEEK_CUR = 1)
222: parameter (PETSC_BINARY_SEEK_END = 2)
224: PetscEnum PETSC_BUILDTWOSIDED_ALLREDUCE
225: PetscEnum PETSC_BUILDTWOSIDED_IBARRIER
226: PetscEnum PETSC_BUILDTWOSIDED_REDSCATTER
227: parameter (PETSC_BUILDTWOSIDED_ALLREDUCE = 0)
228: parameter (PETSC_BUILDTWOSIDED_IBARRIER = 1)
229: parameter (PETSC_BUILDTWOSIDED_REDSCATTER = 2)
230: !
231: ! PetscSubcommType
232: !
233: PetscEnum PETSC_SUBCOMM_GENERAL
234: PetscEnum PETSC_SUBCOMM_CONTIGUOUS
235: PetscEnum PETSC_SUBCOMM_INTERLACED
236: parameter(PETSC_SUBCOMM_GENERAL=0)
237: parameter(PETSC_SUBCOMM_CONTIGUOUS=1)
238: parameter(PETSC_SUBCOMM_INTERLACED=2)
240: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
241: !DEC$ ATTRIBUTES DLLEXPORT::PetscReal_Private
242: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_REAL_KIND
243: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_OPTIONS
244: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_TRUE
245: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FALSE
246: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE
247: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE
248: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_INTEGER
249: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_REAL
250: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FP_TRAP_OFF
251: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FP_TRAP_ON
252: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STDOUT
253: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_INT
254: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DOUBLE
255: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_COMPLEX
256: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_LONG
257: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SHORT
258: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FLOAT
259: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_CHAR
260: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BIT_LOGICAL
261: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_ENUM
262: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BOOL
263: !DEC$ ATTRIBUTES DLLEXPORT::PETSC___FLOAT128
264: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_OBJECT
265: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_FUNCTION
266: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STRING
267: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_STRUC
268: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_DATATYPE_UNKNOWN
269: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_COPY_VALUES
270: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_OWN_POINTER
271: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_USE_POINTER
272: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_i
273: !DEC$ ATTRIBUTES DLLEXPORT::MPIU_REAL
274: !DEC$ ATTRIBUTES DLLEXPORT::MPIU_SUM
275: !DEC$ ATTRIBUTES DLLEXPORT::MPIU_SCALAR
276: !DEC$ ATTRIBUTES DLLEXPORT::MPIU_INTEGER
277: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_RANDOM
278: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_INT_SIZE
279: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_FLOAT_SIZE
280: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_CHAR_SIZE
281: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SHORT_SIZE
282: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_DOUBLE_SIZE
283: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SCALAR_SIZE
284: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_SET
285: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_CUR
286: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BINARY_SEEK_END
287: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_ALLREDUCE
288: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_IBARRIER
289: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_BUILDTWOSIDED_REDSCATTER
290: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_GENERAL
291: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_CONTIGUOUS
292: !DEC$ ATTRIBUTES DLLEXPORT::PETSC_SUBCOMM_INTERLACED
293: #endif
294: !
295: ! include other sys components
296: !
297: #include "../src/sys/f90-mod/petscerror.h"
298: #include "../src/sys/f90-mod/petsclog.h"
299: #include "../src/sys/f90-mod/petscbag.h"