您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ H5Awrite函数代码示例

51自学网 2021-06-01 21:19:58
  C++
这篇教程C++ H5Awrite函数代码示例写得很实用,希望能帮到您。

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

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

示例1: writeAttribute_int

herr_t writeAttribute_int(hid_t file_id, const char *dsName, const char *attrName,void  *val) {   hid_t dataset = H5Dopen(file_id,dsName,H5P_DEFAULT);   hid_t aid = H5Screate(H5S_SCALAR);   hid_t attr = H5Acreate(dataset,attrName, H5T_NATIVE_INT, aid, H5P_DEFAULT,H5P_DEFAULT);   herr_t ret = H5Awrite(attr,H5T_NATIVE_INT,val);   ret = H5Sclose(aid);   ret = H5Aclose(attr);   return ret;}
开发者ID:ernmeel,项目名称:sweeny,代码行数:9,


示例2: fclib_create_int_attributes_in_info

int fclib_create_int_attributes_in_info(const char *path, const char * attr_name,                                        int attr_value){  hid_t  file_id, id, dataspace_id, attr_id;  hsize_t dim = 1;  hsize_t     dims[1];  FILE *f;  if ((f = fopen (path, "r"))) /* HDF5 outputs lots of warnings when file does not exist */  {    fclose (f);    if ((file_id = H5Fopen (path, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)    {      fprintf (stderr, "ERROR: opening file failed/n");      return 0;    }  }    if (H5Lexists (file_id, "/fclib_local/info", H5P_DEFAULT))  {    IO (id = H5Gopen (file_id, "/fclib_local/info", H5P_DEFAULT));    dims[0]=1;    dataspace_id = H5Screate_simple(1, dims, NULL);    attr_id = H5Acreate (id, attr_name, H5T_NATIVE_INT, dataspace_id,                         H5P_DEFAULT, H5P_DEFAULT);    IO(H5Awrite(attr_id, H5T_NATIVE_INT , &attr_value ));    IO(H5Aclose (attr_id));    IO (H5Gclose (id));  }  else  {    IO (id = H5Gmake (file_id, "/fclib_local/info"));    dims[0]=1;    dataspace_id = H5Screate_simple(1, dims, NULL);    attr_id = H5Acreate (id, attr_name, H5T_NATIVE_INT, dataspace_id,                         H5P_DEFAULT, H5P_DEFAULT);    IO(H5Awrite(attr_id, H5T_NATIVE_INT , &attr_value ));    IO(H5Aclose (attr_id));    IO (H5Gclose (id));  }  IO (H5Fclose (file_id));  return 1;}
开发者ID:xhub,项目名称:fclib,代码行数:44,


示例3: H5Awrite

voidHDF5Attribute::write(const HDF5Id mem_type_id, const void *attribute_data) const{    i32 res = H5Awrite(m_id, mem_type_id, attribute_data);    if (res < 0) {        char attrName[256];        H5Aget_name(m_id, 256, attrName);        THROW(Iex::IoExc, "Could not write attribute" << attrName);    }}
开发者ID:papaver,项目名称:nkhive,代码行数:10,


示例4: main

intmain(){   printf("/n*** Checking many attributes in HDF5 file./n");   printf("*** Checking some more simple atts.../n");   {#define NUM_ATTS 10000      hid_t fcpl_id, hdfid, grpid;      hid_t spaceid, attid1;      int one = 1;      hsize_t dims[1] = {1};      int i;      char name[NC_MAX_NAME];      struct timeval start_time, end_time, diff_time;      double sec;      /* Create a HDF5 file. */      if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;      if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |					       H5P_CRT_ORDER_INDEXED)) < 0) ERR;      if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |					       H5P_CRT_ORDER_INDEXED)) < 0) ERR;      if ((hdfid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0) ERR;      if (H5Pclose(fcpl_id) < 0) ERR;      /* Open the root group. */      if ((grpid = H5Gopen2(hdfid, "/", H5P_DEFAULT)) < 0) ERR;      if (gettimeofday(&start_time, NULL)) ERR;      /* Write an attribute. */      if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0) ERR;      for (i = 0; i < NUM_ATTS; i++)      {	 sprintf(name, "att_%d", i);	 if ((attid1 = H5Acreate2(grpid, name, H5T_NATIVE_INT, spaceid,				  H5P_DEFAULT, H5P_DEFAULT)) < 0) ERR;	 if (H5Awrite(attid1, H5T_NATIVE_INT, &one) < 0) ERR;/*	 if (H5Aclose(attid1) < 0) ERR;*/	 if((i + 1) % 1000 == 0)	 {		/* only print every 1000th attribute name */	    if (gettimeofday(&end_time, NULL)) ERR;	    if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR;	    sec = diff_time.tv_sec + 1.0e-6 * diff_time.tv_usec;	    printf("%i/t%.3g sec/n", i + 1, sec);	 }      }      /* Close everything. */      if (H5Sclose(spaceid) < 0) ERR;      if (H5Gclose(grpid) < 0) ERR;      if (H5Fclose(hdfid) < 0) ERR;   }   SUMMARIZE_ERR;   FINAL_RESULTS;}
开发者ID:ArtisticCoding,项目名称:libmesh,代码行数:55,


示例5: save_quad_bc

bool save_quad_bc(hid_t parent_group_id, JudyArray<Boundary *> &bcs) {	herr_t status;	// create main group	hid_t group_id = H5Gcreate(parent_group_id, "quad", 0);	// count	hid_t dataspace_id = H5Screate(H5S_SCALAR);	hid_t attr_count = H5Acreate(group_id, "count", H5T_NATIVE_UINT32, dataspace_id, H5P_DEFAULT);	uint count = bcs.count();	status = H5Awrite(attr_count, H5T_NATIVE_UINT32, &count);	H5Aclose(attr_count);    ///	hsize_t dims = Quad::NUM_VERTICES;	hid_t elem_dataspace_id = H5Screate_simple(1, &dims, NULL);	hid_t merker_dataspace_id = H5Screate(H5S_SCALAR);    // dump vertices    for (int i = 0; i < count; i++) {    	char name[256];    	sprintf(name, "%d", i);		// the dataset		hid_t dataset_id = H5Dcreate(group_id, name, H5T_NATIVE_UINT32, elem_dataspace_id, H5P_DEFAULT);		status = H5Dwrite(dataset_id, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, bcs[i]->get_vertices());		// marker		hid_t attr_marker = H5Acreate(dataset_id, "marker", H5T_NATIVE_UINT32, dataspace_id, H5P_DEFAULT);		uint marker = bcs[i]->get_marker();		status = H5Awrite(attr_marker, H5T_NATIVE_UINT32, &marker);		H5Aclose(attr_marker);		status = H5Dclose(dataset_id);    }    H5Sclose(elem_dataspace_id);    H5Sclose(dataspace_id);	status = H5Gclose(group_id);		// close the group}
开发者ID:B-Rich,项目名称:hermes-legacy,代码行数:42,


示例6: H5Awrite

char HVLStringAttribute::write(const std::string & str){	const char *string_att[1];	string_att[0] = str.c_str();	herr_t status = H5Awrite(fObjectId, dataType(), &string_att);				if(status < 0)		return 0;		return 1;}
开发者ID:spinos,项目名称:aphid,代码行数:11,


示例7: sizeof

herr_tH5AwriteVL_str    (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf){    herr_t  status = -1;    char  **wdata;    jsize   size;    jint    i;    size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf);    wdata = (char**)HDcalloc((size_t)size + 1, sizeof(char*));    if (!wdata) {        h5JNIFatalError(env, "H5AwriteVL_str:  cannot allocate buffer");    } /* end if */    else {        HDmemset(wdata, 0, (size_t)size * sizeof(char*));        for (i = 0; i < size; ++i) {            jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) buf, i);            if (obj != 0) {                jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);                const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);                if (utf8) {                    wdata[i] = (char*)HDmalloc((size_t)length + 1);                    if (wdata[i]) {                        HDmemset(wdata[i], 0, ((size_t)length + 1));                        HDstrncpy(wdata[i], utf8, (size_t)length);                    } /* end if */                } /* end if */                ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);                ENVPTR->DeleteLocalRef(ENVPAR obj);            } /* end if */        } /* end for (i = 0; i < size; ++i) */        status = H5Awrite((hid_t)aid, (hid_t)tid, wdata);        for (i = 0; i < size; i++) {            if(wdata[i]) {                HDfree(wdata[i]);            } /* end if */        } /* end for */        HDfree(wdata);        if (status < 0)            h5libraryError(env);    } /* end else */    return (jint)status;}
开发者ID:Starlink,项目名称:hdf5,代码行数:51,


