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

C++ H5Tinsert函数代码示例

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

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



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

示例1: create_symbol_datatype

/*-------------------------------------------------------------------------
 * Function:    create_symbol_datatype
 *
 * Purpose:     Create's the HDF5 datatype used for elements in the SWMR
 *              testing datasets.
 *
 * Parameters:  N/A
 *
 * Return:      Success:    An HDF5 type ID
 *              Failure:    -1
 *
 *-------------------------------------------------------------------------
 */
hid_t
create_symbol_datatype(void)
{
    hid_t sym_type_id;          /* Datatype ID for symbol */
    hid_t opaq_type_id;         /* Datatype ID for opaque part of record */

    /* Create opaque datatype to represent other information for this record */
    if((opaq_type_id = H5Tcreate(H5T_OPAQUE, (size_t)DTYPE_SIZE)) < 0)
        return -1;

    /* Create compound datatype for symbol */
    if((sym_type_id = H5Tcreate(H5T_COMPOUND, sizeof(symbol_t))) < 0)
        return -1;

    /* Insert fields in symbol datatype */
    if(H5Tinsert(sym_type_id, "rec_id", HOFFSET(symbol_t, rec_id), H5T_NATIVE_UINT64) < 0)
        return -1;
    if(H5Tinsert(sym_type_id, "info", HOFFSET(symbol_t, info), opaq_type_id) < 0)
        return -1;

    /* Close opaque datatype */
    if(H5Tclose(opaq_type_id) < 0)
        return -1;

    return sym_type_id;
} /* end create_symbol_datatype() */
开发者ID:FilipeMaia,项目名称:hdf5,代码行数:39,代码来源:swmr_common.c


示例2: make_particle_type

/*-------------------------------------------------------------------------
 * function to create a datatype representing the particle struct
 *-------------------------------------------------------------------------
 */
static hid_t
make_particle_type(void)
{
    hid_t type_id;
    hid_t string_type;
    size_t type_size = sizeof(particle_t);

    /* Create the memory data type. */
    if ((type_id = H5Tcreate (H5T_COMPOUND, type_size )) < 0 )
        return -1;

    /* Insert fields. */
    string_type = H5Tcopy( H5T_C_S1 );
    H5Tset_size( string_type, (size_t)16 );

    if ( H5Tinsert(type_id, "Name", HOFFSET(particle_t, name) , string_type ) < 0 )
        return -1;
    if ( H5Tinsert(type_id, "Lat", HOFFSET(particle_t, lati) , H5T_NATIVE_INT ) < 0 )
        return -1;
    if ( H5Tinsert(type_id, "Long", HOFFSET(particle_t, longi) , H5T_NATIVE_INT ) < 0 )
        return -1;
    if ( H5Tinsert(type_id, "Pressure", HOFFSET(particle_t, pressure) , H5T_NATIVE_FLOAT ) < 0 )
        return -1;
    if ( H5Tinsert(type_id, "Temperature", HOFFSET(particle_t, temperature) , H5T_NATIVE_DOUBLE ) < 0 )
        return -1;

    return type_id;
}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:32,代码来源:test_packet.c


示例3: create_ieee_complex256

/* Counterpart for complex256 */
hid_t create_ieee_complex256(const char *byteorder) {
  herr_t err = 0;
  hid_t float_id, complex_id;
  H5T_order_t h5order = H5Tget_order(H5T_NATIVE_LDOUBLE);

  complex_id = H5Tcreate(H5T_COMPOUND, sizeof(npy_complex256));
  float_id = H5Tcopy(H5T_NATIVE_LDOUBLE);
  if (float_id < 0)
  {
    H5Tclose(complex_id);
    return float_id;
  }

  if ((strcmp(byteorder, "little") == 0) && (h5order != H5T_ORDER_LE))
    err = H5Tset_order(float_id, H5T_ORDER_LE);
  else if ((strcmp(byteorder, "big") == 0) && (h5order != H5T_ORDER_BE))
    err = H5Tset_order(float_id, H5T_ORDER_BE);

  if (err < 0)
  {
    H5Tclose(complex_id);
    return err;
  }

  H5Tinsert(complex_id, "r", HOFFSET(npy_complex256, real), float_id);
  H5Tinsert(complex_id, "i", HOFFSET(npy_complex256, imag), float_id);
  H5Tclose(float_id);
  return complex_id;
}
开发者ID:bbudescu,项目名称:PyTables,代码行数:30,代码来源:utils.c


