xref: /petsc/src/sys/ftn-mod/petscsysmod.F90 (revision b06eb4cd3db6f436e3907d9ad23211c2914d8916)
16dd63270SBarry Smithmodule petscmpi
2fe66ebccSMartin Diehl  use, intrinsic :: ISO_C_binding
36dd63270SBarry Smith#include <petscconf.h>
46dd63270SBarry Smith#include "petsc/finclude/petscsys.h"
56dd63270SBarry Smith#if defined(PETSC_HAVE_MPIUNI)
66dd63270SBarry Smith  use mpiuni
76dd63270SBarry Smith#else
8*b06eb4cdSBarry Smith#if defined(PETSC_HAVE_MPI_FTN_MODULE)
9*b06eb4cdSBarry Smith  use PETSC_MPI_FTN_MODULE
106dd63270SBarry Smith#else
116dd63270SBarry Smith#include "mpif.h"
126dd63270SBarry Smith#endif
136dd63270SBarry Smith#endif
146dd63270SBarry Smith
15*b06eb4cdSBarry Smith  MPIU_Datatype :: MPIU_REAL
16*b06eb4cdSBarry Smith  MPIU_Datatype :: MPIU_SCALAR
17*b06eb4cdSBarry Smith  MPIU_Datatype :: MPIU_INTEGER
18*b06eb4cdSBarry Smith  MPIU_Op :: MPIU_SUM
196dd63270SBarry Smith
20*b06eb4cdSBarry Smith  MPIU_Comm:: PETSC_COMM_WORLD
21*b06eb4cdSBarry Smith  MPIU_Comm:: PETSC_COMM_SELF
226dd63270SBarry Smith
236dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
246dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_REAL
256dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_SUM
266dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_SCALAR
276dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::MPIU_INTEGER
286dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_COMM_SELF
296dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_COMM_WORLD
306dd63270SBarry Smith#endif
310f7a542fSMartin Diehlend module petscmpi
326dd63270SBarry Smith
336dd63270SBarry Smith! ------------------------------------------------------------------------
346dd63270SBarry Smithmodule petscsysdef
35fe66ebccSMartin Diehl  use, intrinsic :: ISO_C_binding
366dd63270SBarry Smith  use petscmpi
370f7a542fSMartin Diehl  PetscReal, parameter :: PetscReal_Private = 1.0
3802c639afSMartin Diehl  integer, parameter   :: PETSC_REAL_KIND = kind(PetscReal_Private)
396dd63270SBarry Smith
40*b06eb4cdSBarry Smith  PetscScalar, parameter :: PetscScalar_Private = (1.0, 0.0)
41*b06eb4cdSBarry Smith  integer, parameter   :: PETSC_SCALAR_KIND = kind(PetscScalar_Private)
42*b06eb4cdSBarry Smith
43*b06eb4cdSBarry Smith  PetscInt, parameter :: PetscInt_Private = 1
44*b06eb4cdSBarry Smith  integer, parameter   :: PETSC_INT_KIND = kind(PetscInt_Private)
45*b06eb4cdSBarry Smith
46*b06eb4cdSBarry Smith  PetscMPIInt, parameter :: PetscMPIInt_Private = 1
47*b06eb4cdSBarry Smith  integer, parameter   :: PETSC_MPIINT_KIND = kind(PetscMPIInt_Private)
48*b06eb4cdSBarry Smith
491dc74096SMartin Diehl  PetscBool, parameter :: PETSC_TRUE = .true._C_BOOL
501dc74096SMartin Diehl  PetscBool, parameter :: PETSC_FALSE = .false._C_BOOL
516dd63270SBarry Smith
526dd63270SBarry Smith  PetscInt, parameter :: PETSC_DECIDE = -1
53*b06eb4cdSBarry Smith  PetscInt, parameter :: PETSC_DECIDE_INTEGER = -1_PETSC_INT_KIND
540f7a542fSMartin Diehl  PetscReal, parameter :: PETSC_DECIDE_REAL = -1.0_PETSC_REAL_KIND
556dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
566dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE
576dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE_INTEGER
586dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DECIDE_REAL
596dd63270SBarry Smith#endif
606dd63270SBarry Smith
616dd63270SBarry Smith  PetscInt, parameter :: PETSC_DETERMINE = -1
626dd63270SBarry Smith  PetscInt, parameter :: PETSC_DETERMINE_INTEGER = -1
630f7a542fSMartin Diehl  PetscReal, parameter :: PETSC_DETERMINE_REAL = -1.0_PETSC_REAL_KIND
646dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
656dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE
666dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE_INTEGER
676dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DETERMINE_REAL
686dd63270SBarry Smith#endif
696dd63270SBarry Smith
706dd63270SBarry Smith  PetscInt, parameter :: PETSC_CURRENT = -2
716dd63270SBarry Smith  PetscInt, parameter :: PETSC_CURRENT_INTEGER = -2
720f7a542fSMartin Diehl  PetscReal, parameter :: PETSC_CURRENT_REAL = -2.0_PETSC_REAL_KIND
736dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
746dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT
756dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT_INTEGER
766dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_CURRENT_REAL
776dd63270SBarry Smith#endif
786dd63270SBarry Smith
796dd63270SBarry Smith  PetscInt, parameter :: PETSC_DEFAULT = -2
806dd63270SBarry Smith  PetscInt, parameter :: PETSC_DEFAULT_INTEGER = -2
810f7a542fSMartin Diehl  PetscReal, parameter :: PETSC_DEFAULT_REAL = -2.0_PETSC_REAL_KIND
826dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
836dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT
846dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_INTEGER
856dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_DEFAULT_REAL
866dd63270SBarry Smith#endif
870f7a542fSMartin Diehl
886dd63270SBarry Smith  PetscFortranAddr, parameter :: PETSC_STDOUT = 0
896dd63270SBarry Smith!
906dd63270SBarry Smith!  PETSc DataTypes
916dd63270SBarry Smith!
926dd63270SBarry Smith#if defined(PETSC_USE_REAL_SINGLE)
936dd63270SBarry Smith#define PETSC_REAL PETSC_FLOAT
946dd63270SBarry Smith#elif defined(PETSC_USE_REAL___FLOAT128)
956dd63270SBarry Smith#define PETSC_REAL PETSC___FLOAT128
966dd63270SBarry Smith#else
976dd63270SBarry Smith#define PETSC_REAL PETSC_DOUBLE
986dd63270SBarry Smith#endif
996dd63270SBarry Smith#define PETSC_FORTRANADDR PETSC_LONG
1006dd63270SBarry Smith
1016dd63270SBarry Smith! PETSc mathematics include file. Defines certain basic mathematical
1026dd63270SBarry Smith! constants and functions for working with single and double precision
1036dd63270SBarry Smith! floating point numbers as well as complex and integers.
1046dd63270SBarry Smith!
1056dd63270SBarry Smith! Representation of complex i
1060f7a542fSMartin Diehl  PetscComplex, parameter :: PETSC_i = (0.0_PETSC_REAL_KIND, 1.0_PETSC_REAL_KIND)
1076dd63270SBarry Smith
1086dd63270SBarry Smith! A PETSC_NULL_FUNCTION pointer
1096dd63270SBarry Smith!
1106dd63270SBarry Smith  external PETSC_NULL_FUNCTION
1116dd63270SBarry Smith!
1126dd63270SBarry Smith! Possible arguments to PetscPushErrorHandler()
1136dd63270SBarry Smith!
1146dd63270SBarry Smith  external PETSCTRACEBACKERRORHANDLER
1156dd63270SBarry Smith  external PETSCABORTERRORHANDLER
1166dd63270SBarry Smith  external PETSCEMACSCLIENTERRORHANDLER
1176dd63270SBarry Smith  external PETSCATTACHDEBUGGERERRORHANDLER
1186dd63270SBarry Smith  external PETSCIGNOREERRORHANDLER
1196dd63270SBarry Smith!
1206dd63270SBarry Smith  external PetscIsInfOrNanScalar
1216dd63270SBarry Smith  external PetscIsInfOrNanReal
1226dd63270SBarry Smith  PetscBool PetscIsInfOrNanScalar
1236dd63270SBarry Smith  PetscBool PetscIsInfOrNanReal
1246dd63270SBarry Smith
1256dd63270SBarry Smith#include <../ftn/sys/petscall.h>
1266dd63270SBarry Smith
1276dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_STDOUT_SELF = tPetscViewer(9)
1286dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_DRAW_WORLD = tPetscViewer(4)
1296dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_DRAW_SELF = tPetscViewer(5)
1306dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_SOCKET_WORLD = tPetscViewer(6)
1316dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_SOCKET_SELF = tPetscViewer(7)
1326dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_STDOUT_WORLD = tPetscViewer(8)
1336dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_STDERR_WORLD = tPetscViewer(10)
1346dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_STDERR_SELF = tPetscViewer(11)
1356dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_BINARY_WORLD = tPetscViewer(12)
1366dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_BINARY_SELF = tPetscViewer(13)
1376dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_MATLAB_WORLD = tPetscViewer(14)
1386dd63270SBarry Smith  PetscViewer, parameter :: PETSC_VIEWER_MATLAB_SELF = tPetscViewer(15)
1396dd63270SBarry Smith
1406dd63270SBarry Smith  PetscViewer PETSC_VIEWER_STDOUT_
1416dd63270SBarry Smith  PetscViewer PETSC_VIEWER_DRAW_
1426dd63270SBarry Smith  external PETSC_VIEWER_STDOUT_
1436dd63270SBarry Smith  external PETSC_VIEWER_DRAW_
1446dd63270SBarry Smith  external PetscViewerAndFormatDestroy
1456dd63270SBarry Smith
1466dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
1476dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_STDOUT_SELF
1486dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_DRAW_WORLD
1496dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_DRAW_SELF
1506dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_SOCKET_WORLD
1516dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_SOCKET_SELF
1526dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_STDOUT_WORLD
1536dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_STDERR_WORLD
1546dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_STDERR_SELF
1556dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_BINARY_WORLD
1566dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_BINARY_SELF
1576dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_MATLAB_WORLD
1586dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_VIEWER_MATLAB_SELF
1596dd63270SBarry Smith#endif
1606dd63270SBarry Smith
1616dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_MEM = 55
1626dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_SUP = 56
1636dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_SUP_SYS = 57
1646dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ORDER = 58
1656dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_SIG = 59
1666dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_FP = 72
1676dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_COR = 74
1686dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_LIB = 76
1696dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_PLIB = 77
1706dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_MEMC = 78
1716dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_CONV_FAILED = 82
1726dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_USER = 83
1736dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_SYS = 88
1746dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_POINTER = 70
1756dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_MPI_LIB_INCOMP = 87
1766dd63270SBarry Smith
1776dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_SIZ = 60
1786dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_IDN = 61
1796dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_WRONG = 62
1806dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_CORRUPT = 64
1816dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_OUTOFRANGE = 63
1826dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_BADPTR = 68
1836dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_NOTSAMETYPE = 69
1846dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_NOTSAMECOMM = 80
1856dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_WRONGSTATE = 73
1866dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_TYPENOTSET = 89
1876dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_INCOMP = 75
1886dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_NULL = 85
1896dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_ARG_UNKNOWN_TYPE = 86
1906dd63270SBarry Smith
1916dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_FILE_OPEN = 65
1926dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_FILE_READ = 66
1936dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_FILE_WRITE = 67
1946dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_FILE_UNEXPECTED = 79
1956dd63270SBarry Smith
1966dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_MAT_LU_ZRPVT = 71
1976dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_MAT_CH_ZRPVT = 81
1986dd63270SBarry Smith
1996dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_INT_OVERFLOW = 84
2006dd63270SBarry Smith
2016dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_FLOP_COUNT = 90
2026dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_NOT_CONVERGED = 91
2036dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_MISSING_FACTOR = 92
2046dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_OPT_OVERWRITE = 93
2056dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_WRONG_MPI_SIZE = 94
2066dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_USER_INPUT = 95
2076dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_GPU_RESOURCE = 96
2086dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_GPU = 97
2096dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_MPI = 98
2106dd63270SBarry Smith  PetscErrorCode, parameter :: PETSC_ERR_RETURN = 99
2116dd63270SBarry Smith
2126dd63270SBarry Smith  character(len=80) :: PETSC_NULL_CHARACTER = ''
2136dd63270SBarry Smith  PetscInt PETSC_NULL_INTEGER, PETSC_NULL_INTEGER_ARRAY(1)
2146dd63270SBarry Smith  PetscInt, pointer :: PETSC_NULL_INTEGER_POINTER(:)
2156dd63270SBarry Smith  PetscScalar, pointer :: PETSC_NULL_SCALAR_POINTER(:)
2166dd63270SBarry Smith  PetscFortranDouble PETSC_NULL_DOUBLE
2176dd63270SBarry Smith  PetscScalar PETSC_NULL_SCALAR, PETSC_NULL_SCALAR_ARRAY(1)
2186dd63270SBarry Smith  PetscReal PETSC_NULL_REAL, PETSC_NULL_REAL_ARRAY(1)
2196dd63270SBarry Smith  PetscReal, pointer :: PETSC_NULL_REAL_POINTER(:)
2206dd63270SBarry Smith  PetscBool PETSC_NULL_BOOL
2216dd63270SBarry Smith  PetscEnum PETSC_NULL_ENUM
222*b06eb4cdSBarry Smith  MPIU_Comm PETSC_NULL_MPI_COMM
2236dd63270SBarry Smith!
2246dd63270SBarry Smith!     Basic math constants
2256dd63270SBarry Smith!
2266dd63270SBarry Smith  PetscReal PETSC_PI
2276dd63270SBarry Smith  PetscReal PETSC_MAX_REAL
2286dd63270SBarry Smith  PetscReal PETSC_MIN_REAL
2296dd63270SBarry Smith  PetscReal PETSC_MACHINE_EPSILON
2306dd63270SBarry Smith  PetscReal PETSC_SQRT_MACHINE_EPSILON
2316dd63270SBarry Smith  PetscReal PETSC_SMALL
2326dd63270SBarry Smith  PetscReal PETSC_INFINITY
2336dd63270SBarry Smith  PetscReal PETSC_NINFINITY
2346dd63270SBarry Smith
2356dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
2366dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_CHARACTER
2376dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_INTEGER
2386dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_INTEGER_ARRAY
2396dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_INTEGER_POINTER
2406dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_SCALAR_POINTER
2416dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_REAL_POINTER
2426dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_DOUBLE
2436dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_SCALAR
2446dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_SCALAR_ARRAY
2456dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_REAL
2466dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_REAL_ARRAY
2476dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_BOOL
2486dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_ENUM
2496dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NULL_MPI_COMM
2506dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_PI
2516dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_MAX_REAL
2526dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_MIN_REAL
2536dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_MACHINE_EPSILON
2546dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_SQRT_MACHINE_EPSILON
2556dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_SMALL
2566dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_INFINITY
2576dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PETSC_NINFINITY
2586dd63270SBarry Smith#endif
2596dd63270SBarry Smith
2606dd63270SBarry Smith  type tPetscReal2d
2616dd63270SBarry Smith    sequence
2626dd63270SBarry Smith    PetscReal, dimension(:), pointer :: ptr
2636dd63270SBarry Smith  end type tPetscReal2D
2646dd63270SBarry Smith
2650f7a542fSMartin Diehlend module petscsysdef
2666dd63270SBarry Smith
2676dd63270SBarry Smith!   ------------------------------------------------------------------------
2686dd63270SBarry Smith
2696dd63270SBarry Smithmodule petscsys
2700f7a542fSMartin Diehl  use, intrinsic :: ISO_C_binding
2716dd63270SBarry Smith  use petscsysdef
2726dd63270SBarry Smith
2736dd63270SBarry Smith#include <../src/sys/ftn-mod/petscsys.h90>
2746dd63270SBarry Smith#include <../src/sys/ftn-mod/petscviewer.h90>
2756dd63270SBarry Smith#include <../ftn/sys/petscall.h90>
2766dd63270SBarry Smith
2776dd63270SBarry Smith  interface PetscInitialize
2786dd63270SBarry Smith    module procedure PetscInitializeWithHelp, PetscInitializeNoHelp, PetscInitializeNoArguments
2790f7a542fSMartin Diehl  end interface PetscInitialize
2806dd63270SBarry Smith
2810f7a542fSMartin Diehl  interface
2826dd63270SBarry Smith    subroutine PetscSetFortranBasePointers( &
2830f7a542fSMartin Diehl      PETSC_NULL_CHARACTER, &
2840f7a542fSMartin Diehl      PETSC_NULL_INTEGER, PETSC_NULL_SCALAR, &
2850f7a542fSMartin Diehl      PETSC_NULL_DOUBLE, PETSC_NULL_REAL, &
2860f7a542fSMartin Diehl      PETSC_NULL_BOOL, PETSC_NULL_ENUM, PETSC_NULL_FUNCTION, &
2870f7a542fSMartin Diehl      PETSC_NULL_MPI_COMM, &
2880f7a542fSMartin Diehl      PETSC_NULL_INTEGER_ARRAY, PETSC_NULL_SCALAR_ARRAY, &
2890f7a542fSMartin Diehl      PETSC_NULL_REAL_ARRAY, APETSC_NULL_INTEGER_POINTER, &
2900f7a542fSMartin Diehl      PETSC_NULL_SCALAR_POINTER, PETSC_NULL_REAL_POINTER)
291fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
292*b06eb4cdSBarry Smith      use petscmpi
2936dd63270SBarry Smith      character(*) PETSC_NULL_CHARACTER
2946dd63270SBarry Smith      PetscInt PETSC_NULL_INTEGER
2956dd63270SBarry Smith      PetscScalar PETSC_NULL_SCALAR
2966dd63270SBarry Smith      PetscFortranDouble PETSC_NULL_DOUBLE
2976dd63270SBarry Smith      PetscReal PETSC_NULL_REAL
2986dd63270SBarry Smith      PetscBool PETSC_NULL_BOOL
2996dd63270SBarry Smith      PetscEnum PETSC_NULL_ENUM
3006dd63270SBarry Smith      external PETSC_NULL_FUNCTION
301*b06eb4cdSBarry Smith      MPIU_Comm PETSC_NULL_MPI_COMM
3026dd63270SBarry Smith      PetscInt PETSC_NULL_INTEGER_ARRAY(*)
3036dd63270SBarry Smith      PetscScalar PETSC_NULL_SCALAR_ARRAY(*)
3046dd63270SBarry Smith      PetscReal PETSC_NULL_REAL_ARRAY(*)
3056dd63270SBarry Smith      PetscInt, pointer :: APETSC_NULL_INTEGER_POINTER(:)
3066dd63270SBarry Smith      PetscScalar, pointer :: PETSC_NULL_SCALAR_POINTER(:)
3076dd63270SBarry Smith      PetscReal, pointer :: PETSC_NULL_REAL_POINTER(:)
3086dd63270SBarry Smith    end subroutine PetscSetFortranBasePointers
3096dd63270SBarry Smith
3106dd63270SBarry Smith    subroutine PetscOptionsString(string, text, man, default, value, flg, ierr)
311fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3126dd63270SBarry Smith      character(*) string, text, man, default, value
3136dd63270SBarry Smith      PetscBool flg
3146dd63270SBarry Smith      PetscErrorCode ierr
3156dd63270SBarry Smith    end subroutine PetscOptionsString
3166dd63270SBarry Smith  end interface
3176dd63270SBarry Smith
3180f7a542fSMartin Diehl  interface petscbinaryread
3196dd63270SBarry Smith    subroutine petscbinaryreadcomplex(fd, data, num, count, type, z)
320fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3216dd63270SBarry Smith      import ePetscDataType
3226dd63270SBarry Smith      integer4 fd
3236dd63270SBarry Smith      PetscComplex data(*)
3246dd63270SBarry Smith      PetscInt num
3256dd63270SBarry Smith      PetscInt count
3266dd63270SBarry Smith      PetscDataType type
3276dd63270SBarry Smith      PetscErrorCode z
3280f7a542fSMartin Diehl    end subroutine petscbinaryreadcomplex
3296dd63270SBarry Smith    subroutine petscbinaryreadreal(fd, data, num, count, type, z)
330fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3316dd63270SBarry Smith      import ePetscDataType
3326dd63270SBarry Smith      integer4 fd
3336dd63270SBarry Smith      PetscReal data(*)
3346dd63270SBarry Smith      PetscInt num
3356dd63270SBarry Smith      PetscInt count
3366dd63270SBarry Smith      PetscDataType type
3376dd63270SBarry Smith      PetscErrorCode z
3380f7a542fSMartin Diehl    end subroutine petscbinaryreadreal
3396dd63270SBarry Smith    subroutine petscbinaryreadint(fd, data, num, count, type, z)
340fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3416dd63270SBarry Smith      import ePetscDataType
3426dd63270SBarry Smith      integer4 fd
3436dd63270SBarry Smith      PetscInt data(*)
3446dd63270SBarry Smith      PetscInt num
3456dd63270SBarry Smith      PetscInt count
3466dd63270SBarry Smith      PetscDataType type
3476dd63270SBarry Smith      PetscErrorCode z
3480f7a542fSMartin Diehl    end subroutine petscbinaryreadint
3496dd63270SBarry Smith    subroutine petscbinaryreadcomplex1(fd, data, num, count, type, z)
350fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3516dd63270SBarry Smith      import ePetscDataType
3526dd63270SBarry Smith      integer4 fd
3536dd63270SBarry Smith      PetscComplex data
3546dd63270SBarry Smith      PetscInt num
3556dd63270SBarry Smith      PetscInt count
3566dd63270SBarry Smith      PetscDataType type
3576dd63270SBarry Smith      PetscErrorCode z
3580f7a542fSMartin Diehl    end subroutine petscbinaryreadcomplex1
3596dd63270SBarry Smith    subroutine petscbinaryreadreal1(fd, data, num, count, type, z)
360fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3616dd63270SBarry Smith      import ePetscDataType
3626dd63270SBarry Smith      integer4 fd
3636dd63270SBarry Smith      PetscReal data
3646dd63270SBarry Smith      PetscInt num
3656dd63270SBarry Smith      PetscInt count
3666dd63270SBarry Smith      PetscDataType type
3676dd63270SBarry Smith      PetscErrorCode z
3680f7a542fSMartin Diehl    end subroutine petscbinaryreadreal1
3696dd63270SBarry Smith    subroutine petscbinaryreadint1(fd, data, num, count, type, z)
370fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3716dd63270SBarry Smith      import ePetscDataType
3726dd63270SBarry Smith      integer4 fd
3736dd63270SBarry Smith      PetscInt data
3746dd63270SBarry Smith      PetscInt num
3756dd63270SBarry Smith      PetscInt count
3766dd63270SBarry Smith      PetscDataType type
3776dd63270SBarry Smith      PetscErrorCode z
3780f7a542fSMartin Diehl    end subroutine petscbinaryreadint1
3796dd63270SBarry Smith    subroutine petscbinaryreadcomplexcnt(fd, data, num, count, type, z)
380fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3816dd63270SBarry Smith      import ePetscDataType
3826dd63270SBarry Smith      integer4 fd
3836dd63270SBarry Smith      PetscComplex data(*)
3846dd63270SBarry Smith      PetscInt num
3856dd63270SBarry Smith      PetscInt count(1)
3866dd63270SBarry Smith      PetscDataType type
3876dd63270SBarry Smith      PetscErrorCode z
3880f7a542fSMartin Diehl    end subroutine petscbinaryreadcomplexcnt
3896dd63270SBarry Smith    subroutine petscbinaryreadrealcnt(fd, data, num, count, type, z)
390fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
3916dd63270SBarry Smith      import ePetscDataType
3926dd63270SBarry Smith      integer4 fd
3936dd63270SBarry Smith      PetscReal data(*)
3946dd63270SBarry Smith      PetscInt num
3956dd63270SBarry Smith      PetscInt count(1)
3966dd63270SBarry Smith      PetscDataType type
3976dd63270SBarry Smith      PetscErrorCode z
3980f7a542fSMartin Diehl    end subroutine petscbinaryreadrealcnt
3996dd63270SBarry Smith    subroutine petscbinaryreadintcnt(fd, data, num, count, type, z)
400fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4016dd63270SBarry Smith      import ePetscDataType
4026dd63270SBarry Smith      integer4 fd
4036dd63270SBarry Smith      PetscInt data(*)
4046dd63270SBarry Smith      PetscInt num
4056dd63270SBarry Smith      PetscInt count(1)
4066dd63270SBarry Smith      PetscDataType type
4076dd63270SBarry Smith      PetscErrorCode z
4080f7a542fSMartin Diehl    end subroutine petscbinaryreadintcnt
4096dd63270SBarry Smith    subroutine petscbinaryreadcomplex1cnt(fd, data, num, count, type, z)
410fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4116dd63270SBarry Smith      import ePetscDataType
4126dd63270SBarry Smith      integer4 fd
4136dd63270SBarry Smith      PetscComplex data
4146dd63270SBarry Smith      PetscInt num
4156dd63270SBarry Smith      PetscInt count(1)
4166dd63270SBarry Smith      PetscDataType type
4176dd63270SBarry Smith      PetscErrorCode z
4180f7a542fSMartin Diehl    end subroutine petscbinaryreadcomplex1cnt
4196dd63270SBarry Smith    subroutine petscbinaryreadreal1cnt(fd, data, num, count, type, z)
420fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4216dd63270SBarry Smith      import ePetscDataType
4226dd63270SBarry Smith      integer4 fd
4236dd63270SBarry Smith      PetscReal data
4246dd63270SBarry Smith      PetscInt num
4256dd63270SBarry Smith      PetscInt count(1)
4266dd63270SBarry Smith      PetscDataType type
4276dd63270SBarry Smith      PetscErrorCode z
4280f7a542fSMartin Diehl    end subroutine petscbinaryreadreal1cnt
4296dd63270SBarry Smith    subroutine petscbinaryreadint1cnt(fd, data, num, count, type, z)
430fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4316dd63270SBarry Smith      import ePetscDataType
4326dd63270SBarry Smith      integer4 fd
4336dd63270SBarry Smith      PetscInt data
4346dd63270SBarry Smith      PetscInt num
4356dd63270SBarry Smith      PetscInt count(1)
4366dd63270SBarry Smith      PetscDataType type
4376dd63270SBarry Smith      PetscErrorCode z
4380f7a542fSMartin Diehl    end subroutine petscbinaryreadint1cnt
4390f7a542fSMartin Diehl  end interface petscbinaryread
4406dd63270SBarry Smith
4410f7a542fSMartin Diehl  interface petscbinarywrite
4426dd63270SBarry Smith    subroutine petscbinarywritecomplex(fd, data, num, type, z)
443fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4446dd63270SBarry Smith      import ePetscDataType
4456dd63270SBarry Smith      integer4 fd
4466dd63270SBarry Smith      PetscComplex data(*)
4476dd63270SBarry Smith      PetscInt num
4486dd63270SBarry Smith      PetscDataType type
4496dd63270SBarry Smith      PetscErrorCode z
4500f7a542fSMartin Diehl    end subroutine petscbinarywritecomplex
4516dd63270SBarry Smith    subroutine petscbinarywritereal(fd, data, num, type, z)
452fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4536dd63270SBarry Smith      import ePetscDataType
4546dd63270SBarry Smith      integer4 fd
4556dd63270SBarry Smith      PetscReal data(*)
4566dd63270SBarry Smith      PetscInt num
4576dd63270SBarry Smith      PetscDataType type
4586dd63270SBarry Smith      PetscErrorCode z
4590f7a542fSMartin Diehl    end subroutine petscbinarywritereal
4606dd63270SBarry Smith    subroutine petscbinarywriteint(fd, data, num, type, z)
461fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4626dd63270SBarry Smith      import ePetscDataType
4636dd63270SBarry Smith      integer4 fd
4646dd63270SBarry Smith      PetscInt data(*)
4656dd63270SBarry Smith      PetscInt num
4666dd63270SBarry Smith      PetscDataType type
4676dd63270SBarry Smith      PetscErrorCode z
4680f7a542fSMartin Diehl    end subroutine petscbinarywriteint
4696dd63270SBarry Smith    subroutine petscbinarywritecomplex1(fd, data, num, type, z)
470fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4716dd63270SBarry Smith      import ePetscDataType
4726dd63270SBarry Smith      integer4 fd
4736dd63270SBarry Smith      PetscComplex data
4746dd63270SBarry Smith      PetscInt num
4756dd63270SBarry Smith      PetscDataType type
4766dd63270SBarry Smith      PetscErrorCode z
4770f7a542fSMartin Diehl    end subroutine petscbinarywritecomplex1
4786dd63270SBarry Smith    subroutine petscbinarywritereal1(fd, data, num, type, z)
479fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4806dd63270SBarry Smith      import ePetscDataType
4816dd63270SBarry Smith      integer4 fd
4826dd63270SBarry Smith      PetscReal data
4836dd63270SBarry Smith      PetscInt num
4846dd63270SBarry Smith      PetscDataType type
4856dd63270SBarry Smith      PetscErrorCode z
4860f7a542fSMartin Diehl    end subroutine petscbinarywritereal1
4876dd63270SBarry Smith    subroutine petscbinarywriteint1(fd, data, num, type, z)
488fe66ebccSMartin Diehl      use, intrinsic :: ISO_C_binding
4896dd63270SBarry Smith      import ePetscDataType
4906dd63270SBarry Smith      integer4 fd
4916dd63270SBarry Smith      PetscInt data
4926dd63270SBarry Smith      PetscInt num
4936dd63270SBarry Smith      PetscDataType type
4946dd63270SBarry Smith      PetscErrorCode z
4950f7a542fSMartin Diehl    end subroutine petscbinarywriteint1
4960f7a542fSMartin Diehl  end interface petscbinarywrite
4976dd63270SBarry Smith
4986dd63270SBarry Smithcontains
4996dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
5006dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PetscInitializeWithHelp
5016dd63270SBarry Smith#endif
5026dd63270SBarry Smith  subroutine PetscInitializeWithHelp(filename, help, ierr)
5036dd63270SBarry Smith    character(len=*) :: filename
5046dd63270SBarry Smith    character(len=*) :: help
5056dd63270SBarry Smith    PetscErrorCode   :: ierr
5066dd63270SBarry Smith
5074820e4eaSBarry Smith    if (filename /= PETSC_NULL_CHARACTER) then
5086dd63270SBarry Smith      call PetscInitializeF(trim(filename), help, ierr)
5096dd63270SBarry Smith      CHKERRQ(ierr)
5106dd63270SBarry Smith    else
5116dd63270SBarry Smith      call PetscInitializeF(filename, help, ierr)
5126dd63270SBarry Smith      CHKERRQ(ierr)
5136dd63270SBarry Smith    end if
5146dd63270SBarry Smith  end subroutine PetscInitializeWithHelp
5156dd63270SBarry Smith
5166dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
5176dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PetscInitializeNoHelp
5186dd63270SBarry Smith#endif
5196dd63270SBarry Smith  subroutine PetscInitializeNoHelp(filename, ierr)
5206dd63270SBarry Smith    character(len=*) :: filename
5216dd63270SBarry Smith    PetscErrorCode   :: ierr
5226dd63270SBarry Smith
5234820e4eaSBarry Smith    if (filename /= PETSC_NULL_CHARACTER) then
5246dd63270SBarry Smith      call PetscInitializeF(trim(filename), PETSC_NULL_CHARACTER, ierr)
5256dd63270SBarry Smith      CHKERRQ(ierr)
5266dd63270SBarry Smith    else
5276dd63270SBarry Smith      call PetscInitializeF(filename, PETSC_NULL_CHARACTER, ierr)
5286dd63270SBarry Smith      CHKERRQ(ierr)
5296dd63270SBarry Smith    end if
5306dd63270SBarry Smith  end subroutine PetscInitializeNoHelp
5316dd63270SBarry Smith
5326dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
5336dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT::PetscInitializeNoArguments
5346dd63270SBarry Smith#endif
5356dd63270SBarry Smith  subroutine PetscInitializeNoArguments(ierr)
5366dd63270SBarry Smith    PetscErrorCode :: ierr
5376dd63270SBarry Smith
5386dd63270SBarry Smith    call PetscInitializeF(PETSC_NULL_CHARACTER, PETSC_NULL_CHARACTER, ierr)
5396dd63270SBarry Smith    CHKERRQ(ierr)
5406dd63270SBarry Smith  end subroutine PetscInitializeNoArguments
5416dd63270SBarry Smith
5426dd63270SBarry Smith#include <../ftn/sys/petscall.hf90>
5430f7a542fSMartin Diehlend module petscsys
5446dd63270SBarry Smith
5450f7a542fSMartin Diehlsubroutine F90ArraySetRealPointer(array, sz, j, T)
5466dd63270SBarry Smith  use petscsysdef
5470f7a542fSMartin Diehl  PetscInt :: j, sz
5486dd63270SBarry Smith  PetscReal, target    :: array(1:sz)
5496dd63270SBarry Smith  PetscReal2d, pointer :: T(:)
5500f7a542fSMartin Diehl
5516dd63270SBarry Smith  T(j + 1)%ptr => array
5520f7a542fSMartin Diehlend subroutine F90ArraySetRealPointer
5536dd63270SBarry Smith#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
5546dd63270SBarry Smith!DEC$ ATTRIBUTES DLLEXPORT:: F90ArraySetRealPointer
5556dd63270SBarry Smith#endif
5566dd63270SBarry Smith
5576dd63270SBarry Smith!------------------------------------------------------------------------
5586dd63270SBarry Smith!TODO: generate the modules below by looping over
5596dd63270SBarry Smith!      ftn/sys/XXX.h90
560bfe80ac4SPierre Jolivet!      and skipping those in petscall.h
5616dd63270SBarry Smith
5626dd63270SBarry Smithmodule petscbag
5636dd63270SBarry Smith  use petscsys
5646dd63270SBarry Smith#include <../include/petsc/finclude/petscbag.h>
5656dd63270SBarry Smith#include <../ftn/sys/petscbag.h>
5666dd63270SBarry Smith#include <../ftn/sys/petscbag.h90>
5676dd63270SBarry Smithcontains
5686dd63270SBarry Smith#include <../ftn/sys/petscbag.hf90>
5690f7a542fSMartin Diehlend module petscbag
5706dd63270SBarry Smith
5716dd63270SBarry Smith!------------------------------------------------------------------------
5726dd63270SBarry Smithmodule petscbm
5736dd63270SBarry Smith  use petscsys
5746dd63270SBarry Smith#include <../include/petsc/finclude/petscbm.h>
5756dd63270SBarry Smith#include <../ftn/sys/petscbm.h>
5766dd63270SBarry Smith#include <../ftn/sys/petscbm.h90>
5776dd63270SBarry Smithcontains
5786dd63270SBarry Smith
5796dd63270SBarry Smith#include <../ftn/sys/petscbm.hf90>
5800f7a542fSMartin Diehlend module petscbm
5816dd63270SBarry Smith
5826dd63270SBarry Smith!------------------------------------------------------------------------
5836dd63270SBarry Smithmodule petscmatlab
5846dd63270SBarry Smith  use petscsys
5856dd63270SBarry Smith#include <../include/petsc/finclude/petscmatlab.h>
5866dd63270SBarry Smith#include <../ftn/sys/petscmatlab.h>
5876dd63270SBarry Smith#include <../ftn/sys/petscmatlab.h90>
5886dd63270SBarry Smith
5896dd63270SBarry Smithcontains
5906dd63270SBarry Smith
5916dd63270SBarry Smith#include <../ftn/sys/petscmatlab.hf90>
5920f7a542fSMartin Diehlend module petscmatlab
5936dd63270SBarry Smith
5946dd63270SBarry Smith!------------------------------------------------------------------------
5956dd63270SBarry Smithmodule petscdraw
5966dd63270SBarry Smith  use petscsys
5976dd63270SBarry Smith#include <../include/petsc/finclude/petscdraw.h>
5986dd63270SBarry Smith#include <../ftn/sys/petscdraw.h>
5996dd63270SBarry Smith#include <../ftn/sys/petscdraw.h90>
6006dd63270SBarry Smith
6016dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_BASIC_COLORS = 33
6026dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_ROTATE = -1
6036dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_WHITE = 0
6046dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_BLACK = 1
6056dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_RED = 2
6066dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_GREEN = 3
6076dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_CYAN = 4
6086dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_BLUE = 5
6096dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_MAGENTA = 6
6106dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_AQUAMARINE = 7
6116dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_FORESTGREEN = 8
6126dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_ORANGE = 9
6136dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_VIOLET = 10
6146dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_BROWN = 11
6156dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_PINK = 12
6166dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_CORAL = 13
6176dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_GRAY = 14
6186dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_YELLOW = 15
6196dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_GOLD = 16
6206dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_LIGHTPINK = 17
6216dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_MEDIUMTURQUOISE = 18
6226dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_KHAKI = 19
6236dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_DIMGRAY = 20
6246dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_YELLOWGREEN = 21
6256dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_SKYBLUE = 22
6266dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_DARKGREEN = 23
6276dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_NAVYBLUE = 24
6286dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_SANDYBROWN = 25
6296dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_CADETBLUE = 26
6306dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_POWDERBLUE = 27
6316dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_DEEPPINK = 28
6326dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_THISTLE = 29
6336dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_LIMEGREEN = 30
6346dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_LAVENDERBLUSH = 31
6356dd63270SBarry Smith  PetscEnum, parameter :: PETSC_DRAW_PLUM = 32
6366dd63270SBarry Smith
6376dd63270SBarry Smithcontains
6386dd63270SBarry Smith
6396dd63270SBarry Smith#include <../ftn/sys/petscdraw.hf90>
6400f7a542fSMartin Diehlend module petscdraw
6416dd63270SBarry Smith
6426dd63270SBarry Smith!------------------------------------------------------------------------
6436dd63270SBarry Smithsubroutine PetscSetCOMM(c1, c2)
644fe66ebccSMartin Diehl  use, intrinsic :: ISO_C_binding
645*b06eb4cdSBarry Smith  use petscmpi
6466dd63270SBarry Smith
6476dd63270SBarry Smith  implicit none
648*b06eb4cdSBarry Smith  MPIU_Comm c1, c2
6496dd63270SBarry Smith
6506dd63270SBarry Smith  PETSC_COMM_WORLD = c1
6516dd63270SBarry Smith  PETSC_COMM_SELF = c2
6526dd63270SBarry Smithend
6536dd63270SBarry Smith
6546dd63270SBarry Smithsubroutine PetscGetCOMM(c1)
655fe66ebccSMartin Diehl  use, intrinsic :: ISO_C_binding
656*b06eb4cdSBarry Smith  use petscmpi
6576dd63270SBarry Smith  implicit none
658*b06eb4cdSBarry Smith  MPIU_Comm c1
6596dd63270SBarry Smith
6606dd63270SBarry Smith  c1 = PETSC_COMM_WORLD
6610f7a542fSMartin Diehlend subroutine PetscGetCOMM
6626dd63270SBarry Smith
6636dd63270SBarry Smithsubroutine PetscSetModuleBlock()
664fe66ebccSMartin Diehl  use, intrinsic :: ISO_C_binding
6656dd63270SBarry Smith  use petscsys!, only: PETSC_NULL_CHARACTER,PETSC_NULL_INTEGER,&
6666dd63270SBarry Smith  !  PETSC_NULL_SCALAR,PETSC_NULL_DOUBLE,PETSC_NULL_REAL,&
6676dd63270SBarry Smith  !  PETSC_NULL_BOOL,PETSC_NULL_FUNCTION,PETSC_NULL_MPI_COMM
6686dd63270SBarry Smith  implicit none
6696dd63270SBarry Smith
6706dd63270SBarry Smith  call PetscSetFortranBasePointers(PETSC_NULL_CHARACTER, &
6710f7a542fSMartin Diehl                                   PETSC_NULL_INTEGER, PETSC_NULL_SCALAR, &
6720f7a542fSMartin Diehl                                   PETSC_NULL_DOUBLE, PETSC_NULL_REAL, &
6730f7a542fSMartin Diehl                                   PETSC_NULL_BOOL, PETSC_NULL_ENUM, PETSC_NULL_FUNCTION, &
6740f7a542fSMartin Diehl                                   PETSC_NULL_MPI_COMM, &
6750f7a542fSMartin Diehl                                   PETSC_NULL_INTEGER_ARRAY, PETSC_NULL_SCALAR_ARRAY, &
6760f7a542fSMartin Diehl                                   PETSC_NULL_REAL_ARRAY, PETSC_NULL_INTEGER_POINTER, &
6770f7a542fSMartin Diehl                                   PETSC_NULL_SCALAR_POINTER, PETSC_NULL_REAL_POINTER)
6780f7a542fSMartin Diehlend subroutine PetscSetModuleBlock
6796dd63270SBarry Smith
6806dd63270SBarry Smithsubroutine PetscSetModuleBlockMPI(freal, fscalar, fsum, finteger)
681fe66ebccSMartin Diehl  use, intrinsic :: ISO_C_binding
682*b06eb4cdSBarry Smith  use petscmpi
6836dd63270SBarry Smith  implicit none
6846dd63270SBarry Smith
685*b06eb4cdSBarry Smith  MPIU_Datatype freal, fscalar, finteger
686*b06eb4cdSBarry Smith  MPIU_Op fsum
6876dd63270SBarry Smith
6886dd63270SBarry Smith  MPIU_REAL = freal
6896dd63270SBarry Smith  MPIU_SCALAR = fscalar
6906dd63270SBarry Smith  MPIU_SUM = fsum
6916dd63270SBarry Smith  MPIU_INTEGER = finteger
6920f7a542fSMartin Diehlend subroutine PetscSetModuleBlockMPI
6936dd63270SBarry Smith
6940f7a542fSMartin Diehlsubroutine PetscSetModuleBlockNumeric(pi, maxreal, minreal, eps, seps, small, pinf, pninf)
6956dd63270SBarry Smith  use petscsys, only: PETSC_PI, PETSC_MAX_REAL, PETSC_MIN_REAL, &
6966dd63270SBarry Smith                      PETSC_MACHINE_EPSILON, PETSC_SQRT_MACHINE_EPSILON, &
6976dd63270SBarry Smith                      PETSC_SMALL, PETSC_INFINITY, PETSC_NINFINITY
698fe66ebccSMartin Diehl  use, intrinsic :: ISO_C_binding
6996dd63270SBarry Smith  implicit none
7006dd63270SBarry Smith
7016dd63270SBarry Smith  PetscReal pi, maxreal, minreal, eps, seps
7026dd63270SBarry Smith  PetscReal small, pinf, pninf
7036dd63270SBarry Smith
7046dd63270SBarry Smith  PETSC_PI = pi
7056dd63270SBarry Smith  PETSC_MAX_REAL = maxreal
7066dd63270SBarry Smith  PETSC_MIN_REAL = minreal
7076dd63270SBarry Smith  PETSC_MACHINE_EPSILON = eps
7086dd63270SBarry Smith  PETSC_SQRT_MACHINE_EPSILON = seps
7096dd63270SBarry Smith  PETSC_SMALL = small
7106dd63270SBarry Smith  PETSC_INFINITY = pinf
7116dd63270SBarry Smith  PETSC_NINFINITY = pninf
7120f7a542fSMartin Diehlend subroutine PetscSetModuleBlockNumeric
713