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

C++ HDfree函数代码示例

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

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



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

示例1: h5dread_vl_real_c

int_f
h5dread_vl_real_c ( hid_t_f *dset_id ,  hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len)
/******/
{
  int ret_value = -1;
  hid_t c_dset_id;
  hid_t c_mem_type_id;
  hid_t c_mem_space_id;
  hid_t c_file_space_id;
  hid_t c_xfer_prp;
  herr_t status;
  size_t max_len;

  hvl_t *c_buf;
  hsize_t i;
  hssize_t num_elem;

  c_dset_id       = (hid_t)*dset_id;
  c_mem_type_id   = (hid_t)*mem_type_id;
  c_mem_space_id  = (hid_t)*mem_space_id;
  c_file_space_id = (hid_t)*file_space_id;
  c_xfer_prp      = (hid_t)*xfer_prp;

  max_len = (size_t)dims[0];
  num_elem = H5Sget_select_npoints(c_mem_space_id);
  if(num_elem != (hssize_t)dims[1]) return ret_value;

  c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
  if (c_buf == NULL) return ret_value;
  /*
   * Call H5Dread function.
   */
   status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
 if ( status <0  )  goto DONE;
  for (i=0; i < (hsize_t)num_elem; i++) {
       len[i] = (size_t_f)c_buf[i].len;
       memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(real_f));
  }

  H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
  ret_value = 0;
DONE:
  HDfree(c_buf);
  return ret_value;
}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:45,代码来源:H5Df.c


示例2: named_datatype_free

/*-------------------------------------------------------------------------
 * Function: named_datatype_free
 *
 * Purpose: Frees the stack of named datatypes.
 *-------------------------------------------------------------------------
 */
int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) {
    named_dt_t *dt = *named_dt_head_p;
    int         ret_value = -1;

    while (dt) {
        /* Pop the datatype off the stack and free it */
        if (H5Tclose(dt->id_out) < 0 && !ignore_err)
            HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
        dt = dt->next;
        HDfree(*named_dt_head_p);
        *named_dt_head_p = dt;
    } /* end while */

    ret_value = 0;

done:
    return (ret_value);
} /* end named_datatype_free */
开发者ID:ngcurrier,项目名称:ProteusCFD,代码行数:24,代码来源:h5repack.c


示例3: test_vlstr_free_custom

/****************************************************************
**
**  test_vlstr_free_custom(): Test VL datatype custom memory
**      allocation routines.  This routine just uses free to
**      release the memory and decrements the amount of memory
**      allocated.
**
****************************************************************/
void test_vlstr_free_custom(void *_mem, void *info)
{
    unsigned char *mem;
    size_t *mem_used=(size_t *)info;  /* Get the pointer to the memory used */
    size_t extra;               /* Extra space needed */

    /*
     *  This weird contortion is required on the DEC Alpha to keep the
     *  alignment correct - QAK
     */
    extra=MAX(sizeof(void *),sizeof(size_t));

    if(_mem!=NULL) {
        mem=((unsigned char *)_mem)-extra;
        *mem_used-=*(size_t *)mem;
        HDfree(mem);
    } /* end if */
}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:26,代码来源:tvlstr.c