示例4: main

int main(int argc, char *argv[])
{
    hdf_sa_t arr[LEN];
    initArr(arr, LEN);

    // create data type corresponding to compound struct
    hid_t cid = H5Tcreate(H5T_COMPOUND, sizeof(hdf_sa_t));
    H5Tinsert(cid, "a", HOFFSET(hdf_sa_t, a), H5T_NATIVE_INT);
    H5Tinsert(cid, "b", HOFFSET(hdf_sa_t, b), H5T_NATIVE_FLOAT);
    H5Tinsert(cid, "c", HOFFSET(hdf_sa_t, c), H5T_NATIVE_DOUBLE);

    // write data to file
    hid_t fid = H5Fcreate("compound.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);

    // create data space
    hsize_t dim[1] = {LEN};
    hid_t space = H5Screate_simple(1, dim, NULL);
    hid_t dataset = H5Dcreate(fid, "compound", cid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);

    // write data 
    H5Dwrite(dataset, cid, H5S_ALL, H5S_ALL, H5P_DEFAULT, arr);

    H5Sclose(space);
    H5Dclose(dataset);
    H5Fclose(fid);

    return 0;
}
开发者ID:wxm71,项目名称:todo,代码行数:28,代码来源:compound.c


示例5: createNestedType

hid_t
createNestedType(void) {
    hid_t tid, tid2, tid3;
    size_t offset, offset2;

    offset = 1;  offset2 = 2;
    // Create a coumpound type large enough (>= 20)
    tid = H5Tcreate(H5T_COMPOUND, 21);
    // Insert an atomic type
    tid2 = H5Tcopy(H5T_NATIVE_FLOAT);
    H5Tinsert(tid, "float", offset, tid2);
    H5Tclose(tid2);
    offset += 4 + 2;  // add two to the offset so as to create gaps
    // Insert a nested compound
    tid2 = H5Tcreate(H5T_COMPOUND, 12);     
    tid3 = H5Tcopy(H5T_NATIVE_CHAR);
    H5Tinsert(tid2, "char", offset2, tid3);
    H5Tclose(tid3);
    offset2 += 2;  // add one space (for introducing gaps)
    tid3 = H5Tcopy(H5T_NATIVE_DOUBLE);
    H5Tinsert(tid2, "double", offset2, tid3);
    H5Tclose(tid3);
    offset2 += 5;  // add one space (for introducing gaps)
    H5Tinsert(tid, "compound", offset, tid2);
    H5Tclose(tid2);
    offset += 12 + 1;
    return(tid);
}
开发者ID:87,项目名称:PyTables,代码行数:28,代码来源:create-nested-type.c


示例6: hdf5

    /** Creates a HDF5 type identifier for the [kmer,abundance] structure. This type will be used
     * for dumping Count instances in a HDF5 file (like SortingCount algorithm does).
     * \param[in] isCompound : tells whether the structure is compound (SHOULD BE OBSOLETE IN THE FUTURE)
     * \return the HDF5 identifier for the type. */
    static hid_t hdf5 (bool& isCompound)
    {
        hid_t abundanceType = H5T_NATIVE_UINT16;

        if (sizeof(Number)==1) {
            abundanceType = H5T_NATIVE_UINT8;
        }
        else if (sizeof(Number)==2) {
            abundanceType = H5T_NATIVE_UINT16;
        }
        else if (sizeof(Number)==4) {
            abundanceType = H5T_NATIVE_UINT32;
        }
        else if (sizeof(Number)==8) {
            abundanceType = H5T_NATIVE_UINT64;
        }
        else {
            throw "Bad type size for Abundance HDF5 serialization";
        }

        hid_t result = H5Tcreate (H5T_COMPOUND, sizeof(Abundance));
        H5Tinsert (result, "value",      HOFFSET(Abundance, value),     Type::hdf5(isCompound));
        H5Tinsert (result, "abundance",  HOFFSET(Abundance, abundance), abundanceType);

        isCompound = true;

        return result;
    }
开发者ID:cdeltel,项目名称:gatb-core-mirrored,代码行数:32,代码来源:Abundance.hpp


示例7: gent_compound

/*-------------------------------------------------------------------------
 * Function:    gent_compound
 *
 * Purpose:     Generate a compound dataset in LOC_ID
 *
 *-------------------------------------------------------------------------
 */
static void gent_compound(hid_t loc_id)
{
    typedef struct s_t
    {
        char str1[20];
        char str2[20];
    } s_t;
    hid_t   sid, did, tid_c, tid_s;
    hsize_t dims[1] = {2};
    s_t     buf[2]  = {{"str1", "str2"}, {"str3", "str4"}};

    /* create dataspace */
    sid = H5Screate_simple(1, dims, NULL);

    /* create a compound type */
    tid_c = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
    tid_s = H5Tcopy(H5T_C_S1);
    H5Tset_size(tid_s, 20);

    H5Tinsert(tid_c, "str1", HOFFSET(s_t,str1), tid_s);
    H5Tinsert(tid_c, "str2", HOFFSET(s_t,str2), tid_s);

    /* create dataset */
    did = H5Dcreate2(loc_id, DATASET_COMPOUND, tid_c, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);

    /* write */
    H5Dwrite(did, tid_c, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);

    /* close */
    H5Sclose(sid);
    H5Dclose(did);
    H5Tclose(tid_c);
    H5Tclose(tid_s);
}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:41,代码来源:h5copygentest.c


示例8: hdf5

 inline static hid_t hdf5 (bool& compound)
 {
     hid_t result = H5Tcreate (H5T_COMPOUND, sizeof(Entry));
     H5Tinsert (result, "index",      HOFFSET(Entry, index),     H5T_NATIVE_UINT16);
     H5Tinsert (result, "abundance",  HOFFSET(Entry, abundance), H5T_NATIVE_UINT64);
     compound = true;
     return result;
 }
开发者ID:zy26,项目名称:gatb-core,代码行数:8,代码来源:IHistogram.hpp


示例9: AH5_auto_test_file

char *test_read_complex_dataset()
{

    int i,rank = 1;
    hsize_t dims[1];
    hid_t dataspace_id, dset_id, dtr_id, dti_id, file_id;
    size_t type_size;
    hid_t type_id;
    herr_t status, status_2;
    float *real_part, *imag_part;
    const char* path = "dataset_name";
    AH5_complex_t cplx[2];
    AH5_complex_t * rdata;

    file_id = AH5_auto_test_file();

    cplx[0].re=10.;
    cplx[0].im=20.;
    cplx[1].re=10.5;
    cplx[1].im=20.5;
    //first write complex array set with hdf5 lib
	real_part = (float *)malloc(2 * sizeof(float));
    imag_part = (float *)malloc(2 * sizeof(float));
    for( i=0;i<2;i++)
    {
        real_part[i] = cplx[i].re;
        imag_part[i] = cplx[i].im;
    }
    type_id = create_type_id(H5T_NATIVE_FLOAT);
    dims[0] = 2;
    dataspace_id = H5Screate_simple(rank, dims, NULL);
    dset_id = H5Dcreate(file_id,path,type_id,dataspace_id,
                H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
    type_size = H5Tget_size(H5T_NATIVE_FLOAT);
    dtr_id = H5Tcreate(H5T_COMPOUND,type_size);
    status = H5Tinsert(dtr_id,"r",0, H5T_NATIVE_FLOAT);
    dti_id = H5Tcreate(H5T_COMPOUND,type_size);
    status = H5Tinsert(dti_id,"i",0, H5T_NATIVE_FLOAT);
    status = H5Dwrite(dset_id,dtr_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,real_part);
    status = H5Dwrite(dset_id,dti_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,imag_part);
    status = H5Tclose(dtr_id);
    status = H5Tclose(dti_id);
    free(real_part);
    free(imag_part);
    mu_assert("Read complex dataset.",
        		AH5_read_cpx_dataset(file_id,"dataset_name", 2, &rdata));

    for (i = 0; i < 2; i++)
    {
      	printf("Real parts : %f %f\n", cplx[i].re, rdata[i].re);
       	printf("Imaginary parts : %f %f\n", cplx[i].im, rdata[i].im);
       	mu_assert_equal("Check the real values.", cplx[i].re, rdata[i].re);
       	mu_assert_equal("Check the imaginary value.", cplx[i].im, rdata[i].im);
    }

    return MU_FINISHED_WITHOUT_ERRORS;
}
开发者ID:ThinkManhattan,项目名称:amelet-hdf,代码行数:57,代码来源:dataset.c


示例10: H5Pcreate

void OHDF5mpipp::registerHDF5DataSet(HDF5DataSet& dataset, char* name)
{
  //hsize_t dimsext[2] = {1,1}; 
  //dataset.memspace = H5Screate_simple (RANK, dimsext, NULL);
  
  int chunk_size = buf_size/dataset.sizeof_entry;
  
  std::cout << "chunk_size=" << chunk_size << std::endl;
  std::cout << "dataset.all_window_size=" << dataset.all_window_size << std::endl;
  
  hsize_t maxdims[2]={H5S_UNLIMITED,1};
  hsize_t dims[2]={dataset.all_window_size, 1};
  hsize_t chunk_dims[2]={5*chunk_size,1};			//numberOfValues is to small
  /* Create the data space with unlimited dimensions. */
  
  dataset.plist_id = H5Pcreate(H5P_DATASET_XFER);
  if (logger_type==nestio::Standard || logger_type==nestio::Buffered)
    H5Pset_dxpl_mpio(dataset.plist_id, H5FD_MPIO_INDEPENDENT);
  else
    H5Pset_dxpl_mpio(dataset.plist_id, H5FD_MPIO_COLLECTIVE);
  
  //hid_t filespace=H5Screate_simple (RANK, dims, maxdims);
  dataset.filespace=H5Screate_simple (RANK, dims, maxdims);
  
  /* Modify dataset creation properties, i.e. enable chunking  */
  
  hid_t prop=H5Pcreate (H5P_DATASET_CREATE);
  status = H5Pset_chunk (prop, RANK, chunk_dims);
  /*
     * Create the compound datatype for the file.  Because the standard
     * types we are using for the file may have different sizes than
     * the corresponding native types, we must manually calculate the
     * offset of each member.
     */

  hid_t filetype = H5Tcreate (H5T_COMPOUND, 3*8+dataset.max_numberOfValues*8);
  status = H5Tinsert (filetype, "id", 0, H5T_STD_I64BE);
  status = H5Tinsert (filetype, "neuron id", 8, H5T_STD_I64BE);
  status = H5Tinsert (filetype, "timestamp", 16, H5T_STD_I64BE);
  for (int i=0; i<dataset.max_numberOfValues; i++) {
    std::stringstream ss;
    ss << "V" << i;
    status = H5Tinsert (filetype, ss.str().c_str(), 24+i*8, H5T_IEEE_F64BE); //third argument: offset
  }

  /* Create a new dataset within the file using chunk 
      creation properties.  */
  
  std::cout << "H5Dcreate2 name=" << name << " max_numberOfValues=" << dataset.max_numberOfValues << std::endl;

  dataset.dset_id=H5Dcreate2 (file, name, filetype, dataset.filespace,
	    H5P_DEFAULT, prop, H5P_DEFAULT);
  
  status = H5Pclose(prop);
  status = H5Tclose(filetype);
  //status = H5Sclose (filespace);
}
开发者ID:tillschumann,项目名称:nestio_inm6,代码行数:57,代码来源:ohdf5mpipp.cpp


示例11: require_group

void NSDFWriter::createEventMap()
{
    herr_t status;    
    hid_t eventMapContainer = require_group(filehandle_, MAPEVENTSRC);
    // Open the container for the event maps
    // Create the Datasets themselves (one for each field - each row
    // for one object).
    for (map< string, vector < string > >::iterator ii = classFieldToEventSrc_.begin();
         ii != classFieldToEventSrc_.end();
         ++ii){
        vector < string > pathTokens;
        tokenize(ii->first, "/", pathTokens);
        string className = pathTokens[0];
        string fieldName = pathTokens[1];
        hid_t classGroup = require_group(eventMapContainer, className);
        hid_t strtype = H5Tcopy(H5T_C_S1);
        status = H5Tset_size(strtype, H5T_VARIABLE);
        // create file space
        hid_t ftype = H5Tcreate(H5T_COMPOUND, sizeof(hvl_t) +sizeof(hobj_ref_t));
        status = H5Tinsert(ftype, "source", 0, strtype);
        status = H5Tinsert(ftype, "data", sizeof(hvl_t), H5T_STD_REF_OBJ);
        hsize_t dims[1] = {ii->second.size()};
        hid_t space = H5Screate_simple(1, dims, NULL);
        // The dataset for mapping is named after the field
        hid_t ds = H5Dcreate2(classGroup, fieldName.c_str(), ftype, space,
                              H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
        status = H5Sclose(space);
        map_type * buf = (map_type*)calloc(ii->second.size(), sizeof(map_type));
        // Populate the buffer entries with source uid and data
        // reference
        for (unsigned int jj = 0; jj < ii->second.size(); ++jj){
            buf->source = ii->second[jj].c_str();
            char * dsname = (char*)calloc(256, sizeof(char));
            ssize_t size = H5Iget_name(classFieldToEvent_[ii->first][jj], dsname, 255);
            if (size > 255){
                free(dsname);
                dsname = (char*)calloc(size, sizeof(char));
                size = H5Iget_name(classFieldToEvent_[ii->first][jj], dsname, 255);
            }
            status = H5Rcreate(&(buf->data), filehandle_, dsname, H5R_OBJECT, -1);
            free(dsname);
            assert(status >= 0);            
        }
        // create memory space
        hid_t memtype = H5Tcreate(H5T_COMPOUND, sizeof(map_type));
        status = H5Tinsert(memtype, "source",
                           HOFFSET(map_type, source), strtype);
        status = H5Tinsert(memtype, "data",
                           HOFFSET(map_type, data), H5T_STD_REF_OBJ);
        status = H5Dwrite(ds, memtype,  H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
        free(buf);
        status = H5Tclose(strtype);
        status = H5Tclose(ftype);
        status = H5Tclose(memtype);
        status = H5Dclose(ds);
    }
}
开发者ID:asiaszmek,项目名称:moose-core,代码行数:57,代码来源:NSDFWriter.cpp


示例12: AH5_H5Tcreate_cpx_filetype

hid_t AH5_H5Tcreate_cpx_filetype(void)
{
    hid_t cpx_filetype;

    cpx_filetype = H5Tcreate(H5T_COMPOUND, H5Tget_size(AH5_NATIVE_FLOAT) * 2);
    H5Tinsert(cpx_filetype, "r", 0, AH5_NATIVE_FLOAT);
    H5Tinsert(cpx_filetype, "i", H5Tget_size(AH5_NATIVE_FLOAT), AH5_NATIVE_FLOAT);

    return cpx_filetype;
}
开发者ID:ThinkManhattan,项目名称:amelet-hdf,代码行数:10,代码来源:ah5_general.c


示例13: H5Tcreate

inline
hid_t
get_hdf5_type< std::complex<float> >()
  {
  hid_t type = H5Tcreate(H5T_COMPOUND, sizeof(hdf5_complex_t<float>));
  
  H5Tinsert(type, "real", HOFFSET(hdf5_complex_t<float>, real), H5T_NATIVE_FLOAT);
  H5Tinsert(type, "imag", HOFFSET(hdf5_complex_t<float>, imag), H5T_NATIVE_FLOAT);
  
  return type;
  }
开发者ID:ELEN4002-Lab-Project-2012,项目名称:ELEN4002-Lab-Project,代码行数:11,代码来源:hdf5_misc.hpp


示例14: create_type_id

hid_t create_type_id(hid_t real_or_double)
{
    hid_t type_id;
    hid_t type_size, two_type_size;
    herr_t status;

    type_size = H5Tget_size(real_or_double);
    two_type_size = type_size * 2;
    type_id = H5Tcreate(H5T_COMPOUND, two_type_size);
    status = H5Tinsert(type_id, "r", 0, real_or_double);
    status = H5Tinsert(type_id, "i", type_size, real_or_double);
    return type_id;
}
开发者ID:ThinkManhattan,项目名称:amelet-hdf,代码行数:13,代码来源:dataset.c


示例15: linkDatatype

hid_t linkDatatype()
{
	hid_t tLink;
	hid_t tPosition;
	hid_t tNumber;	
	
	tLink = H5Tcreate(H5T_COMPOUND, sizeof(link_t));
	tPosition = H5Tcopy(H5T_NATIVE_INT32);
	tNumber = H5Tcopy(H5T_NATIVE_INT32);
	H5Tinsert(tLink, "position", HOFFSET(link_t, position), tPosition);
	H5Tinsert(tLink, "number", HOFFSET(link_t, number), tNumber);
	H5Tclose(tPosition);
	H5Tclose(tNumber);
	return tLink;
}
开发者ID:hbredin,项目名称:pinocchIO,代码行数:15,代码来源:structure_utils.c


示例16: create_ieee_complex128

/* Counterpart for complex128 */
hid_t create_ieee_complex128(const char *byteorder) {
  hid_t float_id, complex_id;

  complex_id = H5Tcreate(H5T_COMPOUND, sizeof(npy_complex128));
  if (byteorder == NULL)
    float_id = H5Tcopy(H5T_NATIVE_DOUBLE);
  else if (strcmp(byteorder, "little") == 0)
    float_id = H5Tcopy(H5T_IEEE_F64LE);
  else
    float_id = H5Tcopy(H5T_IEEE_F64BE);
  H5Tinsert(complex_id, "r", HOFFSET(npy_complex128, real), float_id);
  H5Tinsert(complex_id, "i", HOFFSET(npy_complex128, imag), float_id);
  H5Tclose(float_id);
  return complex_id;
}
开发者ID:andreas-h,项目名称:PyTables,代码行数:16,代码来源:utils.c


示例17: miset_record_field_name

/** This method sets a field name for the volume record. The volume
 * must be of class "MI_CLASS_UNIFORM_RECORD".  The size of record
 * type will be increased if necessary to accomodate the new field.
 */
int miset_record_field_name(mihandle_t volume,
                        int index,
                        const char *name)
{
    hid_t mtype_id;
    hid_t ftype_id;
    size_t offset;

    if (volume == NULL || name == NULL) {
        return (MI_ERROR);
    }
    if (volume->volume_class != MI_CLASS_UNIFORM_RECORD &&
        volume->volume_class != MI_CLASS_NON_UNIFORM_RECORD) {
        return (MI_ERROR);
    }
    /* Get the type of the record's fields.  This is recorded as the
     * type of the volume.
     */
    ftype_id = mitype_to_hdftype(volume->volume_type, FALSE);
    mtype_id = mitype_to_hdftype(volume->volume_type, TRUE);

    /* Calculate the offset of the new member.
     */
    offset = index * H5Tget_size(ftype_id);

    /* If the offset plus the size of the member is larger than the
     * current size of the structure, increase the size of the structure.
     */
    if (offset + H5Tget_size(ftype_id) > H5Tget_size(volume->ftype_id)) {
        H5Tset_size(volume->ftype_id, offset + H5Tget_size(ftype_id));
    }

    if (offset + H5Tget_size(mtype_id) > H5Tget_size(volume->mtype_id)) {
        H5Tset_size(volume->mtype_id, offset + H5Tget_size(mtype_id));
    }

    /* Actually define the field within the structure.
     */
    H5Tinsert(volume->ftype_id, name, offset, ftype_id);
    H5Tinsert(volume->mtype_id, name, offset, mtype_id);

    /* Delete the HDF5 type object returned by mitype_to_hdftype().
     */
    H5Tclose(ftype_id);
    H5Tclose(mtype_id);

    return (MI_NOERROR);
}
开发者ID:BishopWolf,项目名称:ITK,代码行数:52,代码来源:record.c


示例18: readDoubleComplexMatrix

int readDoubleComplexMatrix(int _iDatasetId, double *_pdblReal, double *_pdblImg)
{
    hid_t compoundId;
    herr_t status;
    int iDims = 0;
    int* piDims = NULL;
    int iComplex = 0;
    int iSize = 1;
    doublecomplex* pData = NULL;
    int i = 0;

    /*define compound dataset*/
    compoundId = H5Tcreate(H5T_COMPOUND, sizeof(doublecomplex));
    H5Tinsert(compoundId, "real", HOFFSET(doublecomplex, r), H5T_NATIVE_DOUBLE);
    H5Tinsert(compoundId, "imag", HOFFSET(doublecomplex, i), H5T_NATIVE_DOUBLE);

    //get dimension from dataset
    getDatasetInfo(_iDatasetId, &iComplex, &iDims, NULL);
    piDims = (int*)MALLOC(sizeof(int) * iDims);
    iSize = getDatasetInfo(_iDatasetId, &iComplex, &iDims, piDims);
    if (iSize < 0)
    {
        FREE(piDims);
        return -1;
    }

    FREE(piDims);
    //alloc temp array
    pData = (doublecomplex*)MALLOC(sizeof(doublecomplex) * iSize);
    //Read the data.
    status = H5Dread(_iDatasetId, compoundId, H5S_ALL, H5S_ALL, H5P_DEFAULT, pData);
    if (status < 0)
    {
        FREE(pData);
        return -1;
    }


    vGetPointerFromDoubleComplex(pData, iSize, _pdblReal, _pdblImg);
    FREE(pData);
    status = H5Dclose(_iDatasetId);
    if (status < 0)
    {
        return -1;
    }

    return 0;
}
开发者ID:ScilabOrg,项目名称:scilab,代码行数:48,代码来源:h5_readDataFromFile.c


示例19: main

int main(){
  hid_t fprop;
  hid_t fid;
  hid_t vol_id = H5VL_memvol_init();
  char name[1024];

  // create some datatypes

  hid_t tid = H5Tcreate (H5T_COMPOUND, sizeof(complex_type));
  H5Tinsert(tid, "re", HOFFSET(complex_type,re), H5T_NATIVE_DOUBLE);
  H5Tinsert(tid, "im", HOFFSET(complex_type,im), H5T_NATIVE_DOUBLE);
  hid_t s10 = H5Tcopy(H5T_C_S1);
  H5Tset_size(s10, 10);
  H5Tinsert(tid, "name", HOFFSET(complex_type,name), s10);
  H5Tinsert(tid, "val", HOFFSET(complex_type,val), H5T_NATIVE_INT);

  // packed version of the datatype
  hid_t disk_tid = H5Tcopy (tid);
  H5Tpack(disk_tid);

  fprop = H5Pcreate(H5P_FILE_ACCESS);
  H5Pset_vol(fprop, vol_id, &fprop);

  fid = H5Fcreate("test", H5F_ACC_TRUNC, H5P_DEFAULT, fprop);
  H5VLget_plugin_name(fid, name, 1024);
  printf ("%s using VOL %s\n", __FILE__ , name);

  assert(H5Tcommit(fid, "t_complex", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) >= 0);
  assert(H5Tcommit(fid, "t_complex_p", disk_tid,  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) >= 0);

  hid_t tid_stored1 = H5Topen(fid, "t_complex", H5P_DEFAULT);
  hid_t tid_stored2 = H5Topen(fid, "t_complex_p", H5P_DEFAULT);
  // hid_t tid_stored3 = H5Topen(fid, "NotExisting", H5P_DEFAULT);
  // assert(tid_stored3 < 0);

  assert(H5Tequal(tid_stored1, tid));
  assert(H5Tequal(tid_stored2, disk_tid));

  H5Fclose(fid);

  H5Tclose(tid);
  H5Tclose(disk_tid);

  H5VL_memvol_finalize();

  return 0;
}
开发者ID:ESiWACE,项目名称:ESD-Middleware,代码行数:47,代码来源:direct-datatype.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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