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 
  42 #if 0
  43 
  44 
  45 MPI_File MPIO_File_f2c(MPI_Fint fh)
  46 {
  47 #ifndef INT_LT_POINTER
  48     return (MPI_File) ((void *) fh);
  49     
  50 
  51 
  52 
  53 #else
  54     if (!fh)
  55         return MPI_FILE_NULL;
  56     if ((fh < 0) || (fh > ADIOI_Ftable_ptr)) {
  57         FPRINTF(stderr, "MPI_File_f2c: Invalid file handle\n");
  58         MPI_Abort(MPI_COMM_WORLD, 1);
  59     }
  60     return ADIOI_Ftable[fh];
  61 #endif
  62 }
  63 
  64 MPI_Fint MPIO_File_c2f(MPI_File fh)
  65 {
  66 #ifndef INT_LT_POINTER
  67     return (MPI_Fint) fh;
  68 #else
  69     int i;
  70 
  71     if ((fh == NULL) || (fh->cookie != ADIOI_FILE_COOKIE))
  72         return (MPI_Fint) 0;
  73     if (!ADIOI_Ftable) {
  74         ADIOI_Ftable_max = 1024;
  75         ADIOI_Ftable = (MPI_File *)
  76             ADIOI_Malloc(ADIOI_Ftable_max * sizeof(MPI_File));
  77         ADIOI_Ftable_ptr = 0;   
  78 
  79         for (i = 0; i < ADIOI_Ftable_max; i++)
  80             ADIOI_Ftable[i] = MPI_FILE_NULL;
  81     }
  82     if (ADIOI_Ftable_ptr == ADIOI_Ftable_max - 1) {
  83         ADIOI_Ftable = (MPI_File *) ADIOI_Realloc(ADIOI_Ftable,
  84                                                   (ADIOI_Ftable_max + 1024) * sizeof(MPI_File));
  85         for (i = ADIOI_Ftable_max; i < ADIOI_Ftable_max + 1024; i++)
  86             ADIOI_Ftable[i] = MPI_FILE_NULL;
  87         ADIOI_Ftable_max += 1024;
  88     }
  89     ADIOI_Ftable_ptr++;
  90     ADIOI_Ftable[ADIOI_Ftable_ptr] = fh;
  91     return (MPI_Fint) ADIOI_Ftable_ptr;
  92 #endif
  93 }
  94 
  95 #endif