示例8: nh5awrite_c

int_fnh5awrite_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf, void UNUSED *dims){    int_f ret_value=0;          /* Return value */     /*      * Call H5Awrite function.      */     if (H5Awrite((hid_t)*attr_id, (hid_t)*mem_type_id, buf) < 0)        HGOTO_DONE(FAIL);done:     return ret_value;}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:14,


示例9: add_attr

/* add a single attribute */int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) {    hid_t aid;    aid = H5Acreate (oid, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT);	if (aid <0)	return 0;	    H5Awrite(aid, tid, buf);     H5Aclose(aid);		return 1;}
开发者ID:FilipeMaia,项目名称:hdf5,代码行数:15,


示例10: write_string_attribute

 void write_string_attribute(hid_t id, std::string name, std::string value) {  datatype strdatatype = H5Tcopy(H5T_C_S1);  auto status = H5Tset_size(strdatatype, value.size() + 1);  // auto status = H5Tset_size(strdatatype, H5T_VARIABLE);  if (status < 0) TRIQS_RUNTIME_ERROR << "Internal error in H5Tset_size";  dataspace space = H5Screate(H5S_SCALAR);  attribute attr = H5Acreate2(id, name.c_str(), strdatatype, space, H5P_DEFAULT, H5P_DEFAULT);  if (!attr.is_valid()) TRIQS_RUNTIME_ERROR << "Cannot create the attribute " << name;  status = H5Awrite(attr, strdatatype, (void *)(value.c_str()));  if (status < 0) TRIQS_RUNTIME_ERROR << "Cannot write the attribute " << name; }
开发者ID:cyrilmartins,项目名称:triqs,代码行数:15,


示例11: test_attrname

/* * test_attrname * Test that attributes can deal with UTF-8 strings */void test_attrname(hid_t fid, const char * string){  hid_t group_id, attr_id;  hid_t dtype_id, space_id;  hsize_t dims=1;  char read_buf[MAX_STRING_LENGTH];  herr_t ret; /* Create a new group and give it an attribute whose  * name and value are UTF-8 strings.  */  group_id = H5Gcreate2(fid, GROUP4_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);  CHECK(group_id, FAIL, "H5Gcreate2");  space_id = H5Screate_simple(RANK, &dims, NULL);  CHECK(space_id, FAIL, "H5Screate_simple");  dtype_id = H5Tcopy(H5T_C_S1);  CHECK(dtype_id, FAIL, "H5Tcopy");  ret = H5Tset_size(dtype_id, (size_t)MAX_STRING_LENGTH);  CHECK(ret, FAIL, "H5Tset_size");  /* Create the attribute and check that its name is correct */  attr_id = H5Acreate2(group_id, string, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);  CHECK(attr_id, FAIL, "H5Acreate2");  ret = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf);  CHECK(ret, FAIL, "H5Aget_name");  ret = strcmp(read_buf, string);  VERIFY(ret, 0, "strcmp");  read_buf[0] = '/0';  /* Try writing and reading from the attribute */  ret = H5Awrite(attr_id, dtype_id, string);  CHECK(ret, FAIL, "H5Awrite");  ret = H5Aread(attr_id, dtype_id, read_buf);  CHECK(ret, FAIL, "H5Aread");  ret = strcmp(read_buf, string);  VERIFY(ret, 0, "strcmp");  /* Clean up */  ret = H5Aclose(attr_id);  CHECK(ret, FAIL, "H5Aclose");  ret = H5Tclose(dtype_id);  CHECK(ret, FAIL, "H5Tclose");  ret = H5Sclose(space_id);  CHECK(ret, FAIL, "H5Sclose");  ret = H5Gclose(group_id);  CHECK(ret, FAIL, "H5Gclose");}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:52,