示例4: PIN_JAVA_STRING

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Oget_comment_by_name
 * Signature: (JLjava/lang/String;J)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name
    (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
    char       *oComment;
    const char *oName;
    ssize_t     buf_size;
    ssize_t     status;
    jstring     str = NULL;

    PIN_JAVA_STRING(name, oName);
    if (oName != NULL) {
        /* get the length of the comment */
        buf_size = H5Oget_comment_by_name((hid_t)loc_id, oName, NULL, 0, (hid_t)access_id);
        if (buf_size < 0) {
            h5badArgument( env, "H5Oget_comment_by_name:  buf_size < 0");
        } /* end if */
        else if (buf_size > 0) {
            buf_size++; /* add extra space for the null terminator */
            oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
            if (oComment == NULL) {
                h5outOfMemory( env, "H5Oget_comment_by_name:  malloc failed");
            } /* end if */
            else {
                status = H5Oget_comment_by_name((hid_t)loc_id, oName, oComment, (size_t)buf_size, (hid_t)access_id);

                if (status < 0) {
                    h5libraryError(env);
                } /* end if */
                else {
                    /*  may throw OutOfMemoryError */
                    str = ENVPTR->NewStringUTF(ENVPAR oComment);
                    if (str == NULL) {
                        h5JNIFatalError( env, "H5Oget_comment_by_name:  return string not allocated");
                    } /* end if */
                } /* end else */
                HDfree(oComment);
            }
        } /* end if */
        UNPIN_JAVA_STRING(name, oName);
    }

    return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */
开发者ID:ngcurrier,项目名称:ProteusCFD,代码行数:49,代码来源:h5oImp.c


示例5: h5dread_ref_reg_c

/****if* H5Df/h5dread_ref_reg_c
 * NAME
 *  h5dread_ref_reg_c
 * PURPOSE
 *  Call H5Dread to read a dataset of dataset region references
 * INPUTS
 *  dset_id - dataset identifier
 *  mem_type_id - memory datatype identifier
 *  mem_space_id - memory dataspace identifier
 *  file_space_id - memory dataspace identifier
 *  xfer_pr  - identifier of transfer property list
 *  buf      - data buffer to store references to the objects.
 *  n - number of references to be stored.
 * RETURNS
 *  0 on success, -1 on failure
 * AUTHOR
 *  Elena Pourmal
 *  Wednesday, May 15, 2002
 * HISTORY
 *  This function was added to accomodate h5dread_f subroutine
 *  with the dims parameter being of INTEGER(HSIZE_T_F) size.
 * SOURCE
*/
int_f
h5dread_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, hsize_t_f *dims)
/******/
{
     int ret_value = -1;
     herr_t ret = -1;
     hid_t c_dset_id;
     hid_t c_mem_type_id;
     hid_t c_mem_space_id;
     hid_t c_file_space_id;
     hid_t c_xfer_prp;
     hdset_reg_ref_t *buf_c = NULL;
     hsize_t i, n;
     n = (hsize_t)*dims;
     /*
      * Define transfer property
      */
     c_xfer_prp = (hid_t)*xfer_prp;

     /*
      * Allocate temporary buffer.
      */
     buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t)*(size_t)n);
     if ( buf_c != NULL ) {
         /*
          * Call H5Dread function.
          */
         c_dset_id = (hid_t)*dset_id;
         c_mem_type_id = (hid_t)*mem_type_id;
         c_mem_space_id = (hid_t)*mem_space_id;
         c_file_space_id = (hid_t)*file_space_id;
         ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c);
         if (ret >=0) {
            for (i = 0; i < n; i++) {
               HDmemcpy(buf, &buf_c[i], H5R_DSET_REG_REF_BUF_SIZE);
               buf = buf + REF_REG_BUF_LEN_F;
            }
         }
         if ( buf_c != NULL ) HDfree(buf_c);
     }
     if (ret < 0) return ret_value;
     ret_value = 0;
     return ret_value;
}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:67,代码来源:H5Df.c


示例6: getR8

int
getR8(int xdim, int ydim, char *image, char *pal, int compress)
{
    FILE       *fp;
    int32       length;
    char       *buf;

    if (!fileOpen())
      {
          noFile();
          return FAIL;
      }
    if (pal)
        if (setPal(pal) < 0)
            /* Error already signalled by setPal */
            return FAIL;

    length = xdim * ydim;
    buf = (char *) HDmalloc(length);

    if ((fp = fopen(image, "r")) == NULL)
      {
          fprintf(stderr, "Error opening image file: %s.\n", image);
          return FAIL;
      }
    if (fread(buf, (size_t)xdim, (size_t)ydim, fp) < (size_t)ydim)
      {
          fprintf(stderr, "Error reading image file: %s.\n", image);
          return FAIL;
      }
    fclose(fp);

    if (DFR8addimage(he_file, buf, (int32) xdim, (int32) ydim, (uint16) compress) < 0)
      {
          HEprint(stderr, 0);
          return FAIL;
      }
    HDfree(buf);

    if (updateDesc() < 0)
        return FAIL;

    return HE_OK;
}
开发者ID:schwehr,项目名称:hdf4,代码行数:44,代码来源:he_main.c


示例7: nh5fopen_c

/****if* H5Ff/h5fopen_c
 * NAME
 *        h5fopen_c
 * PURPOSE
 *     Call H5Fopen to open the file
 * INPUTS
 *      name - name of the file
 *              namelen - name length
 *              access_flags - file access  flags
 *              acc_prp - identifier of access property list
 * OUTPUTS
 *     file_id - file identifier
 * RETURNS
 *     0 on success, -1 on failure
 * AUTHOR
 *  Elena Pourmal
 *              Tuesday, August 3, 1999
 * SOURCE
*/
int_f
nh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id)
/******/
{
     int ret_value = -1;
     char *c_name;
     int_f c_namelen;
     hid_t c_file_id;
     unsigned c_access_flags;
     hid_t c_acc_prp;
     c_acc_prp = (hid_t)*acc_prp;

     /*
      * Define access flags
      */
     c_access_flags = (unsigned) *access_flags;

     /*
      * Define access property
      */
     c_acc_prp = *acc_prp;

     /*
      * Convert FORTRAN name to C name
      */
     c_namelen = *namelen;
     c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);
     if(c_name == NULL)
         return ret_value;

     /*
      * Call H5Fopen function.
      */
     c_file_id = H5Fopen(c_name, c_access_flags, c_acc_prp);

     if(c_file_id >= 0) {
         ret_value = 0;
         *file_id = (hid_t_f)c_file_id;
     } /* end if */

     HDfree(c_name);
     return ret_value;
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:62,代码来源:H5Ff.c


示例8: initFile

int
initFile(char *file)
{
    if (he_file)
        HDfree(he_file);
    he_file = copyStr(file);

    if (updateDesc() < 0)
        return FAIL;

    /* if there are groups in this file, go to the first group tag */
    /* otherwise, just go to the first element */
    if (he_numGrp > 0)
        he_currDesc = he_grp[0].desc;
    else
        he_currDesc = 0;

    return resetPred();
}
开发者ID:schwehr,项目名称:hdf4,代码行数:19,代码来源:he_main.c


示例9: nh5sget_select_elem_pointlist_c

