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

C++ H5Tget_class函数代码示例

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

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



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

示例1: EquivalentDatatypes

//-*****************************************************************************
bool EquivalentDatatypes( hid_t iA, hid_t iB )
{
    if ( iA >= 0 && iB >= 0 )
    {
        if ( H5Tequal( iA, iB ) > 0 )
        {
            return true;
        }

        // If they're not equal, but they are both arrayed and
        // both have the same super type
        // and dimensions, they're equivalent
        if ( H5Tget_class( iA ) == H5T_ARRAY &&
             H5Tget_class( iB ) == H5T_ARRAY )
        {
            hid_t superA = H5Tget_super( iA );
            hid_t superB = H5Tget_super( iB );
            if ( superA >= 0 && superB >= 0 &&
                 H5Tequal( superA, superB ) > 0 )
            {
                Dimensions aDims;
                getDatatypeArrayDims( iA, aDims );
                Dimensions bDims;
                getDatatypeArrayDims( iB, bDims );
                if ( aDims == bDims )
                {
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:ryutaro765,项目名称:Alembic,代码行数:34,代码来源:HDF5Util.cpp


示例2: ReadStringsT

void
ReadStringsT( hid_t iParent,
              const std::string &iAttrName,
              size_t iNumStrings,
              StringT *oStrings )
{
    ABCA_ASSERT( iParent >= 0, "Invalid parent in ReadStringsT" );

    // Open the attribute.
    hid_t attrId = H5Aopen( iParent, iAttrName.c_str(), H5P_DEFAULT );
    ABCA_ASSERT( attrId >= 0,
                 "Couldn't open attribute named: " << iAttrName );
    AttrCloser attrCloser( attrId );

    // Checking code.
    {
        hid_t attrFtype = H5Aget_type( attrId );
        DtypeCloser dtypeCloser( attrFtype );

        hid_t nativeDtype = GetNativeDtype<CharT>();
        ABCA_ASSERT( H5Tget_class( attrFtype ) ==
                     H5Tget_class( nativeDtype ) &&

                     H5Tget_sign( attrFtype ) ==
                     H5Tget_sign( nativeDtype ),

                     "Invalid datatype for stringT" );
    }

    hid_t attrSpace = H5Aget_space( attrId );
    ABCA_ASSERT( attrSpace >= 0,
                 "Couldn't get dataspace for attribute: " << iAttrName );
    DspaceCloser dspaceCloser( attrSpace );

    hssize_t numPoints = H5Sget_simple_extent_npoints( attrSpace );
    ABCA_ASSERT( numPoints > 0,
                 "Degenerate string dimensions in ReadStringsT" );

    // Create temporary char storage buffer.
    std::vector<CharT> charStorage( ( size_t )( 1 + numPoints ),
                                    ( CharT )0 );

    // Read into it.
    herr_t status = H5Aread( attrId, GetNativeDtype<CharT>(),
                             ( void * )&charStorage.front() );
    ABCA_ASSERT( status >= 0, "Couldn't read from attribute: " << iAttrName );

    // Extract 'em.
    ExtractStrings( oStrings, ( const CharT * )&charStorage.front(),
                    1 + numPoints, iNumStrings );
}
开发者ID:ryutaro765,项目名称:Alembic,代码行数:51,代码来源:StringReadUtil.cpp


示例3: write

void write(const hid_attribute_adaptor& attrib, const std::string& value)
{
	hid_t attr_type_id = H5CPP_ERR_ON_NEG(H5Aget_type(attrib.id()));
	if(H5Tget_class(attr_type_id) != H5T_STRING)
		H5CPP_THROW("Attempted to set string value on non-string attribute '"
			<< object::get_name(attrib.id()) << '\'');

	const char* cstr = value.c_str();

	if(H5Tis_variable_str(attr_type_id))
		H5CPP_ERR_ON_NEG(H5Awrite(attrib.id(), attr_type_id, &cstr));
	else
	{
		std::size_t attriblen = H5Aget_storage_size(attrib.id());
		if(attriblen > value.length())
		{
			// avoid reading past end of value into unalloc'd mem
			std::vector<char> buf(attriblen,'\0');
			std::copy(cstr, cstr+value.length(), &buf[0]);
			H5CPP_ERR_ON_NEG(H5Awrite(attrib.id(), attr_type_id, &buf[0]));
		}
		else
			H5CPP_ERR_ON_NEG(H5Awrite(attrib.id(), attr_type_id, cstr));
	}
}
开发者ID:achayan,项目名称:anim-studio-tools,代码行数:25,代码来源:attribute.cpp


示例4: test_compounds

/*-------------------------------------------------------------------------
* subroutine for test_text_dtype(): test_compounds().
*-------------------------------------------------------------------------
*/
static int test_compounds(void)
{
    hid_t   dtype;
    int     nmembs;
    char    *memb_name = NULL;
    H5T_class_t memb_class;
    H5T_class_t type_class;
    char*   dt_str;
    size_t  str_len;

    TESTING3("        text for compound types");

    if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I16BE \"one_field\" : 2; H5T_STD_U8LE \"two_field\" : 6; }", H5LT_DDL))<0)
        goto out;

    if((type_class = H5Tget_class(dtype))<0)
        goto out;
    if(type_class != H5T_COMPOUND)
        goto out;

    if((nmembs = H5Tget_nmembers(dtype))<0)
        goto out;
    if(nmembs != 2)
        goto out;

    if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
        goto out;
    dt_str = (char*)calloc(str_len, sizeof(char));
    if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0)
        goto out;
    if(strcmp(dt_str, "H5T_COMPOUND {\n      H5T_STD_I16BE \"one_field\" : 2;\n      H5T_STD_U8LE \"two_field\" : 6;\n   }")) {
        printf("dt=\n%s\n", dt_str);
        goto out;
    }
    free(dt_str);

    if(H5Tclose(dtype)<0)
        goto out;

    if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I32BE \"i32_field\"; H5T_STD_I16BE \"i16_field\"; H5T_COMPOUND  { H5T_STD_I16BE \"sec_field\"; H5T_COMPOUND { H5T_STD_I32BE \"thd_field\"; } \"grandchild\"; } \"child_compound\"; H5T_STD_I8BE  \"i8_field\"; }", H5LT_DDL))<0)
        goto out;

    if((memb_name = H5Tget_member_name(dtype, 1)) == NULL)
        goto out;
    if(strcmp(memb_name, "i16_field"))
        goto out;
    free(memb_name);

    if((memb_class = H5Tget_member_class(dtype, 2))<0)
        goto out;
    if(memb_class != H5T_COMPOUND)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    return -1;
}
开发者ID:chaako,项目名称:sceptic3D,代码行数:64,代码来源:test_lite.c


