• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ H5Dget_type函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中H5Dget_type函数的典型用法代码示例。如果您正苦于以下问题:C++ H5Dget_type函数的具体用法?C++ H5Dget_type怎么用?C++ H5Dget_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了H5Dget_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: h5_value_doubles

void 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,代码来源:measures_hdf2csv.c


示例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,代码来源:utils.c


示例3: luaC_h5_read_string

int 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,代码来源:h5lua.c


示例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,代码来源:datatype.c


示例5: H5Dataset_readPalette

void  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,代码来源:h5Dataset.c


示例6: H5Dget_type

H5T_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,代码来源:mdal_hdf5.cpp


示例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,代码来源:nadc_pytable_api.c


示例8: VsObject

VsDataset::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,代码来源:VsDataset.C


示例9: _hfile

hdf5dataset::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,代码来源:hdf5internals.cpp


示例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,代码来源:H5IntType.cpp


示例11: H5Dget_type

H5Type & 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,代码来源:H5Dataset.cpp


示例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,代码来源:nxvgroup.c


示例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,代码来源:H5CompType.cpp


示例14: getDatasetByFrame

asynStatus 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,代码来源:hdf5Driver.cpp


示例15: H5Dget_type

void 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,代码来源:fast5files.cpp


示例16: checkVersion

void 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,代码来源:PWParameterSet.cpp


示例17: try_read_string

static 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,代码来源:cxi.c


示例18: try_read_float_array

static 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,代码来源:cxi.c


示例19: try_read_int

static 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,代码来源:cxi.c


示例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,代码来源:DCDataSet.cpp



注:本文中的H5Dget_type函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ H5Dopen函数代码示例发布时间:2022-05-30
下一篇:
C++ H5Dget_space函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap