This source file includes following definitions.
- MPIO_File_create
- MPIO_File_resolve
- MPIO_File_free
- MPIO_File_f2c
- MPIO_File_c2f
1
2
3
4
5
6
7
8 #include "mpioimpl.h"
9
10 #include "adio_extern.h"
11
12
13
14
15
16
17
18
19
20
21
22 MPI_File MPIO_File_create(int size)
23 {
24 MPI_File mpi_fh;
25
26 mpi_fh = (MPI_File) ADIOI_Calloc(size,1);
27 return mpi_fh;
28 }
29
30 ADIO_File MPIO_File_resolve(MPI_File mpi_fh)
31 {
32 return mpi_fh;
33 }
34
35 void MPIO_File_free(MPI_File *mpi_fh)
36 {
37 ADIOI_Free(*mpi_fh);
38 *mpi_fh = MPI_FILE_NULL;
39 }
40
41 MPI_File MPIO_File_f2c(MPI_Fint fh)
42 {
43 #ifndef INT_LT_POINTER
44 return (MPI_File) ((void *) fh);
45
46
47
48
49 #else
50 if (!fh) return MPI_FILE_NULL;
51 if ((fh < 0) || (fh > ADIOI_Ftable_ptr)) {
52
53 return MPI_FILE_NULL;
54 }
55 return ADIOI_Ftable[fh];
56 #endif
57 }
58
59 MPI_Fint MPIO_File_c2f(MPI_File fh)
60 {
61 #ifndef INT_LT_POINTER
62 return (MPI_Fint) fh;
63 #else
64 int i;
65
66 if ((fh == NULL) || (fh->cookie != ADIOI_FILE_COOKIE))
67 return (MPI_Fint) 0;
68
69 if (fh->fortran_handle != -1)
70 return fh->fortran_handle;
71
72 if (!ADIOI_Ftable) {
73 ADIOI_Ftable_max = 1024;
74 ADIOI_Ftable = (MPI_File *)
75 ADIOI_Malloc(ADIOI_Ftable_max*sizeof(MPI_File));
76 ADIOI_Ftable_ptr = 0;
77
78 for (i=0; i<ADIOI_Ftable_max; i++) ADIOI_Ftable[i] = MPI_FILE_NULL;
79 }
80 if (ADIOI_Ftable_ptr == ADIOI_Ftable_max-1) {
81 ADIOI_Ftable = (MPI_File *) ADIOI_Realloc(ADIOI_Ftable,
82 (ADIOI_Ftable_max+1024)*sizeof(MPI_File));
83 for (i=ADIOI_Ftable_max; i<ADIOI_Ftable_max+1024; i++)
84 ADIOI_Ftable[i] = MPI_FILE_NULL;
85 ADIOI_Ftable_max += 1024;
86 }
87 ADIOI_Ftable_ptr++;
88 ADIOI_Ftable[ADIOI_Ftable_ptr] = fh;
89 fh->fortran_handle = ADIOI_Ftable_ptr;
90 return (MPI_Fint) ADIOI_Ftable_ptr;
91 #endif
92 }