示例5: if

std::string hdf5attribute::read_as_string()
{
	std::string result;
	if(H5Tequal(_type_id, H5T_NATIVE_INT16))
		result = boost::lexical_cast<std::string>(read<short>());
	else if(H5Tequal(_type_id, H5T_NATIVE_INT32))
		result = boost::lexical_cast<std::string>(read<int>());
	else if(H5Tequal(_type_id, H5T_NATIVE_UINT32))
		result = boost::lexical_cast<std::string>(read<unsigned int>());
	else if(H5Tequal(_type_id, H5T_NATIVE_UINT16))
		result = boost::lexical_cast<std::string>(read<unsigned short>());
	else if(H5Tequal(_type_id, H5T_NATIVE_UINT8))
		result = boost::lexical_cast<std::string>(read<unsigned char>());
	else if(H5Tequal(_type_id, H5T_NATIVE_INT8))
		result = boost::lexical_cast<std::string>(read<char>());
	else if(H5Tequal(_type_id, H5T_NATIVE_FLOAT))
		result = boost::lexical_cast<std::string>(read<float>());
	else if(H5Tequal(_type_id, H5T_NATIVE_DOUBLE))
		result = boost::lexical_cast<std::string>(read<double>());
	else if(H5Tget_class(_type_id) == H5T_STRING)
		result = read<std::string>();
	else
		throw std::runtime_error("unknown type");
	return result;
}
开发者ID:klindworth,项目名称:cvwidgets,代码行数:25,代码来源:hdf5internals.cpp


示例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: 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


示例8: issue

/* This may be ultimately confused with nested types with 2 components
   called 'r' and 'i' and being floats, but in that case, the user
   most probably wanted to keep a complex type, so getting a complex
   instead of a nested type should not be a big issue (I hope!) :-/
   F. Alted 2005-05-23 */
