/****if* H5Ff/h5funmount_c * NAME * h5funmount_c * PURPOSE * Call H5Funmount to unmount the file * INPUTS * loc_id - Identifier for file or group * dsetname - name of dataset * namelen - dsetname length * RETURNS * 0 on success, -1 on failure * AUTHOR * Xiangyang Su * Monday, October 25, 1999 * SOURCE */ int_f nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen) /******/ { int ret_value = -1; char *c_name; int_f c_namelen; hid_t c_loc_id; htri_t status; c_loc_id = *loc_id; /* * Convert FORTRAN name to C name */ c_namelen = *namelen; c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen); if (c_name == NULL) return ret_value; /* * Call H5Fmount function. */ status = H5Funmount(c_loc_id, c_name); if (status >= 0) ret_value = 0; HDfree(c_name); return ret_value; }
extern med_err _MEDfichierDemonter(med_idt pid, const char *nom) { med_err ret = 0; ret = H5Funmount(pid,nom); return ret; }
//-------------------------------------------------------------------------- // Function: CommonFG::unmount ///\brief Unmounts the specified file. ///\param name - IN: Name of the file to unmount ///\exception H5::FileIException or H5::GroupIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CommonFG::unmount( const char* name ) const { // Call C routine H5Fmount to do the mouting herr_t ret_value = H5Funmount( getLocId(), name ); // Raise exception if H5Funmount returns negative value if( ret_value < 0 ) { throwException("unmount", "H5Funmount failed"); } }
static VALUE rb_H5Funmount (VALUE mod, VALUE v_loc_id, VALUE v_name) { herr_t status; status = H5Funmount(NUM2INT(v_loc_id), StringValuePtr(v_name)); if ( status < 0 ) rb_hdf5_raise("can't unmount HDF5 file"); return INT2NUM(status); }
int main(void) { hid_t fid1, fid2, gid; /* Files and group identifiers */ hid_t did, tid, sid; /* Dataset and datatype identifiers */ herr_t status; hsize_t dims[] = {NX,NY}; /* Dataset dimensions */ int i, j; int bm[NX][NY], bm_out[NX][NY]; /* Data buffers */ /* * Initialization of buffer matrix "bm" */ for(i =0; i<NX; i++) { for(j = 0; j<NY; j++) bm[i][j] = i + j; } /* * Create first file and a group in it. */ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); gid = H5Gcreate(fid1, "/G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Close group and file */ H5Gclose(gid); H5Fclose(fid1); /* * Create second file and dataset "D" in it. */ fid2 = H5Fcreate (FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); dims[0] = NX; dims[1] = NY; sid = H5Screate_simple (RANK, dims, NULL); did = H5Dcreate (fid2, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write data to the dataset. */ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm); /* * Close all identifiers. */ H5Sclose(sid); H5Dclose(did); H5Fclose(fid2); /* * Reopen both files */ fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); fid2 = H5Fopen(FILE2, H5F_ACC_RDONLY, H5P_DEFAULT); /* * Mount second file under G in the first file. */ H5Fmount(fid1, "/G", fid2, H5P_DEFAULT); /* * Access dataset D in the first file under /G/D name. */ did = H5Dopen(fid1,"/G/D", H5P_DEFAULT); tid = H5Dget_type(did); status = H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm_out); /* * Print out the data. */ for(i=0; i<NX; i++){ for(j=0; j<NY; j++) printf(" %d", bm_out[i][j]); printf("\n"); } /* * Close all identifers */ H5Tclose(tid); H5Dclose(did); /* * Unmounting second file */ H5Funmount(fid1, "/G"); /* * Close both files */ H5Fclose(fid1); H5Fclose(fid2); return 0; }