Actual source code: f90_cwrap.c
petsc-3.9.4 2018-09-11
1: #include <petsc/private/f90impl.h>
3: /*@C
5: Converts a MPI_Fint that contains a Fortran MPI_Datatype to its C MPI_Datatype equivalent
7: Not Collective
9: Input Parameter:
10: . unit - The Fortran MPI_Datatype
12: Output Parameter:
13: . dtype - the corresponding C MPI_Datatype
15: Level: developer
17: Developer Notes: The MPI documentation in multiple places says that one can never us
18: Fortran MPI_Datatypes in C (or vis-versa) but this is problematic since users could never
19: call C routines from Fortran that have MPI_Datatype arguments. Jed states that the Fortran
20: MPI_Datatypes will always be available in C if the MPI was built to support Fortran. This function
21: relys on this.
22: @*/
23: PetscErrorCode PetscMPIFortranDatatypeToC(MPI_Fint unit,MPI_Datatype *dtype)
24: {
25: MPI_Datatype ftype;
28: ftype = MPI_Type_f2c(unit);
29: if (ftype == MPI_INTEGER) *dtype = MPI_INT;
30: else if (ftype == MPI_INTEGER8) *dtype = MPIU_INT64;
31: else if (ftype == MPI_DOUBLE_PRECISION) *dtype = MPI_DOUBLE;
32: #if defined(PETSC_HAVE_COMPLEX)
33: else if (ftype == MPI_COMPLEX16) *dtype = MPIU_C_DOUBLE_COMPLEX;
34: #endif
35: else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unknown Fortran MPI_Datatype");
36: return(0);
37: }
39: /*************************************************************************/
41: #if defined(PETSC_HAVE_FORTRAN_CAPS)
42: #define f90array1dcreatescalar_ F90ARRAY1DCREATESCALAR
43: #define f90array1daccessscalar_ F90ARRAY1DACCESSSCALAR
44: #define f90array1ddestroyscalar_ F90ARRAY1DDESTROYSCALAR
45: #define f90array1dcreatereal_ F90ARRAY1DCREATEREAL
46: #define f90array1daccessreal_ F90ARRAY1DACCESSREAL
47: #define f90array1ddestroyreal_ F90ARRAY1DDESTROYREAL
48: #define f90array1dcreateint_ F90ARRAY1DCREATEINT
49: #define f90array1daccessint_ F90ARRAY1DACCESSINT
50: #define f90array1ddestroyint_ F90ARRAY1DDESTROYINT
51: #define f90array1dcreatefortranaddr_ F90ARRAY1DCREATEFORTRANADDR
52: #define f90array1daccessfortranaddr_ F90ARRAY1DACCESSFORTRANADDR
53: #define f90array1ddestroyfortranaddr_ F90ARRAY1DDESTROYFORTRANADDR
54: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
55: #define f90array1dcreatescalar_ f90array1dcreatescalar
56: #define f90array1daccessscalar_ f90array1daccessscalar
57: #define f90array1ddestroyscalar_ f90array1ddestroyscalar
58: #define f90array1dcreatereal_ f90array1dcreatereal
59: #define f90array1daccessreal_ f90array1daccessreal
60: #define f90array1ddestroyreal_ f90array1ddestroyreal
61: #define f90array1dcreateint_ f90array1dcreateint
62: #define f90array1daccessint_ f90array1daccessint
63: #define f90array1ddestroyint_ f90array1ddestroyint
64: #define f90array1dcreatefortranaddr_ f90array1dcreatefortranaddr
65: #define f90array1daccessfortranaddr_ f90array1daccessfortranaddr
66: #define f90array1ddestroyfortranaddr_ f90array1ddestroyfortranaddr
67: #endif
69: PETSC_EXTERN void PETSC_STDCALL f90array1dcreatescalar_(void *,PetscInt *,PetscInt *,F90Array1d * PETSC_F90_2PTR_PROTO_NOVAR);
70: PETSC_EXTERN void PETSC_STDCALL f90array1daccessscalar_(F90Array1d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
71: PETSC_EXTERN void PETSC_STDCALL f90array1ddestroyscalar_(F90Array1d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
72: PETSC_EXTERN void PETSC_STDCALL f90array1dcreatereal_(void *,PetscInt *,PetscInt *,F90Array1d * PETSC_F90_2PTR_PROTO_NOVAR);
73: PETSC_EXTERN void PETSC_STDCALL f90array1daccessreal_(F90Array1d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
74: PETSC_EXTERN void PETSC_STDCALL f90array1ddestroyreal_(F90Array1d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
75: PETSC_EXTERN void PETSC_STDCALL f90array1dcreateint_(void *,PetscInt *,PetscInt *,F90Array1d * PETSC_F90_2PTR_PROTO_NOVAR);
76: PETSC_EXTERN void PETSC_STDCALL f90array1daccessint_(F90Array1d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
77: PETSC_EXTERN void PETSC_STDCALL f90array1ddestroyint_(F90Array1d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
78: PETSC_EXTERN void PETSC_STDCALL f90array1dcreatefortranaddr_(void *,PetscInt *,PetscInt *,F90Array1d * PETSC_F90_2PTR_PROTO_NOVAR);
79: PETSC_EXTERN void PETSC_STDCALL f90array1daccessfortranaddr_(F90Array1d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
80: PETSC_EXTERN void PETSC_STDCALL f90array1ddestroyfortranaddr_(F90Array1d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
82: PetscErrorCode F90Array1dCreate(void *array,MPI_Datatype type,PetscInt start,PetscInt len,F90Array1d *ptr PETSC_F90_2PTR_PROTO(ptrd))
83: {
85: if (type == MPIU_SCALAR) {
86: if (!len) array = PETSC_NULL_SCALAR_Fortran;
87: f90array1dcreatescalar_(array,&start,&len,ptr PETSC_F90_2PTR_PARAM(ptrd));
88: } else if (type == MPIU_REAL) {
89: if (!len) array = PETSC_NULL_REAL_Fortran;
90: f90array1dcreatereal_(array,&start,&len,ptr PETSC_F90_2PTR_PARAM(ptrd));
91: } else if (type == MPIU_INT) {
92: if (!len) array = PETSC_NULL_INTEGER_Fortran;
93: f90array1dcreateint_(array,&start,&len,ptr PETSC_F90_2PTR_PARAM(ptrd));
94: } else if (type == MPIU_FORTRANADDR) {
95: f90array1dcreatefortranaddr_(array,&start,&len,ptr PETSC_F90_2PTR_PARAM(ptrd));
96: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
97: return(0);
98: }
100: PetscErrorCode F90Array1dAccess(F90Array1d *ptr,MPI_Datatype type,void **array PETSC_F90_2PTR_PROTO(ptrd))
101: {
103: if (type == MPIU_SCALAR) {
104: f90array1daccessscalar_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
105: if (*array == PETSC_NULL_SCALAR_Fortran) *array = 0;
106: } else if (type == MPIU_REAL) {
107: f90array1daccessreal_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
108: if (*array == PETSC_NULL_REAL_Fortran) *array = 0;
109: } else if (type == MPIU_INT) {
110: f90array1daccessint_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
111: if (*array == PETSC_NULL_INTEGER_Fortran) *array = 0;
112: } else if (type == MPIU_FORTRANADDR) {
113: f90array1daccessfortranaddr_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
114: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
115: return(0);
116: }
118: PetscErrorCode F90Array1dDestroy(F90Array1d *ptr,MPI_Datatype type PETSC_F90_2PTR_PROTO(ptrd))
119: {
121: if (type == MPIU_SCALAR) {
122: f90array1ddestroyscalar_(ptr PETSC_F90_2PTR_PARAM(ptrd));
123: } else if (type == MPIU_REAL) {
124: f90array1ddestroyreal_(ptr PETSC_F90_2PTR_PARAM(ptrd));
125: } else if (type == MPIU_INT) {
126: f90array1ddestroyint_(ptr PETSC_F90_2PTR_PARAM(ptrd));
127: } else if (type == MPIU_FORTRANADDR) {
128: f90array1ddestroyfortranaddr_(ptr PETSC_F90_2PTR_PARAM(ptrd));
129: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
130: return(0);
131: }
133: /*************************************************************************/
135: #if defined(PETSC_HAVE_FORTRAN_CAPS)
136: #define f90array2dcreatescalar_ F90ARRAY2DCREATESCALAR
137: #define f90array2daccessscalar_ F90ARRAY2DACCESSSCALAR
138: #define f90array2ddestroyscalar_ F90ARRAY2DDESTROYSCALAR
139: #define f90array2dcreatereal_ F90ARRAY2DCREATEREAL
140: #define f90array2daccessreal_ F90ARRAY2DACCESSREAL
141: #define f90array2ddestroyreal_ F90ARRAY2DDESTROYREAL
142: #define f90array2dcreateint_ F90ARRAY2DCREATEINT
143: #define f90array2daccessint_ F90ARRAY2DACCESSINT
144: #define f90array2ddestroyint_ F90ARRAY2DDESTROYINT
145: #define f90array2dcreatefortranaddr_ F90ARRAY2DCREATEFORTRANADDR
146: #define f90array2daccessfortranaddr_ F90ARRAY2DACCESSFORTRANADDR
147: #define f90array2ddestroyfortranaddr_ F90ARRAY2DDESTROYFORTRANADDR
148: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
149: #define f90array2dcreatescalar_ f90array2dcreatescalar
150: #define f90array2daccessscalar_ f90array2daccessscalar
151: #define f90array2ddestroyscalar_ f90array2ddestroyscalar
152: #define f90array2dcreatereal_ f90array2dcreatereal
153: #define f90array2daccessreal_ f90array2daccessreal
154: #define f90array2ddestroyreal_ f90array2ddestroyreal
155: #define f90array2dcreateint_ f90array2dcreateint
156: #define f90array2daccessint_ f90array2daccessint
157: #define f90array2ddestroyint_ f90array2ddestroyint
158: #define f90array2dcreatefortranaddr_ f90array2dcreatefortranaddr
159: #define f90array2daccessfortranaddr_ f90array2daccessfortranaddr
160: #define f90array2ddestroyfortranaddr_ f90array2ddestroyfortranaddr
161: #endif
163: PETSC_EXTERN void PETSC_STDCALL f90array2dcreatescalar_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array2d * PETSC_F90_2PTR_PROTO_NOVAR);
164: PETSC_EXTERN void PETSC_STDCALL f90array2daccessscalar_(F90Array2d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
165: PETSC_EXTERN void PETSC_STDCALL f90array2ddestroyscalar_(F90Array2d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
166: PETSC_EXTERN void PETSC_STDCALL f90array2dcreatereal_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array2d * PETSC_F90_2PTR_PROTO_NOVAR);
167: PETSC_EXTERN void PETSC_STDCALL f90array2daccessreal_(F90Array2d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
168: PETSC_EXTERN void PETSC_STDCALL f90array2ddestroyreal_(F90Array2d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
169: PETSC_EXTERN void PETSC_STDCALL f90array2dcreateint_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array2d * PETSC_F90_2PTR_PROTO_NOVAR);
170: PETSC_EXTERN void PETSC_STDCALL f90array2daccessint_(F90Array2d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
171: PETSC_EXTERN void PETSC_STDCALL f90array2ddestroyint_(F90Array2d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
172: PETSC_EXTERN void PETSC_STDCALL f90array2dcreatefortranaddr_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array2d * PETSC_F90_2PTR_PROTO_NOVAR);
173: PETSC_EXTERN void PETSC_STDCALL f90array2daccessfortranaddr_(F90Array2d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
174: PETSC_EXTERN void PETSC_STDCALL f90array2ddestroyfortranaddr_(F90Array2d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
176: PetscErrorCode F90Array2dCreate(void *array,MPI_Datatype type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,F90Array2d *ptr PETSC_F90_2PTR_PROTO(ptrd))
177: {
179: if (type == MPIU_SCALAR) {
180: f90array2dcreatescalar_(array,&start1,&len1,&start2,&len2,ptr PETSC_F90_2PTR_PARAM(ptrd));
181: } else if (type == MPIU_REAL) {
182: f90array2dcreatereal_(array,&start1,&len1,&start2,&len2,ptr PETSC_F90_2PTR_PARAM(ptrd));
183: } else if (type == MPIU_INT) {
184: f90array2dcreateint_(array,&start1,&len1,&start2,&len2,ptr PETSC_F90_2PTR_PARAM(ptrd));
185: } else if (type == MPIU_FORTRANADDR) {
186: f90array2dcreatefortranaddr_(array,&start1,&len1,&start2,&len2,ptr PETSC_F90_2PTR_PARAM(ptrd));
187: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
188: return(0);
189: }
191: PetscErrorCode F90Array2dAccess(F90Array2d *ptr,MPI_Datatype type,void **array PETSC_F90_2PTR_PROTO(ptrd))
192: {
194: if (type == MPIU_SCALAR) {
195: f90array2daccessscalar_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
196: } else if (type == MPIU_REAL) {
197: f90array2daccessreal_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
198: } else if (type == MPIU_INT) {
199: f90array2daccessint_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
200: } else if (type == MPIU_FORTRANADDR) {
201: f90array2daccessfortranaddr_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
202: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
203: return(0);
204: }
206: PetscErrorCode F90Array2dDestroy(F90Array2d *ptr,MPI_Datatype type PETSC_F90_2PTR_PROTO(ptrd))
207: {
209: if (type == MPIU_SCALAR) {
210: f90array2ddestroyscalar_(ptr PETSC_F90_2PTR_PARAM(ptrd));
211: } else if (type == MPIU_REAL) {
212: f90array2ddestroyreal_(ptr PETSC_F90_2PTR_PARAM(ptrd));
213: } else if (type == MPIU_INT) {
214: f90array2ddestroyint_(ptr PETSC_F90_2PTR_PARAM(ptrd));
215: } else if (type == MPIU_FORTRANADDR) {
216: f90array2ddestroyfortranaddr_(ptr PETSC_F90_2PTR_PARAM(ptrd));
217: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
218: return(0);
219: }
221: /*************************************************************************/
223: #if defined(PETSC_HAVE_FORTRAN_CAPS)
224: #define f90array3dcreatescalar_ F90ARRAY3DCREATESCALAR
225: #define f90array3daccessscalar_ F90ARRAY3DACCESSSCALAR
226: #define f90array3ddestroyscalar_ F90ARRAY3DDESTROYSCALAR
227: #define f90array3dcreatereal_ F90ARRAY3DCREATEREAL
228: #define f90array3daccessreal_ F90ARRAY3DACCESSREAL
229: #define f90array3ddestroyreal_ F90ARRAY3DDESTROYREAL
230: #define f90array3dcreateint_ F90ARRAY3DCREATEINT
231: #define f90array3daccessint_ F90ARRAY3DACCESSINT
232: #define f90array3ddestroyint_ F90ARRAY3DDESTROYINT
233: #define f90array3dcreatefortranaddr_ F90ARRAY3DCREATEFORTRANADDR
234: #define f90array3daccessfortranaddr_ F90ARRAY3DACCESSFORTRANADDR
235: #define f90array3ddestroyfortranaddr_ F90ARRAY3DDESTROYFORTRANADDR
236: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
237: #define f90array3dcreatescalar_ f90array3dcreatescalar
238: #define f90array3daccessscalar_ f90array3daccessscalar
239: #define f90array3ddestroyscalar_ f90array3ddestroyscalar
240: #define f90array3dcreatereal_ f90array3dcreatereal
241: #define f90array3daccessreal_ f90array3daccessreal
242: #define f90array3ddestroyreal_ f90array3ddestroyreal
243: #define f90array3dcreateint_ f90array3dcreateint
244: #define f90array3daccessint_ f90array3daccessint
245: #define f90array3ddestroyint_ f90array3ddestroyint
246: #define f90array3dcreatefortranaddr_ f90array3dcreatefortranaddr
247: #define f90array3daccessfortranaddr_ f90array3daccessfortranaddr
248: #define f90array3ddestroyfortranaddr_ f90array3ddestroyfortranaddr
249: #endif
251: PETSC_EXTERN void PETSC_STDCALL f90array3dcreatescalar_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array3d * PETSC_F90_2PTR_PROTO_NOVAR);
252: PETSC_EXTERN void PETSC_STDCALL f90array3daccessscalar_(F90Array3d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
253: PETSC_EXTERN void PETSC_STDCALL f90array3ddestroyscalar_(F90Array3d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
254: PETSC_EXTERN void PETSC_STDCALL f90array3dcreatereal_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array3d * PETSC_F90_2PTR_PROTO_NOVAR);
255: PETSC_EXTERN void PETSC_STDCALL f90array3daccessreal_(F90Array3d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
256: PETSC_EXTERN void PETSC_STDCALL f90array3ddestroyreal_(F90Array3d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
257: PETSC_EXTERN void PETSC_STDCALL f90array3dcreateint_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array3d * PETSC_F90_2PTR_PROTO_NOVAR);
258: PETSC_EXTERN void PETSC_STDCALL f90array3daccessint_(F90Array3d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
259: PETSC_EXTERN void PETSC_STDCALL f90array3ddestroyint_(F90Array3d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
260: PETSC_EXTERN void PETSC_STDCALL f90array3dcreatefortranaddr_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array3d * PETSC_F90_2PTR_PROTO_NOVAR);
261: PETSC_EXTERN void PETSC_STDCALL f90array3daccessfortranaddr_(F90Array3d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
262: PETSC_EXTERN void PETSC_STDCALL f90array3ddestroyfortranaddr_(F90Array3d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
264: PetscErrorCode F90Array3dCreate(void *array,MPI_Datatype type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,PetscInt start3,PetscInt len3,F90Array3d *ptr PETSC_F90_2PTR_PROTO(ptrd))
265: {
267: if (type == MPIU_SCALAR) {
268: f90array3dcreatescalar_(array,&start1,&len1,&start2,&len2,&start3,&len3,ptr PETSC_F90_2PTR_PARAM(ptrd));
269: } else if (type == MPIU_REAL) {
270: f90array3dcreatereal_(array,&start1,&len1,&start2,&len2,&start3,&len3,ptr PETSC_F90_2PTR_PARAM(ptrd));
271: } else if (type == MPIU_INT) {
272: f90array3dcreateint_(array,&start1,&len1,&start2,&len2,&start3,&len3,ptr PETSC_F90_2PTR_PARAM(ptrd));
273: } else if (type == MPIU_FORTRANADDR) {
274: f90array3dcreatefortranaddr_(array,&start1,&len1,&start2,&len2,&start3,&len3,ptr PETSC_F90_2PTR_PARAM(ptrd));
275: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
276: return(0);
277: }
279: PetscErrorCode F90Array3dAccess(F90Array3d *ptr,MPI_Datatype type,void **array PETSC_F90_2PTR_PROTO(ptrd))
280: {
282: if (type == MPIU_SCALAR) {
283: f90array3daccessscalar_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
284: } else if (type == MPIU_REAL) {
285: f90array3daccessreal_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
286: } else if (type == MPIU_INT) {
287: f90array3daccessint_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
288: } else if (type == MPIU_FORTRANADDR) {
289: f90array3daccessfortranaddr_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
290: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
291: return(0);
292: }
294: PetscErrorCode F90Array3dDestroy(F90Array3d *ptr,MPI_Datatype type PETSC_F90_2PTR_PROTO(ptrd))
295: {
297: if (type == MPIU_SCALAR) {
298: f90array3ddestroyscalar_(ptr PETSC_F90_2PTR_PARAM(ptrd));
299: } else if (type == MPIU_REAL) {
300: f90array3ddestroyreal_(ptr PETSC_F90_2PTR_PARAM(ptrd));
301: } else if (type == MPIU_INT) {
302: f90array3ddestroyint_(ptr PETSC_F90_2PTR_PARAM(ptrd));
303: } else if (type == MPIU_FORTRANADDR) {
304: f90array3ddestroyfortranaddr_(ptr PETSC_F90_2PTR_PARAM(ptrd));
305: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
306: return(0);
307: }
309: /*************************************************************************/
310: #if defined(PETSC_HAVE_FORTRAN_CAPS)
311: #define f90array4dcreatescalar_ F90ARRAY4DCREATESCALAR
312: #define f90array4daccessscalar_ F90ARRAY4DACCESSSCALAR
313: #define f90array4ddestroyscalar_ F90ARRAY4DDESTROYSCALAR
314: #define f90array4dcreatereal_ F90ARRAY4DCREATEREAL
315: #define f90array4daccessreal_ F90ARRAY4DACCESSREAL
316: #define f90array4ddestroyreal_ F90ARRAY4DDESTROYREAL
317: #define f90array4dcreateint_ F90ARRAY4DCREATEINT
318: #define f90array4daccessint_ F90ARRAY4DACCESSINT
319: #define f90array4ddestroyint_ F90ARRAY4DDESTROYINT
320: #define f90array4dcreatefortranaddr_ F90ARRAY4DCREATEFORTRANADDR
321: #define f90array4daccessfortranaddr_ F90ARRAY4DACCESSFORTRANADDR
322: #define f90array4ddestroyfortranaddr_ F90ARRAY4DDESTROYFORTRANADDR
323: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
324: #define f90array4dcreatescalar_ f90array4dcreatescalar
325: #define f90array4daccessscalar_ f90array4daccessscalar
326: #define f90array4ddestroyscalar_ f90array4ddestroyscalar
327: #define f90array4dcreatereal_ f90array4dcreatereal
328: #define f90array4daccessreal_ f90array4daccessreal
329: #define f90array4ddestroyreal_ f90array4ddestroyreal
330: #define f90array4dcreateint_ f90array4dcreateint
331: #define f90array4daccessint_ f90array4daccessint
332: #define f90array4ddestroyint_ f90array4ddestroyint
333: #define f90array4dcreatefortranaddr_ f90array4dcreatefortranaddr
334: #define f90array4daccessfortranaddr_ f90array4daccessfortranaddr
335: #define f90array4ddestroyfortranaddr_ f90array4ddestroyfortranaddr
336: #endif
338: PETSC_EXTERN void PETSC_STDCALL f90array4dcreatescalar_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt*,PetscInt*,F90Array4d * PETSC_F90_2PTR_PROTO_NOVAR);
339: PETSC_EXTERN void PETSC_STDCALL f90array4daccessscalar_(F90Array4d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
340: PETSC_EXTERN void PETSC_STDCALL f90array4ddestroyscalar_(F90Array4d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
341: PETSC_EXTERN void PETSC_STDCALL f90array4dcreatereal_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt*,PetscInt*,F90Array4d * PETSC_F90_2PTR_PROTO_NOVAR);
342: PETSC_EXTERN void PETSC_STDCALL f90array4daccessreal_(F90Array4d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
343: PETSC_EXTERN void PETSC_STDCALL f90array4ddestroyreal_(F90Array4d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
344: PETSC_EXTERN void PETSC_STDCALL f90array4dcreateint_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt*,PetscInt*,F90Array4d * PETSC_F90_2PTR_PROTO_NOVAR);
345: PETSC_EXTERN void PETSC_STDCALL f90array4daccessint_(F90Array4d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
346: PETSC_EXTERN void PETSC_STDCALL f90array4ddestroyint_(F90Array4d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
347: PETSC_EXTERN void PETSC_STDCALL f90array4dcreatefortranaddr_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt*,PetscInt*,F90Array4d * PETSC_F90_2PTR_PROTO_NOVAR);
348: PETSC_EXTERN void PETSC_STDCALL f90array4daccessfortranaddr_(F90Array4d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
349: PETSC_EXTERN void PETSC_STDCALL f90array4ddestroyfortranaddr_(F90Array4d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
351: PetscErrorCode F90Array4dCreate(void *array,MPI_Datatype type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,PetscInt start3,PetscInt len3,PetscInt start4,PetscInt len4,F90Array4d *ptr PETSC_F90_2PTR_PROTO(ptrd))
352: {
354: if (type == MPIU_SCALAR) {
355: f90array4dcreatescalar_(array,&start1,&len1,&start2,&len2,&start3,&len3,&start4,&len4,ptr PETSC_F90_2PTR_PARAM(ptrd));
356: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
357: return(0);
358: }
360: PetscErrorCode F90Array4dAccess(F90Array4d *ptr,MPI_Datatype type,void **array PETSC_F90_2PTR_PROTO(ptrd))
361: {
363: if (type == MPIU_SCALAR) {
364: f90array4daccessscalar_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
365: } else if (type == MPIU_REAL) {
366: f90array4daccessreal_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
367: } else if (type == MPIU_INT) {
368: f90array4daccessint_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
369: } else if (type == MPIU_FORTRANADDR) {
370: f90array4daccessfortranaddr_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
371: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
372: return(0);
373: }
375: PetscErrorCode F90Array4dDestroy(F90Array4d *ptr,MPI_Datatype type PETSC_F90_2PTR_PROTO(ptrd))
376: {
378: if (type == MPIU_SCALAR) {
379: f90array4ddestroyscalar_(ptr PETSC_F90_2PTR_PARAM(ptrd));
380: } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported MPI_Datatype");
381: return(0);
382: }
384: /*************************************************************************/
385: #if defined(PETSC_HAVE_FORTRAN_CAPS)
386: #define f90array1dgetaddrscalar_ F90ARRAY1DGETADDRSCALAR
387: #define f90array1dgetaddrreal_ F90ARRAY1DGETADDRREAL
388: #define f90array1dgetaddrint_ F90ARRAY1DGETADDRINT
389: #define f90array1dgetaddrfortranaddr_ F90ARRAY1DGETADDRFORTRANADDR
390: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
391: #define f90array1dgetaddrscalar_ f90array1dgetaddrscalar
392: #define f90array1dgetaddrreal_ f90array1dgetaddrreal
393: #define f90array1dgetaddrint_ f90array1dgetaddrint
394: #define f90array1dgetaddrfortranaddr_ f90array1dgetaddrfortranaddr
395: #endif
397: PETSC_EXTERN void PETSC_STDCALL f90array1dgetaddrscalar_(void *array, PetscFortranAddr *address)
398: {
399: *address = (PetscFortranAddr)array;
400: }
401: PETSC_EXTERN void PETSC_STDCALL f90array1dgetaddrreal_(void *array, PetscFortranAddr *address)
402: {
403: *address = (PetscFortranAddr)array;
404: }
405: PETSC_EXTERN void PETSC_STDCALL f90array1dgetaddrint_(void *array, PetscFortranAddr *address)
406: {
407: *address = (PetscFortranAddr)array;
408: }
409: PETSC_EXTERN void PETSC_STDCALL f90array1dgetaddrfortranaddr_(void *array, PetscFortranAddr *address)
410: {
411: *address = (PetscFortranAddr)array;
412: }
414: /*************************************************************************/
415: #if defined(PETSC_HAVE_FORTRAN_CAPS)
416: #define f90array2dgetaddrscalar_ F90ARRAY2DGETADDRSCALAR
417: #define f90array2dgetaddrreal_ F90ARRAY2DGETADDRREAL
418: #define f90array2dgetaddrint_ F90ARRAY2DGETADDRINT
419: #define f90array2dgetaddrfortranaddr_ F90ARRAY2DGETADDRFORTRANADDR
420: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
421: #define f90array2dgetaddrscalar_ f90array2dgetaddrscalar
422: #define f90array2dgetaddrreal_ f90array2dgetaddrreal
423: #define f90array2dgetaddrint_ f90array2dgetaddrint
424: #define f90array2dgetaddrfortranaddr_ f90array2dgetaddrfortranaddr
425: #endif
427: PETSC_EXTERN void PETSC_STDCALL f90array2dgetaddrscalar_(void *array, PetscFortranAddr *address)
428: {
429: *address = (PetscFortranAddr)array;
430: }
431: PETSC_EXTERN void PETSC_STDCALL f90array2dgetaddrreal_(void *array, PetscFortranAddr *address)
432: {
433: *address = (PetscFortranAddr)array;
434: }
435: PETSC_EXTERN void PETSC_STDCALL f90array2dgetaddrint_(void *array, PetscFortranAddr *address)
436: {
437: *address = (PetscFortranAddr)array;
438: }
439: PETSC_EXTERN void PETSC_STDCALL f90array2dgetaddrfortranaddr_(void *array, PetscFortranAddr *address)
440: {
441: *address = (PetscFortranAddr)array;
442: }
444: /*************************************************************************/
445: #if defined(PETSC_HAVE_FORTRAN_CAPS)
446: #define f90array3dgetaddrscalar_ F90ARRAY3DGETADDRSCALAR
447: #define f90array3dgetaddrreal_ F90ARRAY3DGETADDRREAL
448: #define f90array3dgetaddrint_ F90ARRAY3DGETADDRINT
449: #define f90array3dgetaddrfortranaddr_ F90ARRAY3DGETADDRFORTRANADDR
450: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
451: #define f90array3dgetaddrscalar_ f90array3dgetaddrscalar
452: #define f90array3dgetaddrreal_ f90array3dgetaddrreal
453: #define f90array3dgetaddrint_ f90array3dgetaddrint
454: #define f90array3dgetaddrfortranaddr_ f90array3dgetaddrfortranaddr
455: #endif
457: PETSC_EXTERN void PETSC_STDCALL f90array3dgetaddrscalar_(void *array, PetscFortranAddr *address)
458: {
459: *address = (PetscFortranAddr)array;
460: }
461: PETSC_EXTERN void PETSC_STDCALL f90array3dgetaddrreal_(void *array, PetscFortranAddr *address)
462: {
463: *address = (PetscFortranAddr)array;
464: }
465: PETSC_EXTERN void PETSC_STDCALL f90array3dgetaddrint_(void *array, PetscFortranAddr *address)
466: {
467: *address = (PetscFortranAddr)array;
468: }
469: PETSC_EXTERN void PETSC_STDCALL f90array3dgetaddrfortranaddr_(void *array, PetscFortranAddr *address)
470: {
471: *address = (PetscFortranAddr)array;
472: }
474: /*************************************************************************/
475: #if defined(PETSC_HAVE_FORTRAN_CAPS)
476: #define f90array4dgetaddrscalar_ F90ARRAY4DGETADDRSCALAR
477: #define f90array4dgetaddrreal_ F90ARRAY4DGETADDRREAL
478: #define f90array4dgetaddrint_ F90ARRAY4DGETADDRINT
479: #define f90array4dgetaddrfortranaddr_ F90ARRAY4DGETADDRFORTRANADDR
480: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
481: #define f90array4dgetaddrscalar_ f90array4dgetaddrscalar
482: #define f90array4dgetaddrreal_ f90array4dgetaddrreal
483: #define f90array4dgetaddrint_ f90array4dgetaddrint
484: #define f90array4dgetaddrfortranaddr_ f90array4dgetaddrfortranaddr
485: #endif
487: PETSC_EXTERN void PETSC_STDCALL f90array4dgetaddrscalar_(void *array, PetscFortranAddr *address)
488: {
489: *address = (PetscFortranAddr)array;
490: }
491: PETSC_EXTERN void PETSC_STDCALL f90array4dgetaddrreal_(void *array, PetscFortranAddr *address)
492: {
493: *address = (PetscFortranAddr)array;
494: }
495: PETSC_EXTERN void PETSC_STDCALL f90array4dgetaddrint_(void *array, PetscFortranAddr *address)
496: {
497: *address = (PetscFortranAddr)array;
498: }
499: PETSC_EXTERN void PETSC_STDCALL f90array4dgetaddrfortranaddr_(void *array, PetscFortranAddr *address)
500: {
501: *address = (PetscFortranAddr)array;
502: }