mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-05 15:42:32 +08:00
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/~lrknox/hdf5_lrk into develop
This commit is contained in:
commit
383202e856
@ -1,7 +1,7 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
/* All rights reserved. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
|
@ -295,7 +295,7 @@ unsigned FileCreatPropList::getIstorek() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileCreatPropList::setFileSpace
|
||||
// Function: FileCreatPropList::setFileSpaceStrategy
|
||||
///\brief Sets the strategy and the threshold value that the library
|
||||
/// will employ in managing file space.
|
||||
///\param strategy - IN: Strategy for file space management
|
||||
@ -307,62 +307,71 @@ unsigned FileCreatPropList::getIstorek() const
|
||||
/// changed and the existing strategy will be retained.
|
||||
/// If the given threshold value is zero, the property will not be
|
||||
/// changed and the existing threshold will be retained.
|
||||
/// Valid values of \a libver_low are as follows:
|
||||
/// \li \c H5F_FILE_SPACE_ALL (Default)
|
||||
/// \li \c H5F_FILE_SPACE_ALL_PERSIST
|
||||
/// \li \c H5F_FILE_SPACE_AGGR_VFD
|
||||
/// \li \c H5F_FILE_SPACE_VFD
|
||||
/// For information, please see the C layer Reference Manual at:
|
||||
/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFileSpace
|
||||
// Programmer Binh-Minh Ribler - Feb, 2017
|
||||
//--------------------------------------------------------------------------
|
||||
void FileCreatPropList::setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const
|
||||
void FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_file_space(id, strategy, threshold);
|
||||
herr_t ret_value = H5Pset_file_space_strategy(id, strategy, persist, threshold);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("FileCreatPropList::setFileSpace",
|
||||
"H5Pset_file_space failed");
|
||||
throw PropListIException("FileCreatPropList::setFileSpaceStrategy",
|
||||
"H5Pset_file_space_strategy failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileCreatPropList::getFileSpaceStrategy
|
||||
///\brief Returns the strategy that the library uses in managing file space.
|
||||
///\return The strategy value
|
||||
///\brief Retrieves the strategy, persist, and threshold that the library
|
||||
/// uses in managing file space.
|
||||
///\exception H5::PropListIException
|
||||
// Programmer Binh-Minh Ribler - Feb, 2017
|
||||
//--------------------------------------------------------------------------
|
||||
H5F_file_space_type_t FileCreatPropList::getFileSpaceStrategy() const
|
||||
void FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const
|
||||
{
|
||||
H5F_file_space_type_t strategy = H5F_FILE_SPACE_ALL;
|
||||
herr_t ret_value = H5Pget_file_space(id, &strategy, NULL);
|
||||
herr_t ret_value = H5Pget_file_space_strategy(id, &strategy, &persist, &threshold);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("FileCreatPropList::getFileSpaceStrategy",
|
||||
"H5Pget_file_space for strategy failed");
|
||||
"H5Pget_file_space_strategy failed");
|
||||
}
|
||||
return(strategy);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileCreatPropList::getFileSpaceThreshold
|
||||
///\brief Returns the threshold value that the library uses in tracking
|
||||
/// free space sections.
|
||||
///\return The threshold value
|
||||
// Function: FileCreatPropList::setFileSpacePagesize
|
||||
///\brief Sets the file space page size for paged aggregation.
|
||||
///\exception H5::PropListIException
|
||||
// Programmer Binh-Minh Ribler - Feb, 2017
|
||||
//--------------------------------------------------------------------------
|
||||
hsize_t FileCreatPropList::getFileSpaceThreshold() const
|
||||
void FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const
|
||||
{
|
||||
hsize_t threshold = 0;
|
||||
herr_t ret_value = H5Pget_file_space(id, NULL, &threshold);
|
||||
herr_t ret_value = H5Pset_file_space_page_size(id, fsp_psize);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("FileCreatPropList::getFileSpaceThreshold",
|
||||
"H5Pget_file_space for threshold failed");
|
||||
throw PropListIException("FileCreatPropList::setFileSpacePagesize",
|
||||
"H5Pset_file_space_page_size failed");
|
||||
}
|
||||
return(threshold);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileCreatPropList::getFileSpacePagesize
|
||||
///\brief Returns the file space page size for aggregating small
|
||||
/// metadata or raw data.
|
||||
///\return File space page size
|
||||
///\exception H5::PropListIException
|
||||
// Programmer Binh-Minh Ribler - Feb, 2017
|
||||
//--------------------------------------------------------------------------
|
||||
hsize_t FileCreatPropList::getFileSpacePagesize() const
|
||||
{
|
||||
hsize_t fsp_psize = 0;
|
||||
herr_t ret_value = H5Pget_file_space_page_size(id, &fsp_psize);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("FileCreatPropList::getFileSpacePagesize",
|
||||
"H5Pget_file_space_page_size failed");
|
||||
}
|
||||
return(fsp_psize);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -67,14 +67,17 @@ class H5_DLLCPP FileCreatPropList : public PropList {
|
||||
|
||||
// Sets the strategy and the threshold value that the library will
|
||||
// will employ in managing file space.
|
||||
void setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const;
|
||||
void setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const;
|
||||
|
||||
// Returns the strategy that the library uses in managing file space.
|
||||
H5F_file_space_type_t getFileSpaceStrategy() const;
|
||||
void getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const;
|
||||
|
||||
// Sets the file space page size for paged aggregation.
|
||||
void setFileSpacePagesize(hsize_t fsp_psize) const;
|
||||
|
||||
// Returns the threshold value that the library uses in tracking free
|
||||
// space sections.
|
||||
hsize_t getFileSpaceThreshold() const;
|
||||
hsize_t getFileSpacePagesize() const;
|
||||
|
||||
///\brief Returns this class name.
|
||||
virtual H5std_string fromClass() const { return("FileCreatPropList"); }
|
||||
|
@ -812,19 +812,17 @@ const H5std_string FILE7("tfile7.h5");
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
const hsize_t FSP_SIZE_DEF = 4096;
|
||||
const hsize_t FSP_SIZE512 = 512;
|
||||
static void test_file_info()
|
||||
{
|
||||
// Output message about test being performed
|
||||
SUBTEST("File general information");
|
||||
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
hsize_t in_threshold = 2; // Free space section threshold to set */
|
||||
hsize_t out_threshold = 0; // Free space section threshold to get */
|
||||
hsize_t out_threshold = 0; // Free space section threshold to get
|
||||
hbool_t out_persist = FALSE;// Persist free-space read
|
||||
// File space handling strategy
|
||||
H5F_file_space_type_t in_strategy = H5F_FILE_SPACE_ALL;
|
||||
// File space handling strategy
|
||||
H5F_file_space_type_t out_strategy = H5F_FILE_SPACE_DEFAULT;
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
H5F_fspace_strategy_t out_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
|
||||
|
||||
try {
|
||||
// Create a file using default properties.
|
||||
@ -843,14 +841,30 @@ static void test_file_info()
|
||||
// Create file creation property list.
|
||||
FileCreatPropList fcpl;
|
||||
|
||||
// Retrieve file space information.
|
||||
fcpl.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
|
||||
|
||||
// Verify file space information.
|
||||
verify_val(out_strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
verify_val(out_persist, FALSE, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
verify_val(out_threshold, 1, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
|
||||
/* Retrieve file space page size */
|
||||
hsize_t out_fsp_psize = fcpl.getFileSpacePagesize();
|
||||
verify_val(out_fsp_psize, FSP_SIZE_DEF, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
|
||||
|
||||
// Set various file information.
|
||||
fcpl.setUserblock(F2_USERBLOCK_SIZE);
|
||||
fcpl.setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
|
||||
fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
|
||||
fcpl.setIstorek(F2_ISTORE);
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
fcpl.setFileSpace(in_strategy, in_threshold);
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
|
||||
hsize_t threshold = 5; // Free space section threshold to set
|
||||
hbool_t persist = TRUE; // Persist free-space to set
|
||||
H5F_fspace_strategy_t strategy = H5F_FSPACE_STRATEGY_PAGE;
|
||||
|
||||
fcpl.setFileSpaceStrategy(strategy, persist, threshold);
|
||||
fcpl.setFileSpacePagesize(FSP_SIZE512);
|
||||
|
||||
// Creating a file with the non-default file creation property list
|
||||
// should create a version 1 superblock
|
||||
@ -863,11 +877,7 @@ static void test_file_info()
|
||||
|
||||
// Get the file's version information.
|
||||
file7.getFileInfo(finfo);
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
#else /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
verify_val(finfo.super.version, 1, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
|
||||
@ -882,11 +892,7 @@ static void test_file_info()
|
||||
|
||||
// Get the file's version information.
|
||||
file7.getFileInfo(finfo);
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
#else /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
verify_val(finfo.super.version, 1, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||
|
||||
@ -912,14 +918,14 @@ static void test_file_info()
|
||||
VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
|
||||
*/
|
||||
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
// Get and verify the file space info from the creation property list */
|
||||
out_strategy = fcpl2.getFileSpaceStrategy();
|
||||
verify_val(static_cast<unsigned>(out_strategy), static_cast<unsigned>(in_strategy), "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
|
||||
fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
|
||||
verify_val(out_strategy, strategy, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
|
||||
verify_val(out_persist, persist, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
|
||||
verify_val(out_threshold, threshold, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
|
||||
|
||||
out_threshold = fcpl2.getFileSpaceThreshold();
|
||||
verify_val(static_cast<unsigned>(out_threshold), static_cast<unsigned>(in_threshold), "FileCreatPropList::getFileSpaceThreshold", __LINE__, __FILE__);
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
out_fsp_psize = fcpl2.getFileSpacePagesize();
|
||||
verify_val(out_fsp_psize, FSP_SIZE512, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
|
||||
|
||||
PASSED();
|
||||
} // end of try block
|
||||
|
Loading…
Reference in New Issue
Block a user