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

C++ H5Awrite函数代码示例

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

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



在下文中一共展示了H5Awrite函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:fileio_hdf5.c


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


示例3: H5Awrite

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


示例4: main

int
main()
{
   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,代码来源:tst_h_many_atts.c


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


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


示例7: sizeof

herr_t
H5AwriteVL_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,代码来源:h5aImp.c


示例8: nh5awrite_c

int_f
nh5awrite_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,代码来源:H5Af.c


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


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


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


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


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


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


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


示例16: create_complex_attribute

// create a complex float attribute
herr_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,代码来源:complextype.c


示例17: WriteDataToAttr

//-*****************************************************************************
void
WriteDataToAttr( 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,代码来源:WriteUtil.cpp


示例18: NC4_put_propattr

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


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


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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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