示例12: _write_grid

hid_t _write_grid(hid_t loc_id, std::string attr_name, double *attr_array, const hsize_t size){	herr_t status;	hid_t attr_id;	DataspaceCreate x_grid_space(H5S_SCALAR);	status = H5Sset_extent_simple(x_grid_space.dataspace_id, 1, &size, NULL);	attr_id = H5Acreate(loc_id, attr_name.c_str(), H5T_NATIVE_DOUBLE, x_grid_space.dataspace_id, H5P_DEFAULT, H5P_DEFAULT);	status = H5Awrite(attr_id, H5T_NATIVE_DOUBLE, attr_array);	H5Aclose(attr_id);	return status;}
开发者ID:joelfrederico,项目名称:IonSim,代码行数:16,


示例13: ASDF_write_double_attribute

herr_t ASDF_write_double_attribute(hid_t dataset_id,			            const char *attr_name,				    double attr_value) {  hid_t space_id, attr_id;  CHK_H5(space_id = H5Screate(H5S_SCALAR));  CHK_H5(attr_id = H5Acreate(dataset_id, attr_name, H5T_IEEE_F64LE, space_id, H5P_DEFAULT, H5P_DEFAULT));  CHK_H5(H5Awrite(attr_id, H5T_IEEE_F64LE, &attr_value));  CHK_H5(H5Aclose(attr_id));  CHK_H5(H5Sclose(space_id));  return 0; // Success}
开发者ID:QuLogic,项目名称:asdf-library,代码行数:16,


示例14: ASDF_write_integer_attribute

herr_t ASDF_write_integer_attribute(hid_t dataset_id,			            const char *attr_name,				    long long int attr_value) {  hid_t space_id, attr_id;  CHK_H5(space_id = H5Screate(H5S_SCALAR));  CHK_H5(attr_id = H5Acreate(dataset_id, attr_name, H5T_STD_I64LE, space_id, H5P_DEFAULT, H5P_DEFAULT));  CHK_H5(H5Awrite(attr_id, H5T_STD_I64LE, &attr_value));  CHK_H5(H5Aclose(attr_id));  CHK_H5(H5Sclose(space_id));  return 0; // Success}
开发者ID:QuLogic,项目名称:asdf-library,代码行数:16,


示例15: filename

void Simulation3D::dumpTimings(unsigned long* timings, hsize_t total_timings,			       unsigned int steps_per_timing) {  std::ostringstream filename(std::ios::out);  filename << dumpDir << "/timing_s" << blockSize << "_p" << world.size() << ".h5";    hid_t file_id=H5Fcreate(filename.str().c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);  hid_t timingspace=H5Screate_simple(1, & total_timings, NULL);  hid_t dx_space = H5Screate(H5S_SCALAR);  hid_t dt_space = H5Screate(H5S_SCALAR);  hid_t bs_space = H5Screate(H5S_SCALAR);  hid_t ns_space = H5Screate(H5S_SCALAR);  hid_t alg_name_space = H5Screate(H5S_SCALAR);  hid_t atype = H5Tcopy(H5T_C_S1);#ifndef YEE  H5Tset_size(atype, xUpdateRHSs->getAlgName().length());#else  H5Tset_size(atype, std::string("Yee").length());#endif  H5Tset_strpad(atype, H5T_STR_NULLTERM);  hid_t timing_dset_id = H5Dcreate(file_id, "timings", H5T_NATIVE_LONG, timingspace,				   H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);  hid_t dx_attr_id = H5Acreate(timing_dset_id, "dx", H5T_NATIVE_DOUBLE, dx_space,			       H5P_DEFAULT, H5P_DEFAULT);  hid_t dt_attr_id = H5Acreate(timing_dset_id, "dt", H5T_NATIVE_DOUBLE, dt_space,			       H5P_DEFAULT, H5P_DEFAULT);  hid_t bs_attr_id = H5Acreate(timing_dset_id, "blockSize", H5T_NATIVE_UINT, bs_space,			       H5P_DEFAULT, H5P_DEFAULT);  hid_t ns_attr_id = H5Acreate(timing_dset_id, "stepsPerTiming", H5T_NATIVE_UINT, ns_space,			       H5P_DEFAULT, H5P_DEFAULT);  hid_t alg_attr_id = H5Acreate(timing_dset_id,"communicationStrategy", atype, alg_name_space,				H5P_DEFAULT, H5P_DEFAULT);  herr_t status = H5Dwrite(timing_dset_id, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL,			   H5P_DEFAULT, timings);  status = H5Awrite(dx_attr_id, H5T_NATIVE_DOUBLE, & dx);  status = H5Awrite(dt_attr_id, H5T_NATIVE_DOUBLE, & dt);  status = H5Awrite(bs_attr_id, H5T_NATIVE_UINT, & blockSize);  status = H5Awrite(ns_attr_id, H5T_NATIVE_UINT, & steps_per_timing);#ifndef YEE  status = H5Awrite(alg_attr_id, atype, xUpdateRHSs->getAlgName().c_str());#else  status = H5Awrite(alg_attr_id, atype, "Yee");#endif  H5Sclose(timingspace); H5Sclose(dx_space); H5Sclose(dt_space);  H5Sclose(alg_name_space); H5Sclose(bs_space); H5Sclose(ns_space);  H5Tclose(atype);  H5Aclose(dx_attr_id); H5Aclose(dt_attr_id); H5Aclose(bs_attr_id);  H5Aclose(alg_attr_id); H5Aclose(ns_attr_id);  H5Dclose(timing_dset_id);  H5Fclose(file_id);}
开发者ID:adam-higuera,项目名称:adi-prototype,代码行数:54,


示例16: create_complex_attribute

// create a complex float attributeherr_t create_complex_attribute(hid_t loc_id, const char* path,        const char* name, float_complex value){    hid_t space_id, attr_id;    hid_t real_type_id;    hsize_t *dims;    herr_t status;    float * buf;    real_type_id = create_real_type_id();    space_id = H5Screate_simple(1,dims,NULL);    attr_id = H5Acreate_by_name(loc_id,path,name,real_type_id,space_id,H5P_DEFAULT,H5P_DEFAULT, H5P_DEFAULT);    buf[0] = crealf(value);    buf[1] = cimagf(value);    status = H5Awrite(attr_id,real_type_id,buf);    return status;}
开发者ID:ThinkManhattan,项目名称:amelet-hdf,代码行数:18,


示例17: WriteDataToAttr

//-*****************************************************************************voidWriteDataToAttr( hid_t iParent,                 hid_t iDspace,                 const std::string &iAttrName,                 hid_t iFileType,                 hid_t iNativeType,                 const void *iData ){    hid_t attrId = H5Acreate2( iParent, iAttrName.c_str(),                               iFileType, iDspace,                               H5P_DEFAULT, H5P_DEFAULT );    AttrCloser attrCloser( attrId );    herr_t status = H5Awrite( attrId, iNativeType, iData );    ABCA_ASSERT( status >= 0, "Couldn't write attribute: " << iAttrName );}
开发者ID:AWhetter,项目名称:alembic,代码行数:18,


示例18: NC4_put_propattr

intNC4_put_propattr(NC_HDF5_FILE_INFO_T* h5){    int ncstat = NC_NOERR;    H5T_class_t t_class;    size_t size;    hid_t grp = -1;    hid_t exists = -1;    hid_t attid = -1;    hid_t aspace = -1;    hid_t atype = -1;    herr_t herr = 0;    char* text = NULL;    /* Get root group */    grp = h5->root_grp->hdf_grpid; /* get root group */    /* See if the NCPROPS attribute exists */    if(H5Aexists(grp,NCPROPS) == 0) { /* Does not exist */      ncstat = NC4_buildpropinfo(&h5->fileinfo->propattr,&text);      if(text == NULL || ncstat != NC_NOERR) {        goto done;      }      herr = -1;      /* Create a datatype to refer to. */      HCHECK((atype = H5Tcopy(H5T_C_S1)));      HCHECK((H5Tset_cset(atype, H5T_CSET_ASCII)));      HCHECK((H5Tset_size(atype, strlen(text)+1))); /*keep nul term */      HCHECK((aspace = H5Screate(H5S_SCALAR)));      HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT)));      HCHECK((H5Awrite(attid, atype, text)));      herr = 0;    } done:    if(ncstat != NC_NOERR) {      if(text != NULL) {        free(text);        text = NULL;      }    }    if(attid >= 0) HCHECK((H5Aclose(attid)));    if(aspace >= 0) HCHECK((H5Sclose(aspace)));    if(atype >= 0) HCHECK((H5Tclose(atype)));    return ncstat;}
开发者ID:balborian,项目名称:libmesh,代码行数:45,


