xref: /petsc/src/sys/ftn-mod/petscsysmod.F90 (revision 6dd63270497ad23dcf16ae500a87ff2b2a0b7474)
1*6dd63270SBarry Smith        module petscmpi
2*6dd63270SBarry Smith#include <petscconf.h>
3*6dd63270SBarry Smith#include "petsc/finclude/petscsys.h"
4*6dd63270SBarry Smith#if defined(PETSC_HAVE_MPIUNI)
5*6dd63270SBarry Smith        use mpiuni
6*6dd63270SBarry Smith#else
7*6dd63270SBarry Smith#if defined(PETSC_HAVE_MPI_F90MODULE)
8*6dd63270SBarry Smith        use mpi
9*6dd63270SBarry Smith#else
10*6dd63270SBarry Smith#include "mpif.h"
11*6dd63270SBarry Smith#endif
12*6dd63270SBarry Smith#endif
13*6dd63270SBarry Smith
14*6dd63270SBarry Smith        public:: MPIU_REAL, MPIU_SUM, MPIU_SCALAR, MPIU_INTEGER
15*6dd63270SBarry Smith        public:: PETSC_COMM_WORLD, PETSC_COMM_SELF
16*6dd63270SBarry Smith
17*6dd63270SBarry Smith!   These values are for __float128 are handled in the common block (below)
18*6dd63270SBarry Smith!   and transmitted from the C code
19*6dd63270SBarry Smith
20*6dd63270SBarry Smith      integer4 :: MPIU_REAL
21*6dd63270SBarry Smith      integer4 :: MPIU_SUM
22*6dd63270SBarry Smith      integer4 :: MPIU_SCALAR
23*6dd63270SBarry Smith      integer4 :: MPIU_INTEGER
24*6dd63270SBarry Smith
25*6dd63270SBarry Smith      MPI_Comm::PETSC_COMM_WORLD = 0
26*6dd63270SBarry Smith      MPI_Comm::PETSC_COMM_SELF = 0
27*6dd63270SBarry Smith
28*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
29*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_REAL
30*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_SUM
31*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_SCALAR
32*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_INTEGER
33*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_COMM_SELF
34*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_COMM_WORLD
35*6dd63270SBarry Smith#endif
36*6dd63270SBarry Smith      end module
37*6dd63270SBarry Smith
38*6dd63270SBarry Smith! ------------------------------------------------------------------------
39*6dd63270SBarry Smith
40*6dd63270SBarry Smith        module petscsysdef
41*6dd63270SBarry Smith#if defined(PETSC_HAVE_MPI_F90MODULE_VISIBILITY)
42*6dd63270SBarry Smith        use petscmpi
43*6dd63270SBarry Smith#else
44*6dd63270SBarry Smith        use petscmpi, only: MPIU_REAL,MPIU_SUM,MPIU_SCALAR,MPIU_INTEGER,PETSC_COMM_WORLD,PETSC_COMM_SELF
45*6dd63270SBarry Smith#endif
46*6dd63270SBarry Smith      PetscReal,Parameter :: PetscReal_Private = 1.0
47*6dd63270SBarry Smith      Integer,Parameter   :: PETSC_REAL_KIND = Selected_Real_Kind(Precision(PetscReal_Private))
48*6dd63270SBarry Smith
49*6dd63270SBarry Smith      PetscBool, parameter :: PETSC_TRUE = .true.
50*6dd63270SBarry Smith      PetscBool, parameter :: PETSC_FALSE = .false.
51*6dd63270SBarry Smith
52*6dd63270SBarry Smith      PetscInt, parameter :: PETSC_DECIDE = -1
53*6dd63270SBarry Smith      PetscInt, parameter :: PETSC_DECIDE_INTEGER = -1
54*6dd63270SBarry Smith      PetscReal, parameter :: PETSC_DECIDE_REAL = -1.0d0
55*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
56*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE
57*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE_INTEGER
58*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE_REAL
59*6dd63270SBarry Smith#endif
60*6dd63270SBarry Smith
61*6dd63270SBarry Smith      PetscInt, parameter :: PETSC_DETERMINE = -1
62*6dd63270SBarry Smith      PetscInt, parameter :: PETSC_DETERMINE_INTEGER = -1
63*6dd63270SBarry Smith      PetscReal, parameter :: PETSC_DETERMINE_REAL = -1.0d0
64*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
65*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE
66*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE_INTEGER
67*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE_REAL
68*6dd63270SBarry Smith#endif
69*6dd63270SBarry Smith
70*6dd63270SBarry Smith      PetscInt, parameter :: PETSC_CURRENT = -2
71*6dd63270SBarry Smith      PetscInt, parameter :: PETSC_CURRENT_INTEGER = -2
72*6dd63270SBarry Smith      PetscReal, parameter :: PETSC_CURRENT_REAL = -2.0d0
73*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
74*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT
75*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT_INTEGER
76*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT_REAL
77*6dd63270SBarry Smith#endif
78*6dd63270SBarry Smith
79*6dd63270SBarry Smith      PetscInt, parameter :: PETSC_DEFAULT = -2
80*6dd63270SBarry Smith      PetscInt, parameter :: PETSC_DEFAULT_INTEGER = -2
81*6dd63270SBarry Smith      PetscReal, parameter :: PETSC_DEFAULT_REAL = -2.0d0
82*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
83*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT
84*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_INTEGER
85*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_REAL
86*6dd63270SBarry Smith#endif
87*6dd63270SBarry Smith     PetscFortranAddr, parameter :: PETSC_STDOUT = 0
88*6dd63270SBarry Smith!
89*6dd63270SBarry Smith!     PETSc DataTypes
90*6dd63270SBarry Smith!
91*6dd63270SBarry Smith#if defined(PETSC_USE_REAL_SINGLE)
92*6dd63270SBarry Smith#define PETSC_REAL PETSC_FLOAT
93*6dd63270SBarry Smith#elif defined(PETSC_USE_REAL___FLOAT128)
94*6dd63270SBarry Smith#define PETSC_REAL PETSC___FLOAT128
95*6dd63270SBarry Smith#else
96*6dd63270SBarry Smith#define PETSC_REAL PETSC_DOUBLE
97*6dd63270SBarry Smith#endif
98*6dd63270SBarry Smith#define PETSC_FORTRANADDR PETSC_LONG
99*6dd63270SBarry Smith
100*6dd63270SBarry Smith!     PETSc mathematics include file. Defines certain basic mathematical
101*6dd63270SBarry Smith!    constants and functions for working with single and double precision
102*6dd63270SBarry Smith!    floating point numbers as well as complex and integers.
103*6dd63270SBarry Smith!
104*6dd63270SBarry Smith!     Representation of complex i
105*6dd63270SBarry Smith!
106*6dd63270SBarry Smith#if defined(PETSC_USE_REAL_SINGLE)
107*6dd63270SBarry Smith      PetscComplex, parameter :: PETSC_i = (0.0e0,1.0e0)
108*6dd63270SBarry Smith#else
109*6dd63270SBarry Smith      PetscComplex, parameter :: PETSC_i = (0.0d0,1.0d0)
110*6dd63270SBarry Smith#endif
111*6dd63270SBarry Smith
112*6dd63270SBarry Smith!      A PETSC_NULL_FUNCTION pointer
113*6dd63270SBarry Smith!
114*6dd63270SBarry Smith      external PETSC_NULL_FUNCTION
115*6dd63270SBarry Smith!
116*6dd63270SBarry Smith!     Possible arguments to PetscPushErrorHandler()
117*6dd63270SBarry Smith!
118*6dd63270SBarry Smith      external PETSCTRACEBACKERRORHANDLER
119*6dd63270SBarry Smith      external PETSCABORTERRORHANDLER
120*6dd63270SBarry Smith      external PETSCEMACSCLIENTERRORHANDLER
121*6dd63270SBarry Smith      external PETSCATTACHDEBUGGERERRORHANDLER
122*6dd63270SBarry Smith      external PETSCIGNOREERRORHANDLER
123*6dd63270SBarry Smith!
124*6dd63270SBarry Smith      external  PetscIsInfOrNanScalar
125*6dd63270SBarry Smith      external  PetscIsInfOrNanReal
126*6dd63270SBarry Smith      PetscBool PetscIsInfOrNanScalar
127*6dd63270SBarry Smith      PetscBool PetscIsInfOrNanReal
128*6dd63270SBarry Smith
129*6dd63270SBarry Smith#include <../ftn/sys/petscall.h>
130*6dd63270SBarry Smith
131*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_STDOUT_SELF  = tPetscViewer(9)
132*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_DRAW_WORLD   = tPetscViewer(4)
133*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_DRAW_SELF    = tPetscViewer(5)
134*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_SOCKET_WORLD = tPetscViewer(6)
135*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_SOCKET_SELF  = tPetscViewer(7)
136*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_STDOUT_WORLD = tPetscViewer(8)
137*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_STDERR_WORLD = tPetscViewer(10)
138*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_STDERR_SELF  = tPetscViewer(11)
139*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_BINARY_WORLD = tPetscViewer(12)
140*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_BINARY_SELF  = tPetscViewer(13)
141*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_MATLAB_WORLD = tPetscViewer(14)
142*6dd63270SBarry Smith      PetscViewer, parameter :: PETSC_VIEWER_MATLAB_SELF  = tPetscViewer(15)
143*6dd63270SBarry Smith
144*6dd63270SBarry Smith      PetscViewer PETSC_VIEWER_STDOUT_
145*6dd63270SBarry Smith      PetscViewer PETSC_VIEWER_DRAW_
146*6dd63270SBarry Smith      external PETSC_VIEWER_STDOUT_
147*6dd63270SBarry Smith      external PETSC_VIEWER_DRAW_
148*6dd63270SBarry Smith      external PetscViewerAndFormatDestroy
149*6dd63270SBarry Smith
150*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
151*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_STDOUT_SELF
152*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_DRAW_WORLD
153*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_DRAW_SELF
154*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_SOCKET_WORLD
155*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_SOCKET_SELF
156*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_STDOUT_WORLD
157*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_STDERR_WORLD
158*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_STDERR_SELF
159*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_BINARY_WORLD
160*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_BINARY_SELF
161*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_MATLAB_WORLD
162*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_MATLAB_SELF
163*6dd63270SBarry Smith#endif
164*6dd63270SBarry Smith
165*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_MEM              = 55
166*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_SUP              = 56
167*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_SUP_SYS          = 57
168*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ORDER            = 58
169*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_SIG              = 59
170*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_FP               = 72
171*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_COR              = 74
172*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_LIB              = 76
173*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_PLIB             = 77
174*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_MEMC             = 78
175*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_CONV_FAILED      = 82
176*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_USER             = 83
177*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_SYS              = 88
178*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_POINTER          = 70
179*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_MPI_LIB_INCOMP   = 87
180*6dd63270SBarry Smith
181*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_SIZ          = 60
182*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_IDN          = 61
183*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_WRONG        = 62
184*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_CORRUPT      = 64
185*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_OUTOFRANGE   = 63
186*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_BADPTR       = 68
187*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_NOTSAMETYPE  = 69
188*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_NOTSAMECOMM  = 80
189*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_WRONGSTATE   = 73
190*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_TYPENOTSET   = 89
191*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_INCOMP       = 75
192*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_NULL         = 85
193*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_ARG_UNKNOWN_TYPE = 86
194*6dd63270SBarry Smith
195*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_FILE_OPEN        = 65
196*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_FILE_READ        = 66
197*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_FILE_WRITE       = 67
198*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_FILE_UNEXPECTED  = 79
199*6dd63270SBarry Smith
200*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_MAT_LU_ZRPVT     = 71
201*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_MAT_CH_ZRPVT     = 81
202*6dd63270SBarry Smith
203*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_INT_OVERFLOW     = 84
204*6dd63270SBarry Smith
205*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_FLOP_COUNT       = 90
206*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_NOT_CONVERGED    = 91
207*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_MISSING_FACTOR   = 92
208*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_OPT_OVERWRITE    = 93
209*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_WRONG_MPI_SIZE   = 94
210*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_USER_INPUT       = 95
211*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_GPU_RESOURCE     = 96
212*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_GPU              = 97
213*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_MPI              = 98
214*6dd63270SBarry Smith      PetscErrorCode, parameter :: PETSC_ERR_RETURN           = 99
215*6dd63270SBarry Smith
216*6dd63270SBarry Smith        character(len = 80) :: PETSC_NULL_CHARACTER = ''
217*6dd63270SBarry Smith        PetscInt PETSC_NULL_INTEGER, PETSC_NULL_INTEGER_ARRAY(1)
218*6dd63270SBarry Smith        PetscInt, pointer :: PETSC_NULL_INTEGER_POINTER(:)
219*6dd63270SBarry Smith        PetscScalar, pointer :: PETSC_NULL_SCALAR_POINTER(:)
220*6dd63270SBarry Smith        PetscFortranDouble PETSC_NULL_DOUBLE
221*6dd63270SBarry Smith        PetscScalar PETSC_NULL_SCALAR, PETSC_NULL_SCALAR_ARRAY(1)
222*6dd63270SBarry Smith        PetscReal PETSC_NULL_REAL, PETSC_NULL_REAL_ARRAY(1)
223*6dd63270SBarry Smith        PetscReal, pointer :: PETSC_NULL_REAL_POINTER(:)
224*6dd63270SBarry Smith        PetscBool PETSC_NULL_BOOL
225*6dd63270SBarry Smith        PetscEnum PETSC_NULL_ENUM
226*6dd63270SBarry Smith        MPI_Comm  PETSC_NULL_MPI_COMM
227*6dd63270SBarry Smith!
228*6dd63270SBarry Smith!     Basic math constants
229*6dd63270SBarry Smith!
230*6dd63270SBarry Smith        PetscReal PETSC_PI
231*6dd63270SBarry Smith        PetscReal PETSC_MAX_REAL
232*6dd63270SBarry Smith        PetscReal PETSC_MIN_REAL
233*6dd63270SBarry Smith        PetscReal PETSC_MACHINE_EPSILON
234*6dd63270SBarry Smith        PetscReal PETSC_SQRT_MACHINE_EPSILON
235*6dd63270SBarry Smith        PetscReal PETSC_SMALL
236*6dd63270SBarry Smith        PetscReal PETSC_INFINITY
237*6dd63270SBarry Smith        PetscReal PETSC_NINFINITY
238*6dd63270SBarry Smith
239*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
240*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_CHARACTER
241*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_INTEGER
242*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_INTEGER_ARRAY
243*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_INTEGER_POINTER
244*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_SCALAR_POINTER
245*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_REAL_POINTER
246*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_DOUBLE
247*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_SCALAR
248*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_SCALAR_ARRAY
249*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_REAL
250*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_REAL_ARRAY
251*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_BOOL
252*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_ENUM
253*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_MPI_COMM
254*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_PI
255*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_MAX_REAL
256*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_MIN_REAL
257*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_MACHINE_EPSILON
258*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_SQRT_MACHINE_EPSILON
259*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_SMALL
260*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_INFINITY
261*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NINFINITY
262*6dd63270SBarry Smith#endif
263*6dd63270SBarry Smith
264*6dd63270SBarry Smith      type tPetscReal2d
265*6dd63270SBarry Smith        sequence
266*6dd63270SBarry Smith        PetscReal, dimension(:), pointer :: ptr
267*6dd63270SBarry Smith      end type tPetscReal2D
268*6dd63270SBarry Smith
269*6dd63270SBarry Smith       end module
270*6dd63270SBarry Smith
271*6dd63270SBarry Smith!     ------------------------------------------------------------------------
272*6dd63270SBarry Smith
273*6dd63270SBarry Smith        module petscsys
274*6dd63270SBarry Smith        use,intrinsic :: iso_c_binding
275*6dd63270SBarry Smith        use petscsysdef
276*6dd63270SBarry Smith
277*6dd63270SBarry Smith#include <../src/sys/ftn-mod/petscsys.h90>
278*6dd63270SBarry Smith#include <../src/sys/ftn-mod/petscviewer.h90>
279*6dd63270SBarry Smith#include <../ftn/sys/petscall.h90>
280*6dd63270SBarry Smith
281*6dd63270SBarry Smith        interface PetscInitialize
282*6dd63270SBarry Smith          module procedure PetscInitializeWithHelp, PetscInitializeNoHelp, PetscInitializeNoArguments
283*6dd63270SBarry Smith        end interface
284*6dd63270SBarry Smith
285*6dd63270SBarry Smith      interface PetscSetFortranBasePointers
286*6dd63270SBarry Smith         subroutine PetscSetFortranBasePointers(                        &
287*6dd63270SBarry Smith     &     PETSC_NULL_CHARACTER,          &
288*6dd63270SBarry Smith     &     PETSC_NULL_INTEGER,PETSC_NULL_SCALAR,                        &
289*6dd63270SBarry Smith     &     PETSC_NULL_DOUBLE,PETSC_NULL_REAL,                           &
290*6dd63270SBarry Smith     &     PETSC_NULL_BOOL,PETSC_NULL_ENUM,PETSC_NULL_FUNCTION,         &
291*6dd63270SBarry Smith     &     PETSC_NULL_MPI_COMM,                                         &
292*6dd63270SBarry Smith     &     PETSC_NULL_INTEGER_ARRAY,PETSC_NULL_SCALAR_ARRAY,            &
293*6dd63270SBarry Smith     &     PETSC_NULL_REAL_ARRAY, APETSC_NULL_INTEGER_POINTER,           &
294*6dd63270SBarry Smith     &     PETSC_NULL_SCALAR_POINTER, PETSC_NULL_REAL_POINTER)
295*6dd63270SBarry Smith          character(*) PETSC_NULL_CHARACTER
296*6dd63270SBarry Smith          PetscInt PETSC_NULL_INTEGER
297*6dd63270SBarry Smith          PetscScalar PETSC_NULL_SCALAR
298*6dd63270SBarry Smith          PetscFortranDouble PETSC_NULL_DOUBLE
299*6dd63270SBarry Smith          PetscReal PETSC_NULL_REAL
300*6dd63270SBarry Smith          PetscBool PETSC_NULL_BOOL
301*6dd63270SBarry Smith          PetscEnum PETSC_NULL_ENUM
302*6dd63270SBarry Smith          external PETSC_NULL_FUNCTION
303*6dd63270SBarry Smith          MPI_Comm PETSC_NULL_MPI_COMM
304*6dd63270SBarry Smith          PetscInt PETSC_NULL_INTEGER_ARRAY(*)
305*6dd63270SBarry Smith          PetscScalar PETSC_NULL_SCALAR_ARRAY(*)
306*6dd63270SBarry Smith          PetscReal PETSC_NULL_REAL_ARRAY(*)
307*6dd63270SBarry Smith          PetscInt, pointer :: APETSC_NULL_INTEGER_POINTER(:)
308*6dd63270SBarry Smith          PetscScalar, pointer :: PETSC_NULL_SCALAR_POINTER(:)
309*6dd63270SBarry Smith          PetscReal, pointer :: PETSC_NULL_REAL_POINTER(:)
310*6dd63270SBarry Smith         end subroutine PetscSetFortranBasePointers
311*6dd63270SBarry Smith      end interface
312*6dd63270SBarry Smith
313*6dd63270SBarry Smith      interface PetscOptionsString
314*6dd63270SBarry Smith      subroutine PetscOptionsString(string, text, man, default, value, flg, ierr)
315*6dd63270SBarry Smith        character(*) string, text, man, default, value
316*6dd63270SBarry Smith        PetscBool flg
317*6dd63270SBarry Smith        PetscErrorCode ierr
318*6dd63270SBarry Smith      end subroutine PetscOptionsString
319*6dd63270SBarry Smith      end interface
320*6dd63270SBarry Smith
321*6dd63270SBarry Smith        Interface petscbinaryread
322*6dd63270SBarry Smith        subroutine petscbinaryreadcomplex(fd,data,num,count,type,z)
323*6dd63270SBarry Smith          import ePetscDataType
324*6dd63270SBarry Smith          integer4 fd
325*6dd63270SBarry Smith          PetscComplex data(*)
326*6dd63270SBarry Smith          PetscInt num
327*6dd63270SBarry Smith          PetscInt count
328*6dd63270SBarry Smith          PetscDataType type
329*6dd63270SBarry Smith          PetscErrorCode z
330*6dd63270SBarry Smith        end subroutine
331*6dd63270SBarry Smith        subroutine petscbinaryreadreal(fd,data,num,count,type,z)
332*6dd63270SBarry Smith          import ePetscDataType
333*6dd63270SBarry Smith          integer4 fd
334*6dd63270SBarry Smith          PetscReal data(*)
335*6dd63270SBarry Smith          PetscInt num
336*6dd63270SBarry Smith          PetscInt count
337*6dd63270SBarry Smith          PetscDataType type
338*6dd63270SBarry Smith          PetscErrorCode z
339*6dd63270SBarry Smith        end subroutine
340*6dd63270SBarry Smith        subroutine petscbinaryreadint(fd,data,num,count,type,z)
341*6dd63270SBarry Smith          import ePetscDataType
342*6dd63270SBarry Smith          integer4 fd
343*6dd63270SBarry Smith          PetscInt data(*)
344*6dd63270SBarry Smith          PetscInt num
345*6dd63270SBarry Smith          PetscInt count
346*6dd63270SBarry Smith          PetscDataType type
347*6dd63270SBarry Smith          PetscErrorCode z
348*6dd63270SBarry Smith        end subroutine
349*6dd63270SBarry Smith        subroutine petscbinaryreadcomplex1(fd,data,num,count,type,z)
350*6dd63270SBarry Smith          import ePetscDataType
351*6dd63270SBarry Smith          integer4 fd
352*6dd63270SBarry Smith          PetscComplex data
353*6dd63270SBarry Smith          PetscInt num
354*6dd63270SBarry Smith          PetscInt count
355*6dd63270SBarry Smith          PetscDataType type
356*6dd63270SBarry Smith          PetscErrorCode z
357*6dd63270SBarry Smith        end subroutine
358*6dd63270SBarry Smith        subroutine petscbinaryreadreal1(fd,data,num,count,type,z)
359*6dd63270SBarry Smith          import ePetscDataType
360*6dd63270SBarry Smith          integer4 fd
361*6dd63270SBarry Smith          PetscReal data
362*6dd63270SBarry Smith          PetscInt num
363*6dd63270SBarry Smith          PetscInt count
364*6dd63270SBarry Smith          PetscDataType type
365*6dd63270SBarry Smith          PetscErrorCode z
366*6dd63270SBarry Smith        end subroutine
367*6dd63270SBarry Smith        subroutine petscbinaryreadint1(fd,data,num,count,type,z)
368*6dd63270SBarry Smith          import ePetscDataType
369*6dd63270SBarry Smith          integer4 fd
370*6dd63270SBarry Smith          PetscInt data
371*6dd63270SBarry Smith          PetscInt num
372*6dd63270SBarry Smith          PetscInt count
373*6dd63270SBarry Smith          PetscDataType type
374*6dd63270SBarry Smith          PetscErrorCode z
375*6dd63270SBarry Smith        end subroutine
376*6dd63270SBarry Smith        subroutine petscbinaryreadcomplexcnt(fd,data,num,count,type,z)
377*6dd63270SBarry Smith          import ePetscDataType
378*6dd63270SBarry Smith          integer4 fd
379*6dd63270SBarry Smith          PetscComplex data(*)
380*6dd63270SBarry Smith          PetscInt num
381*6dd63270SBarry Smith          PetscInt count(1)
382*6dd63270SBarry Smith          PetscDataType type
383*6dd63270SBarry Smith          PetscErrorCode z
384*6dd63270SBarry Smith        end subroutine
385*6dd63270SBarry Smith        subroutine petscbinaryreadrealcnt(fd,data,num,count,type,z)
386*6dd63270SBarry Smith          import ePetscDataType
387*6dd63270SBarry Smith          integer4 fd
388*6dd63270SBarry Smith          PetscReal data(*)
389*6dd63270SBarry Smith          PetscInt num
390*6dd63270SBarry Smith          PetscInt count(1)
391*6dd63270SBarry Smith          PetscDataType type
392*6dd63270SBarry Smith          PetscErrorCode z
393*6dd63270SBarry Smith        end subroutine
394*6dd63270SBarry Smith        subroutine petscbinaryreadintcnt(fd,data,num,count,type,z)
395*6dd63270SBarry Smith          import ePetscDataType
396*6dd63270SBarry Smith          integer4 fd
397*6dd63270SBarry Smith          PetscInt data(*)
398*6dd63270SBarry Smith          PetscInt num
399*6dd63270SBarry Smith          PetscInt count(1)
400*6dd63270SBarry Smith          PetscDataType type
401*6dd63270SBarry Smith          PetscErrorCode z
402*6dd63270SBarry Smith        end subroutine
403*6dd63270SBarry Smith        subroutine petscbinaryreadcomplex1cnt(fd,data,num,count,type,z)
404*6dd63270SBarry Smith          import ePetscDataType
405*6dd63270SBarry Smith          integer4 fd
406*6dd63270SBarry Smith          PetscComplex data
407*6dd63270SBarry Smith          PetscInt num
408*6dd63270SBarry Smith          PetscInt count(1)
409*6dd63270SBarry Smith          PetscDataType type
410*6dd63270SBarry Smith          PetscErrorCode z
411*6dd63270SBarry Smith        end subroutine
412*6dd63270SBarry Smith        subroutine petscbinaryreadreal1cnt(fd,data,num,count,type,z)
413*6dd63270SBarry Smith          import ePetscDataType
414*6dd63270SBarry Smith          integer4 fd
415*6dd63270SBarry Smith          PetscReal data
416*6dd63270SBarry Smith          PetscInt num
417*6dd63270SBarry Smith          PetscInt count(1)
418*6dd63270SBarry Smith          PetscDataType type
419*6dd63270SBarry Smith          PetscErrorCode z
420*6dd63270SBarry Smith        end subroutine
421*6dd63270SBarry Smith        subroutine petscbinaryreadint1cnt(fd,data,num,count,type,z)
422*6dd63270SBarry Smith          import ePetscDataType
423*6dd63270SBarry Smith          integer4 fd
424*6dd63270SBarry Smith          PetscInt data
425*6dd63270SBarry Smith          PetscInt num
426*6dd63270SBarry Smith          PetscInt count(1)
427*6dd63270SBarry Smith          PetscDataType type
428*6dd63270SBarry Smith          PetscErrorCode z
429*6dd63270SBarry Smith        end subroutine
430*6dd63270SBarry Smith        end Interface
431*6dd63270SBarry Smith
432*6dd63270SBarry Smith        Interface petscbinarywrite
433*6dd63270SBarry Smith        subroutine petscbinarywritecomplex(fd,data,num,type,z)
434*6dd63270SBarry Smith          import ePetscDataType
435*6dd63270SBarry Smith          integer4 fd
436*6dd63270SBarry Smith          PetscComplex data(*)
437*6dd63270SBarry Smith          PetscInt num
438*6dd63270SBarry Smith          PetscDataType type
439*6dd63270SBarry Smith          PetscErrorCode z
440*6dd63270SBarry Smith        end subroutine
441*6dd63270SBarry Smith        subroutine petscbinarywritereal(fd,data,num,type,z)
442*6dd63270SBarry Smith          import ePetscDataType
443*6dd63270SBarry Smith          integer4 fd
444*6dd63270SBarry Smith          PetscReal data(*)
445*6dd63270SBarry Smith          PetscInt num
446*6dd63270SBarry Smith          PetscDataType type
447*6dd63270SBarry Smith          PetscErrorCode z
448*6dd63270SBarry Smith        end subroutine
449*6dd63270SBarry Smith        subroutine petscbinarywriteint(fd,data,num,type,z)
450*6dd63270SBarry Smith          import ePetscDataType
451*6dd63270SBarry Smith          integer4 fd
452*6dd63270SBarry Smith          PetscInt data(*)
453*6dd63270SBarry Smith          PetscInt num
454*6dd63270SBarry Smith          PetscDataType type
455*6dd63270SBarry Smith          PetscErrorCode z
456*6dd63270SBarry Smith        end subroutine
457*6dd63270SBarry Smith        subroutine petscbinarywritecomplex1(fd,data,num,type,z)
458*6dd63270SBarry Smith          import ePetscDataType
459*6dd63270SBarry Smith          integer4 fd
460*6dd63270SBarry Smith          PetscComplex data
461*6dd63270SBarry Smith          PetscInt num
462*6dd63270SBarry Smith          PetscDataType type
463*6dd63270SBarry Smith          PetscErrorCode z
464*6dd63270SBarry Smith        end subroutine
465*6dd63270SBarry Smith        subroutine petscbinarywritereal1(fd,data,num,type,z)
466*6dd63270SBarry Smith          import ePetscDataType
467*6dd63270SBarry Smith          integer4 fd
468*6dd63270SBarry Smith          PetscReal data
469*6dd63270SBarry Smith          PetscInt num
470*6dd63270SBarry Smith          PetscDataType type
471*6dd63270SBarry Smith          PetscErrorCode z
472*6dd63270SBarry Smith        end subroutine
473*6dd63270SBarry Smith        subroutine petscbinarywriteint1(fd,data,num,type,z)
474*6dd63270SBarry Smith          import ePetscDataType
475*6dd63270SBarry Smith          integer4 fd
476*6dd63270SBarry Smith          PetscInt data
477*6dd63270SBarry Smith          PetscInt num
478*6dd63270SBarry Smith          PetscDataType type
479*6dd63270SBarry Smith          PetscErrorCode z
480*6dd63270SBarry Smith          end subroutine
481*6dd63270SBarry Smith        end Interface
482*6dd63270SBarry Smith
483*6dd63270SBarry Smith      contains
484*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
485*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PetscInitializeWithHelp
486*6dd63270SBarry Smith#endif
487*6dd63270SBarry Smith      subroutine PetscInitializeWithHelp(filename,help,ierr)
488*6dd63270SBarry Smith          character(len=*)           :: filename
489*6dd63270SBarry Smith          character(len=*)           :: help
490*6dd63270SBarry Smith          PetscErrorCode             :: ierr
491*6dd63270SBarry Smith
492*6dd63270SBarry Smith          if (filename .ne. PETSC_NULL_CHARACTER) then
493*6dd63270SBarry Smith             call PetscInitializeF(trim(filename),help,ierr)
494*6dd63270SBarry Smith             CHKERRQ(ierr)
495*6dd63270SBarry Smith          else
496*6dd63270SBarry Smith             call PetscInitializeF(filename,help,ierr)
497*6dd63270SBarry Smith             CHKERRQ(ierr)
498*6dd63270SBarry Smith          endif
499*6dd63270SBarry Smith        end subroutine PetscInitializeWithHelp
500*6dd63270SBarry Smith
501*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
502*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PetscInitializeNoHelp
503*6dd63270SBarry Smith#endif
504*6dd63270SBarry Smith        subroutine PetscInitializeNoHelp(filename,ierr)
505*6dd63270SBarry Smith          character(len=*)           :: filename
506*6dd63270SBarry Smith          PetscErrorCode             :: ierr
507*6dd63270SBarry Smith
508*6dd63270SBarry Smith          if (filename .ne. PETSC_NULL_CHARACTER) then
509*6dd63270SBarry Smith             call PetscInitializeF(trim(filename),PETSC_NULL_CHARACTER,ierr)
510*6dd63270SBarry Smith             CHKERRQ(ierr)
511*6dd63270SBarry Smith          else
512*6dd63270SBarry Smith             call PetscInitializeF(filename,PETSC_NULL_CHARACTER,ierr)
513*6dd63270SBarry Smith             CHKERRQ(ierr)
514*6dd63270SBarry Smith          endif
515*6dd63270SBarry Smith        end subroutine PetscInitializeNoHelp
516*6dd63270SBarry Smith
517*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
518*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PetscInitializeNoArguments
519*6dd63270SBarry Smith#endif
520*6dd63270SBarry Smith        subroutine PetscInitializeNoArguments(ierr)
521*6dd63270SBarry Smith          PetscErrorCode             :: ierr
522*6dd63270SBarry Smith
523*6dd63270SBarry Smith          call PetscInitializeF(PETSC_NULL_CHARACTER,PETSC_NULL_CHARACTER,ierr)
524*6dd63270SBarry Smith          CHKERRQ(ierr)
525*6dd63270SBarry Smith          end subroutine PetscInitializeNoArguments
526*6dd63270SBarry Smith
527*6dd63270SBarry Smith#include <../ftn/sys/petscall.hf90>
528*6dd63270SBarry Smith        end module
529*6dd63270SBarry Smith
530*6dd63270SBarry Smith        Subroutine F90ArraySetRealPointer(array, sz, j, T)
531*6dd63270SBarry Smith          use petscsysdef
532*6dd63270SBarry Smith          PetscInt                j,sz
533*6dd63270SBarry Smith          PetscReal, target    :: array(1:sz)
534*6dd63270SBarry Smith          PetscReal2d, pointer :: T(:)
535*6dd63270SBarry Smith          T(j+1)%ptr=>array
536*6dd63270SBarry Smith        End Subroutine
537*6dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
538*6dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT:: F90ArraySetRealPointer
539*6dd63270SBarry Smith#endif
540*6dd63270SBarry Smith
541*6dd63270SBarry Smith!      ------------------------------------------------------------------------
542*6dd63270SBarry Smith!      TODO: generate the modules below by looping over
543*6dd63270SBarry Smith!            ftn/sys/XXX.h90
544*6dd63270SBarry Smith!            and skiping those in petscall.h
545*6dd63270SBarry Smith
546*6dd63270SBarry Smith        module petscbag
547*6dd63270SBarry Smith        use petscsys
548*6dd63270SBarry Smith#include <../include/petsc/finclude/petscbag.h>
549*6dd63270SBarry Smith#include <../ftn/sys/petscbag.h>
550*6dd63270SBarry Smith#include <../ftn/sys/petscbag.h90>
551*6dd63270SBarry Smith        contains
552*6dd63270SBarry Smith
553*6dd63270SBarry Smith#include <../ftn/sys/petscbag.hf90>
554*6dd63270SBarry Smith        end module
555*6dd63270SBarry Smith
556*6dd63270SBarry Smith!     ------------------------------------------------------------------------
557*6dd63270SBarry Smith
558*6dd63270SBarry Smith        module petscbm
559*6dd63270SBarry Smith        use petscsys
560*6dd63270SBarry Smith#include <../include/petsc/finclude/petscbm.h>
561*6dd63270SBarry Smith#include <../ftn/sys/petscbm.h>
562*6dd63270SBarry Smith#include <../ftn/sys/petscbm.h90>
563*6dd63270SBarry Smith        contains
564*6dd63270SBarry Smith
565*6dd63270SBarry Smith#include <../ftn/sys/petscbm.hf90>
566*6dd63270SBarry Smith       end module
567*6dd63270SBarry Smith
568*6dd63270SBarry Smith!     ------------------------------------------------------------------------
569*6dd63270SBarry Smith
570*6dd63270SBarry Smith        module petscmatlab
571*6dd63270SBarry Smith        use petscsys
572*6dd63270SBarry Smith#include <../include/petsc/finclude/petscmatlab.h>
573*6dd63270SBarry Smith#include <../ftn/sys/petscmatlab.h>
574*6dd63270SBarry Smith#include <../ftn/sys/petscmatlab.h90>
575*6dd63270SBarry Smith
576*6dd63270SBarry Smith        contains
577*6dd63270SBarry Smith
578*6dd63270SBarry Smith#include <../ftn/sys/petscmatlab.hf90>
579*6dd63270SBarry Smith        end module
580*6dd63270SBarry Smith
581*6dd63270SBarry Smith!     ------------------------------------------------------------------------
582*6dd63270SBarry Smith
583*6dd63270SBarry Smith        module petscdraw
584*6dd63270SBarry Smith        use petscsys
585*6dd63270SBarry Smith#include <../include/petsc/finclude/petscdraw.h>
586*6dd63270SBarry Smith#include <../ftn/sys/petscdraw.h>
587*6dd63270SBarry Smith#include <../ftn/sys/petscdraw.h90>
588*6dd63270SBarry Smith
589*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_BASIC_COLORS = 33
590*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_ROTATE = -1
591*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_WHITE = 0
592*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_BLACK = 1
593*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_RED = 2
594*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_GREEN = 3
595*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_CYAN = 4
596*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_BLUE = 5
597*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_MAGENTA = 6
598*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_AQUAMARINE = 7
599*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_FORESTGREEN = 8
600*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_ORANGE = 9
601*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_VIOLET = 10
602*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_BROWN = 11
603*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_PINK = 12
604*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_CORAL = 13
605*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_GRAY = 14
606*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_YELLOW = 15
607*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_GOLD = 16
608*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_LIGHTPINK = 17
609*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_MEDIUMTURQUOISE = 18
610*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_KHAKI = 19
611*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_DIMGRAY = 20
612*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_YELLOWGREEN = 21
613*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_SKYBLUE = 22
614*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_DARKGREEN = 23
615*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_NAVYBLUE = 24
616*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_SANDYBROWN = 25
617*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_CADETBLUE = 26
618*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_POWDERBLUE = 27
619*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_DEEPPINK = 28
620*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_THISTLE = 29
621*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_LIMEGREEN = 30
622*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_LAVENDERBLUSH = 31
623*6dd63270SBarry Smith      PetscEnum, parameter :: PETSC_DRAW_PLUM = 32
624*6dd63270SBarry Smith
625*6dd63270SBarry Smith      contains
626*6dd63270SBarry Smith
627*6dd63270SBarry Smith#include <../ftn/sys/petscdraw.hf90>
628*6dd63270SBarry Smith      end module
629*6dd63270SBarry Smith
630*6dd63270SBarry Smith!     ------------------------------------------------------------------------
631*6dd63270SBarry Smith
632*6dd63270SBarry Smith        subroutine PetscSetCOMM(c1,c2)
633*6dd63270SBarry Smith        use petscmpi, only: PETSC_COMM_WORLD,PETSC_COMM_SELF
634*6dd63270SBarry Smith
635*6dd63270SBarry Smith        implicit none
636*6dd63270SBarry Smith        MPI_Comm c1,c2
637*6dd63270SBarry Smith
638*6dd63270SBarry Smith        PETSC_COMM_WORLD    = c1
639*6dd63270SBarry Smith        PETSC_COMM_SELF     = c2
640*6dd63270SBarry Smith        end
641*6dd63270SBarry Smith
642*6dd63270SBarry Smith        subroutine PetscGetCOMM(c1)
643*6dd63270SBarry Smith        use petscmpi, only: PETSC_COMM_WORLD
644*6dd63270SBarry Smith        implicit none
645*6dd63270SBarry Smith        MPI_Comm c1
646*6dd63270SBarry Smith
647*6dd63270SBarry Smith        c1 = PETSC_COMM_WORLD
648*6dd63270SBarry Smith        end
649*6dd63270SBarry Smith
650*6dd63270SBarry Smith        subroutine PetscSetModuleBlock()
651*6dd63270SBarry Smith        use petscsys!, only: PETSC_NULL_CHARACTER,PETSC_NULL_INTEGER,&
652*6dd63270SBarry Smith           !  PETSC_NULL_SCALAR,PETSC_NULL_DOUBLE,PETSC_NULL_REAL,&
653*6dd63270SBarry Smith           !  PETSC_NULL_BOOL,PETSC_NULL_FUNCTION,PETSC_NULL_MPI_COMM
654*6dd63270SBarry Smith        implicit none
655*6dd63270SBarry Smith
656*6dd63270SBarry Smith        call PetscSetFortranBasePointers(PETSC_NULL_CHARACTER,          &
657*6dd63270SBarry Smith     &     PETSC_NULL_INTEGER,PETSC_NULL_SCALAR,                        &
658*6dd63270SBarry Smith     &     PETSC_NULL_DOUBLE,PETSC_NULL_REAL,                           &
659*6dd63270SBarry Smith     &     PETSC_NULL_BOOL,PETSC_NULL_ENUM,PETSC_NULL_FUNCTION,         &
660*6dd63270SBarry Smith     &     PETSC_NULL_MPI_COMM,                                         &
661*6dd63270SBarry Smith     &     PETSC_NULL_INTEGER_ARRAY,PETSC_NULL_SCALAR_ARRAY,            &
662*6dd63270SBarry Smith     &     PETSC_NULL_REAL_ARRAY, PETSC_NULL_INTEGER_POINTER,           &
663*6dd63270SBarry Smith     &     PETSC_NULL_SCALAR_POINTER, PETSC_NULL_REAL_POINTER)
664*6dd63270SBarry Smith        end
665*6dd63270SBarry Smith
666*6dd63270SBarry Smith        subroutine PetscSetModuleBlockMPI(freal,fscalar,fsum,finteger)
667*6dd63270SBarry Smith        use petscmpi, only: MPIU_REAL,MPIU_SUM,MPIU_SCALAR,MPIU_INTEGER
668*6dd63270SBarry Smith        implicit none
669*6dd63270SBarry Smith
670*6dd63270SBarry Smith        integer4 freal,fscalar,fsum,finteger
671*6dd63270SBarry Smith
672*6dd63270SBarry Smith        MPIU_REAL    = freal
673*6dd63270SBarry Smith        MPIU_SCALAR  = fscalar
674*6dd63270SBarry Smith        MPIU_SUM     = fsum
675*6dd63270SBarry Smith        MPIU_INTEGER = finteger
676*6dd63270SBarry Smith
677*6dd63270SBarry Smith        end
678*6dd63270SBarry Smith
679*6dd63270SBarry Smith        subroutine PetscSetModuleBlockNumeric(pi,maxreal,minreal,eps,       &
680*6dd63270SBarry Smith     &     seps,small,pinf,pninf)
681*6dd63270SBarry Smith        use petscsys, only: PETSC_PI,PETSC_MAX_REAL,PETSC_MIN_REAL,&
682*6dd63270SBarry Smith             PETSC_MACHINE_EPSILON,PETSC_SQRT_MACHINE_EPSILON,&
683*6dd63270SBarry Smith             PETSC_SMALL,PETSC_INFINITY,PETSC_NINFINITY
684*6dd63270SBarry Smith        implicit none
685*6dd63270SBarry Smith
686*6dd63270SBarry Smith        PetscReal pi,maxreal,minreal,eps,seps
687*6dd63270SBarry Smith        PetscReal small,pinf,pninf
688*6dd63270SBarry Smith
689*6dd63270SBarry Smith        PETSC_PI = pi
690*6dd63270SBarry Smith        PETSC_MAX_REAL = maxreal
691*6dd63270SBarry Smith        PETSC_MIN_REAL = minreal
692*6dd63270SBarry Smith        PETSC_MACHINE_EPSILON = eps
693*6dd63270SBarry Smith        PETSC_SQRT_MACHINE_EPSILON = seps
694*6dd63270SBarry Smith        PETSC_SMALL = small
695*6dd63270SBarry Smith        PETSC_INFINITY = pinf
696*6dd63270SBarry Smith        PETSC_NINFINITY = pninf
697*6dd63270SBarry Smith
698*6dd63270SBarry Smith        end
699*6dd63270SBarry Smith
700