int_f
nh5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint,
                                  hsize_t_f * numpoints, hsize_t_f * buf)
{
  int ret_value = -1;
  hid_t c_space_id;
  hsize_t c_num_points;
  hsize_t c_startpoint,* c_buf;
  hsize_t i, i1;
  int rank;
  int j,i2;

  c_space_id = *space_id;
  c_num_points = (hsize_t)* numpoints;

  rank = H5Sget_simple_extent_ndims(c_space_id);
  if (rank < 0 ) return ret_value;

  c_startpoint = (hsize_t)*startpoint;
  c_buf = (hsize_t*)malloc(sizeof(hsize_t)*(size_t)(c_num_points*rank));
  if (!c_buf) return ret_value;
  ret_value = H5Sget_select_elem_pointlist(c_space_id, c_startpoint,
                                            c_num_points, c_buf);

  /* re-arrange the return buffer to account for Fortran ordering of 2D arrays */
  /* and add 1 to account for array's starting at one in Fortran */
  i2 = 0;
  for( i = 0; i < c_num_points; i++) {
    i1 =  rank*(i+1);
    for(j = 0; j < rank; j++) {
      buf[i2] = (hsize_t_f)(c_buf[i1-1]+1);
      i2 = i2 + 1;
      i1 = i1 - 1;
    }
  }

  if (ret_value  >= 0  ) ret_value = 0;

  HDfree(c_buf);

  return ret_value;
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:42,代码来源:H5Sf.c


示例10: DFclose

/*
   ** NAME
   **   DFclose -- close HDF file
   ** USAGE
   **   int DFclose(dfile)
   **   DF *dfile;              IN: pointer to an open DF file
   ** RETURNS
   **   0 on success, -1 on failure with DFerror set
   ** DESCRIPTION
   **   Write out updated DDs; close DF file.
   ** GLOBAL VARIABLES
   ** COMMENTS, BUGS, ASSUMPTIONS
   ** EXAMPLES
   ** REVISION LOG
 */
int
DFclose(DF * dfile)
{
    int         ret;

    if (DFIcheck(dfile) != 0)
      {
          DFerror = DFE_NOTOPEN;
          return (FAIL);
      }
    else
        DFerror = DFE_NONE;

    if (DFelstat == DFEL_RESIDENT)
      {
          Hputelement(DFid, acc_tag, acc_ref, (unsigned char *) DFelement, DFelsize);
          HDfree(DFelement);
      }
    else
        Hendaccess(DFaid);

    if (search_stat == DFSRCH_OLD)
      {
          Hendaccess(search_aid);
          search_aid = 0;
      }

    ret = Hclose(DFid);
    if (ret == 0)
      {
          dfile = 0;
          DFlist = (DF *) NULL;
          DFid = 0;
          DFaccmode = 0;
      }
    else
      {
          DFerror = (int)HEvalue(1);
      }

    return (ret);
}
开发者ID:Higginbottom,项目名称:zeus_python,代码行数:57,代码来源:dfstubs.c


示例11: HCIcszip_init

/*--------------------------------------------------------------------------
 NAME
    HCIcszip_init -- Initialize a SZIP compressed data element.

 USAGE
    int32 HCIcszip_init(access_rec)
    accrec_t *access_rec;   IN: the access record of the data element

 RETURNS
    Returns SUCCEED or FAIL

 DESCRIPTION
    Common code called by HCIcszip_staccess and HCIcszip_seek

 GLOBAL VARIABLES
 COMMENTS, BUGS, ASSUMPTIONS
 EXAMPLES
 REVISION LOG
--------------------------------------------------------------------------*/
PRIVATE int32
HCIcszip_init(accrec_t * access_rec)
{
    CONSTR(FUNC, "HCIcszip_init");
    compinfo_t *info;           /* special element information */
    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */
    intn       ret_value = SUCCEED;

#ifdef H4_HAVE_LIBSZ
    /* Sanity check to make certain that we haven't drifted out of date with
     * the mask options from the SZIP ricehdf.h header */
    assert(H4_SZ_ALLOW_K13_OPTION_MASK==SZ_ALLOW_K13_OPTION_MASK);
    assert(H4_SZ_CHIP_OPTION_MASK==SZ_CHIP_OPTION_MASK);
    assert(H4_SZ_EC_OPTION_MASK==SZ_EC_OPTION_MASK);
    assert(H4_SZ_LSB_OPTION_MASK==SZ_LSB_OPTION_MASK);
    assert(H4_SZ_MSB_OPTION_MASK==SZ_MSB_OPTION_MASK);
    assert(H4_SZ_NN_OPTION_MASK==SZ_NN_OPTION_MASK);
    assert(H4_SZ_RAW_OPTION_MASK==SZ_RAW_OPTION_MASK);
#endif

    info = (compinfo_t *) access_rec->special_info;
    if (Hseek(info->aid, 0, DF_START) == FAIL)  /* seek to beginning of element */
        HGOTO_ERROR(DFE_SEEKERROR, FAIL);

    szip_info = &(info->cinfo.coder_info.szip_info);

    /* Initialize SZIP state information */
    szip_info->szip_state = SZIP_INIT;     /* start in initial state */
    if (szip_info->buffer_size != 0) {
        szip_info->buffer_size = 0;   /* offset into the file */
        if (szip_info->buffer != NULL) {
		HDfree(szip_info->buffer);
		szip_info->buffer = NULL;
        }
    }
    szip_info->offset = 0;   /* offset into the file */
    szip_info->szip_dirty=SZIP_CLEAN;

done:
    return(ret_value);
}   /* end HCIcszip_init() */
开发者ID:Higginbottom,项目名称:zeus_python,代码行数:60,代码来源:cszip.c


示例12: UNUSED

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Oget_comment_by_name
 * Signature: (JLjava/lang/String;J)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name
    (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
    const char *objName = NULL;
    jstring     str = NULL;
    ssize_t     buf_size;
    ssize_t     status;
    char       *objComment = NULL;

    UNUSED(clss);

    if (NULL == name)
        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_comment_by_name: object name is NULL");

    PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_comment_by_name: object name not pinned");

    /* Get the length of the comment */
    if ((buf_size = H5Oget_comment_by_name((hid_t)loc_id, objName, NULL, 0, (hid_t)access_id)) < 0)
        H5_LIBRARY_ERROR(ENVONLY);

    if (buf_size) {
        if (NULL == (objComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
            H5_JNI_FATAL_ERROR(ENVONLY, "H5Oget_comment_by_name: failed to allocate buffer for object comment");

        if ((status = H5Oget_comment_by_name((hid_t)loc_id, objName, objComment, (size_t)buf_size + 1, (hid_t)access_id)) < 0)
            H5_LIBRARY_ERROR(ENVONLY);
        objComment[buf_size] = '\0';

        if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, objComment)))
            CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
    }

done:
    if (objComment)
        HDfree(objComment);
    if (objName)
        UNPIN_JAVA_STRING(ENVONLY, name, objName);

    return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */
开发者ID:soumagne,项目名称:hdf5,代码行数:46,代码来源:h5oImp.c


示例13: symlink_visit_add

/*-------------------------------------------------------------------------
 * Function: symlink_visit_add
 *
 * Purpose: Add an symbolic link to visited data structure
 *
 * Return: 0 on success, -1 on failure
 *
 * Programmer: Neil Fortner, [email protected]
 *             Adapted from trav_addr_add in h5trav.c by Quincey Koziol
 *
 * Date: September 5, 2008
 *
 * Modified: 
 *  Jonathan Kim
 *   - Moved from h5ls.c to share among tools.  (Sep 16, 2010)
 *   - Renamed from elink_trav_add to symlink_visit_add for both soft and 
 *     external links.   (May 25, 2010)
 *   - Add type parameter to distingush between soft and external link for 
 *     sure, which prevent from mixing up visited link when the target names
 *     are same between the soft and external link, as code marks with the
 *     target name.  (May 25,2010) 
 *
 *-------------------------------------------------------------------------
 */
herr_t
symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
    size_t  idx;         /* Index of address to use */
    void    *tmp_ptr;

    /* Allocate space if necessary */
    if(visited->nused == visited->nalloc) 
    {
        visited->nalloc = MAX(1, visited->nalloc * 2);
        if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(visited->objs[0]))))
            return -1;
        visited->objs = tmp_ptr;
    } /* end if */

    /* Append it */
    idx = visited->nused++;

    visited->objs[idx].type = type;
    visited->objs[idx].file = NULL;
    visited->objs[idx].path = NULL;

    if (type == H5L_TYPE_EXTERNAL)
    {
        if(NULL == (visited->objs[idx].file = HDstrdup(file))) 
        {
            visited->nused--;
            return -1;
        }
    }

    if(NULL == (visited->objs[idx].path = HDstrdup(path))) 
    {
        visited->nused--;
        if (visited->objs[idx].file)
            HDfree (visited->objs[idx].file);
        return -1;
    }

    return 0;
} /* end symlink_visit_add() */
开发者ID:FilipeMaia,项目名称:hdf5,代码行数:65,代码来源:h5trav.c


