1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 herr_t
 ss_blob_bind_f1(ss_blob_t *blob,                /* The blob to which a dataset is associated. */
                 hid_t dset,                     /* The dataset to associate with the blob. The handle is duplicated by SSlib,
                                                  * allowing the caller to close its handle at any time. */
                 hsize_t offset,                 /* Offset into the array for the region of the dataset owned by this blob. */
                 hsize_t size,                   /* Number of elements owned by this blob. */
                 unsigned flags                  /* Bit flags to pass down to ss_blob_bind_f() */
                 )
 {
     SS_ENTER(ss_blob_bind_f1, herr_t);
     hid_t               dspace=-1;
     int                 ndims;

     if ((dspace=H5Dget_space(dset))<0) SS_ERROR(HDF5);
     if ((ndims=H5Sget_simple_extent_ndims(dspace))<0) SS_ERROR(HDF5);
     if (ndims!=1 && ndims!=0) SS_ERROR_FMT(USAGE, ("dataset is not one-dimensional or scalar"));

     if (SS_MAGIC(ss_scope_t)==SS_MAGIC_OF(blob)) {
         /* This task is in the file communicator but not the scope communicator */
         if (H5Sselect_none(dspace)<0) SS_ERROR(HDF5);
     } else {
         if (H5Sselect_slab(dspace, H5S_SELECT_SET, (hsize_t)0, &offset, &size)<0) SS_ERROR(HDF5);
     }
     if (ss_blob_bind_f(blob, dset, dspace, flags)<0) SS_ERROR(FAILED);
     if (H5Sclose(dspace)<0) SS_ERROR(HDF5);
     dspace = -1;

  SS_CLEANUP:
     if (dspace>0) H5Sclose(dspace);
     SS_LEAVE(0);
 }