1 #include <petsc/private/fortranimpl.h> 2 3 #if defined(PETSC_HAVE_FORTRAN_CAPS) 4 #define petsctestfile_ PETSCTESTFILE 5 #define petscbinaryreadint_ PETSCBINARYREADINT 6 #define petscbinaryreadreal_ PETSCBINARYREADREAL 7 #define petscbinaryreadcomplex_ PETSCBINARYREADCOMPLEX 8 #define petscbinaryreadrealcnt_ PETSCBINARYREADREALCNT 9 #define petscbinaryreadcomplexcnt_ PETSCBINARYREADCOMPLEXCNT 10 #define petscbinaryreadintcnt_ PETSCBINARYREADINTCNT 11 #define petscbinaryreadint1_ PETSCBINARYREADINT1 12 #define petscbinaryreadreal1_ PETSCBINARYREADREAL1 13 #define petscbinaryreadcomplex1_ PETSCBINARYREADCOMPLEX1 14 #define petscbinaryreadint1cnt_ PETSCBINARYREADINT1CNT 15 #define petscbinaryreadreal1cnt_ PETSCBINARYREADREAL1CNT 16 #define petscbinaryreadcomplex1cnt_ PETSCBINARYREADCOMPLEX1CNT 17 #define petscbinarywriteint_ PETSCBINARYWRITEINT 18 #define petscbinarywritereal_ PETSCBINARYWRITEREAL 19 #define petscbinarywritecomplex_ PETSCBINARYWRITECOMPLEX 20 #define petscbinarywriteint1_ PETSCBINARYWRITEINT1 21 #define petscbinarywritereal1_ PETSCBINARYWRITEREAL1 22 #define petscbinarywritecomplex1_ PETSCBINARYWRITECOMPLEX1 23 #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 24 #define petsctestfile_ petsctestfile 25 #define petscbinaryreadint_ petscbinaryreadint 26 #define petscbinaryreadreal_ petscbinaryreadreal 27 #define petscbinaryreadcomplex_ petscbinaryreadcomplex 28 #define petscbinaryreadintcnt_ petscbinaryreadintcnt 29 #define petscbinaryreadrealcnt_ petscbinaryreadrealcnt 30 #define petscbinaryreadcomplexcnt_ petscbinaryreadcomplexcnt 31 #define petscbinaryreadint1_ petscbinaryreadint1 32 #define petscbinaryreadrea11_ petscbinaryreadrea11 33 #define petscbinaryreadcomplex1_ petscbinaryreadcomplex1 34 #define petscbinaryreadint1cnt_ petscbinaryreadint1cnt 35 #define petscbinaryreadreal1cnt_ petscbinaryreadreal1cnt 36 #define petscbinaryreadcomplex1cnt_ petscbinaryreadcomplex1cnt 37 #define petscbinarywriteint_ petscbinarywriteint 38 #define petscbinarywritereal_ petscbinarywritereal 39 #define petscbinarywritecomplex_ petscbinarywritecomplex 40 #define petscbinarywriteint1_ petscbinarywriteint1 41 #define petscbinarywritereal1_ petscbinarywritereal1 42 #define petscbinarywritecomplex1_ petscbinarywritecomplex1 43 #endif 44 45 /* Definitions of Fortran Wrapper routines */ 46 #if defined(__cplusplus) 47 extern "C" { 48 #endif 49 50 PETSC_EXTERN void petscbinarywriteint_(int *fd, void *p, PetscInt *n, PetscDataType *type, int *ierr) 51 { 52 *ierr = PetscBinaryWrite(*fd, p, *n, *type); 53 } 54 55 PETSC_EXTERN void petscbinarywritereal_(int *fd, void *p, PetscInt *n, PetscDataType *type, int *ierr) 56 { 57 *ierr = PetscBinaryWrite(*fd, p, *n, *type); 58 } 59 60 PETSC_EXTERN void petscbinarywritecomplex_(int *fd, void *p, PetscInt *n, PetscDataType *type, int *ierr) 61 { 62 *ierr = PetscBinaryWrite(*fd, p, *n, *type); 63 } 64 65 PETSC_EXTERN void petscbinarywriteint1_(int *fd, void *p, PetscInt *n, PetscDataType *type, int *ierr) 66 { 67 *ierr = PetscBinaryWrite(*fd, p, *n, *type); 68 } 69 70 PETSC_EXTERN void petscbinarywritereal1_(int *fd, void *p, PetscInt *n, PetscDataType *type, int *ierr) 71 { 72 *ierr = PetscBinaryWrite(*fd, p, *n, *type); 73 } 74 75 PETSC_EXTERN void petscbinarywritecomplex1_(int *fd, void *p, PetscInt *n, PetscDataType *type, int *ierr) 76 { 77 *ierr = PetscBinaryWrite(*fd, p, *n, *type); 78 } 79 80 PETSC_EXTERN void petscbinaryreadint_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 81 { 82 CHKFORTRANNULLINTEGER(count); 83 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 84 if (*ierr) return; 85 } 86 87 PETSC_EXTERN void petscbinaryreadreal_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 88 { 89 CHKFORTRANNULLINTEGER(count); 90 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 91 if (*ierr) return; 92 } 93 94 PETSC_EXTERN void petscbinaryreadcomplex_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 95 { 96 CHKFORTRANNULLINTEGER(count); 97 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 98 if (*ierr) return; 99 } 100 101 PETSC_EXTERN void petscbinaryreadint1_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 102 { 103 CHKFORTRANNULLINTEGER(count); 104 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 105 if (*ierr) return; 106 } 107 108 PETSC_EXTERN void petscbinaryreadreal1_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 109 { 110 CHKFORTRANNULLINTEGER(count); 111 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 112 if (*ierr) return; 113 } 114 115 PETSC_EXTERN void petscbinaryreadcomplex1_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 116 { 117 CHKFORTRANNULLINTEGER(count); 118 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 119 if (*ierr) return; 120 } 121 122 PETSC_EXTERN void petscbinaryreadintcnt_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 123 { 124 CHKFORTRANNULLINTEGER(count); 125 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 126 if (*ierr) return; 127 } 128 129 PETSC_EXTERN void petscbinaryreadrealcnt_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 130 { 131 CHKFORTRANNULLINTEGER(count); 132 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 133 if (*ierr) return; 134 } 135 136 PETSC_EXTERN void petscbinaryreadcomplexcnt_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 137 { 138 CHKFORTRANNULLINTEGER(count); 139 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 140 if (*ierr) return; 141 } 142 143 PETSC_EXTERN void petscbinaryreadint1cnt_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 144 { 145 CHKFORTRANNULLINTEGER(count); 146 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 147 if (*ierr) return; 148 } 149 150 PETSC_EXTERN void petscbinaryreadreal1cnt_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 151 { 152 CHKFORTRANNULLINTEGER(count); 153 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 154 if (*ierr) return; 155 } 156 157 PETSC_EXTERN void petscbinaryreadcomplex1cnt_(int *fd, void *data, PetscInt *num, PetscInt *count, PetscDataType *type, int *ierr) 158 { 159 CHKFORTRANNULLINTEGER(count); 160 *ierr = PetscBinaryRead(*fd, data, *num, count, *type); 161 if (*ierr) return; 162 } 163 164 PETSC_EXTERN void petsctestfile_(char *name, char *mode, PetscBool *flg, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len, PETSC_FORTRAN_CHARLEN_T len1) 165 { 166 char *c1; 167 168 FIXCHAR(name, len, c1); 169 *ierr = PetscTestFile(c1, *mode, flg); 170 if (*ierr) return; 171 FREECHAR(name, c1); 172 } 173 174 #if defined(__cplusplus) 175 } 176 #endif 177