Actual source code: f90_cwrap.c

petsc-3.6.1 2015-08-06
Report Typos and Errors
  1: #include <../src/sys/f90-src/f90impl.h>

  3: /*************************************************************************/

  5: #if defined(PETSC_HAVE_FORTRAN_CAPS)
  6: #define f90array1dcreatescalar_           F90ARRAY1DCREATESCALAR
  7: #define f90array1daccessscalar_           F90ARRAY1DACCESSSCALAR
  8: #define f90array1ddestroyscalar_          F90ARRAY1DDESTROYSCALAR
  9: #define f90array1dcreatereal_             F90ARRAY1DCREATEREAL
 10: #define f90array1daccessreal_             F90ARRAY1DACCESSREAL
 11: #define f90array1ddestroyreal_            F90ARRAY1DDESTROYREAL
 12: #define f90array1dcreateint_              F90ARRAY1DCREATEINT
 13: #define f90array1daccessint_              F90ARRAY1DACCESSINT
 14: #define f90array1ddestroyint_             F90ARRAY1DDESTROYINT
 15: #define f90array1dcreatefortranaddr_      F90ARRAY1DCREATEFORTRANADDR
 16: #define f90array1daccessfortranaddr_      F90ARRAY1DACCESSFORTRANADDR
 17: #define f90array1ddestroyfortranaddr_     F90ARRAY1DDESTROYFORTRANADDR
 18: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
 19: #define f90array1dcreatescalar_           f90array1dcreatescalar
 20: #define f90array1daccessscalar_           f90array1daccessscalar
 21: #define f90array1ddestroyscalar_          f90array1ddestroyscalar
 22: #define f90array1dcreatereal_             f90array1dcreatereal
 23: #define f90array1daccessreal_             f90array1daccessreal
 24: #define f90array1ddestroyreal_            f90array1ddestroyreal
 25: #define f90array1dcreateint_              f90array1dcreateint
 26: #define f90array1daccessint_              f90array1daccessint
 27: #define f90array1ddestroyint_             f90array1ddestroyint
 28: #define f90array1dcreatefortranaddr_      f90array1dcreatefortranaddr
 29: #define f90array1daccessfortranaddr_      f90array1daccessfortranaddr
 30: #define f90array1ddestroyfortranaddr_     f90array1ddestroyfortranaddr
 31: #endif

 33: PETSC_EXTERN void PETSC_STDCALL f90array1dcreatescalar_(void *,PetscInt *,PetscInt *,F90Array1d * PETSC_F90_2PTR_PROTO_NOVAR);
 34: PETSC_EXTERN void PETSC_STDCALL f90array1daccessscalar_(F90Array1d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
 35: PETSC_EXTERN void PETSC_STDCALL f90array1ddestroyscalar_(F90Array1d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
 36: PETSC_EXTERN void PETSC_STDCALL f90array1dcreatereal_(void *,PetscInt *,PetscInt *,F90Array1d * PETSC_F90_2PTR_PROTO_NOVAR);
 37: PETSC_EXTERN void PETSC_STDCALL f90array1daccessreal_(F90Array1d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
 38: PETSC_EXTERN void PETSC_STDCALL f90array1ddestroyreal_(F90Array1d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
 39: PETSC_EXTERN void PETSC_STDCALL f90array1dcreateint_(void *,PetscInt *,PetscInt *,F90Array1d * PETSC_F90_2PTR_PROTO_NOVAR);
 40: PETSC_EXTERN void PETSC_STDCALL f90array1daccessint_(F90Array1d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
 41: PETSC_EXTERN void PETSC_STDCALL f90array1ddestroyint_(F90Array1d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
 42: PETSC_EXTERN void PETSC_STDCALL f90array1dcreatefortranaddr_(void *,PetscInt *,PetscInt *,F90Array1d * PETSC_F90_2PTR_PROTO_NOVAR);
 43: PETSC_EXTERN void PETSC_STDCALL f90array1daccessfortranaddr_(F90Array1d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
 44: PETSC_EXTERN void PETSC_STDCALL f90array1ddestroyfortranaddr_(F90Array1d *ptr PETSC_F90_2PTR_PROTO_NOVAR);

 48: PetscErrorCode F90Array1dCreate(void *array,PetscDataType type,PetscInt start,PetscInt len,F90Array1d *ptr PETSC_F90_2PTR_PROTO(ptrd))
 49: {
 51:   if (type == PETSC_SCALAR) {
 52:     if (!len) array = PETSC_NULL_SCALAR_Fortran;
 53:     f90array1dcreatescalar_(array,&start,&len,ptr PETSC_F90_2PTR_PARAM(ptrd));
 54:   } else if (type == PETSC_REAL) {
 55:     if (!len) array = PETSC_NULL_REAL_Fortran;
 56:     f90array1dcreatereal_(array,&start,&len,ptr PETSC_F90_2PTR_PARAM(ptrd));
 57:   } else if (type == PETSC_INT) {
 58:     if (!len) array = PETSC_NULL_INTEGER_Fortran;
 59:     f90array1dcreateint_(array,&start,&len,ptr PETSC_F90_2PTR_PARAM(ptrd));
 60:   } else if (type == PETSC_FORTRANADDR) {
 61:     f90array1dcreatefortranaddr_(array,&start,&len,ptr PETSC_F90_2PTR_PARAM(ptrd));
 62:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
 63:   return(0);
 64: }

 68: PetscErrorCode  F90Array1dAccess(F90Array1d *ptr,PetscDataType type,void **array PETSC_F90_2PTR_PROTO(ptrd))
 69: {
 71:   if (type == PETSC_SCALAR) {
 72:     f90array1daccessscalar_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
 73:     if (*array == PETSC_NULL_SCALAR_Fortran) *array = 0;
 74:   } else if (type == PETSC_REAL) {
 75:     f90array1daccessreal_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
 76:     if (*array == PETSC_NULL_REAL_Fortran) *array = 0;
 77:   } else if (type == PETSC_INT) {
 78:     f90array1daccessint_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
 79:     if (*array == PETSC_NULL_INTEGER_Fortran) *array = 0;
 80:   } else if (type == PETSC_FORTRANADDR) {
 81:     f90array1daccessfortranaddr_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
 82:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
 83:   return(0);
 84: }

 88: PetscErrorCode  F90Array1dDestroy(F90Array1d *ptr,PetscDataType type PETSC_F90_2PTR_PROTO(ptrd))
 89: {
 91:   if (type == PETSC_SCALAR) {
 92:     f90array1ddestroyscalar_(ptr PETSC_F90_2PTR_PARAM(ptrd));
 93:   } else if (type == PETSC_REAL) {
 94:     f90array1ddestroyreal_(ptr PETSC_F90_2PTR_PARAM(ptrd));
 95:   } else if (type == PETSC_INT) {
 96:     f90array1ddestroyint_(ptr PETSC_F90_2PTR_PARAM(ptrd));
 97:   } else if (type == PETSC_FORTRANADDR) {
 98:     f90array1ddestroyfortranaddr_(ptr PETSC_F90_2PTR_PARAM(ptrd));
 99:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
100:   return(0);
101: }

103: /*************************************************************************/

105: #if defined(PETSC_HAVE_FORTRAN_CAPS)
106: #define f90array2dcreatescalar_           F90ARRAY2DCREATESCALAR
107: #define f90array2daccessscalar_           F90ARRAY2DACCESSSCALAR
108: #define f90array2ddestroyscalar_          F90ARRAY2DDESTROYSCALAR
109: #define f90array2dcreatereal_             F90ARRAY2DCREATEREAL
110: #define f90array2daccessreal_             F90ARRAY2DACCESSREAL
111: #define f90array2ddestroyreal_            F90ARRAY2DDESTROYREAL
112: #define f90array2dcreateint_              F90ARRAY2DCREATEINT
113: #define f90array2daccessint_              F90ARRAY2DACCESSINT
114: #define f90array2ddestroyint_             F90ARRAY2DDESTROYINT
115: #define f90array2dcreatefortranaddr_      F90ARRAY2DCREATEFORTRANADDR
116: #define f90array2daccessfortranaddr_      F90ARRAY2DACCESSFORTRANADDR
117: #define f90array2ddestroyfortranaddr_     F90ARRAY2DDESTROYFORTRANADDR
118: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
119: #define f90array2dcreatescalar_           f90array2dcreatescalar
120: #define f90array2daccessscalar_           f90array2daccessscalar
121: #define f90array2ddestroyscalar_          f90array2ddestroyscalar
122: #define f90array2dcreatereal_             f90array2dcreatereal
123: #define f90array2daccessreal_             f90array2daccessreal
124: #define f90array2ddestroyreal_            f90array2ddestroyreal
125: #define f90array2dcreateint_              f90array2dcreateint
126: #define f90array2daccessint_              f90array2daccessint
127: #define f90array2ddestroyint_             f90array2ddestroyint
128: #define f90array2dcreatefortranaddr_      f90array2dcreatefortranaddr
129: #define f90array2daccessfortranaddr_      f90array2daccessfortranaddr
130: #define f90array2ddestroyfortranaddr_     f90array2ddestroyfortranaddr
131: #endif

133: PETSC_EXTERN void PETSC_STDCALL f90array2dcreatescalar_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array2d * PETSC_F90_2PTR_PROTO_NOVAR);
134: PETSC_EXTERN void PETSC_STDCALL f90array2daccessscalar_(F90Array2d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
135: PETSC_EXTERN void PETSC_STDCALL f90array2ddestroyscalar_(F90Array2d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
136: PETSC_EXTERN void PETSC_STDCALL f90array2dcreatereal_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array2d * PETSC_F90_2PTR_PROTO_NOVAR);
137: PETSC_EXTERN void PETSC_STDCALL f90array2daccessreal_(F90Array2d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
138: PETSC_EXTERN void PETSC_STDCALL f90array2ddestroyreal_(F90Array2d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
139: PETSC_EXTERN void PETSC_STDCALL f90array2dcreateint_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array2d * PETSC_F90_2PTR_PROTO_NOVAR);
140: PETSC_EXTERN void PETSC_STDCALL f90array2daccessint_(F90Array2d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
141: PETSC_EXTERN void PETSC_STDCALL f90array2ddestroyint_(F90Array2d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
142: PETSC_EXTERN void PETSC_STDCALL f90array2dcreatefortranaddr_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array2d * PETSC_F90_2PTR_PROTO_NOVAR);
143: PETSC_EXTERN void PETSC_STDCALL f90array2daccessfortranaddr_(F90Array2d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
144: PETSC_EXTERN void PETSC_STDCALL f90array2ddestroyfortranaddr_(F90Array2d *ptr PETSC_F90_2PTR_PROTO_NOVAR);

148: PetscErrorCode F90Array2dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,F90Array2d *ptr PETSC_F90_2PTR_PROTO(ptrd))
149: {
151:   if (type == PETSC_SCALAR) {
152:     f90array2dcreatescalar_(array,&start1,&len1,&start2,&len2,ptr PETSC_F90_2PTR_PARAM(ptrd));
153:   } else if (type == PETSC_REAL) {
154:     f90array2dcreatereal_(array,&start1,&len1,&start2,&len2,ptr PETSC_F90_2PTR_PARAM(ptrd));
155:   } else if (type == PETSC_INT) {
156:     f90array2dcreateint_(array,&start1,&len1,&start2,&len2,ptr PETSC_F90_2PTR_PARAM(ptrd));
157:   } else if (type == PETSC_FORTRANADDR) {
158:     f90array2dcreatefortranaddr_(array,&start1,&len1,&start2,&len2,ptr PETSC_F90_2PTR_PARAM(ptrd));
159:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
160:   return(0);
161: }

165: PetscErrorCode  F90Array2dAccess(F90Array2d *ptr,PetscDataType type,void **array PETSC_F90_2PTR_PROTO(ptrd))
166: {
168:   if (type == PETSC_SCALAR) {
169:     f90array2daccessscalar_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
170:   } else if (type == PETSC_REAL) {
171:     f90array2daccessreal_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
172:   } else if (type == PETSC_INT) {
173:     f90array2daccessint_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
174:   } else if (type == PETSC_FORTRANADDR) {
175:     f90array2daccessfortranaddr_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
176:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
177:   return(0);
178: }

182: PetscErrorCode  F90Array2dDestroy(F90Array2d *ptr,PetscDataType type PETSC_F90_2PTR_PROTO(ptrd))
183: {
185:   if (type == PETSC_SCALAR) {
186:     f90array2ddestroyscalar_(ptr PETSC_F90_2PTR_PARAM(ptrd));
187:   } else if (type == PETSC_REAL) {
188:     f90array2ddestroyreal_(ptr PETSC_F90_2PTR_PARAM(ptrd));
189:   } else if (type == PETSC_INT) {
190:     f90array2ddestroyint_(ptr PETSC_F90_2PTR_PARAM(ptrd));
191:   } else if (type == PETSC_FORTRANADDR) {
192:     f90array2ddestroyfortranaddr_(ptr PETSC_F90_2PTR_PARAM(ptrd));
193:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
194:   return(0);
195: }

197: /*************************************************************************/

199: #if defined(PETSC_HAVE_FORTRAN_CAPS)
200: #define f90array3dcreatescalar_           F90ARRAY3DCREATESCALAR
201: #define f90array3daccessscalar_           F90ARRAY3DACCESSSCALAR
202: #define f90array3ddestroyscalar_          F90ARRAY3DDESTROYSCALAR
203: #define f90array3dcreatereal_             F90ARRAY3DCREATEREAL
204: #define f90array3daccessreal_             F90ARRAY3DACCESSREAL
205: #define f90array3ddestroyreal_            F90ARRAY3DDESTROYREAL
206: #define f90array3dcreateint_              F90ARRAY3DCREATEINT
207: #define f90array3daccessint_              F90ARRAY3DACCESSINT
208: #define f90array3ddestroyint_             F90ARRAY3DDESTROYINT
209: #define f90array3dcreatefortranaddr_      F90ARRAY3DCREATEFORTRANADDR
210: #define f90array3daccessfortranaddr_      F90ARRAY3DACCESSFORTRANADDR
211: #define f90array3ddestroyfortranaddr_     F90ARRAY3DDESTROYFORTRANADDR
212: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
213: #define f90array3dcreatescalar_           f90array3dcreatescalar
214: #define f90array3daccessscalar_           f90array3daccessscalar
215: #define f90array3ddestroyscalar_          f90array3ddestroyscalar
216: #define f90array3dcreatereal_             f90array3dcreatereal
217: #define f90array3daccessreal_             f90array3daccessreal
218: #define f90array3ddestroyreal_            f90array3ddestroyreal
219: #define f90array3dcreateint_              f90array3dcreateint
220: #define f90array3daccessint_              f90array3daccessint
221: #define f90array3ddestroyint_             f90array3ddestroyint
222: #define f90array3dcreatefortranaddr_      f90array3dcreatefortranaddr
223: #define f90array3daccessfortranaddr_      f90array3daccessfortranaddr
224: #define f90array3ddestroyfortranaddr_     f90array3ddestroyfortranaddr
225: #endif

227: PETSC_EXTERN void PETSC_STDCALL f90array3dcreatescalar_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array3d * PETSC_F90_2PTR_PROTO_NOVAR);
228: PETSC_EXTERN void PETSC_STDCALL f90array3daccessscalar_(F90Array3d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
229: PETSC_EXTERN void PETSC_STDCALL f90array3ddestroyscalar_(F90Array3d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
230: PETSC_EXTERN void PETSC_STDCALL f90array3dcreatereal_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array3d * PETSC_F90_2PTR_PROTO_NOVAR);
231: PETSC_EXTERN void PETSC_STDCALL f90array3daccessreal_(F90Array3d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
232: PETSC_EXTERN void PETSC_STDCALL f90array3ddestroyreal_(F90Array3d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
233: PETSC_EXTERN void PETSC_STDCALL f90array3dcreateint_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array3d * PETSC_F90_2PTR_PROTO_NOVAR);
234: PETSC_EXTERN void PETSC_STDCALL f90array3daccessint_(F90Array3d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
235: PETSC_EXTERN void PETSC_STDCALL f90array3ddestroyint_(F90Array3d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
236: PETSC_EXTERN void PETSC_STDCALL f90array3dcreatefortranaddr_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,F90Array3d * PETSC_F90_2PTR_PROTO_NOVAR);
237: PETSC_EXTERN void PETSC_STDCALL f90array3daccessfortranaddr_(F90Array3d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
238: PETSC_EXTERN void PETSC_STDCALL f90array3ddestroyfortranaddr_(F90Array3d *ptr PETSC_F90_2PTR_PROTO_NOVAR);

242: PetscErrorCode F90Array3dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,PetscInt start3,PetscInt len3,F90Array3d *ptr PETSC_F90_2PTR_PROTO(ptrd))
243: {
245:   if (type == PETSC_SCALAR) {
246:     f90array3dcreatescalar_(array,&start1,&len1,&start2,&len2,&start3,&len3,ptr PETSC_F90_2PTR_PARAM(ptrd));
247:   } else if (type == PETSC_REAL) {
248:     f90array3dcreatereal_(array,&start1,&len1,&start2,&len2,&start3,&len3,ptr PETSC_F90_2PTR_PARAM(ptrd));
249:   } else if (type == PETSC_INT) {
250:     f90array3dcreateint_(array,&start1,&len1,&start2,&len2,&start3,&len3,ptr PETSC_F90_2PTR_PARAM(ptrd));
251:   } else if (type == PETSC_FORTRANADDR) {
252:     f90array3dcreatefortranaddr_(array,&start1,&len1,&start2,&len2,&start3,&len3,ptr PETSC_F90_2PTR_PARAM(ptrd));
253:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
254:   return(0);
255: }

259: PetscErrorCode  F90Array3dAccess(F90Array3d *ptr,PetscDataType type,void **array PETSC_F90_2PTR_PROTO(ptrd))
260: {
262:   if (type == PETSC_SCALAR) {
263:     f90array3daccessscalar_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
264:   } else if (type == PETSC_REAL) {
265:     f90array3daccessreal_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
266:   } else if (type == PETSC_INT) {
267:     f90array3daccessint_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
268:   } else if (type == PETSC_FORTRANADDR) {
269:     f90array3daccessfortranaddr_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
270:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
271:   return(0);
272: }

276: PetscErrorCode  F90Array3dDestroy(F90Array3d *ptr,PetscDataType type PETSC_F90_2PTR_PROTO(ptrd))
277: {
279:   if (type == PETSC_SCALAR) {
280:     f90array3ddestroyscalar_(ptr PETSC_F90_2PTR_PARAM(ptrd));
281:   } else if (type == PETSC_REAL) {
282:     f90array3ddestroyreal_(ptr PETSC_F90_2PTR_PARAM(ptrd));
283:   } else if (type == PETSC_INT) {
284:     f90array3ddestroyint_(ptr PETSC_F90_2PTR_PARAM(ptrd));
285:   } else if (type == PETSC_FORTRANADDR) {
286:     f90array3ddestroyfortranaddr_(ptr PETSC_F90_2PTR_PARAM(ptrd));
287:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
288:   return(0);
289: }

291: /*************************************************************************/
292: #if defined(PETSC_HAVE_FORTRAN_CAPS)
293: #define f90array4dcreatescalar_           F90ARRAY4DCREATESCALAR
294: #define f90array4daccessscalar_           F90ARRAY4DACCESSSCALAR
295: #define f90array4ddestroyscalar_          F90ARRAY4DDESTROYSCALAR
296: #define f90array4dcreatereal_             F90ARRAY4DCREATEREAL
297: #define f90array4daccessreal_             F90ARRAY4DACCESSREAL
298: #define f90array4ddestroyreal_            F90ARRAY4DDESTROYREAL
299: #define f90array4dcreateint_              F90ARRAY4DCREATEINT
300: #define f90array4daccessint_              F90ARRAY4DACCESSINT
301: #define f90array4ddestroyint_             F90ARRAY4DDESTROYINT
302: #define f90array4dcreatefortranaddr_      F90ARRAY4DCREATEFORTRANADDR
303: #define f90array4daccessfortranaddr_      F90ARRAY4DACCESSFORTRANADDR
304: #define f90array4ddestroyfortranaddr_     F90ARRAY4DDESTROYFORTRANADDR
305: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
306: #define f90array4dcreatescalar_           f90array4dcreatescalar
307: #define f90array4daccessscalar_           f90array4daccessscalar
308: #define f90array4ddestroyscalar_          f90array4ddestroyscalar
309: #define f90array4dcreatereal_             f90array4dcreatereal
310: #define f90array4daccessreal_             f90array4daccessreal
311: #define f90array4ddestroyreal_            f90array4ddestroyreal
312: #define f90array4dcreateint_              f90array4dcreateint
313: #define f90array4daccessint_              f90array4daccessint
314: #define f90array4ddestroyint_             f90array4ddestroyint
315: #define f90array4dcreatefortranaddr_      f90array4dcreatefortranaddr
316: #define f90array4daccessfortranaddr_      f90array4daccessfortranaddr
317: #define f90array4ddestroyfortranaddr_     f90array4ddestroyfortranaddr
318: #endif

320: PETSC_EXTERN void PETSC_STDCALL f90array4dcreatescalar_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt*,PetscInt*,F90Array4d * PETSC_F90_2PTR_PROTO_NOVAR);
321: PETSC_EXTERN void PETSC_STDCALL f90array4daccessscalar_(F90Array4d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
322: PETSC_EXTERN void PETSC_STDCALL f90array4ddestroyscalar_(F90Array4d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
323: PETSC_EXTERN void PETSC_STDCALL f90array4dcreatereal_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt*,PetscInt*,F90Array4d * PETSC_F90_2PTR_PROTO_NOVAR);
324: PETSC_EXTERN void PETSC_STDCALL f90array4daccessreal_(F90Array4d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
325: PETSC_EXTERN void PETSC_STDCALL f90array4ddestroyreal_(F90Array4d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
326: PETSC_EXTERN void PETSC_STDCALL f90array4dcreateint_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt*,PetscInt*,F90Array4d * PETSC_F90_2PTR_PROTO_NOVAR);
327: PETSC_EXTERN void PETSC_STDCALL f90array4daccessint_(F90Array4d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
328: PETSC_EXTERN void PETSC_STDCALL f90array4ddestroyint_(F90Array4d *ptr PETSC_F90_2PTR_PROTO_NOVAR);
329: PETSC_EXTERN void PETSC_STDCALL f90array4dcreatefortranaddr_(void *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt *,PetscInt*,PetscInt*,F90Array4d * PETSC_F90_2PTR_PROTO_NOVAR);
330: PETSC_EXTERN void PETSC_STDCALL f90array4daccessfortranaddr_(F90Array4d*,void** PETSC_F90_2PTR_PROTO_NOVAR);
331: PETSC_EXTERN void PETSC_STDCALL f90array4ddestroyfortranaddr_(F90Array4d *ptr PETSC_F90_2PTR_PROTO_NOVAR);

335: PetscErrorCode F90Array4dCreate(void *array,PetscDataType type,PetscInt start1,PetscInt len1,PetscInt start2,PetscInt len2,PetscInt start3,PetscInt len3,PetscInt start4,PetscInt len4,F90Array4d *ptr PETSC_F90_2PTR_PROTO(ptrd))
336: {
338:   if (type == PETSC_SCALAR) {
339:     f90array4dcreatescalar_(array,&start1,&len1,&start2,&len2,&start3,&len3,&start4,&len4,ptr PETSC_F90_2PTR_PARAM(ptrd));
340:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
341:   return(0);
342: }

346: PetscErrorCode  F90Array4dAccess(F90Array4d *ptr,PetscDataType type,void **array PETSC_F90_2PTR_PROTO(ptrd))
347: {
349:   if (type == PETSC_SCALAR) {
350:     f90array4daccessscalar_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
351:   } else if (type == PETSC_REAL) {
352:     f90array4daccessreal_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
353:   } else if (type == PETSC_INT) {
354:     f90array4daccessint_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
355:   } else if (type == PETSC_FORTRANADDR) {
356:     f90array4daccessfortranaddr_(ptr,array PETSC_F90_2PTR_PARAM(ptrd));
357:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
358:   return(0);
359: }

363: PetscErrorCode  F90Array4dDestroy(F90Array4d *ptr,PetscDataType type PETSC_F90_2PTR_PROTO(ptrd))
364: {
366:   if (type == PETSC_SCALAR) {
367:     f90array4ddestroyscalar_(ptr PETSC_F90_2PTR_PARAM(ptrd));
368:   } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unsupported PetscDataType: %d",(PetscInt)type);
369:   return(0);
370: }

372: /*************************************************************************/
373: #if defined(PETSC_HAVE_FORTRAN_CAPS)
374: #define f90array1dgetaddrscalar_            F90ARRAY1DGETADDRSCALAR
375: #define f90array1dgetaddrreal_              F90ARRAY1DGETADDRREAL
376: #define f90array1dgetaddrint_               F90ARRAY1DGETADDRINT
377: #define f90array1dgetaddrfortranaddr_       F90ARRAY1DGETADDRFORTRANADDR
378: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
379: #define f90array1dgetaddrscalar_            f90array1dgetaddrscalar
380: #define f90array1dgetaddrreal_              f90array1dgetaddrreal
381: #define f90array1dgetaddrint_               f90array1dgetaddrint
382: #define f90array1dgetaddrfortranaddr_       f90array1dgetaddrfortranaddr
383: #endif

385: PETSC_EXTERN void PETSC_STDCALL f90array1dgetaddrscalar_(void *array, PetscFortranAddr *address)
386: {
387:   *address = (PetscFortranAddr)array;
388: }
389: PETSC_EXTERN void PETSC_STDCALL f90array1dgetaddrreal_(void *array, PetscFortranAddr *address)
390: {
391:   *address = (PetscFortranAddr)array;
392: }
393: PETSC_EXTERN void PETSC_STDCALL f90array1dgetaddrint_(void *array, PetscFortranAddr *address)
394: {
395:   *address = (PetscFortranAddr)array;
396: }
397: PETSC_EXTERN void PETSC_STDCALL f90array1dgetaddrfortranaddr_(void *array, PetscFortranAddr *address)
398: {
399:   *address = (PetscFortranAddr)array;
400: }

402: /*************************************************************************/
403: #if defined(PETSC_HAVE_FORTRAN_CAPS)
404: #define f90array2dgetaddrscalar_            F90ARRAY2DGETADDRSCALAR
405: #define f90array2dgetaddrreal_              F90ARRAY2DGETADDRREAL
406: #define f90array2dgetaddrint_               F90ARRAY2DGETADDRINT
407: #define f90array2dgetaddrfortranaddr_       F90ARRAY2DGETADDRFORTRANADDR
408: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
409: #define f90array2dgetaddrscalar_            f90array2dgetaddrscalar
410: #define f90array2dgetaddrreal_              f90array2dgetaddrreal
411: #define f90array2dgetaddrint_               f90array2dgetaddrint
412: #define f90array2dgetaddrfortranaddr_       f90array2dgetaddrfortranaddr
413: #endif

415: PETSC_EXTERN void PETSC_STDCALL f90array2dgetaddrscalar_(void *array, PetscFortranAddr *address)
416: {
417:   *address = (PetscFortranAddr)array;
418: }
419: PETSC_EXTERN void PETSC_STDCALL f90array2dgetaddrreal_(void *array, PetscFortranAddr *address)
420: {
421:   *address = (PetscFortranAddr)array;
422: }
423: PETSC_EXTERN void PETSC_STDCALL f90array2dgetaddrint_(void *array, PetscFortranAddr *address)
424: {
425:   *address = (PetscFortranAddr)array;
426: }
427: PETSC_EXTERN void PETSC_STDCALL f90array2dgetaddrfortranaddr_(void *array, PetscFortranAddr *address)
428: {
429:   *address = (PetscFortranAddr)array;
430: }

432: /*************************************************************************/
433: #if defined(PETSC_HAVE_FORTRAN_CAPS)
434: #define f90array3dgetaddrscalar_            F90ARRAY3DGETADDRSCALAR
435: #define f90array3dgetaddrreal_              F90ARRAY3DGETADDRREAL
436: #define f90array3dgetaddrint_               F90ARRAY3DGETADDRINT
437: #define f90array3dgetaddrfortranaddr_       F90ARRAY3DGETADDRFORTRANADDR
438: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
439: #define f90array3dgetaddrscalar_            f90array3dgetaddrscalar
440: #define f90array3dgetaddrreal_              f90array3dgetaddrreal
441: #define f90array3dgetaddrint_               f90array3dgetaddrint
442: #define f90array3dgetaddrfortranaddr_       f90array3dgetaddrfortranaddr
443: #endif

445: PETSC_EXTERN void PETSC_STDCALL f90array3dgetaddrscalar_(void *array, PetscFortranAddr *address)
446: {
447:   *address = (PetscFortranAddr)array;
448: }
449: PETSC_EXTERN void PETSC_STDCALL f90array3dgetaddrreal_(void *array, PetscFortranAddr *address)
450: {
451:   *address = (PetscFortranAddr)array;
452: }
453: PETSC_EXTERN void PETSC_STDCALL f90array3dgetaddrint_(void *array, PetscFortranAddr *address)
454: {
455:   *address = (PetscFortranAddr)array;
456: }
457: PETSC_EXTERN void PETSC_STDCALL f90array3dgetaddrfortranaddr_(void *array, PetscFortranAddr *address)
458: {
459:   *address = (PetscFortranAddr)array;
460: }

462: /*************************************************************************/
463: #if defined(PETSC_HAVE_FORTRAN_CAPS)
464: #define f90array4dgetaddrscalar_            F90ARRAY4DGETADDRSCALAR
465: #define f90array4dgetaddrreal_              F90ARRAY4DGETADDRREAL
466: #define f90array4dgetaddrint_               F90ARRAY4DGETADDRINT
467: #define f90array4dgetaddrfortranaddr_       F90ARRAY4DGETADDRFORTRANADDR
468: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
469: #define f90array4dgetaddrscalar_            f90array4dgetaddrscalar
470: #define f90array4dgetaddrreal_              f90array4dgetaddrreal
471: #define f90array4dgetaddrint_               f90array4dgetaddrint
472: #define f90array4dgetaddrfortranaddr_       f90array4dgetaddrfortranaddr
473: #endif

475: PETSC_EXTERN void PETSC_STDCALL f90array4dgetaddrscalar_(void *array, PetscFortranAddr *address)
476: {
477:   *address = (PetscFortranAddr)array;
478: }
479: PETSC_EXTERN void PETSC_STDCALL f90array4dgetaddrreal_(void *array, PetscFortranAddr *address)
480: {
481:   *address = (PetscFortranAddr)array;
482: }
483: PETSC_EXTERN void PETSC_STDCALL f90array4dgetaddrint_(void *array, PetscFortranAddr *address)
484: {
485:   *address = (PetscFortranAddr)array;
486: }
487: PETSC_EXTERN void PETSC_STDCALL f90array4dgetaddrfortranaddr_(void *array, PetscFortranAddr *address)
488: {
489:   *address = (PetscFortranAddr)array;
490: }