mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-11 16:01:00 +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 HDF Group. *
|
||||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
* 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 *
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||||
* terms governing use, modification, and redistribution, is contained in *
|
* 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
|
///\brief Sets the strategy and the threshold value that the library
|
||||||
/// will employ in managing file space.
|
/// will employ in managing file space.
|
||||||
///\param strategy - IN: Strategy for file space management
|
///\param strategy - IN: Strategy for file space management
|
||||||
@ -307,62 +307,71 @@ unsigned FileCreatPropList::getIstorek() const
|
|||||||
/// changed and the existing strategy will be retained.
|
/// changed and the existing strategy will be retained.
|
||||||
/// If the given threshold value is zero, the property will not be
|
/// If the given threshold value is zero, the property will not be
|
||||||
/// changed and the existing threshold will be retained.
|
/// 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:
|
/// For information, please see the C layer Reference Manual at:
|
||||||
/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFileSpace
|
/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFileSpace
|
||||||
// Programmer Binh-Minh Ribler - Feb, 2017
|
// 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)
|
if (ret_value < 0)
|
||||||
{
|
{
|
||||||
throw PropListIException("FileCreatPropList::setFileSpace",
|
throw PropListIException("FileCreatPropList::setFileSpaceStrategy",
|
||||||
"H5Pset_file_space failed");
|
"H5Pset_file_space_strategy failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// Function: FileCreatPropList::getFileSpaceStrategy
|
// Function: FileCreatPropList::getFileSpaceStrategy
|
||||||
///\brief Returns the strategy that the library uses in managing file space.
|
///\brief Retrieves the strategy, persist, and threshold that the library
|
||||||
///\return The strategy value
|
/// uses in managing file space.
|
||||||
///\exception H5::PropListIException
|
///\exception H5::PropListIException
|
||||||
// Programmer Binh-Minh Ribler - Feb, 2017
|
// 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_strategy(id, &strategy, &persist, &threshold);
|
||||||
herr_t ret_value = H5Pget_file_space(id, &strategy, NULL);
|
|
||||||
if (ret_value < 0)
|
if (ret_value < 0)
|
||||||
{
|
{
|
||||||
throw PropListIException("FileCreatPropList::getFileSpaceStrategy",
|
throw PropListIException("FileCreatPropList::getFileSpaceStrategy",
|
||||||
"H5Pget_file_space for strategy failed");
|
"H5Pget_file_space_strategy failed");
|
||||||
}
|
}
|
||||||
return(strategy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// Function: FileCreatPropList::getFileSpaceThreshold
|
// Function: FileCreatPropList::setFileSpacePagesize
|
||||||
///\brief Returns the threshold value that the library uses in tracking
|
///\brief Sets the file space page size for paged aggregation.
|
||||||
/// free space sections.
|
|
||||||
///\return The threshold value
|
|
||||||
///\exception H5::PropListIException
|
///\exception H5::PropListIException
|
||||||
// Programmer Binh-Minh Ribler - Feb, 2017
|
// 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 = H5Pset_file_space_page_size(id, fsp_psize);
|
||||||
herr_t ret_value = H5Pget_file_space(id, NULL, &threshold);
|
|
||||||
if (ret_value < 0)
|
if (ret_value < 0)
|
||||||
{
|
{
|
||||||
throw PropListIException("FileCreatPropList::getFileSpaceThreshold",
|
throw PropListIException("FileCreatPropList::setFileSpacePagesize",
|
||||||
"H5Pget_file_space for threshold failed");
|
"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
|
// Sets the strategy and the threshold value that the library will
|
||||||
// will employ in managing file space.
|
// 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.
|
// 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
|
// Returns the threshold value that the library uses in tracking free
|
||||||
// space sections.
|
// space sections.
|
||||||
hsize_t getFileSpaceThreshold() const;
|
hsize_t getFileSpacePagesize() const;
|
||||||
|
|
||||||
///\brief Returns this class name.
|
///\brief Returns this class name.
|
||||||
virtual H5std_string fromClass() const { return("FileCreatPropList"); }
|
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()
|
static void test_file_info()
|
||||||
{
|
{
|
||||||
// Output message about test being performed
|
// Output message about test being performed
|
||||||
SUBTEST("File general information");
|
SUBTEST("File general information");
|
||||||
|
|
||||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
hsize_t out_threshold = 0; // Free space section threshold to get
|
||||||
hsize_t in_threshold = 2; // Free space section threshold to set */
|
hbool_t out_persist = FALSE;// Persist free-space read
|
||||||
hsize_t out_threshold = 0; // Free space section threshold to get */
|
|
||||||
// File space handling strategy
|
// File space handling strategy
|
||||||
H5F_file_space_type_t in_strategy = H5F_FILE_SPACE_ALL;
|
H5F_fspace_strategy_t out_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
|
||||||
// File space handling strategy
|
|
||||||
H5F_file_space_type_t out_strategy = H5F_FILE_SPACE_DEFAULT;
|
|
||||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Create a file using default properties.
|
// Create a file using default properties.
|
||||||
@ -843,14 +841,30 @@ static void test_file_info()
|
|||||||
// Create file creation property list.
|
// Create file creation property list.
|
||||||
FileCreatPropList fcpl;
|
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.
|
// Set various file information.
|
||||||
fcpl.setUserblock(F2_USERBLOCK_SIZE);
|
fcpl.setUserblock(F2_USERBLOCK_SIZE);
|
||||||
fcpl.setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
|
fcpl.setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
|
||||||
fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
|
fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
|
||||||
fcpl.setIstorek(F2_ISTORE);
|
fcpl.setIstorek(F2_ISTORE);
|
||||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
|
||||||
fcpl.setFileSpace(in_strategy, in_threshold);
|
hsize_t threshold = 5; // Free space section threshold to set
|
||||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
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
|
// Creating a file with the non-default file creation property list
|
||||||
// should create a version 1 superblock
|
// should create a version 1 superblock
|
||||||
@ -863,11 +877,7 @@ static void test_file_info()
|
|||||||
|
|
||||||
// Get the file's version information.
|
// Get the file's version information.
|
||||||
file7.getFileInfo(finfo);
|
file7.getFileInfo(finfo);
|
||||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
|
||||||
verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
|
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.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||||
verify_val(finfo.sohm.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.
|
// Get the file's version information.
|
||||||
file7.getFileInfo(finfo);
|
file7.getFileInfo(finfo);
|
||||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
|
||||||
verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
|
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.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
|
||||||
verify_val(finfo.sohm.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");
|
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 */
|
// Get and verify the file space info from the creation property list */
|
||||||
out_strategy = fcpl2.getFileSpaceStrategy();
|
fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
|
||||||
verify_val(static_cast<unsigned>(out_strategy), static_cast<unsigned>(in_strategy), "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
|
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();
|
out_fsp_psize = fcpl2.getFileSpacePagesize();
|
||||||
verify_val(static_cast<unsigned>(out_threshold), static_cast<unsigned>(in_threshold), "FileCreatPropList::getFileSpaceThreshold", __LINE__, __FILE__);
|
verify_val(out_fsp_psize, FSP_SIZE512, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
|
||||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
|
||||||
|
|
||||||
PASSED();
|
PASSED();
|
||||||
} // end of try block
|
} // end of try block
|
||||||
|
Loading…
Reference in New Issue
Block a user