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