示例19: writeStringAttribute

void writeStringAttribute(hid_t element, const char *attr_name, const char *attr_value){  herr_t hdfstatus = -1;  hid_t hdfdatatype = -1;  hid_t hdfattr = -1;  hid_t hdfattrdataspace = -1;  hdfattrdataspace = H5Screate(H5S_SCALAR);  hdfdatatype      = H5Tcopy(H5T_C_S1);  hdfstatus        = H5Tset_size(hdfdatatype, strlen(attr_value));  hdfstatus        = H5Tset_strpad(hdfdatatype, H5T_STR_NULLTERM);  hdfattr          = H5Acreate2(element, attr_name, hdfdatatype, hdfattrdataspace, H5P_DEFAULT, H5P_DEFAULT);  hdfstatus = H5Awrite(hdfattr, hdfdatatype, attr_value);  H5Aclose (hdfattr);  H5Sclose(hdfattrdataspace);  return;}
开发者ID:areaDetector,项目名称:ADCore,代码行数:18,


示例20: EPIK_TRACER

void seissol::checkpoint::h5::Fault::write(int timestepFault){	EPIK_TRACER("CheckPointFault_write");	SCOREP_USER_REGION("CheckPointFault_write", SCOREP_USER_REGION_TYPE_FUNCTION);	if (numSides() == 0)		return;	logInfo(rank()) << "Writing fault check point.";	// Create array with all pointers	EPIK_USER_REG(r_write_fault, "checkpoint_write_fault");	SCOREP_USER_REGION_DEFINE(r_write_fault);	EPIK_USER_START(r_write_fault);	SCOREP_USER_REGION_BEGIN(r_write_fault, "checkpoint_write_fault", SCOREP_USER_REGION_TYPE_COMMON);	// Attributes	checkH5Err(H5Awrite(m_h5timestepFault[odd()], H5T_NATIVE_INT, &timestepFault));	// Set memory and file space	hsize_t fStart[2] = {fileOffset(), 0};	hsize_t count[2] = {numSides(), numBndGP()};	hid_t h5memSpace = H5Screate_simple(2, count, 0L);	checkH5Err(h5memSpace);	checkH5Err(H5Sselect_all(h5memSpace));	checkH5Err(H5Sselect_hyperslab(m_h5fSpaceData, H5S_SELECT_SET, fStart, 0L, count, 0L));	for (unsigned int i = 0; i < NUM_VARIABLES; i++) {		checkH5Err(H5Dwrite(m_h5data[odd()][i], H5T_NATIVE_DOUBLE, h5memSpace, m_h5fSpaceData,				h5XferList(), data(i)));	}	checkH5Err(H5Sclose(h5memSpace));	EPIK_USER_END(r_write_fault);	SCOREP_USER_REGION_END(r_write_fault);	// Finalize the checkpoint	finalizeCheckpoint();	logInfo(rank()) << "Writing fault check point. Done.";}
开发者ID:fsimonis,项目名称:SeisSol,代码行数:42,


示例21: writeInt32Attribute

void writeInt32Attribute(hid_t element, const char *attr_name, hsize_t dims, int *attr_value){  herr_t hdfstatus = -1;  hid_t hdfdatatype = -1;  hid_t hdfattr = -1;  hid_t hdfattrdataspace = -1;    hdfattrdataspace = H5Screate(H5S_SCALAR);  hdfdatatype      = H5Tcopy(H5T_NATIVE_INT32);  if (dims == 1) {  } else {    hdfattrdataspace = H5Screate(H5S_SIMPLE);    H5Sset_extent_simple(hdfattrdataspace, 1, &dims, NULL);  }  hdfattr = H5Acreate2(element, attr_name, hdfdatatype, hdfattrdataspace, H5P_DEFAULT, H5P_DEFAULT);  hdfstatus = H5Awrite(hdfattr, hdfdatatype, attr_value);  H5Aclose (hdfattr);  H5Sclose(hdfattrdataspace);  return;}
开发者ID:areaDetector,项目名称:ADCore,代码行数:21,


示例22: ASDF_write_string_attribute

herr_t ASDF_write_string_attribute(hid_t dataset_id,                                   const char *attr_name,                                   const char *attr_value) {  hid_t space_id, type_id, attr_id;  CHK_H5(space_id  = H5Screate(H5S_SCALAR));  CHK_H5(type_id = H5Tcopy(H5T_C_S1));  CHK_H5(H5Tset_size(type_id, strlen(attr_value)));  CHK_H5(H5Tset_strpad(type_id,H5T_STR_NULLPAD));  CHK_H5(attr_id = H5Acreate(dataset_id, attr_name, type_id, space_id,        H5P_DEFAULT, H5P_DEFAULT));  CHK_H5(H5Awrite(attr_id, type_id, attr_value));  CHK_H5(H5Aclose(attr_id));  CHK_H5(H5Tclose(type_id));  CHK_H5(H5Sclose(space_id));  return 0; // Success}
开发者ID:QuLogic,项目名称:asdf-library,代码行数:21,


示例23: main

int main() {   hid_t       file_id, dataset_id, attribute_id, dataspace_id;  /* identifiers */   hsize_t     dims;   int         attr_data[2];   herr_t      status;   /* Initialize the attribute data. */   attr_data[0] = 100;   attr_data[1] = 200;   /* Open an existing file. */   file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);   /* Open an existing dataset. */   dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT);   /* Create the data space for the attribute. */   dims = 2;   dataspace_id = H5Screate_simple(1, &dims, NULL);   /* Create a dataset attribute. */   attribute_id = H5Acreate2 (dataset_id, "Units", H5T_STD_I32BE, dataspace_id,                              H5P_DEFAULT, H5P_DEFAULT);   /* Write the attribute data. */   status = H5Awrite(attribute_id, H5T_NATIVE_INT, attr_data);   /* Close the attribute. */   status = H5Aclose(attribute_id);   /* Close the dataspace. */   status = H5Sclose(dataspace_id);   /* Close to the dataset. */   status = H5Dclose(dataset_id);   /* Close the file. */   status = H5Fclose(file_id);}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:40,