int is_complex(hid_t type_id) {
  hid_t class_id, base_type_id;
  hid_t class1, class2;
  char *colname1, *colname2;
  int result = 0;
  hsize_t nfields;

  class_id = H5Tget_class(type_id);
  if (class_id == H5T_COMPOUND) {
    nfields = H5Tget_nmembers(type_id);
    if (nfields == 2) {
      colname1 = H5Tget_member_name(type_id, 0);
      colname2 = H5Tget_member_name(type_id, 1);
      if ((strcmp(colname1, "r") == 0) && (strcmp(colname2, "i") == 0)) {
        class1 = H5Tget_member_class(type_id, 0);
        class2 = H5Tget_member_class(type_id, 1);
        if (class1 == H5T_FLOAT && class2 == H5T_FLOAT)
          result = 1;
      }
      free(colname1);
      free(colname2);
    }
  }
  /* Is an Array of Complex? */
  else if (class_id == H5T_ARRAY) {
    /* Get the array base component */
    base_type_id = H5Tget_super(type_id);
    /* Call is_complex again */
    result = is_complex(base_type_id);
    H5Tclose(base_type_id);
  }
  return result;
}
开发者ID:andreas-h,项目名称:PyTables,代码行数:38,代码来源:utils.c


示例9: H5Aget_type

// JRC: This fat interface may not scale?  What about
// scalar attributes?
herr_t VsH5Attribute::getDoubleVectorValue(std::vector<double>* dvals) {
  herr_t err = 0;
  size_t npoints;
  hid_t atype = H5Aget_type(getId());
  H5T_class_t type = H5Tget_class(atype);
  hid_t aspace = H5Aget_space(getId());
  size_t rank = H5Sget_simple_extent_ndims(aspace);

  if (type != H5T_FLOAT) {
    VsLog::warningLog() <<"VsH5Attribute::getDoubleVectorValue() - Requested attribute " <<getShortName()
         <<" is not a floating point vector." <<std::endl;
    dvals->resize(0);
    return -1;
  }
  
  if (rank == 0) {
    dvals->resize(1);
    double v;
    err = H5Aread(getId(), H5T_NATIVE_DOUBLE, &v);
    (*dvals)[0] = v;
    return err;
  }
  
  // rank>0
  npoints = H5Sget_simple_extent_npoints(aspace);
  double* v = new double[npoints];
  err = H5Aread(getId(), H5T_NATIVE_DOUBLE, v);
  dvals->resize(npoints);
  for (size_t i = 0; i<npoints; ++i) {
    (*dvals)[i] = v[i];
  }
  delete [] v;
  
  return err;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:37,代码来源:VsH5Attribute.C


示例10: get_attribute_float

static herr_t get_attribute_float(hid_t input, const char *name, float *val)
{
    hid_t attr_id;
    hid_t type_id;
    H5T_class_t type_class;
    size_t type_size;

    herr_t status;

    char *strval;

    attr_id = H5Aopen_name(input, name);
    type_id = H5Aget_type(attr_id);
    type_class = H5Tget_class(type_id);
    type_size = H5Tget_size(type_id);

    H5Tclose(type_id);
    H5Aclose(attr_id);

    switch(type_class)
    {
        case H5T_STRING:
            status = get_attribute_str(input, name, &strval);
            if (status < 0) return -1;
                *val = atof(strval);
            free(strval);
            return 0;
        case H5T_FLOAT:
            status = get_attribute(input, name, H5T_NATIVE_FLOAT, val);
            if (status < 0) return -1;
            return 0;
    }
    return -1;
}
开发者ID:QuLogic,项目名称:citcoms,代码行数:34,代码来源:Citcoms_Hdf2Vtk.c


示例11: p_get_type

//--------------------------------------------------------------------------
// Function:	AbstractDs::getTypeClass
///\brief	Returns the class of the datatype that is used by this
///		object, which can be a dataset or an attribute.
///\return	Datatype class identifier
///\exception	H5::DataTypeIException
// Programmer	Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_class_t AbstractDs::getTypeClass() const
{
    // Gets the datatype used by this dataset or attribute.
    // p_get_type calls either H5Dget_type or H5Aget_type depending on
    // which object invokes getTypeClass
    hid_t datatype_id;
    try {
        datatype_id = p_get_type();  // returned value is already validated
    }
    catch (DataSetIException E) {
        throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg());
    }
    catch (AttributeIException E) {
        throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg());
    }

    // Gets the class of the datatype and validate it before returning
    H5T_class_t type_class = H5Tget_class(datatype_id);
    if( type_class != H5T_NO_CLASS )
        return( type_class );
    else
    {
        if (fromClass() == "DataSet")
            throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
        else if (fromClass() == "Attribute")
            throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
    }
}
开发者ID:plasmasim,项目名称:sceptic3D,代码行数:36,代码来源:H5AbstractDs.cpp


