kharm/hdf5_utils.hpp
// Add the named attribute to the named variable
Add the named attribute to the named variable
Add the named attribute to the named variable
int H5F::add_attr(const void *att, const char *att_name, const char *data_name, hsize_t hdf5_type)
{
    char path[STRLEN];
    strncpy(path, cur_dir, STRLEN);
    strncat(path, data_name, STRLEN - strlen(path));
    if (DEBUG)
        fprintf(stderr, "Adding att %s\n", path);
    hid_t attribute_id = H5Acreate_by_name(file_id, path, att_name, hdf5_type, H5Screate(H5S_SCALAR), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
    if (attribute_id < 0)
        FAIL(attribute_id, "hdf5_add_attr", path);
    H5Awrite(attribute_id, hdf5_type, att);
    H5Aclose(attribute_id);
    return 0;
}
int H5F :: add_attr ( const void * att , const char * att_name , const char * data_name , hsize_t hdf5_type ) { char path [ STRLEN ] ; strncpy ( path , cur_dir , STRLEN ) ; strncat ( path , data_name , STRLEN - strlen ( path ) ) ; if ( DEBUG ) fprintf ( stderr , " \n " , path ) ; hid_t attribute_id = H5Acreate_by_name ( file_id , path , att_name , hdf5_type , H5Screate ( H5S_SCALAR ) , H5P_DEFAULT , H5P_DEFAULT , H5P_DEFAULT ) ; if ( attribute_id < 0 ) FAIL ( attribute_id , " " , path ) ; H5Awrite ( attribute_id , hdf5_type , att ) ; H5Aclose ( attribute_id ) ; return 0 ; }
Add the named attribute to the named variable
Add the named attribute to the named variable