示例14: symlink_visit_add

/*-------------------------------------------------------------------------
 * Function: symlink_visit_add
 *
 * Purpose: Add an symbolic link to visited data structure
 *
 * Return:   0 on success,
 *          -1 on failure
 *-------------------------------------------------------------------------
 */
herr_t
symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
    herr_t    ret_value = SUCCEED;
    size_t    idx;         /* Index of address to use */

    /* Allocate space if necessary */
    if(visited->nused == visited->nalloc) {
        void    *tmp_ptr;

        visited->nalloc = MAX(1, visited->nalloc * 2);
        if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t))))
            HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure realloc failed");
        visited->objs = (symlink_trav_path_t *)tmp_ptr;
    } /* end if */

    /* Append it */
    idx = visited->nused++;

    visited->objs[idx].type = type;
    visited->objs[idx].file = NULL;
    visited->objs[idx].path = NULL;

    if(type == H5L_TYPE_EXTERNAL) {
        if(NULL == (visited->objs[idx].file = HDstrdup(file))) {
            visited->nused--;
            HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure name allocation failed");
        } /* end if */
    } /* end if */

    if(NULL == (visited->objs[idx].path = HDstrdup(path))) {
        visited->nused--;
        if(visited->objs[idx].file)
            HDfree (visited->objs[idx].file);
        HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure path allocation failed");
    } /* end if */