示例12: getNestedSizeType

size_t
getNestedSizeType(hid_t type_id) {
    hid_t member_type_id;
    H5T_class_t class_id;
    hsize_t i, nfields;
    size_t itemsize, offset;

    nfields = H5Tget_nmembers(type_id);
    offset = 0;
    // Iterate thru the members
    for (i=0; i < nfields; i++) {
        // Get the member type
        member_type_id = H5Tget_member_type(type_id, i);
        // Get the HDF5 class
        class_id = H5Tget_class(member_type_id);
        if (class_id == H5T_COMPOUND) {
            // Get the member size for compound type
            itemsize = getNestedSizeType(member_type_id);
        }
        else {
            // Get the atomic member size
            itemsize = H5Tget_size(member_type_id);
        }
        // Update the offset
        offset = offset + itemsize;
    }
    return(offset);
}      
开发者ID:87,项目名称:PyTables,代码行数:28,代码来源:create-nested-type.c


示例13: validateFloat3Attribute

/*-------------------------------------------------------------*/
static void validateFloat3Attribute(pNXVcontext self,
	hid_t dpField, char *name)
{
	hid_t attID, attType, attSpace;
	H5T_class_t h5class;
	hsize_t dims[2], maxDims[2];
	char fname[512];

	memset(fname,0,sizeof(fname));

	H5Iget_name(dpField,fname,sizeof(fname));

	if(!H5LTfind_attribute(dpField,name)){
			NXVsetLog(self,"sev","error");
			NXVprintLog(self,"message",
				"Missing attribute %s on %s",
				name, fname);
			NXVlog(self);
			self->errCount++;
	} else {
		attID = H5Aopen(dpField,name,H5P_DEFAULT);
		assert(attID >= 0);
		attType = H5Aget_type(attID);
		assert(attType >= 0);
		h5class = H5Tget_class(attType);
		if(h5class != H5T_FLOAT){
			NXVsetLog(self,"sev","error");
			NXVprintLog(self,"message",
				"%s attribute on %s is of wrong type, expected float",
				name, fname);
			NXVlog(self);
			self->errCount++;
		} else {
			attSpace = H5Aget_space(attID);
			if(H5Sget_simple_extent_ndims(attSpace) != 1){
				NXVsetLog(self,"sev","error");
				NXVprintLog(self,"message",
					"%s attribute on %s is of wrong rank, expected 1",
					name, fname);
				NXVlog(self);
				self->errCount++;
			} else {
				H5Sget_simple_extent_dims(attSpace,dims,maxDims);
				if(dims[0] != 3){
					NXVsetLog(self,"sev","error");
					NXVprintLog(self,"message",
						"%s attribute on %s is of wrong size, expected 3",
						name, fname);
					NXVlog(self);
					self->errCount++;
				}
			}
			H5Sclose(attSpace);
		}
		H5Tclose(attType);
		H5Aclose(attID);
	}
}
开发者ID:nexusformat,项目名称:cnxvalidate,代码行数:59,代码来源:nxvgroup.c


示例14: get_cols

