这篇教程C++ H5Dget_type函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中H5Dget_type函数的典型用法代码示例。如果您正苦于以下问题:C++ H5Dget_type函数的具体用法?C++ H5Dget_type怎么用?C++ H5Dget_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了H5Dget_type函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: h5_value_doublesvoid h5_value_doubles(hid_t file_id, char *group, char *name, double **values, int *numValues){ int kk; hid_t group_id = H5Gopen(file_id, group, H5P_DEFAULT); hid_t data_id = H5Dopen(group_id, name, H5P_DEFAULT); hid_t data_space = H5Dget_space(data_id); int rank = H5Sget_simple_extent_ndims(data_space); hsize_t dims[H5S_MAX_RANK], maxdim[H5S_MAX_RANK]; H5Sget_simple_extent_dims(data_space, dims, maxdim); hid_t data_type = H5Dget_type(data_id); H5T_class_t data_class = H5Tget_native_type(data_type, H5T_DIR_DEFAULT); size_t data_size = H5Tget_size(data_class); hsize_t elements = 1; for (kk=0; kk<rank; kk++) elements *= dims[kk]; void *buf = (void *) MALLOC((size_t)(elements*data_size)); H5Dread(data_id, data_class, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); *values = buf; *numValues = elements; H5Tclose(data_type); H5Tclose(data_class); H5Sclose(data_space); H5Dclose(data_id); H5Gclose(group_id); }
开发者ID:khogenso,项目名称:ASF_MapReady,代码行数:26,
示例2: getHDF5ClassID/******************************************************************** getHDF5ClassID(): Returns class ID for loc_id.name. -1 if error.******************************************************************/H5T_class_t getHDF5ClassID(hid_t loc_id, const char *name, H5D_layout_t *layout, hid_t *type_id, hid_t *dataset_id) { H5T_class_t class_id; hid_t plist; /* Open the dataset. */ if ( (*dataset_id = H5Dopen( loc_id, name, H5P_DEFAULT )) < 0 ) return -1; /* Get an identifier for the datatype. */ *type_id = H5Dget_type( *dataset_id ); /* Get the class. */ class_id = H5Tget_class( *type_id ); /* Get the layout of the datatype */ plist = H5Dget_create_plist(*dataset_id); *layout = H5Pget_layout(plist); H5Pclose(plist); return class_id;}
开发者ID:andreas-h,项目名称:PyTables,代码行数:31,
示例3: luaC_h5_read_stringint luaC_h5_read_string(lua_State *L){ const char *dsetnm = luaL_checkstring(L, 1); if (PresentFile < 0) { luaL_error(L, "no open file"); } hid_t dset = H5Dopen(PresentFile, dsetnm, H5P_DEFAULT); if (dset < 0) { luaL_error(L, "no data set named %s", dsetnm); } hid_t fspc = H5Dget_space(dset); hid_t strn = H5Dget_type(dset); hsize_t msize = H5Tget_size(strn); char *string = (char*) malloc((msize+1)*sizeof(char)); H5Dread(dset, strn, fspc, fspc, H5P_DEFAULT, string); string[msize] = '/0'; // Make sure to null-terminate the string lua_pushstring(L, string); H5Tclose(strn); H5Sclose(fspc); H5Dclose(dset); free(string); return 1;}
开发者ID:jzrake,项目名称:luview,代码行数:27,
示例4: miget_data_type_size/** Return the byte size of the voxel datatytpe */int miget_data_type_size ( mihandle_t volume, misize_t *voxel_size ){ hid_t grp_id; hid_t dset_id; hid_t type_id; hid_t file_id = volume->hdf_id; grp_id = midescend_path ( file_id, MI_FULLIMAGE_PATH ); if ( grp_id < 0 ) { return ( MI_ERROR ); } dset_id = H5Dopen1 ( grp_id, "image" ); if ( dset_id < 0 ) { return ( MI_ERROR ); } type_id = H5Dget_type ( dset_id ); if ( type_id < 0 ) { return ( MI_ERROR ); } *voxel_size = H5Tget_size ( type_id ); H5Tclose ( type_id ); H5Dclose ( dset_id ); H5Gclose ( grp_id ); return ( MI_NOERROR );}
开发者ID:SiyaSher,项目名称:libminc,代码行数:35,
示例5: H5Dataset_readPalettevoid H5Dataset_readPalette(H5Dataset *d, hid_t did){ hid_t pal_id=-1, tid=-1; hobj_ref_t *refs; if (!d || did<=0 ) return; refs = H5Dataset_get_paletteRef(did); if (refs) { // use the fist palette pal_id = H5Rdereference(d->fid, H5R_OBJECT, refs); tid = H5Dget_type(pal_id); if (H5Dget_storage_size(pal_id) <= 768) { H5Attribute *attr; d->nattributes = 1; d->attributes = (H5Attribute*)malloc(sizeof(H5Attribute)); attr = &(d->attributes[0]); H5Attribute_ctor(attr); attr->value = (unsigned char *)malloc(3*256); memset(attr->value, 0, 768); attr->nvalue = 768; attr->name = (char*)malloc(20); strcpy(attr->name, PALETTE_VALUE); H5Dread( pal_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, attr->value); } if (tid > 0) H5Tclose(tid); if (pal_id > 0) H5Dclose(pal_id); free(refs); }}
开发者ID:DICE-UNC,项目名称:iRODS-FUSE-Mod,代码行数:33,
示例6: H5Dget_typeH5T_class_t HdfDataset::type() const{ hid_t tid = H5Dget_type( d->id ); H5T_class_t t_class = H5Tget_class( tid ); H5Tclose( tid ); return t_class;}
开发者ID:DelazJ,项目名称:QGIS,代码行数:7,
示例7: PYTABLE_write_records/*+++++++++++++++++++++++++.IDENTifer PYTABLE_write_records.PURPOSE Write records to an HDF5 array.INPUT/OUTPUT call as stat = PYTABLE_write_records( locID, dset_name, start, step, count, buffer ); input: hid_t locID : HDF5 identifier of file or group char *dset_name : name of dataset hsize_t *start : index of first row to overwrite hsize_t *step : hsize_t *count : number of rows to write void *buffer : data to write .RETURNS A negative value is returned on failure. .COMMENTS none-------------------------*/herr_t PYTABLE_write_records( hid_t locID, const char *dset_name, hsize_t *start, hsize_t *step, hsize_t *count, const void *buffer ){ int rank; hid_t dataID; hid_t spaceID = -1; hid_t mem_spaceID = -1; hid_t typeID = -1;/* open the dataset. */ if ( (dataID = H5Dopen( locID, dset_name, H5P_DEFAULT )) < 0 ) return -1;/* get the dataspace handle */ if ( (spaceID = H5Dget_space( dataID )) < 0 ) goto done;/* get rank */ if ( (rank = H5Sget_simple_extent_ndims( spaceID )) <= 0 ) goto done;/* create a simple memory data space */ if ( (mem_spaceID = H5Screate_simple( rank, count, NULL )) < 0 ) goto done;/* define a hyperslab in the dataset */ if ( H5Sselect_hyperslab( spaceID, H5S_SELECT_SET, start, step, count, NULL ) < 0 ) goto done;/* get an identifier for the datatype. */ if ( (typeID = H5Dget_type( dataID )) < 0 ) goto done;/* write data to hyperslap */ if ( H5Dwrite( dataID, typeID, mem_spaceID, spaceID, H5P_DEFAULT, buffer ) < 0 ) goto done;/* terminate access to the datatype */ if ( H5Tclose( typeID ) < 0 ) goto done;/* end access to the dataset */ if ( H5Dclose( dataID ) ) goto done;/* terminate access to the dataspace */ if ( H5Sclose( mem_spaceID ) < 0 ) goto done; if ( H5Sclose( spaceID ) < 0 ) goto done; return 0; done: if ( typeID > 0 ) (void) H5Tclose( typeID ); if ( spaceID > 0 ) (void) H5Sclose( spaceID ); if ( mem_spaceID > 0 ) (void) H5Sclose( mem_spaceID ); if ( dataID > 0 ) (void) H5Dclose( dataID ); return -1;}
开发者ID:rmvanhees,项目名称:nadc_tools,代码行数:75,
示例8: VsObjectVsDataset::VsDataset(VsRegistry* r, VsObject* parentObject, const std::string& datasetName, hid_t id): VsObject(r, parentObject, datasetName, id) { dataType = H5Tget_native_type(H5Dget_type(id), H5T_DIR_DEFAULT); loadDims(); registry->add(this);}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:9,
示例9: _hfilehdf5dataset::hdf5dataset(hdf5file& hfile, const std::string& pname) : _hfile(hfile), _name(pname){ _dataset_id = H5Dopen(_hfile.handle(), _name.c_str(), H5P_DEFAULT); if(_dataset_id < 0) throw std::runtime_error("Failed to open dataset (" + _hfile.filename() + ") in file (" + _name + ")"); _type_id = H5Dget_type(_dataset_id); _own_type_id = true;}
开发者ID:klindworth,项目名称:cvwidgets,代码行数:9,
示例10: AtomType//--------------------------------------------------------------------------// Function: IntType overloaded constructor////brief Gets the integer datatype of the specified dataset.////param dataset - IN: Dataset that this integer datatype associates with////exception H5::DataTypeIException// Programmer Binh-Minh Ribler - 2000//--------------------------------------------------------------------------IntType::IntType( const DataSet& dataset ) : AtomType(){ // Calls C function H5Dget_type to get the id of the datatype id = H5Dget_type( dataset.getId() ); if( id < 0 ) { throw DataSetIException("IntType constructor", "H5Dget_type failed"); }}
开发者ID:flexi-framework,项目名称:HDF5,代码行数:17,
示例11: H5Dget_typeH5Type & H5Dataset::getDataType(){ hid_t type = H5Dget_type(dataset); if (type < 0) { throw H5Exception(__LINE__, __FILE__, _("Cannot get the dataspace associated with dataset named %s."), name.c_str()); } return *new H5Type(*this, type);}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:10,
示例12: validateDependsOn/*--------------------------------------------------------------*/static void validateDependsOn(pNXVcontext self, hid_t groupID, hid_t fieldID){ char fname[512], dpData[1024]; hid_t h5type, dpfieldID; H5T_class_t h5class; memset(fname,0,sizeof(fname)); memset(dpData,0,sizeof(dpData)); H5Iget_name(fieldID,fname,sizeof(fname)); NXVsetLog(self,"dataPath",fname); NXVsetLog(self,"sev","debug"); NXVprintLog(self,"message","Validating depends_on chain starting at %s", fname); NXVlog(self); /* test that the depends_on field is of the right type */ h5type = H5Dget_type(fieldID); h5class = H5Tget_class(h5type); H5Tclose(h5type); if(h5class != H5T_STRING){ NXVsetLog(self,"sev","error"); NXVsetLog(self,"message", "depends_on field is of wrong type, expect string"); NXVlog(self); self->errCount++; return; } /* read the field */ H5LTread_dataset_string(groupID,"depends_on",dpData); /* find the field and start iterating through the chain */ dpfieldID = findDependentField(self,fieldID,dpData); if(dpfieldID < 0){ NXVsetLog(self,"sev","error"); NXVprintLog(self,"message", "Cannot even find the starting point of the depends_on chain, %s", dpData); NXVlog(self); self->errCount++; return; } else { validateDependsOnField(self,groupID,dpfieldID); H5Dclose(dpfieldID); }}
开发者ID:nexusformat,项目名称:cnxvalidate,代码行数:56,
示例13: DataType//--------------------------------------------------------------------------// Function: CompType overloaded constructor////brief Gets the compound datatype of the specified dataset.////param dataset - IN: Dataset that this enum datatype associates with////return CompType instance////exception H5::DataTypeIException// Programmer Binh-Minh Ribler - 2000//--------------------------------------------------------------------------CompType::CompType( const DataSet& dataset ) : DataType(){ // Calls C function H5Dget_type to get the id of the datatype id = H5Dget_type( dataset.getId() ); // If the datatype id is invalid, throw exception if( id < 0 ) { throw DataSetIException("CompType constructor", "H5Dget_type failed"); }}
开发者ID:Andy-Sun,项目名称:VTK,代码行数:19,
示例14: getDatasetByFrameasynStatus hdf5Driver::getFrameData (int frame, void *pData){ const char *functionName = "getFrameData"; asynStatus status = asynSuccess; struct dsetInfo *pDSet; hid_t dSpace, dType, mSpace; pDSet = getDatasetByFrame(frame); if(!pDSet) return asynError; hsize_t offset[3] = {(hsize_t)(frame - pDSet->imageNrLow), 0, 0}; hsize_t count[3] = {1, pDSet->height, pDSet->width}; if((dSpace = H5Dget_space(pDSet->id)) < 0) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s couldn't get dataspace/n", driverName, functionName); return asynError; } dType = H5Dget_type(pDSet->id); mSpace = H5Screate_simple(3, count, NULL); // Select the hyperslab if(H5Sselect_hyperslab(dSpace, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s couldn't select hyperslab/n", driverName, functionName); status = asynError; goto end; } // and finally read the image if(H5Dread(pDSet->id, dType, mSpace, dSpace, H5P_DEFAULT, pData) < 0) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s couldn't read image/n", driverName, functionName); status = asynError; }end: H5Tclose(dType); H5Sclose(mSpace); return status;}
开发者ID:brunoseivam,项目名称:ADHDF5,代码行数:52,
示例15: H5Dget_typevoid Fast5Files::getFastq(hid_t dataset){ hid_t dt; size_t size; char *data; dt = H5Dget_type(dataset); size = H5Tget_size(dt); data = (char*)malloc(size); H5Dread(dataset, H5T_C_S1, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); qDebug() << data; free(data); H5Dclose(dataset);}
开发者ID:TravisCG,项目名称:Fast5-Studio,代码行数:13,
示例16: checkVersionvoid PWParameterSet::checkVersion(hid_t h){ if(is_manager()) { hid_t dataset=H5Dopen(h,"version"); hid_t datatype=H5Dget_type(dataset); H5T_class_t classtype = H5Tget_class(datatype); H5Tclose(datatype); H5Dclose(dataset); if(classtype == H5T_INTEGER) { HDFAttribIO<TinyVector<int,2> > hdfver(version); hdfver.read(h,"version"); } else if(classtype == H5T_FLOAT) { TinyVector<double,2> vt; HDFAttribIO<TinyVector<double,2> > hdfver(vt); hdfver.read(h,"version"); version[0]=int(vt[0]); version[1]=int(vt[1]); } //else //{ // APP_ABORT("PWParameterSet::checkVersion The type of version is not integer or double."); //} } myComm->bcast(version); app_log() << "/tWavefunction HDF version: " << version[0] << "." << version[1] << endl; if(version[0] == 0) { if(version[1] == 11) { hasSpin=false; paramTag="parameters_0"; basisTag="basis_1"; pwTag="planewaves"; pwMultTag="multipliers"; eigTag="eigenstates_3"; twistTag="twist_"; bandTag="band_"; } else if(version[1] == 10) { pwMultTag="planewaves"; pwTag="0"; } }}
开发者ID:digideskio,项目名称:qmcpack,代码行数:51,
示例17: try_read_stringstatic int try_read_string(hid_t loc, char * name, char ** dest){ if(H5Lexists(loc,name,H5P_DEFAULT)){ hid_t ds = H5Dopen(loc,name,H5P_DEFAULT); hid_t t = H5Dget_type(ds); if(H5Tget_class(t) == H5T_STRING){ *dest = malloc(sizeof(char)*H5Tget_size(t)); H5Dread(ds,t,H5S_ALL,H5S_ALL,H5P_DEFAULT,*dest); } H5Tclose(t); H5Dclose(ds); return 1; } return 0;}
开发者ID:cxidb,项目名称:libcxi,代码行数:14,
示例18: try_read_float_arraystatic int try_read_float_array(hid_t loc, char * name, double * dest, int size){ if(H5Lexists(loc,name,H5P_DEFAULT)){ hid_t ds = H5Dopen(loc,name,H5P_DEFAULT); hid_t t = H5Dget_type(ds); hid_t s = H5Dget_space(ds); if(H5Tget_class(t) == H5T_FLOAT && array_total_size(ds) == size){ H5Dread(ds,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,dest); } H5Tclose(t); H5Sclose(s); H5Dclose(ds); return 1; } return 0;}
开发者ID:cxidb,项目名称:libcxi,代码行数:15,
示例19: try_read_intstatic int try_read_int(hid_t loc, char * name, int * dest){ if(H5Lexists(loc,name,H5P_DEFAULT)){ hid_t ds = H5Dopen(loc,name,H5P_DEFAULT); hid_t t = H5Dget_type(ds); hid_t s = H5Dget_space(ds); if(H5Tget_class(t) == H5T_INTEGER && is_scalar(ds)){ H5Dread(ds,H5T_NATIVE_INT32,H5S_ALL,H5S_ALL,H5P_DEFAULT,dest); } H5Tclose(t); H5Sclose(s); H5Dclose(ds); return 1; } return 0;}
开发者ID:cxidb,项目名称:libcxi,代码行数:15,
示例20: throw bool DCDataSet::open(hid_t group) throw (DCException) { if (checkExistence && !H5Lexists(group, name.c_str(), H5P_LINK_ACCESS_DEFAULT)) return false; dataset = H5Dopen(group, name.c_str(), H5P_DATASET_ACCESS_DEFAULT); if (dataset < 0) throw DCException(getExceptionString("open: Failed to open dataset")); datatype = H5Dget_type(dataset); if (datatype < 0) { H5Dclose(dataset); throw DCException(getExceptionString("open: Failed to get type of dataset")); } dataspace = H5Dget_space(dataset); if (dataspace < 0) { H5Dclose(dataset); throw DCException(getExceptionString("open: Failed to open dataspace")); } int dims_result = H5Sget_simple_extent_ndims(dataspace); if (dims_result < 0) { close(); throw DCException(getExceptionString("open: Failed to get dimensions")); } ndims = dims_result; getLogicalSize().set(1, 1, 1); if (H5Sget_simple_extent_dims(dataspace, getLogicalSize().getPointer(), NULL) < 0) { close(); throw DCException(getExceptionString("open: Failed to get sizes")); } getLogicalSize().swapDims(ndims); opened = true; return true; }
开发者ID:c-schumann-zih,项目名称:libSplash,代码行数:47,
示例21: h5dget_type_cint_fh5dget_type_c ( hid_t_f *dset_id , hid_t_f *type_id)/******/{ int ret_value = -1; hid_t c_dset_id; hid_t c_type_id; c_dset_id = (hid_t)*dset_id; c_type_id = H5Dget_type(c_dset_id); if(c_type_id < 0 ) return ret_value; *type_id = (hid_t_f)c_type_id; ret_value = 0; return ret_value;}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:17,
示例22: HDFdatasetRead/* * - Name : _MEDdatasetRead * - Description : writes a HDF dataset * - Parameters : * - id (IN) : dataset ID * - val (OUT) : datset values * - Result : * - if success : 0 * - if failure : -1 */ hdf_err HDFdatasetRead(hdf_idt id, void *val){ hdf_idt datatype; hdf_err ret; if ((datatype = H5Dget_type(id)) < 0) return -1;//#if defined (PCLINUX) || defined (PCLINUX64) if ((H5Tget_class(datatype) == H5T_INTEGER) && (H5Tget_size(datatype) == 4)) datatype = H5T_NATIVE_INT;//#endif if ((ret = H5Dread(id,datatype,H5S_ALL,H5S_ALL,H5P_DEFAULT, val)) < 0) return -1; return 0;}
开发者ID:FedoraScientific,项目名称:salome-kernel,代码行数:28,
示例23: gridReaderHDF5_readIntoPatchForVarextern voidgridReaderHDF5_readIntoPatchForVar(gridReader_t reader, gridPatch_t patch, int idxOfVar){ assert(reader != NULL); assert(reader->type = GRIDIO_TYPE_HDF5); assert(patch != NULL); assert(idxOfVar >= 0 && idxOfVar < gridPatch_getNumVars(patch)); hid_t dataSet; hid_t dataSpaceFile, dataTypeFile; hid_t dataSpacePatch, dataTypePatch; gridPointUint32_t idxLoPatch, dimsPatch; dataVar_t var = gridPatch_getVarHandle(patch, idxOfVar); void *data = gridPatch_getVarDataHandle(patch, idxOfVar); gridPatch_getIdxLo(patch, idxLoPatch); gridPatch_getDims(patch, dimsPatch); dataSet = H5Dopen(((gridReaderHDF5_t)reader)->file, dataVar_getName(var), H5P_DEFAULT); dataTypeFile = H5Dget_type(dataSet); dataSpaceFile = H5Dget_space(dataSet); dataTypePatch = dataVar_getHDF5Datatype(var); dataSpacePatch = gridUtilHDF5_getDataSpaceFromDims(dimsPatch); gridUtilHDF5_selectHyperslab(dataSpaceFile, idxLoPatch, dimsPatch); if (H5Tequal(dataTypeFile, dataTypePatch)) { H5Dread(dataSet, dataTypeFile, dataSpacePatch, dataSpaceFile, H5P_DEFAULT, data); } else { fprintf(stderr, "ERROR: Datatype in memory differs from file./n"); diediedie(EXIT_FAILURE); } H5Sclose(dataSpacePatch); H5Tclose(dataTypePatch); H5Sclose(dataSpaceFile); H5Tclose(dataTypeFile); H5Dclose(dataSet);} /* gridReaderHDF5_readIntoPatchForVar */
开发者ID:satlank,项目名称:ginnungagap,代码行数:44,
示例24: hdf5_objecthdf5_datatype::hdf5_datatype(hdf5_dataset const& dataset) : hdf5_object(H5Dget_type(dataset.get_id())), type_class_(H5Tget_class(get_id())){ if(dataset.get_id() < 0) { boost::serialization::throw_exception( hdf5_archive_exception( hdf5_archive_exception::hdf5_archive_dataset_access_error ) ); } if(get_id() < 0) { boost::serialization::throw_exception( hdf5_archive_exception( hdf5_archive_exception::hdf5_archive_datatype_access_error ) ); }}
开发者ID:christoph-weinrich,项目名称:serialization,代码行数:20,
示例25: H5Dopen2int H5mdfile::H5_Dopen2(int argc, char **argv, Tcl_Interp *interp){ /* Open an existing dataset */ dataset_id = H5Dopen2(file_id, argv[2], H5P_DEFAULT); // Dataset properties dataspace_id = H5Dget_space(dataset_id); dataset_type_id = H5Dget_type(dataset_id); datatype_size = H5Tget_size(dataset_type_id); dataset_rank = H5Sget_simple_extent_dims(dataspace_id,dims,maxdims); dataset_rank = H5Sget_simple_extent_dims(dataspace_id,dimstotal,maxdims); prop_id = H5Dget_create_plist(dataset_id); if (H5D_CHUNKED == H5Pget_layout(prop_id)) chunk_rank = H5Pget_chunk(prop_id, dataset_rank, chunk_dims); // Dataset size dset_data_size=1; for(int i=0;i<dataset_rank;i++) { dset_data_size*=dims[i]; } return TCL_OK;}
开发者ID:Clemson-MSE,项目名称:espresso,代码行数:21,
示例26: _SDMF_RD_PT_CLUSDEF/*+++++++++++++++++++++++++ Main Program or Function +++++++++++++++*/int IDL_STDCALL _SDMF_RD_PT_CLUSDEF( int argc, void *argv[] ){ IDL_STRING *dbName; struct clusdef_rec *ClusDef; hid_t fid = -1; hid_t data_id = -1; hid_t type_id = -1;/* * check number of parameters */ if ( argc != 2 ) NADC_GOTO_ERROR( NADC_ERR_PARAM, err_msg ); dbName = (IDL_STRING *) argv[0]; ClusDef = (struct clusdef_rec *) argv[1]; fid = H5Fopen( dbName->s, H5F_ACC_RDONLY, H5P_DEFAULT ); if ( fid < 0 ) NADC_GOTO_ERROR( NADC_ERR_HDF_FILE, dbName->s ); if ( (data_id = H5Dopen( fid, "ClusDef", H5P_DEFAULT )) < 0 ) NADC_GOTO_ERROR( NADC_ERR_HDF_DATA, "ClusDef" ); if ( (type_id = H5Dget_type( data_id )) < 0 ) NADC_GOTO_ERROR( NADC_ERR_HDF_DTYPE, "ClusDef" ); if ( H5LTread_dataset( fid, "ClusDef", type_id, ClusDef ) < 0 ) NADC_GOTO_ERROR( NADC_ERR_HDF_RD, "ClusDef" ); (void) H5Tclose( type_id ); (void) H5Dclose( data_id ); (void) H5Fclose( fid ); return 1; done: H5E_BEGIN_TRY { (void) H5Tclose( type_id ); (void) H5Dclose( data_id ); (void) H5Fclose( fid ); } H5E_END_TRY; return -1;}
开发者ID:rmvanhees,项目名称:nadc_tools,代码行数:40,
示例27: cxi_open_datasetCXI_Dataset * cxi_open_dataset(CXI_Dataset_Reference * ref){ cxi_debug("opening dataset"); if(!ref){ return NULL; } cxi_debug("opening dataset"); CXI_Dataset * dataset = calloc(sizeof(CXI_Dataset),1); if(!dataset){ return NULL; } dataset->handle = H5Dopen(ref->parent_handle,ref->group_name,H5P_DEFAULT); hid_t s = H5Dget_space(dataset->handle); dataset->dimension_count = H5Sget_simple_extent_ndims(s); dataset->dimensions = calloc(sizeof(hsize_t),dataset->dimension_count); H5Sget_simple_extent_dims(s,dataset->dimensions,NULL); dataset->data_type = H5Dget_type(dataset->handle); ref->dataset = dataset; return dataset;}
开发者ID:cxidb,项目名称:libcxi,代码行数:22,
示例28: print_trial_infovoid print_trial_info(hid_t trial,int num_trial) { char string_data[512]; hid_t string_type = H5Tcopy(H5T_C_S1); size_t string_size = 512; H5Tset_size(string_type,string_size); printf("Trial #%d/n",num_trial); hid_t data = H5Dopen(trial,"Date",H5P_DEFAULT); H5Dread(data,string_type,H5S_ALL,H5S_ALL,H5P_DEFAULT,string_data); H5Dclose(data); printf("/tDate: %s/n",string_data); data = H5Dopen(trial,"Synchronous Data/Channel Data",H5P_DEFAULT); hsize_t nchans = H5Tget_size(H5Dget_type(data))/sizeof(double); H5Dclose(data); data = H5PTopen(trial,"Synchronous Data/Channel Data"); hsize_t nsamples; H5PTget_num_packets(data,&nsamples); printf("/t%llu Channels X %llu samples/n",nchans,nsamples); for(int i=1;i<=nchans;++i) { std::stringstream channel_name; channel_name << "Synchronous Data/Channel " << i << " Name"; data = H5Dopen(trial,channel_name.str().c_str(),H5P_DEFAULT); H5Dread(data,string_type,H5S_ALL,H5S_ALL,H5P_DEFAULT,string_data); H5Dclose(data); printf("/t/t#%d: %s/n",i,string_data); } printf("/n");}
开发者ID:misterboyle,项目名称:rtxi,代码行数:37,
示例29: main//.........这里部分代码省略......... H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dataset_id < 0) { fprintf(stderr, "Failed to create DataArray dataset./n"); status = H5Fclose(file_id); return -1; } /* Write the data array data */ status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if(status < 0) { fprintf(stderr, "Failed to write DataArray dataset./n"); status = H5Fclose(file_id); return -1; } /* Close the identifiers */ status = H5Dclose(dataset_id); status = H5Sclose(dataspace_id); } /* Open NumDataObj dataset */ dataset_id = H5Dopen2(file_id, "/NumDataObj", H5P_DEFAULT); if(dataset_id < 0) { fprintf(stderr, "Failed to open NumDataObj dataset./n"); status = H5Fclose(file_id); return -1; } /* Write value to NumDataObj dataset */ numdataobj = j + 1; status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj); if(status < 0) { fprintf(stderr, "Failed to write NumDataObj dataset./n"); status = H5Fclose(file_id); return -1; } /* Close identifiers */ status = H5Dclose(dataset_id); status = H5Gclose(group_id); /* Extend attribute arrays */ for(i = 0; i < NEXTARRAYS; i++) { /* Open extendable dataset */ sprintf(name, "/ExtArray%06d", i); dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT); if(dataset_id < 0) { fprintf(stderr, "Failed to open ExtArray dataset./n"); status = H5Fclose(file_id); return -1; } /* end if */ /* Extend attribute dataset */ dims[0] = (hsize_t)j + 1; status = H5Dset_extent(dataset_id, dims); if(status < 0) { fprintf(stderr, "Failed to extend DataArray dataset./n"); status = H5Fclose(file_id); return -1; } /* end if */ /* Select element and write value to attribute dataset */ dims[0] = 1; memspace_id = H5Screate_simple(1, dims, dims); dataspace_id = H5Dget_space(dataset_id); type_id = H5Dget_type(dataset_id); start[0] = 0; status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, start, stride, count, NULL); start[0] = (hssize_t)j; status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, stride, count, NULL); status = H5Dwrite(dataset_id, type_id, memspace_id, dataspace_id, H5P_DEFAULT, &floatval); if(status < 0) { fprintf(stderr, "Failed to write DataArray dataset./n"); status = H5Fclose(file_id); return -1; } /* Close identifiers */ status = H5Tclose(type_id); status = H5Sclose(dataspace_id); status = H5Sclose(memspace_id); status = H5Dclose(dataset_id); } } /* Close the file */ status = H5Fclose(file_id); printf("/n"); return 0;}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:101,
示例30: do_copy_refobjsint do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */{ hid_t grp_in=(-1); /* read group ID */ hid_t grp_out=(-1); /* write group ID */ hid_t dset_in=(-1); /* read dataset ID */ hid_t dset_out=(-1); /* write dataset ID */ hid_t type_in=(-1); /* named type ID */ hid_t dcpl_id=(-1); /* dataset creation property list ID */ hid_t space_id=(-1); /* space ID */ hid_t ftype_id=(-1); /* file data type ID */ hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */ unsigned int i, j; int k; /*------------------------------------------------------------------------- * browse *------------------------------------------------------------------------- */ for ( i = 0; i < travt->nobjs; i++) { switch ( travt->objs[i].type ) { /*------------------------------------------------------------------------- * H5G_GROUP *------------------------------------------------------------------------- */ case H5G_GROUP: /*------------------------------------------------------------------------- * copy referenced objects in attributes *------------------------------------------------------------------------- */ if ((grp_out=H5Gopen(fidout,travt->objs[i].name))<0) goto error; if((grp_in = H5Gopen (fidin,travt->objs[i].name))<0) goto error; if (copy_refs_attr(grp_in,grp_out,options,travt,fidout)<0) goto error; if (H5Gclose(grp_out)<0) goto error; if (H5Gclose(grp_in)<0) goto error; /*------------------------------------------------------------------------- * check for hard links *------------------------------------------------------------------------- */ if (travt->objs[i].nlinks) { for ( j=0; j<travt->objs[i].nlinks; j++) { H5Glink(fidout, H5G_LINK_HARD, travt->objs[i].name, travt->objs[i].links[j].new_name); } } break; /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ case H5G_DATASET: if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) goto error; if ((space_id=H5Dget_space(dset_in))<0) goto error; if ((ftype_id=H5Dget_type (dset_in))<0) goto error; if ((dcpl_id=H5Dget_create_plist(dset_in))<0) goto error; if ( (rank=H5Sget_simple_extent_ndims(space_id))<0) goto error; if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0) goto error; nelmts=1; for (k=0; k<rank; k++) nelmts*=dims[k]; if ((mtype_id=h5tools_get_native_type(ftype_id))<0) goto error; if ((msize=H5Tget_size(mtype_id))==0) goto error; /*-------------------------------------------------------------------------//.........这里部分代码省略.........
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:101,
注:本文中的H5Dget_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ H5Dopen函数代码示例 C++ H5Dget_space函数代码示例 |