done:
    return ret_value;
} /* end symlink_visit_add() */
开发者ID:GATB,项目名称:gatb-core,代码行数:49,代码来源:h5trav.c


示例15: find_med

PRIVATE float
find_med(struct box *ptr, int dim)
{
    int         i, j, count, next, prev;
    int        *rank;
    float32     median;

    rank = (int *) HDmalloc((unsigned) ptr->nmbr_distinct * sizeof(int));
    for (i = 0; i < ptr->nmbr_distinct; i++)
        rank[i] = ptr->pts[i];

    sort(0, ptr->nmbr_distinct - 1, dim, rank);
    /*
       for (i=0; i<ptr->nmbr_distinct; i++)
       printf("find_med: sorted list is %d\n",distinct_pt[rank[i]].c[dim]);
     */

    count = 0;
    prev = i = 0;
    while ((i < ptr->nmbr_distinct) && (count < ptr->nmbr_pts / 2))
      {
          next = next_pt(dim, i, rank, ptr->nmbr_distinct);
          for (j = i; j < next; j++)
              count = count + hist[rank[j]];

          prev = i;
          i = next;
      }

    if (prev == 0)
      {
          /* the first distinct point overshot the median */
          median = (float32) distinct_pt[rank[prev]].c[dim] + (float32) EPSILON;
      }
    else
        median = (float32) distinct_pt[rank[prev - 1]].c[dim] + (float32) EPSILON;

    HDfree((VOIDP) rank);
    return median;
}   /* end of find_med */
开发者ID:schwehr,项目名称:hdf4,代码行数:40,代码来源:dfimcomp.c


示例16: H5Oget_comment

/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Oget_comment
 * Signature: (J)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1comment
    (JNIEnv *env, jclass clss, jlong loc_id)
{
    char    *oComment;
    ssize_t  buf_size;
    ssize_t  status;
    jstring  str = NULL;

    /* get the length of the comment */
    buf_size = H5Oget_comment((hid_t)loc_id, NULL, 0);
    if (buf_size < 0) {
        h5badArgument( env, "H5Oget_comment:  buf_size < 0");
    } /* end if */
    else if (buf_size > 0) {
        buf_size++; /* add extra space for the null terminator */
        oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
        if (oComment == NULL) {
            /* exception -- out of memory */
            h5outOfMemory( env, "H5Oget_comment:  malloc failed");
        } /* end if */
        else {
            status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size);

            if (status < 0) {
                h5libraryError(env);
            } /* end if */
            else {
                /*  may throw OutOfMemoryError */
                str = ENVPTR->NewStringUTF(ENVPAR oComment);
                if (str == NULL) {
                    h5JNIFatalError( env, "H5Oget_comment:  return string not allocated");
                } /* end if */
            } /* end else */
            HDfree(oComment);
        }
    } /* end else if */

    return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment */
开发者ID:ngcurrier,项目名称:ProteusCFD,代码行数:45,代码来源:h5oImp.c


示例17: h5ltread_dataset_c