/* fetch num_cols and the col for a particular trackname */
void get_cols(chromosome_t *chromosome, char *trackname, hsize_t *num_cols,
              hsize_t *col) {
  hid_t attr, root, dataspace, datatype;
  hsize_t data_size, cell_size, num_cells;
  char *attr_data;

  /* Tracknames are stored in the attributes of the root group of each file */
  root = H5Gopen(chromosome->h5group, "/", H5P_DEFAULT);
  assert(root >= 0);

  attr = H5Aopen_name(root, "tracknames");
  assert(attr >= 0);

  dataspace = H5Aget_space(attr);
  assert(dataspace >= 0);

  assert(H5Sget_simple_extent_dims(dataspace, num_cols, NULL) == 1);
  assert(H5Sclose(dataspace) >= 0);

  if (trackname && col) {
    datatype = H5Aget_type(attr);
    assert(datatype >= 0);
    assert(H5Tget_class(datatype) == H5T_STRING);

    cell_size = H5Tget_size(datatype);
    assert(cell_size > 0);

    data_size = H5Aget_storage_size(attr);
    assert(data_size > 0);

    num_cells = data_size / cell_size;

    /* allocate room for tracknames */
    attr_data = xmalloc(data_size);
    assert(attr_data);

    assert(H5Aread(attr, datatype, attr_data) >= 0);

    *col = 0;
    for (*col = 0; *col <= num_cells; (*col)++) {
      if (*col == num_cells) {
        fprintf(stderr, "can't find trackname: %s\n", trackname);
        free(attr_data);
        exit(EXIT_FAILURE);
      } else {
        if (!strncmp(attr_data + (*col * cell_size), trackname, cell_size)) {
          break;
        }
      }
    }

    /* clean up read tracknames */
    free(attr_data);
  }

  assert(H5Aclose(attr) >= 0);
}
开发者ID:weallen,项目名称:Seqwill,代码行数:58,代码来源:genomedata_load_data.c


示例15: validateDependsOnAttributes

/*--------------------------------------------------------------
	This validates the lesser depends_on chain fields like
	vector, offset and transformation_type
----------------------------------------------------------------*/
static void validateDependsOnAttributes(pNXVcontext self,hid_t dpField)
{
	char fname[512], transData[512];
	hid_t attID, attType, attSpace;
	H5T_class_t h5class;

	memset(fname,0,sizeof(fname));
	memset(transData,0,sizeof(transData));

	H5Iget_name(dpField,fname,sizeof(fname));

	/*
		deal with transformation_type
	*/
	if(!H5LTfind_attribute(dpField,"transformation_type")){
			NXVsetLog(self,"sev","error");
			NXVprintLog(self,"message",
				"Missing attribute transformation_type on %s",
				fname);
			NXVlog(self);
			self->errCount++;
	} else {
		attID = H5Aopen(dpField,"transformation_type",H5P_DEFAULT);
		assert(attID >= 0);
		attType = H5Aget_type(attID);
		assert(attType >= 0);
		h5class = H5Tget_class(attType);
		if(h5class != H5T_STRING){
			NXVsetLog(self,"sev","error");
			NXVprintLog(self,"message",
				"transformation_type on %s is of wrong type, expected string",
				fname);
			NXVlog(self);
			self->errCount++;
		} else {
			H5NXget_attribute_string(self->fileID, fname,
					"transformation_type",transData);
			if(strcmp(transData,"translation") != 0
				&& strcmp(transData,"rotation") != 0){
					NXVsetLog(self,"sev","error");
					NXVprintLog(self,"message",
						"transformation_type on %s contains bad data: %s",
						fname,
						"expected rotation or translation");
					NXVlog(self);
					self->errCount++;
				}
		}
		H5Tclose(attType);
		H5Aclose(attID);
	}

	validateFloat3Attribute(self,dpField,"offset");
	validateFloat3Attribute(self,dpField,"vector");

}
开发者ID:nexusformat,项目名称:cnxvalidate,代码行数:60,代码来源:nxvgroup.c


示例16: H5Tget_sign