示例24: put_string_attribute

extern void put_string_attribute(hid_t parent, char *name, char *value){    hid_t   attr, space_attr, typ_attr;    hsize_t dim_attr[1] = {1}; // Single dimension array of values    if (!value)        value = "";    typ_attr = H5Tcopy(H5T_C_S1);    if (typ_attr < 0) {        debug3("PROFILE: failed to copy type for attribute %s", name);        return;    }    H5Tset_size(typ_attr, strlen(value));    H5Tset_strpad(typ_attr, H5T_STR_NULLTERM);    space_attr = H5Screate_simple(1, dim_attr, NULL);    if (space_attr < 0) {        H5Tclose(typ_attr);        debug3("PROFILE: failed to create space for attribute %s",               name);        return;    }    attr = H5Acreate(parent, name, typ_attr, space_attr,                     H5P_DEFAULT, H5P_DEFAULT);    if (attr < 0) {        H5Tclose(typ_attr);        H5Sclose(space_attr);        debug3("PROFILE: failed to create attribute %s", name);        return;    }    if (H5Awrite(attr, typ_attr, value) < 0) {        debug3("PROFILE: failed to write attribute %s", name);        // Fall through to release resources    }    H5Sclose(space_attr);    H5Tclose(typ_attr);    H5Aclose(attr);    return;}
开发者ID:diorsman,项目名称:slurm,代码行数:39,


示例25: H5Fopen

void AccessTraceWriter::dump(bool cont) {    hid_t fid = H5Fopen(fname.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);    if (fid == H5I_INVALID_HID) panic("Could not open HDF5 file %s", fname.c_str());    hid_t table = H5PTopen(fid, "accs");    if (table == H5I_INVALID_HID) panic("Could not open HDF5 packet table");    herr_t err = H5PTappend(table, cur, buf);    assert(err >= 0);    if (!cont) {        hid_t fAttr = H5Aopen(fid, "finished", H5P_DEFAULT);        uint32_t finished = 1;        H5Awrite(fAttr, H5T_NATIVE_UINT, &finished);        H5Aclose(fAttr);        gm_free(buf);        buf = nullptr;        max = 0;    }    cur = 0;    H5PTclose(table);    H5Fclose(fid);}
开发者ID:Luffy0011,项目名称:zsim,代码行数:23,


示例26: H5Exception

hid_t H5Attribute::create(const hid_t loc, const std::string & name, const hid_t type, const hid_t targettype, const hid_t srcspace, const hid_t targetspace, void * data){    herr_t err;    if (H5Aexists(loc, name.c_str()) > 0)    {        throw H5Exception(__LINE__, __FILE__, _("Attribute %s already exists."), name.c_str());    }    hid_t attr = H5Acreate(loc, name.c_str(), targettype, targetspace == -1 ? srcspace : targetspace, H5P_DEFAULT, H5P_DEFAULT);    if (attr < 0)    {        throw H5Exception(__LINE__, __FILE__, _("Cannot create a new attribute."));    }    err = H5Awrite(attr, type, data);    if (err < 0)    {        H5Aclose(attr);        throw H5Exception(__LINE__, __FILE__, _("Cannot write data in the attribute."));    }    return attr;}
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:23,


示例27: utils_hdf5_write_attr

escdf_errno_t utils_hdf5_write_attr(hid_t loc_id, const char *name,                                    hid_t disk_type_id, hsize_t *dims,                                    unsigned int ndims, hid_t mem_type_id,                                    const void *buf){    escdf_errno_t err;    hid_t attr_id;    herr_t err_id;    if ((err = utils_hdf5_create_attr(loc_id, name, disk_type_id, dims, ndims, &attr_id)) != ESCDF_SUCCESS) {        return err;    }    err = ESCDF_SUCCESS;    if ((err_id = H5Awrite(attr_id, mem_type_id, buf)) < 0) {        DEFER_FUNC_ERROR(err_id);        err = ESCDF_ERROR;    }    H5Aclose(attr_id);    return err;}
开发者ID:thomas-ruh,项目名称:libescdf,代码行数:23,


示例28: NC4_put_propattr

intNC4_put_propattr(NC_HDF5_FILE_INFO_T* h5){    int ncstat = NC_NOERR;    char text[NCPROPS_LENGTH+1];    H5T_class_t t_class;	    size_t size;    hid_t grp = -1;    hid_t exists = -1;    hid_t attid = -1;    hid_t aspace = -1;    hid_t atype = -1;    herr_t herr = 0;    /* Get root group */    grp = h5->root_grp->hdf_grpid; /* get root group */    /* See if the NCPROPS attribute exists */    exists = H5Aopen_name(grp, NCPROPS);    if(exists < 0) {/* Does not exist */	herr = -1;        /* Create a datatype to refer to. */        HCHECK((atype = H5Tcopy(H5T_C_S1)));	HCHECK((H5Tset_cset(atype, H5T_CSET_UTF8)));        HCHECK((H5Tset_size(atype, NCPROPS_LENGTH)));	HCHECK((aspace = H5Screate(H5S_SCALAR)));	HCHECK((attid = H5Acreate(grp, NCPROPS, atype, aspace, H5P_DEFAULT)));        HCHECK((H5Awrite(attid, atype, h5->fileinfo->propattr.text)));	herr = 0;    }done:    if(exists >= 0) HCHECK((H5Aclose(exists)));    if(attid >= 0) HCHECK((H5Aclose(attid)));    if(aspace >= 0) HCHECK((H5Sclose(aspace)));    if(atype >= 0) HCHECK((H5Tclose(atype)));    return ncstat;}
开发者ID:jarlela,项目名称:netcdf-c,代码行数:36,


示例29: e5_write_attr_list_int

estatus_te5_write_attr_list_int(    hid_t e5_group_id, e5_attr_int* e5_attr_list){    int i;    hid_t e5_attribute_id;    hid_t e5_dataspace_id = H5Screate(H5S_SCALAR);    for(i = 0; e5_attr_list && e5_attr_list[i].name != 0; i++)    {        e5_attr_int *attr = &e5_attr_list[i];        if(attr->name == 0 || strlen(attr->name) < 1)            continue;        if(H5Aexists(e5_group_id, attr->name) <= 0)            e5_attribute_id = H5Acreate(e5_group_id, attr->name, H5T_STD_I32LE, e5_dataspace_id, H5P_DEFAULT);        e5_info(e5_group_id, "Adding attribute [type='integer', name='%s', value='%d']/n",  attr->name, attr->value);        e5_attribute_id = H5Aopen(e5_group_id, attr->name, H5P_DEFAULT);        H5Awrite(e5_attribute_id, H5T_NATIVE_INT, &(attr->value));        H5Aclose(e5_attribute_id);    }    H5Sclose(e5_dataspace_id);    return E5_SUCCESS;}
开发者ID:voidcycles,项目名称:void,代码行数:24,



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


C++ H5Dclose函数代码示例
C++ H5Aread函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。