int_f
h5ltread_dataset_c (hid_t_f *loc_id,
                     size_t_f *namelen,
                     _fcd name,
                     hid_t_f *type_id,
                     void *buf)
{
    int     ret_value = -1;
    herr_t  ret;
    hid_t   c_loc_id;
    hid_t   c_type_id;
    char    *c_name = NULL;

    /*
    * convert FORTRAN name to C name
    */
    c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
    if (c_name == NULL)
        goto done;

    /*
    * call H5LTread_dataset function.
    */
    c_loc_id = (hid_t)*loc_id;
    c_type_id = (hid_t)*type_id;

    ret = H5LTread_dataset(c_loc_id, c_name, c_type_id, buf );

    if (ret < 0)
        goto done;

    ret_value = 0;

done:
    if(c_name!=NULL)
        HDfree(c_name);

    return ret_value;
}
开发者ID:asteever,项目名称:thirdparty_hdf5,代码行数:39,代码来源:H5LTfc.c


示例18: h5ltget_dataset_ndims_c

int_f
h5ltget_dataset_ndims_c(hid_t_f *loc_id,
                         size_t_f *namelen,
                         _fcd name,
                         int_f *rank)
{
    int     ret_value = -1;
    herr_t  ret;
    hid_t   c_loc_id;
    char    *c_name = NULL;
    int     c_rank;

    /*
    * Convert FORTRAN name to C name
    */
    c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
    if (c_name == NULL)
        goto done;

    /*
    * Call H5LTget_dataset_ndims function.
    */
    c_loc_id = (hid_t)*loc_id;

    ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank);

    if (ret < 0)
        goto done;

    *rank = (int_f)c_rank;
    ret_value = 0;


done:
    if(c_name!=NULL)
        HDfree(c_name);

    return ret_value;
}
开发者ID:asteever,项目名称:thirdparty_hdf5,代码行数:39,代码来源:H5LTfc.c


示例19: nh5fmount_c

/****if* H5Ff/h5fmount_c
 * NAME
 *        h5fmount_c
 * PURPOSE
 *     Call H5Fmount to mount the file
 * INPUTS
 *      loc_id - Identifier for file or group
 *              dsetname - name of dataset
 *              namelen - dsetname length
 *              file_id - file identifier for the file to be mounted
 *              acc_prp - identifier of access property list
 * RETURNS
 *     0 on success, -1 on failure
 * AUTHOR
 *  Xiangyang Su
 *              Monday, October 25, 1999
 * HISTORY
*/
int_f
nh5fmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp)
/******/
{
     int ret_value = -1;
     char *c_name;
     int_f c_namelen;
     hid_t c_loc_id;
     hid_t c_file_id;
     hid_t c_acc_prp;
     htri_t status;

     /*
      * Define access property
      */
     c_acc_prp = *acc_prp;
/*
     if ( H5P_DEFAULT_F == c_acc_prp ) c_acc_prp = H5P_DEFAULT;
*/

     c_loc_id = *loc_id;
     c_file_id = *file_id;
     /*
      * Convert FORTRAN name to C name
      */
     c_namelen = *namelen;
     c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen);
     if (c_name == NULL) return ret_value;

     /*
      * Call H5Fmount function.
      */
     status = H5Fmount(c_loc_id, c_name, c_file_id, c_acc_prp);

     if (status >= 0)  ret_value = 0;

     HDfree(c_name);
     return ret_value;
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:57,代码来源:H5Ff.c


示例20: nh5adelete_c

/*----------------------------------------------------------------------------
 * Name:        h5adelete_c
 * Purpose:     Call H5Adelete to delete an attribute
 * Inputs:      obj_id - object identifier
 *              name - name of the attribute
 *              namelen - name length
 * Returns:     0 on success, -1 on failure
 * Programmer:  Elena Pourmal
 *              Thursday, August 12, 1999
 * Modifications:
 *---------------------------------------------------------------------------*/
int_f
nh5adelete_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen)
{
    char *c_name=NULL;          /* Buffer to hold C string */
    int_f ret_value=0;          /* Return value */

     /*
      * Convert FORTRAN name to C name
      */
     if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
        HGOTO_DONE(FAIL);

     /*
      * Call H5Adelete function.
      */
     if (H5Adelete((hid_t)*obj_id, c_name) < 0)
         HGOTO_DONE(FAIL);

done:
    if(c_name) HDfree(c_name);
    return ret_value;
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:33,代码来源:H5Af.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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