DataType ImageBase::datatypeH5(hid_t h5datatype)
{
    H5T_sign_t h5sign = H5Tget_sign(h5datatype);

    //    if (h5sign == H5T_SGN_ERROR)
    //        REPORT_ERROR(ERR_IO, "datatypeHDF5: Integer sign error in dataset.");
    bool sign = (h5sign > H5T_SGN_NONE);
    size_t size = H5Tget_size(h5datatype);

    DataType dt;
    switch(H5Tget_class(h5datatype))
    {
    case H5T_FLOAT:
        {
            switch(size)
            {
            case 4:
                dt = DT_Float;
                break;
            case 8:
                dt = DT_Double;
                break;
            default:
                REPORT_ERROR(ERR_IO_SIZE, "datatypeHDF5: bad datatype size");
            }
        }
        break;
    case H5T_INTEGER:
        {
            switch(size)
            {
            case 1:
                dt = (sign)? DT_SChar : DT_UChar;
                break;
            case 2:
                dt = (sign)? DT_Short : DT_UShort;
                break;
            case 4:
                dt = (sign)? DT_Int : DT_UInt;
                break;
            case 8:
                dt = (sign)? DT_Long : DT_ULong;
                break;
            default:
                REPORT_ERROR(ERR_IO_SIZE, "datatypeHDF5: bad datatype size");
            }
        }
        break;
    case H5T_NO_CLASS:
    default:
        dt = DT_Unknown;
        break;
    }
    return dt;
}
开发者ID:I2PC,项目名称:scipion,代码行数:55,代码来源:rwHDF5.cpp


示例17: 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


示例18: get_attribute_info

static herr_t get_attribute_info(hid_t obj_id,
                                 const char *attr_name,
                                 hsize_t *dims,
                                 H5T_class_t *type_class,
                                 size_t *type_size,
                                 hid_t *type_id)
{
    hid_t attr_id;
    hid_t space_id;
    herr_t status;
    int rank;

    /* Open the attribute. */
    attr_id = H5Aopen_name(obj_id, attr_name);
    if (attr_id < 0)
        return -1;

    /* Get an identifier for the datatype. */
    *type_id = H5Aget_type(attr_id);

    /* Get the class. */
    *type_class = H5Tget_class(*type_id);

    /* Get the size. */
    *type_size = H5Tget_size(*type_id);

    /* Get the dataspace handle */
    space_id = H5Aget_space(attr_id);
    if (space_id < 0)
        goto out;

    /* Get dimensions */
    rank = H5Sget_simple_extent_dims(space_id, dims, NULL);
    if (rank < 0)
        goto out;

    /* Terminate access to the dataspace */
    status = H5Sclose(space_id);
    if (status < 0)
        goto out;

    /* End access to the attribute */
    status = H5Aclose(attr_id);
    if (status < 0)
        goto out;

    return 0;
out:
    H5Tclose(*type_id);
    H5Aclose(attr_id);
    return -1;
}
开发者ID:QuLogic,项目名称:citcoms,代码行数:52,代码来源:Citcoms_Hdf2Vtk.c


示例19: test_arrays

/*-------------------------------------------------------------------------
* subroutine for test_text_dtype(): test_arrays().
*-------------------------------------------------------------------------
*/
static int test_arrays(void)
{
    hid_t   dtype;
    int     ndims;
    hsize_t dims[3];
    H5T_class_t type_class;
    char*   dt_str;
    size_t  str_len;

    TESTING3("        text for array types");

    if((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }", H5LT_DDL))<0)
        goto out;

    if((type_class = H5Tget_class(dtype))<0)
        goto out;
    if(type_class != H5T_ARRAY)
        goto out;

    if((ndims = H5Tget_array_ndims(dtype))<0)
        goto out;
    if(ndims != 3)
        goto out;

    if(H5Tget_array_dims2(dtype, dims) < 0)
        goto out;
    if(dims[0] != 5 || dims[1] != 7 || dims[2] != 13)
        goto out;

    if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
        goto out;
    dt_str = (char*)calloc(str_len, sizeof(char));
    if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0)
        goto out;
    if(strcmp(dt_str, "H5T_ARRAY {\n      [5][7][13] H5T_ARRAY {\n         [17][19] H5T_COMPOUND {\n            H5T_STD_I8BE \"arr_compound_1\" : 0;\n            H5T_STD_I32BE \"arr_compound_2\" : 1;\n         }\n      }\n   }")) {
        printf("dt=\n%s\n", dt_str);
        goto out;
    }

    free(dt_str);

    if(H5Tclose(dtype)<0)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    return -1;
}
开发者ID:chaako,项目名称:sceptic3D,代码行数:55,代码来源:test_lite.c


示例20: H5Tget_class

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ H5Tget_size函数代码示例发布时间:2022-05-30
下一篇:
C++ H5Tequal函数代码示例发布时间: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