diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-10-03 04:36:22 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-10-03 04:36:22 (GMT) |
commit | d1a4ff0b3056b323ba4ae9e8b03f86115d7456e7 (patch) | |
tree | f67b3e7faeefc698aa51e12ec19c0be0583f5f96 | |
parent | b151281b3897ae367aa520abe2877bc7183f4648 (diff) | |
parent | 3e59374ccd0c7cbb671dc72c34ec1a6a9123bc5b (diff) | |
download | hdf5-d1a4ff0b3056b323ba4ae9e8b03f86115d7456e7.zip hdf5-d1a4ff0b3056b323ba4ae9e8b03f86115d7456e7.tar.gz hdf5-d1a4ff0b3056b323ba4ae9e8b03f86115d7456e7.tar.bz2 |
[svn-r22856] merge trunk up to 22855.
131 files changed, 4255 insertions, 1576 deletions
@@ -349,6 +349,7 @@ ./fortran/test/tH5I.f90 ./fortran/test/tH5L_F03.f90 ./fortran/test/tH5O.f90 +./fortran/test/tH5O_F03.f90 ./fortran/test/tH5P_F03.f90 ./fortran/test/tH5P.f90 ./fortran/test/tH5R.f90 @@ -441,6 +442,8 @@ ./c++/src/H5IntType.h ./c++/src/H5Library.cpp ./c++/src/H5Library.h +./c++/src/H5Location.cpp +./c++/src/H5Location.h ./c++/src/H5Object.cpp ./c++/src/H5Object.h ./c++/src/H5PredType.cpp diff --git a/Makefile.in b/Makefile.in index 34dc91d..1246a41 100644 --- a/Makefile.in +++ b/Makefile.in @@ -245,6 +245,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -259,6 +260,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -1,4 +1,4 @@ -HDF5 version 1.9.131 currently under development +HDF5 version 1.9.132 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/Makefile.in b/c++/Makefile.in index fe9ce2b..c2efdee 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -210,6 +210,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -224,6 +225,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index 021edca..b4a5590 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -177,6 +177,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -191,6 +192,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 375bd4a..d983d1e 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -40,6 +40,7 @@ SET (CPP_SRCS ${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.cpp @@ -74,6 +75,7 @@ SET (CPP_HDRS ${HDF5_CPP_SRC_SOURCE_DIR}/H5Include.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.h diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 9cf1ee8..e6cacf9 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -25,11 +25,6 @@ #include "H5CommonFG.h" #include "H5Alltypes.h" -#include <iostream> // remove when done - - using std::cerr; - using std::endl; - #ifndef H5_NO_NAMESPACE namespace H5 { #endif diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 1d04d6c..354b47b 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -65,7 +65,7 @@ class H5_DLLCPP AbstractDs { // dataset - pure virtual. virtual hsize_t getStorageSize() const = 0; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass() const = 0; // Copy constructor diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index d50017a..7daafed 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -36,7 +36,7 @@ class H5_DLLCPP ArrayType : public DataType { // Returns the sizes of dimensions of this array datatype. int getArrayDims(hsize_t* dims); - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("ArrayType"); } // Copy constructor: makes copy of the original object. diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index 1ddfd7d..25770f5 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -57,7 +57,7 @@ class H5_DLLCPP AtomType : public DataType { // Sets the total size for an atomic datatype. void setSize( size_t size ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("AtomType"); } // Copy constructor - makes copy of the original object diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 226ae5c..120ed39 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -385,6 +385,31 @@ hsize_t Attribute::getStorageSize() const } //-------------------------------------------------------------------------- +// Function: Attribute::flush +///\brief Flushes all buffers associated with a file specified by +/// this attribute, to disk. +///\param scope - IN: Specifies the scope of the flushing action, +/// which can be either of these values: +/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file +/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file +///\exception H5::AttributeIException +///\par Description +/// This attribute is used to identify the file to be flushed. +// Programmer Binh-Minh Ribler - 2012 +// Modification +// Sep 2012 - BMR +// Duplicated from H5Location +//-------------------------------------------------------------------------- +void Attribute::flush(H5F_scope_t scope) const +{ + herr_t ret_value = H5Fflush(getId(), scope); + if( ret_value < 0 ) + { + throw AttributeIException("Attribute::flush", "H5Fflush failed"); + } +} + +//-------------------------------------------------------------------------- // Function: Attribute::getId // Purpose: Get the id of this attribute // Description: diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index 284e5bc..dd37a99 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -51,7 +51,11 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { void write(const DataType& mem_type, const void *buf ) const; void write(const DataType& mem_type, const H5std_string& strg ) const; - // Returns this class name + // Flushes all buffers associated with the file specified by this + // attribute to disk + void flush( H5F_scope_t scope ) const; + + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Attribute"); } // Creates a copy of an existing attribute using the attribute id diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h index f691548..c3b61ca 100644 --- a/c++/src/H5Classes.h +++ b/c++/src/H5Classes.h @@ -22,6 +22,7 @@ namespace H5 { #endif class Exception; class IdComponent; + class H5Location; class H5Object; class PropList; class FileCreatPropList; diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index ae030ee..9b2b572 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -26,12 +26,21 @@ namespace H5 { class H5_DLLCPP CompType : public DataType { public: + // Default constructor + CompType(); + + // Creates a compound datatype using an existing id + CompType( const hid_t existing_id ); + // Creates a new compound datatype, given the type's size CompType( size_t size ); // H5Tcreate // Gets the compound datatype of the specified dataset CompType( const DataSet& dataset ); // H5Dget_type + // Copy constructor - makes a copy of original object + CompType( const CompType& original ); + // Returns the type class of the specified member of this compound // datatype. It provides to the user a way of knowing what type // to create another datatype of the same class @@ -88,18 +97,9 @@ class H5_DLLCPP CompType : public DataType { // Recursively removes padding from within this compound datatype. void pack() const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("CompType"); } - // Default constructor - CompType(); - - // Creates a compound datatype using an existing id - CompType( const hid_t existing_id ); - - // Copy constructor - makes a copy of original object - CompType( const CompType& original ); - // Noop destructor. virtual ~CompType(); diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h index 75d82ba..ddf4f19 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -22,6 +22,7 @@ #include "H5IdComponent.h" #include "H5DataSpace.h" #include "H5PropList.h" +#include "H5Location.h" #include "H5Object.h" #include "H5AbstractDs.h" #include "H5Attribute.h" diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index b974238..ab3fa79 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -30,7 +30,7 @@ * It is assumed that the user has knowledge of the HDF5 file format * and its components. If you are not familiar with HDF5 file format, * and would like to find out more, please refer to the HDF5 documentation - * at http://hdf.ncsa.uiuc.edu/HDF5/doc/H5.intro.html + * at http://www.hdfgroup.org/HDF5/doc/index.html * * Because the HDF5 library maps very well to * the object oriented design approach, classes in the C++ API can diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index f7aaa72..6a1524d 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -644,54 +644,6 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) } } -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: DataSet::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\param ref - IN: Reference to query -///\return An object type, which can be one of the following: -/// \li \c H5G_LINK (0) - Object is a symbolic link. -/// \li \c H5G_GROUP (1) - Object is a group. -/// \li \c H5G_DATASET (2) - Object is a dataset. -/// \li \c H5G_TYPE (3) - Object is a named datatype -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (IdComponentException E) { - throw DataSetIException("DataSet::getObjType", E.getDetailMsg()); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: DataSet::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -/// to H5R_DATASET_REGION -///\return DataSpace instance -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const -{ - try { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); - } - catch (IdComponentException E) { - throw DataSetIException("DataSet::getRegion", E.getDetailMsg()); - } -} - //-------------------------------------------------------------------------- // Function: DataSet::getId ///\brief Get the id of this dataset. diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index 3d9183d..54e9d6f 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -76,15 +76,10 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSet"); } // Creates a dataset by way of dereference. @@ -110,6 +105,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { private: hid_t id; // HDF5 dataset id +#ifndef DOXYGEN_SHOULD_SKIP_THIS // This function contains the common code that is used by // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific @@ -123,6 +119,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { protected: // Sets the dataset id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 80842f7..9afb8ab 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -103,7 +103,7 @@ class H5_DLLCPP DataSpace : public IdComponent { // Sets or resets the size of this dataspace. void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSpace"); } // Creates a DataSpace object using an existing dataspace id. diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 3edb163..99525bc 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -679,51 +679,6 @@ bool DataType::isVariableStr() const } } -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: DataType::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query -///\return Object type, which can be one of the following: -/// \li \c H5G_LINK Object is a symbolic link. -/// \li \c H5G_GROUP Object is a group. -/// \li \c H5G_DATASET Object is a dataset. -/// \li \c H5G_TYPE Object is a named datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t DataType::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (IdComponentException E) { - throw DataTypeIException(inMemFunc("getObjType"), E.getDetailMsg()); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: DataType::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -///\return DataSpace instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -DataSpace DataType::getRegion(void *ref, H5R_type_t ref_type) const -{ - try { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); - } - catch (IdComponentException E) { - throw DataTypeIException(inMemFunc("getRegion"), E.getDetailMsg()); - } -} - //-------------------------------------------------------------------------- // Function: DataType::getId // Purpose: Get the id of this attribute diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 48aeaf8..98514bb 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -101,15 +101,10 @@ class H5_DLLCPP DataType : public H5Object { // Checks whether this datatype is a variable-length string. bool isVariableStr() const; -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } // Creates a copy of an existing DataType using its id diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index b7f5823..ac7664e 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -107,7 +107,7 @@ class H5_DLLCPP DSetCreatPropList : public PropList { // Sets SZIP compression method. void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DSetCreatPropList"); } // Copy constructor: creates a copy of a DSetCreatPropList object. diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 11e15fc..66216d8 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -92,7 +92,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { // Determines whether error-detection is enabled for dataset reads. H5Z_EDC_t getEDCCheck(); - // Returns this class name. + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DSetMemXferPropList"); } // Copy constructor: makes a copy of a DSetMemXferPropList object. diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 2a2c263..914eb66 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -57,7 +57,7 @@ class H5_DLLCPP EnumType : public DataType { void valueOf( const char* name, void *value ) const; void valueOf( const H5std_string& name, void *value ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("EnumType"); } // Default constructor diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 7f133bb..0c2cc21 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -123,7 +123,7 @@ class H5_DLLCPP FileAccPropList : public PropList { // Returns garbage collecting references setting. unsigned getGcReferences() const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("FileAccPropList"); } // Copy constructor: creates a copy of a FileAccPropList object. diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 1aa102f..61074ea 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -62,7 +62,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { // indexing chunked datasets. void setIstorek( unsigned ik ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("FileCreatPropList"); } // Copy constructor: creates a copy of a FileCreatPropList object. diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index da0241f..92c4d32 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -50,7 +50,7 @@ namespace H5 { ///\brief Default constructor: creates a stub H5File object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File() : IdComponent(), id(0) {} +H5File::H5File() : H5Location(), id(0) {} //-------------------------------------------------------------------------- // Function: H5File overloaded constructor @@ -79,7 +79,7 @@ H5File::H5File() : IdComponent(), id(0) {} /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0) +H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) { p_get_file(name, flags, create_plist, access_plist); } @@ -97,7 +97,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c /// FileCreatPropList::DEFAULT // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0) +H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) { p_get_file(name.c_str(), flags, create_plist, access_plist); } @@ -140,34 +140,15 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro ///\param original - IN: H5File instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File(const H5File& original) : IdComponent(original) +H5File::H5File(const H5File& original) : H5Location(original) { id = original.getId(); incRefCount(); // increment number of references to this id } //-------------------------------------------------------------------------- -// Function: H5File::flush -///\brief Flushes all buffers associated with a file to disk. -///\param scope - IN: Specifies the scope of the flushing action, -/// which can be either of these values: -/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file -/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - Dec. 2005 -//-------------------------------------------------------------------------- -void H5File::flush(H5F_scope_t scope) const -{ - herr_t ret_value = H5Fflush( id, scope ); - if( ret_value < 0 ) - { - throw FileIException("H5File::flush", "H5Fflush failed"); - } -} - -//-------------------------------------------------------------------------- // Function: H5File::isHdf5 -///\brief Determines whether a file in HDF5 format. +///\brief Determines whether a file in HDF5 format. (Static) ///\param name - IN: Name of the file ///\return true if the file is in HDF5 format, and false, otherwise ///\exception H5::FileIException @@ -191,7 +172,7 @@ bool H5File::isHdf5(const char* name) //-------------------------------------------------------------------------- // Function: H5File::isHdf5 ///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. +/// It takes an \c H5std_string for \a name. (Static) ///\param name - IN: Name of the file - \c H5std_string // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- @@ -269,8 +250,8 @@ void H5File::reOpen() throw FileIException("H5File::reOpen", close_error.getDetailMsg()); } - // call C routine to reopen the file - Note: not sure about this - // does id need to be closed later? which id to be the parameter? + // call C routine to reopen the file - Note: not sure about this, + // which id to be the parameter when closing? id = H5Freopen( id ); if( id < 0 ) // Raise exception when H5Freopen returns a neg value throw FileIException("H5File::reOpen", "H5Freopen failed"); @@ -278,12 +259,10 @@ void H5File::reOpen() //-------------------------------------------------------------------------- // Function: H5File::reopen -///\brief Reopens this file. -/// -///\exception H5::FileIException -///\par Description -/// This function will be replaced by the above function \c reOpen -/// in future releases. +// Purpose: Reopens this file. +// Exception H5::FileIException +// Description +// This function is replaced by the above function reOpen. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5File::reopen() @@ -490,70 +469,6 @@ void H5File::getVFDHandle(void **file_handle) const } //-------------------------------------------------------------------------- -// Function: H5File::getFileName -///\brief Gets the name of this file. -///\return File name -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - Jul, 2004 -//-------------------------------------------------------------------------- -H5std_string H5File::getFileName() const -{ - try { - return(p_get_file_name()); - } - catch (IdComponentException E) { - throw FileIException("H5File::getFileName", E.getDetailMsg()); - } -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5File::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference -///\return Object type, which can be one of the following: -/// \li \c H5G_LINK - Object is a symbolic link. -/// \li \c H5G_GROUP - Object is a group. -/// \li \c H5G_DATASET - Object is a dataset. -/// \li \c H5G_TYPE - Object is a named datatype -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (IdComponentException E) { - throw FileIException("H5File::getObjType", E.getDetailMsg()); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: H5File::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -///\return DataSpace instance -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -DataSpace H5File::getRegion(void *ref, H5R_type_t ref_type) const -{ - try { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); - } - catch (IdComponentException E) { - throw FileIException("H5File::getRegion", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- // Function: H5File::getFileSize ///\brief Returns the file size of the HDF5 file. ///\return File size @@ -575,134 +490,6 @@ hsize_t H5File::getFileSize() const } //-------------------------------------------------------------------------- -// Function: H5File::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. -// Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5File::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const -{ - herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); - if (ret_value < 0) - { - throw IdComponentException("", "H5Rcreate failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference - this is the default -///\exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5File::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const -{ - try { - p_reference(ref, name, dataspace.getId(), ref_type); - } - catch (IdComponentException E) { - throw IdComponentException("H5File::reference", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it only creates -/// a reference to an HDF5 object, not to a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c char pointer -///\exception H5::IdComponentException -///\par Description -// This function passes H5R_OBJECT and -1 to the protected -// function for it to pass to the C API H5Rcreate -// to create a reference to the named object. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5File::reference(void* ref, const char* name) const -{ - try { - p_reference(ref, name, -1, H5R_OBJECT); - } - catch (IdComponentException E) { - throw IdComponentException("H5File::reference", E.getDetailMsg()); - } -} -//-------------------------------------------------------------------------- -// Function: H5File::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5File::reference(void* ref, const H5std_string& name) const -{ - reference(ref, name.c_str()); -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5File::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. -// Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_LINK Object is a symbolic link. -// H5G_GROUP Object is a group. -// H5G_DATASET Object is a dataset. -// H5G_TYPE Object is a named datatype -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t H5File::p_get_obj_type(void *ref, H5R_type_t ref_type) const -{ - H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref); - - if (obj_type == H5G_UNKNOWN) - { - throw IdComponentException("", "H5Rget_obj_type failed"); - } - return(obj_type); -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - -//-------------------------------------------------------------------------- -// Function: H5File::p_get_region (protected) -// Purpose Retrieves a dataspace with the region pointed to selected. -// Parameters -// ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -// ref - IN: Reference to get region of -// Return Dataspace id -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -hid_t H5File::p_get_region(void *ref, H5R_type_t ref_type) const -{ - hid_t space_id = H5Rget_region(getId(), ref_type, ref); - if (space_id < 0) - { - throw IdComponentException("", "H5Rget_region failed"); - } - return(space_id); -} - -//-------------------------------------------------------------------------- // Function: H5File::getLocId // Purpose: Get the id of this file // Description diff --git a/c++/src/H5File.h b/c++/src/H5File.h index b69c963..cfb6bdf 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -21,7 +21,7 @@ namespace H5 { #endif -class H5_DLLCPP H5File : public IdComponent, public CommonFG { +class H5_DLLCPP H5File : public H5Location, public CommonFG { public: // Creates or opens an HDF5 file. H5File( const char* name, unsigned int flags, @@ -40,18 +40,12 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // Close this file. virtual void close(); - // Flushes all buffers associated with this file to disk - void flush(H5F_scope_t scope) const; - // Gets the access property list of this file. FileAccPropList getAccessPlist() const; // Gets the creation property list of this file. FileCreatPropList getCreatePlist() const; - // Gets the name of this file. - H5std_string getFileName() const; - // Retrieves the file size of an opened file. hsize_t getFileSize() const; @@ -67,11 +61,6 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; @@ -87,14 +76,7 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { void reOpen(); // added for better name void reopen(); - // Creates a reference to a named HDF5 object or to a dataset region - // in this object. - void reference(void* ref, const char* name, const DataSpace& dataspace, - H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const char* name) const; - void reference(void* ref, const H5std_string& name) const; - - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("H5File"); } // Throw file exception. @@ -124,17 +106,6 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // constructors taking a string or a char* void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ); - // Creates a reference to an HDF5 object or a dataset region. - void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; - -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - // Retrieves a dataspace with the region pointed to selected. - hid_t p_get_region(void *ref, H5R_type_t ref_type) const; - protected: // Sets the HDF5 file id. virtual void p_setId(const hid_t new_id); diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index 7444bd5..cbb9541 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -53,7 +53,7 @@ class H5_DLLCPP FloatType : public AtomType { // Sets the mantissa normalization of a floating-point datatype. void setNorm( H5T_norm_t norm ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("FloatType"); } // Default constructor diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 6ec2dbb..e83b635 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -147,53 +147,6 @@ Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() } } -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: Group::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5G_LINK (0) - Object is a symbolic link. -/// \li \c H5G_GROUP (1) - Object is a group. -/// \li \c H5G_DATASET (2) - Object is a dataset. -/// \li \c H5G_TYPE (3) - Object is a named datatype -///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t Group::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (IdComponentException E) { - throw GroupIException("Group::getObjType", E.getDetailMsg()); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: Group::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -///\return DataSpace instance -///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -DataSpace Group::getRegion(void *ref, H5R_type_t ref_type) const -{ - try { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); - } - catch (IdComponentException E) { - throw GroupIException("Group::getRegion", E.getDetailMsg()); - } -} - //-------------------------------------------------------------------------- // Function: Group::getId // Purpose: Get the id of this attribute diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 9978cf0..e4c2415 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -26,15 +26,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Close this group. virtual void close(); -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Group"); } // Throw group exception. diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index b217c10..7dc1da3 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -65,7 +65,7 @@ class H5_DLLCPP IdComponent { // <class-name> is returned by fromClass(). H5std_string inMemFunc(const char* func_name) const; - // Returns this class name. + ///\brief Returns this class name. virtual H5std_string fromClass() const { return("IdComponent");} #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index b712103..53864ee 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -35,7 +35,7 @@ class H5_DLLCPP IntType : public AtomType { // Sets the sign proprety for an integer type. void setSign( H5T_sign_t sign ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("IntType"); } // Default constructor diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp new file mode 100644 index 0000000..b93cd86 --- /dev/null +++ b/c++/src/H5Location.cpp @@ -0,0 +1,669 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include <string> + +#include "H5Include.h" +#include "H5Exception.h" +#include "H5IdComponent.h" +#include "H5PropList.h" +#include "H5Location.h" +#include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5DxferProp.h" +#include "H5FaccProp.h" +#include "H5FcreatProp.h" +#include "H5CommonFG.h" +#include "H5DataType.h" +#include "H5DataSpace.h" +#include "H5AbstractDs.h" +#include "H5File.h" +#include "H5DataSet.h" +#include "H5Attribute.h" + +#ifndef H5_NO_NAMESPACE +namespace H5 { +#endif + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// userAttrOpWrpr simply interfaces between the user's function and the +// C library function H5Aiterate2; used to resolve the different prototype +// problem. May be moved to Iterator later. +extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, + const H5A_info_t *ainfo, void *op_data) +{ + H5std_string s_attr_name = H5std_string( attr_name ); +#ifdef NO_STATIC_CAST + UserData4Aiterate* myData = (UserData4Aiterate *) op_data; +#else + UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data); +#endif + myData->op( *myData->location, s_attr_name, myData->opData ); + return 0; +} + +//-------------------------------------------------------------------------- +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5Location::H5Location() : IdComponent(0) {} + +//-------------------------------------------------------------------------- +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +//-------------------------------------------------------------------------- +// Function: H5Location copy constructor +///\brief Copy constructor: makes a copy of the original H5Location +/// instance. +///\param original - IN: H5Location instance to copy +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} + +//-------------------------------------------------------------------------- +// Function: H5Location::createAttribute +///\brief Creates an attribute for a group, dataset, or named datatype. +///\param name - IN: Name of the attribute +///\param data_type - IN: Datatype for the attribute +///\param data_space - IN: Dataspace for the attribute - only simple +/// dataspaces are allowed at this time +///\param create_plist - IN: Creation property list - default to +/// PropList::DEFAULT +///\return Attribute instance +///\exception H5::AttributeIException +///\par Description +/// The attribute name specified in \a name must be unique. +/// Attempting to create an attribute with the same name as an +/// existing attribute will raise an exception, leaving the +/// pre-existing attribute intact. To overwrite an existing +/// attribute with a new attribute of the same name, first +/// delete the existing one with \c H5Location::removeAttr, then +/// recreate it with this function. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const +{ + hid_t type_id = data_type.getId(); + hid_t space_id = data_space.getId(); + hid_t plist_id = create_plist.getId(); + hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT ); + + // If the attribute id is valid, create and return the Attribute object + if( attr_id > 0 ) + { + Attribute attr( attr_id ); + return( attr ); + } + else + throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::createAttribute +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const +{ + return( createAttribute( name.c_str(), data_type, data_space, create_plist )); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::openAttribute +///\brief Opens an attribute given its name. +///\param name - IN: Name of the attribute +///\return Attribute instance +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::openAttribute( const char* name ) const +{ + hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT); + if( attr_id > 0 ) + { + Attribute attr( attr_id ); + return( attr ); + } + else + { + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::openAttribute +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::openAttribute( const H5std_string& name ) const +{ + return( openAttribute( name.c_str()) ); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::openAttribute +///\brief Opens an attribute given its index. +///\param idx - IN: Index of the attribute, a 0-based, non-negative integer +///\return Attribute instance +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::openAttribute( const unsigned int idx ) const +{ + hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, + H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT); + if( attr_id > 0 ) + { + Attribute attr( attr_id ); + return( attr ); + } + else + { + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::iterateAttrs +///\brief Iterates a user's function over all the attributes of an H5 +/// object, which may be a group, dataset or named datatype. +///\param user_op - IN: User's function to operate on each attribute +///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices +///\param op_data - IN: User's data to pass to user's operator function +///\return Returned value of the last operator if it was non-zero, or +/// zero if all attributes were processed +///\exception H5::AttributeIException +///\par Description +/// The signature of user_op is +/// void (*)(H5::H5Location&, H5std_string, void*). +/// For information, please refer to the C layer Reference Manual +/// at: +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data ) +{ + // store the user's function and data + UserData4Aiterate* userData = new UserData4Aiterate; + userData->opData = op_data; + userData->op = user_op; + userData->location = this; + + // call the C library routine H5Aiterate2 to iterate the attributes + hsize_t idx = _idx ? (hsize_t)*_idx : 0; + int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, + userAttrOpWrpr, (void *) userData); + + // release memory + delete userData; + + if( ret_value >= 0 ) { + /* Pass back update index value to calling code */ + if (_idx) + *_idx = (unsigned)idx; + + return( ret_value ); + } + else // raise exception when H5Aiterate returns a negative value + throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getNumAttrs +///\brief Returns the number of attributes attached to this HDF5 object. +///\return Number of attributes +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +int H5Location::getNumAttrs() const +{ + H5O_info_t oinfo; /* Object info */ + + if(H5Oget_info(getId(), &oinfo) < 0) + throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); + else + return( (int)oinfo.num_attrs ); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeAttr +///\brief Removes the named attribute from this object. +///\param name - IN: Name of the attribute to be removed +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void H5Location::removeAttr( const char* name ) const +{ + herr_t ret_value = H5Adelete(getId(), name); + if( ret_value < 0 ) + throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeAttr +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void H5Location::removeAttr( const H5std_string& name ) const +{ + removeAttr( name.c_str() ); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::renameAttr +///\brief Renames the named attribute from this object. +///\param oldname - IN: Name of the attribute to be renamed +///\param newname - IN: New name ame of the attribute +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Mar, 2005 +//-------------------------------------------------------------------------- +void H5Location::renameAttr(const char* oldname, const char* newname) const +{ + herr_t ret_value = H5Arename(getId(), oldname, newname); + if (ret_value < 0) + throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::renameAttr +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for the names. +// Programmer Binh-Minh Ribler - Mar, 2005 +//-------------------------------------------------------------------------- +void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& newname) const +{ + renameAttr (oldname.c_str(), newname.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::flush +///\brief Flushes all buffers associated with a location to disk. +///\param scope - IN: Specifies the scope of the flushing action, +/// which can be either of these values: +/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file +/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file +///\exception H5::FileIException +///\par Description +/// This location is used to identify the file to be flushed. +// Programmer Binh-Minh Ribler - 2012 +// Modification +// Sep 2012 - BMR +// Moved from H5File/H5Object +//-------------------------------------------------------------------------- +void H5Location::flush(H5F_scope_t scope) const +{ + herr_t ret_value = H5Fflush(getId(), scope); + if( ret_value < 0 ) + { + throw FileIException(inMemFunc("flush"), "H5Fflush failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getFileName +///\brief Gets the name of the file, in which this HDF5 object belongs. +///\return File name +///\exception H5::IdComponentException +// Programmer Binh-Minh Ribler - Jul, 2004 +//-------------------------------------------------------------------------- +H5std_string H5Location::getFileName() const +{ + try { + return(p_get_file_name()); + } + catch (IdComponentException E) { + throw FileIException(inMemFunc("getFileName"), E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. +// Parameters +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::IdComponentException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const +{ + herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); + if (ret_value < 0) + { + throw ReferenceException("", "H5Rcreate failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. - this is the default +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const +{ + try { + p_reference(ref, name, dataspace.getId(), ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::reference", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it only creates +/// a reference to an HDF5 object, not to a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c char pointer +///\exception H5::ReferenceException +///\par Description +// This function passes H5R_OBJECT and -1 to the protected +// function for it to pass to the C API H5Rcreate +// to create a reference to the named object. +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const char* name) const +{ + try { + p_reference(ref, name, -1, H5R_OBJECT); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::reference", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const H5std_string& name) const +{ + reference(ref, name.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::p_dereference (protected) +// Purpose Dereference a ref into an hdf5 object. +// Parameters +// loc_id - IN: An hdf5 identifier specifying the location of the +// referenced object +// ref - IN: Reference pointer +// ref_type - IN: Reference type +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May 2008 - BMR +// Moved from IdComponent. +//-------------------------------------------------------------------------- +hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); + if (temp_id < 0) + { + throw ReferenceException("", "H5Rdereference failed"); + } + + // No failure, set id to the object + return(temp_id); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. +///\param obj - IN: Object specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May, 2008 +// Corrected missing parameters. - BMR +//-------------------------------------------------------------------------- +void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + try { + temp_id = p_dereference(obj.getId(), ref, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg()); + } + p_setId(temp_id); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. +///\param h5file - IN: HDF5 file specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May, 2008 +// Corrected missing parameters. - BMR +//-------------------------------------------------------------------------- +void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + try { + temp_id = p_dereference(h5file.getId(), ref, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg()); + } + p_setId(temp_id); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an attribute. +///\param attr - IN: Attribute specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May, 2008 +// Corrected missing parameters. - BMR +//-------------------------------------------------------------------------- +void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + try { + temp_id = p_dereference(attr.getId(), ref, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg()); + } + p_setId(temp_id); +} + +#ifndef H5_NO_DEPRECATED_SYMBOLS +//-------------------------------------------------------------------------- +// Function: H5Location::getObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT \tReference is an object reference. +/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference. +///\param ref - IN: Reference to query +///\return An object type, which can be one of the following: +/// \li \c H5G_UNKNOWN \tA failure occurs. (-1) +/// \li \c H5G_GROUP \tObject is a group. +/// \li \c H5G_DATASET \tObject is a dataset. +/// \li \c H5G_TYPE Object \tis a named datatype +/// \li \c H5G_LINK \tObject is a symbolic link. +/// \li \c H5G_UDLINK \tObject is a user-defined link. +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +// Modification +// Sep 2012: Moved up from H5File, Group, DataSet, and DataType +//-------------------------------------------------------------------------- +H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const +{ + try { + return(p_get_obj_type(ref, ref_type)); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::getObjType", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. +// Parameters +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const +{ + H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref); + + if (obj_type == H5G_UNKNOWN) + { + throw ReferenceException("", "H5Rget_obj_type1 failed"); + } + return(obj_type); +} +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + +//-------------------------------------------------------------------------- +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const +{ + try { + return(p_get_ref_obj_type(ref, ref_type)); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::getRefObjType", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. +// Parameters +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5O_TYPE_UNKNOWN - Unknown object type (-1) +// H5O_TYPE_GROUP - Object is a group +// H5O_TYPE_DATASET - Object is a dataset +// H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +// H5O_TYPE_NTYPES - Number of object types +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const +{ + H5O_type_t obj_type = H5O_TYPE_UNKNOWN; + herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type); + + if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) + { + throw ReferenceException("", "H5Rget_obj_type2 failed"); + } + return(obj_type); +} + + +//-------------------------------------------------------------------------- +// Function: H5Location::p_get_region (protected) +// Purpose Retrieves a dataspace with the region pointed to selected. +// Parameters +// ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +// ref - IN: Reference to get region of +// Return Dataspace id +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const +{ + hid_t space_id = H5Rget_region(getId(), ref_type, ref); + if (space_id < 0) + { + throw ReferenceException("", "H5Rget_region failed"); + } + return(space_id); +} + + +//-------------------------------------------------------------------------- +// Function: H5Location destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5Location::~H5Location() {} + +#ifndef H5_NO_NAMESPACE +} // end namespace +#endif diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h new file mode 100644 index 0000000..d1dd892 --- /dev/null +++ b/c++/src/H5Location.h @@ -0,0 +1,146 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5Location_H +#define _H5Location_H + +#include "H5Classes.h" // constains forward class declarations + +// H5Location is an abstract class. It provides a collection of wrappers +// of C functions which take location IDs. Most of these were in H5Object +// but are now moved here for H5File's access. + +#ifndef H5_NO_NAMESPACE +namespace H5 { +#endif + +class H5_DLLCPP H5Location; // forward declaration for UserData4Aiterate + +// Define the operator function pointer for H5Aiterate(). +typedef void (*attr_operator_t)( H5Location& loc/*in*/, + const H5std_string attr_name/*in*/, + void *operator_data/*in,out*/); + +class UserData4Aiterate { // user data for attribute iteration + public: + attr_operator_t op; + void* opData; + H5Location* location; +}; + +// An H5Location can be a file, group, dataset, named datatype, or attribute. + +class H5_DLLCPP H5Location : public IdComponent { + public: + // Creates an attribute for the specified object at this location + // PropList is currently not used, so always be default. + Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; + Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; + + // Given its name, opens the attribute that belongs to an object at + // this location. + Attribute openAttribute( const char* name ) const; + Attribute openAttribute( const H5std_string& name ) const; + + // Given its index, opens the attribute that belongs to an object at + // this location. + Attribute openAttribute( const unsigned int idx ) const; + + // Flushes all buffers associated with this location to disk. + void flush( H5F_scope_t scope ) const; + + // Gets the name of the file, specified by this location. + H5std_string getFileName() const; + + // Determines the number of attributes at this location. + int getNumAttrs() const; + +#ifndef H5_NO_DEPRECATED_SYMBOLS + // Retrieves the type of object that an object reference points to. + H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + // Retrieves the type of object that an object reference points to. + H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; + // Note: getRefObjType deprecates getObjType, but getObjType's name is + // misleading, so getRefObjType is used in the new function instead. + + // Iterate user's function over the attributes at this location. + int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL ); + + // Removes the named attribute from this location. + void removeAttr( const char* name ) const; + void removeAttr( const H5std_string& name ) const; + + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + + // Creates a reference to a named object or to a dataset region + // in this object. + void reference(void* ref, const char* name, const DataSpace& dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; + void reference(void* ref, const char* name) const; + void reference(void* ref, const H5std_string& name) const; + + // Open a referenced object whose location is specified by either + // a file, an HDF5 object, or an attribute. + void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + + // For subclasses. + virtual hid_t getId() const = 0; + + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Default constructor, + H5Location(); + + // Creates a copy of an existing object giving the location id. + H5Location(const hid_t loc_id); + + // Copy constructor. + H5Location(const H5Location& original); + + // Creates a reference to an HDF5 object or a dataset region. + void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; + + // Dereferences a ref into an HDF5 id. + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); + +#ifndef H5_NO_DEPRECATED_SYMBOLS + // Retrieves the type of object that an object reference points to. + H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + // Retrieves the type of object that an object reference points to. + H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; + + // Retrieves a dataspace with the region pointed to selected. + hid_t p_get_region(void *ref, H5R_type_t ref_type) const; + + // Noop destructor. + virtual ~H5Location(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; /* end class H5Location */ + +#ifndef H5_NO_NAMESPACE +} +#endif +#endif diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 3c85502..e29e80e 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -37,30 +37,11 @@ namespace H5 { #endif #ifndef DOXYGEN_SHOULD_SKIP_THIS -// userAttrOpWrpr simply interfaces between the user's function and the -// C library function H5Aiterate2; used to resolve the different prototype -// problem. May be moved to Iterator later. -extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, - const H5A_info_t *ainfo, void *op_data) -{ - H5std_string s_attr_name = H5std_string( attr_name ); -#ifdef NO_STATIC_CAST - UserData4Aiterate* myData = (UserData4Aiterate *) op_data; -#else - UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data); -#endif - myData->op( *myData->object, s_attr_name, myData->opData ); - return 0; -} - //-------------------------------------------------------------------------- // Function: H5Object default constructor (protected) -// Description -// The id is set by IdComponent() but subclass constructor will -// set it to a valid HDF5 id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Object::H5Object() : IdComponent(0) {} +H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- // Function: H5Object overloaded constructor (protected) @@ -69,7 +50,7 @@ H5Object::H5Object() : IdComponent(0) {} // Parameters object_id - IN: Id of an existing HDF5 object // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {} +H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} #endif // DOXYGEN_SHOULD_SKIP_THIS @@ -80,496 +61,7 @@ H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {} ///\param original - IN: H5Object instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Object::H5Object( const H5Object& original ) : IdComponent( original ) {} - -//-------------------------------------------------------------------------- -// Function: H5Object::createAttribute -///\brief Creates an attribute for a group, dataset, or named datatype. -///\param name - IN: Name of the attribute -///\param data_type - IN: Datatype for the attribute -///\param data_space - IN: Dataspace for the attribute - only simple -/// dataspaces are allowed at this time -///\param create_plist - IN: Creation property list - default to -/// PropList::DEFAULT -///\return Attribute instance -///\exception H5::AttributeIException -///\par Description -/// The attribute name specified in \a name must be unique. -/// Attempting to create an attribute with the same name as an -/// existing attribute will raise an exception, leaving the -/// pre-existing attribute intact. To overwrite an existing -/// attribute with a new attribute of the same name, first -/// delete the existing one with \c H5Object::removeAttr, then -/// recreate it with this function. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const -{ - hid_t type_id = data_type.getId(); - hid_t space_id = data_space.getId(); - hid_t plist_id = create_plist.getId(); - hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT ); - - // If the attribute id is valid, create and return the Attribute object - if( attr_id > 0 ) - { - Attribute attr( attr_id ); - return( attr ); - } - else - throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::createAttribute -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const -{ - return( createAttribute( name.c_str(), data_type, data_space, create_plist )); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief Opens an attribute given its name. -///\param name - IN: Name of the attribute -///\return Attribute instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const char* name ) const -{ - hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT); - if( attr_id > 0 ) - { - Attribute attr( attr_id ); - return( attr ); - } - else - { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const H5std_string& name ) const -{ - return( openAttribute( name.c_str()) ); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief Opens an attribute given its index. -///\param idx - IN: Index of the attribute, a 0-based, non-negative integer -///\return Attribute instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const unsigned int idx ) const -{ - hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, - H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT); - if( attr_id > 0 ) - { - Attribute attr( attr_id ); - return( attr ); - } - else - { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::iterateAttrs -///\brief Iterates a user's function over all the attributes of an H5 -/// object, which may be a group, dataset or named datatype. -///\param user_op - IN: User's function to operate on each attribute -///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices -///\param op_data - IN: User's data to pass to user's operator function -///\return Returned value of the last operator if it was non-zero, or -/// zero if all attributes were processed -///\exception H5::AttributeIException -///\par Description -/// The signature of user_op is -/// void (*)(H5::H5Object&, H5std_string, void*). -/// For information, please refer to the C layer Reference Manual -/// at: -/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data ) -{ - // store the user's function and data - UserData4Aiterate* userData = new UserData4Aiterate; - userData->opData = op_data; - userData->op = user_op; - userData->object = this; - - // call the C library routine H5Aiterate2 to iterate the attributes - hsize_t idx = _idx ? (hsize_t)*_idx : 0; - int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, - userAttrOpWrpr, (void *) userData); - - // release memory - delete userData; - - if( ret_value >= 0 ) { - /* Pass back update index value to calling code */ - if (_idx) - *_idx = (unsigned)idx; - - return( ret_value ); - } - else // raise exception when H5Aiterate returns a negative value - throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getNumAttrs -///\brief Returns the number of attributes attached to this HDF5 object. -///\return Number of attributes -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int H5Object::getNumAttrs() const -{ - H5O_info_t oinfo; /* Object info */ - - if(H5Oget_info(getId(), &oinfo) < 0) - throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); - else - return( (int)oinfo.num_attrs ); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::removeAttr -///\brief Removes the named attribute from this object. -///\param name - IN: Name of the attribute to be removed -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void H5Object::removeAttr( const char* name ) const -{ - herr_t ret_value = H5Adelete(getId(), name); - if( ret_value < 0 ) - throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::removeAttr -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void H5Object::removeAttr( const H5std_string& name ) const -{ - removeAttr( name.c_str() ); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::renameAttr -///\brief Renames the named attribute from this object. -///\param oldname - IN: Name of the attribute to be renamed -///\param newname - IN: New name ame of the attribute -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -void H5Object::renameAttr(const char* oldname, const char* newname) const -{ - herr_t ret_value = H5Arename(getId(), oldname, newname); - if (ret_value < 0) - throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::renameAttr -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for the names. -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const -{ - renameAttr (oldname.c_str(), newname.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::flush -///\brief Flushes all buffers associated with a file to disk. -///\param scope - IN: Specifies the scope of the flushing action, -/// which can be either of these values: -/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file -/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::AttributeIException -///\par Description -/// This object is used to identify the file to be flushed. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void H5Object::flush(H5F_scope_t scope) const -{ - herr_t ret_value = H5Fflush(getId(), scope); - if( ret_value < 0 ) - { - throw FileIException(inMemFunc("flush"), "H5Fflush failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getFileName -///\brief Gets the name of the file, in which this HDF5 object belongs. -///\return File name -///\exception H5::IdComponentException -// Programmer Binh-Minh Ribler - Jul, 2004 -//-------------------------------------------------------------------------- -H5std_string H5Object::getFileName() const -{ - try { - return(p_get_file_name()); - } - catch (IdComponentException E) { - throw FileIException(inMemFunc("getFileName"), E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. -// Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Object::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const -{ - herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); - if (ret_value < 0) - { - throw IdComponentException("", "H5Rcreate failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. - this is the default -///\exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Object::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const -{ - try { - p_reference(ref, name, dataspace.getId(), ref_type); - } - catch (IdComponentException E) { - throw IdComponentException("H5Object::reference", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it only creates -/// a reference to an HDF5 object, not to a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c char pointer -///\exception H5::IdComponentException -///\par Description -// This function passes H5R_OBJECT and -1 to the protected -// function for it to pass to the C API H5Rcreate -// to create a reference to the named object. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Object::reference(void* ref, const char* name) const -{ - try { - p_reference(ref, name, -1, H5R_OBJECT); - } - catch (IdComponentException E) { - throw IdComponentException("H5Object::reference", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Object::reference(void* ref, const H5std_string& name) const -{ - reference(ref, name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::p_dereference (protected) -// Purpose Dereference a ref into an hdf5 object. -// Parameters -// loc_id - IN: An hdf5 identifier specifying the location of the -// referenced object -// ref - IN: Reference pointer -// ref_type - IN: Reference type -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May 2008 - BMR -// Moved from IdComponent. -//-------------------------------------------------------------------------- -hid_t H5Object::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); - if (temp_id < 0) - { - throw ReferenceException("", "H5Rdereference failed"); - } - - // No failure, set id to the object - return(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. -///\param obj - IN: Object specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Object::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(obj.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Object::dereference - located by object", E.getDetailMsg()); - } - p_setId(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. -///\param h5file - IN: HDF5 file specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Object::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(h5file.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Object::dereference - located by file", E.getDetailMsg()); - } - p_setId(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::dereference -///\brief Dereferences a reference into an HDF5 object, given an attribute. -///\param attr - IN: Attribute specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Object::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(attr.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Object::dereference - located by attribute", E.getDetailMsg()); - } - p_setId(temp_id); -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5Object::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. -// Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_LINK Object is a symbolic link. -// H5G_GROUP Object is a group. -// H5G_DATASET Object is a dataset. -// H5G_TYPE Object is a named datatype -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t H5Object::p_get_obj_type(void *ref, H5R_type_t ref_type) const -{ - H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref); - - if (obj_type == H5G_UNKNOWN) - { - throw IdComponentException("", "H5Rget_obj_type failed"); - } - return(obj_type); -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - -//-------------------------------------------------------------------------- -// Function: H5Object::p_get_region (protected) -// Purpose Retrieves a dataspace with the region pointed to selected. -// Parameters -// ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -// ref - IN: Reference to get region of -// Return Dataspace id -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -hid_t H5Object::p_get_region(void *ref, H5R_type_t ref_type) const -{ - hid_t space_id = H5Rget_region(getId(), ref_type, ref); - if (space_id < 0) - { - throw IdComponentException("", "H5Rget_region failed"); - } - return(space_id); -} - +H5Object::H5Object( const H5Object& original ) : H5Location( original ) {} //-------------------------------------------------------------------------- // Function: H5Object destructor diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 4ac417b..bfd5e6f 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -17,81 +17,29 @@ #ifndef _H5Object_H #define _H5Object_H +#include "H5Location.h" #include "H5Classes.h" // constains forward class declarations // H5Object is a baseclass. It has these subclasses: // Group, DataSet, and DataType. // DataType, in turn, has several specific datatypes as subclasses. +// Modification: +// Sept 18, 2012: Added class H5Location in between IdComponent and +// H5Object. An H5File now inherits from H5Location. All HDF5 +// wrappers in H5Object are moved up to H5Location. H5Object +// is left mostly empty for future wrappers that are only for +// group, dataset, and named datatype. Note that the reason for +// adding H5Location instead of simply moving H5File to be under +// H5Object is H5File is not an HDF5 object, and renaming H5Object +// to H5Location will risk breaking user applications. +// -BMR #ifndef H5_NO_NAMESPACE namespace H5 { #endif -#ifndef DOXYGEN_SHOULD_SKIP_THIS -class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate - -// Define the operator function pointer for H5Aiterate(). -typedef void (*attr_operator_t)( H5Object& loc/*in*/, - const H5std_string attr_name/*in*/, - void *operator_data/*in,out*/); - -class UserData4Aiterate { // user data for attribute iteration - public: - attr_operator_t op; - void* opData; - H5Object* object; -}; -#endif // DOXYGEN_SHOULD_SKIP_THIS - -// The above part is being moved into Iterator, but not completed - -class H5_DLLCPP H5Object : public IdComponent { +class H5_DLLCPP H5Object : public H5Location { public: - // Creates an attribute for a group, dataset, or named datatype. - // PropList is currently not used, so always be default. - Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; - Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; - - // Opens an attribute given its name. - Attribute openAttribute( const char* name ) const; - Attribute openAttribute( const H5std_string& name ) const; - - // Opens an attribute given its index. - Attribute openAttribute( const unsigned int idx ) const; - - // Flushes all buffers associated with this object to disk - void flush( H5F_scope_t scope ) const; - - // Gets the name of the file, in which this HDF5 object belongs. - H5std_string getFileName() const; - - // Determines the number of attributes attached to this object. - int getNumAttrs() const; - - // Iterate user's function over the attributes of this object - int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL ); - - // Removes the named attribute from this object. - void removeAttr( const char* name ) const; - void removeAttr( const H5std_string& name ) const; - - // Renames the attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; - - // Creates a reference to a named Hdf5 object or to a dataset region - // in this object. - void reference(void* ref, const char* name, const DataSpace& dataspace, - H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const char* name) const; - void reference(void* ref, const H5std_string& name) const; - - // Open a referenced HDF5 object whose location is specified by either - // a file, an HDF5 object, or an attribute. - void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - // Copy constructor: makes copy of an H5Object object. H5Object(const H5Object& original); @@ -106,23 +54,6 @@ class H5_DLLCPP H5Object : public IdComponent { // Creates a copy of an existing object giving the object id H5Object( const hid_t object_id ); - // Gets the id of the H5 file in which the given object is located. - hid_t p_get_file_id(); - - // Creates a reference to an HDF5 object or a dataset region. - void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; - - // Dereferences a ref into an hdf5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); - -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - // Retrieves a dataspace with the region pointed to selected. - hid_t p_get_region(void *ref, H5R_type_t ref_type) const; - #endif // DOXYGEN_SHOULD_SKIP_THIS }; /* end class H5Object */ diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 9cb1c65..8a04f0c 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -36,7 +36,7 @@ namespace H5 { class H5_DLLCPP PredType : public AtomType { public: - ///\brief Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("PredType"); } // Makes a copy of the predefined type and stores the new diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 5dfa538..7e47b32 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -94,7 +94,7 @@ class H5_DLLCPP PropList : public IdComponent { void removeProp(const char *name) const; void removeProp(const H5std_string& name) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("PropList"); } // Default constructor: creates a stub PropList object. diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index d4a0016..be9fed8 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -47,7 +47,7 @@ class H5_DLLCPP StrType : public AtomType { // Defines the storage mechanism for character strings. void setStrpad(H5T_str_t strpad) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("StrType"); } // default constructor diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index 91f653e..0cee219 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -30,7 +30,7 @@ class H5_DLLCPP VarLenType : public DataType { // on the specified base type. VarLenType(const DataType* base_type); - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("VarLenType"); } // Copy constructor: makes copy of the original object. diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 6278fa0..ec942fd 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -40,12 +40,12 @@ bin_SCRIPTS=h5c++ # Source files for the library libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp H5Library.cpp \ - H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp \ - H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp \ - H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp \ - H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp \ - H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \ - H5CommonFG.cpp H5Group.cpp H5File.cpp + H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \ + H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \ + H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \ + H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \ + H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp # HDF5 C++ library depends on HDF5 Library. libhdf5_cpp_la_LIBADD=$(LIBHDF5) @@ -55,8 +55,9 @@ include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \ H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \ H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \ H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \ - H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h \ - H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h + H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \ + H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \ + H5VarLenType.h # h5c++ and libhdf5.settings are generated during configure. Remove only when # distclean. diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 56798a7..65aee60 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -121,12 +121,12 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5_cpp_la_DEPENDENCIES = $(LIBHDF5) am_libhdf5_cpp_la_OBJECTS = H5Exception.lo H5IdComponent.lo \ - H5Library.lo H5Attribute.lo H5Object.lo H5PropList.lo \ - H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo H5DxferProp.lo \ - H5DataType.lo H5DataSpace.lo H5AbstractDs.lo H5AtomType.lo \ - H5PredType.lo H5EnumType.lo H5IntType.lo H5FloatType.lo \ - H5StrType.lo H5ArrayType.lo H5VarLenType.lo H5CompType.lo \ - H5DataSet.lo H5CommonFG.lo H5Group.lo H5File.lo + H5Library.lo H5Attribute.lo H5Location.lo H5Object.lo \ + H5PropList.lo H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo \ + H5DxferProp.lo H5DataType.lo H5DataSpace.lo H5AbstractDs.lo \ + H5AtomType.lo H5PredType.lo H5EnumType.lo H5IntType.lo \ + H5FloatType.lo H5StrType.lo H5ArrayType.lo H5VarLenType.lo \ + H5CompType.lo H5DataSet.lo H5CommonFG.lo H5Group.lo H5File.lo libhdf5_cpp_la_OBJECTS = $(am_libhdf5_cpp_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -249,6 +249,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -263,6 +264,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -459,7 +461,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 121 +LT_VERS_REVISION = 122 LT_VERS_AGE = 0 # Include src directory @@ -474,12 +476,12 @@ bin_SCRIPTS = h5c++ # Source files for the library libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp H5Library.cpp \ - H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp \ - H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp \ - H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp \ - H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp \ - H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \ - H5CommonFG.cpp H5Group.cpp H5File.cpp + H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \ + H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \ + H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \ + H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \ + H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp # HDF5 C++ library depends on HDF5 Library. @@ -490,8 +492,9 @@ include_HEADERS = H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \ H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \ H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \ - H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h \ - H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h + H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \ + H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \ + H5VarLenType.h # h5c++ and libhdf5.settings are generated during configure. Remove only when @@ -656,6 +659,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IdComponent.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IntType.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Library.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Location.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Object.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PredType.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PropList.Plo@am__quote@ diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in index 20435eb..e0ee8af 100644 --- a/c++/src/h5c++.in +++ b/c++/src/h5c++.in @@ -100,6 +100,10 @@ CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" LIBS="${HDF5_LIBS:-$LIBSBASE}" +# If static was disabled, @HDF5_USE_SHLIB@ will be yes. In that case +# HDF5_USE_SHLIB should be set to yes because there are no static +# lib files. +HDF5_USE_SHLIB="@HDF5_USE_SHLIB@" USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" usage() { diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 5d2da53..7468473 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -210,6 +210,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -224,6 +225,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 26abace..e822b36 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -61,7 +61,6 @@ const int H5Z_FILTER_BOGUS = 305; static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - /*------------------------------------------------------------------------- * Function: test_create * @@ -179,7 +178,7 @@ test_create( H5File& file) return -1; } } // test_create - + /*------------------------------------------------------------------------- * Function: test_simple_io * @@ -266,7 +265,7 @@ test_simple_io( H5File& file) return -1; } } // test_simple_io - + /*------------------------------------------------------------------------- * Function: test_datasize * @@ -337,7 +336,7 @@ test_datasize() return -1; } } // test_datasize - + /*------------------------------------------------------------------------- * Function: test_tconv * @@ -460,7 +459,6 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, return nbytes; } - /*------------------------------------------------------------------------- * Function: test_compression * @@ -830,7 +828,6 @@ test_multiopen (H5File& file) } } // test_multiopen - /*------------------------------------------------------------------------- * Function: test_types * @@ -1019,7 +1016,7 @@ test_types(H5File& file) return -1; } } // test_types - + /*------------------------------------------------------------------------- * Function: test_dset * diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 4485808..c6a7a2a 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -100,6 +100,7 @@ void issue_fail_msg(const char* where, int line, const char* file_name, { //if (GetTestVerbosity()>=VERBO_HI) { + cerr << endl; cerr << ">>> FAILED in " << where << " at line " << line << " in " << file_name << " - " << message << endl << endl; } diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 6bb9ca0..6f7674d 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -42,8 +42,13 @@ #include "h5cpputil.h" // C++ utilility header file -const H5std_string FILENAME("tattr.h5"); -const H5std_string ATTR_TMP_NAME("temp_name"); +const H5std_string FILE_BASIC("tattr_basic.h5"); +const H5std_string FILE_COMPOUND("tattr_compound.h5"); +const H5std_string FILE_SCALAR("tattr_scalar.h5"); +const H5std_string FILE_MULTI("tattr_multi.h5"); +const H5std_string FILE_DTYPE("tattr_dtype.h5"); +const H5std_string ATTR_TMP_NAME("temp_attr_name"); +const H5std_string FATTR_TMP_NAME("temp_fattr_name"); const size_t ATTR_MAX_DIMS = 7; /* 3-D dataset with fixed dimensions */ @@ -63,6 +68,10 @@ const int ATTR1_RANK = 1; const int ATTR1_DIM1 = 3; int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */ +// File attribute, using the same rank and dimensions as ATTR1_NAME's +const H5std_string FATTR1_NAME("File Attr1"); +const H5std_string FATTR2_NAME("File Attr2"); + const H5std_string ATTR2_NAME("Attr2"); const int ATTR2_RANK = 2; const int ATTR2_DIM1 = 2; @@ -121,7 +130,7 @@ static void test_attr_basic_write() try { // Create file - H5File fid1 (FILENAME, H5F_ACC_TRUNC); + H5File fid1 (FILE_BASIC, H5F_ACC_TRUNC); // Create dataspace for dataset DataSpace ds_space (SPACE1_RANK, dims1); @@ -136,6 +145,12 @@ static void test_attr_basic_write() // Create dataspace for attribute DataSpace att_space (ATTR1_RANK, dims2); + // Create a file attribute + Attribute file_attr2 = fid1.createAttribute (FATTR1_NAME, PredType::NATIVE_INT, att_space); + + // Create a file attribute + Attribute file_attr1 = fid1.createAttribute (FATTR2_NAME, PredType::NATIVE_INT, att_space); + // Create an attribute for the dataset Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); @@ -163,8 +178,9 @@ static void test_attr_basic_write() if(attr_data1[i]!=read_data1[i]) TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); - // Create another attribute for this dataset - Attribute ds_attr2 = dataset.createAttribute (ATTR1A_NAME, PredType::NATIVE_INT, att_space); + // Create two more attributes for this dataset, but only write to one. + Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att_space); + Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_INT, att_space); // Write attribute information ds_attr2.write (PredType::NATIVE_INT, attr_data1a); @@ -180,6 +196,7 @@ static void test_attr_basic_write() // Close both attributes ds_attr1.close(); ds_attr2.close(); + ds_attr3.close(); /* * Test attribute with group @@ -240,14 +257,32 @@ static void test_attr_rename() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); + + // Check rename of attribute belonging to a file + + // Change attribute name + fid1.renameAttr(FATTR1_NAME, FATTR_TMP_NAME); + + // Open attribute again + Attribute fattr1(fid1.openAttribute(FATTR_TMP_NAME)); + + // Verify new attribute name + H5std_string fattr_name = fattr1.getName(); + verify_val(fattr_name, FATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__); + + int num_attrs = fid1.getNumAttrs(); + verify_val(num_attrs, 2, "Attribute::getNumAttrs", __LINE__, __FILE__); + + // Change first file attribute back to the original name + fid1.renameAttr(FATTR_TMP_NAME, FATTR1_NAME); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); - // Check rename + // Check rename of attribute belonging to a dataset - // change attribute name + // Change attribute name dataset.renameAttr(ATTR1_NAME, ATTR_TMP_NAME); // Open attribute again @@ -269,11 +304,11 @@ static void test_attr_rename() attr1.close(); // Open the second attribute - Attribute attr2(dataset.openAttribute(ATTR1A_NAME)); + Attribute attr2(dataset.openAttribute(ATTR2_NAME)); // Verify second attribute name H5std_string attr2_name = attr2.getName(); - verify_val(attr2_name, ATTR1A_NAME, "Attribute::getName", __LINE__, __FILE__); + verify_val(attr2_name, ATTR2_NAME, "Attribute::getName", __LINE__, __FILE__); // Read attribute information immediately, without closing attribute attr2.read (PredType::NATIVE_INT, read_data1); @@ -311,14 +346,14 @@ static void test_attr_basic_read() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open an attribute for the dataset Attribute ds_attr=dataset.openAttribute(ATTR1_NAME); @@ -378,7 +413,7 @@ static void test_attr_compound_write() try { // Create file - H5File fid1(FILENAME.c_str(), H5F_ACC_TRUNC); + H5File fid1(FILE_COMPOUND.c_str(), H5F_ACC_TRUNC); // Create dataspace for dataset hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -442,14 +477,14 @@ static void test_attr_compound_read() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_COMPOUND, H5F_ACC_RDWR); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); @@ -571,7 +606,7 @@ static void test_attr_scalar_write() try { // Create file - H5File fid1(FILENAME, H5F_ACC_TRUNC); + H5File fid1(FILE_SCALAR, H5F_ACC_TRUNC); // Create dataspace for dataset hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -625,14 +660,14 @@ static void test_attr_scalar_read() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_SCALAR, H5F_ACC_RDWR); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open an attribute for the dataset Attribute ds_attr=dataset.openAttribute(ATTR5_NAME); @@ -669,7 +704,7 @@ static void test_attr_mult_write() try { // Create file - H5File fid1 (FILENAME, H5F_ACC_TRUNC); + H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC); // Create dataspace for dataset hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -746,14 +781,14 @@ static void test_attr_mult_read() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_MULTI, H5F_ACC_RDWR); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); @@ -929,22 +964,42 @@ static void test_attr_mult_read() static void test_attr_delete() { H5std_string attr_name; // Buffer for attribute names + int ii; - // Output message about test being performed + // Output message about test being performed SUBTEST("Removing Attribute Function"); try { - // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + // Open file. + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); + + // Get the number of file attributes + int num_attrs = fid1.getNumAttrs(); + verify_val(num_attrs, 2, "H5File::getNumAttrs", __LINE__, __FILE__); + + // Delete the second file attribute + fid1.removeAttr(FATTR2_NAME); + + // Get the number of file attributes + num_attrs = fid1.getNumAttrs(); + verify_val(num_attrs, 1, "H5File::getNumAttrs", __LINE__, __FILE__); + + // Verify the name of the only file attribute left + Attribute fattr = fid1.openAttribute((uint)0); + H5std_string attr_name = fattr.getName(); + verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__); + fattr.close(); + + // Test deleting non-existing attribute // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes - int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); - // Try to delete bogus attribute, should fail. + // Try to delete bogus attribute, should fail try { dataset.removeAttr("Bogus"); @@ -954,16 +1009,18 @@ static void test_attr_delete() catch (AttributeIException E) // catching invalid removing attribute {} // do nothing, exception expected + // Test deleting dataset's attributes + // Verify the correct number of attributes num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Delete middle (2nd) attribute dataset.removeAttr(ATTR2_NAME); // Verify the correct number of attributes num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 2, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); @@ -989,9 +1046,9 @@ static void test_attr_delete() // Verify the correct number of attributes num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); - // Open last (formally 3rd) attribute for the dataset + // Open the only attribute for the dataset (formally 3rd) attr = dataset.openAttribute((unsigned)0); // Verify Name @@ -1005,7 +1062,7 @@ static void test_attr_delete() // Verify the correct number of attributes num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 0, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 0, "DataSet::getNumAttrs", __LINE__, __FILE__); PASSED(); } // end try block @@ -1035,19 +1092,19 @@ static void test_attr_dtype_shared() try { // Create a file - H5File fid1(FILENAME, H5F_ACC_TRUNC); + H5File fid1(FILE_DTYPE, H5F_ACC_TRUNC); // Close file fid1.close(); // Get size of file h5_stat_size_t empty_filesize; // Size of empty file - empty_filesize = h5_get_file_size(FILENAME.c_str(), H5P_DEFAULT); + empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); // Open the file again - fid1.openFile(FILENAME, H5F_ACC_RDWR); + fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR); // Enclosing to work around the issue of unused variables and/or // objects created by copy constructors stay around until end of @@ -1120,7 +1177,7 @@ static void test_attr_dtype_shared() fid1.close(); // Open the file again - fid1.openFile(FILENAME, H5F_ACC_RDWR); + fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR); { // Second enclosed block... @@ -1161,7 +1218,7 @@ static void test_attr_dtype_shared() fid1.close(); // Check size of file - filesize = h5_get_file_size(FILENAME.c_str(), H5P_DEFAULT); + filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__); PASSED(); @@ -1192,7 +1249,7 @@ static void test_string_attr() try { // Create file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); // // Fixed-lenth string attributes @@ -1349,6 +1406,6 @@ extern "C" #endif void cleanup_attr() { - HDremove(FILENAME.c_str()); + //HDremove(FILENAME.c_str()); } diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index df01752..ba38d7a 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -333,6 +333,7 @@ static void test_file_open() tmpl1.getSymk( iparm1, iparm2); verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + PASSED(); } // end of try block @@ -381,8 +382,16 @@ static void test_file_size() hsize_t file_size = file4.getFileSize(); // Check if file size is reasonable. It's supposed to be 2KB now. - if(file_size<1*KB || file_size>4*KB) - issue_fail_msg("test_file_size()", __LINE__, __FILE__); + if (file_size < 1*KB || file_size > 4*KB) + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFileSize() returned unreasonable value"); + + // Get the amount of free space in the file + hssize_t free_space = file4.getFreeSpace(); + + // Check if it's reasonable. It's 0 now. + if (free_space < 0 || free_space > 4*KB) + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value"); + PASSED(); } // end of try block @@ -415,7 +424,8 @@ const int NX = 4; const int NY = 5; const H5std_string GROUPNAME ("group"); const H5std_string DSETNAME ("dataset"); -const H5std_string ATTRNAME ("attribute"); +const H5std_string DATTRNAME ("dataset attribute"); +const H5std_string FATTRNAME ("file attribute"); const H5std_string DTYPENAME ("compound"); // Compound datatype @@ -431,17 +441,17 @@ static void test_file_name() H5std_string file_name; try { - // Create a file using default properties. + // Create a file using default properties H5File file4(FILE4, H5F_ACC_TRUNC); - // Get file name from the file instance. + // Get file name from the file instance file_name = file4.getFileName(); verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__); // Create a group in the root group Group group(file4.createGroup(GROUPNAME, 0)); - // Get and verify file name + // Get and verify file name via a group file_name = group.getFileName(); verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__); @@ -452,12 +462,12 @@ static void test_file_name() // Create a new dataset DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); - // Get and verify file name + // Get and verify file name via a dataset file_name = dataset.getFileName(); verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); // Create an attribute for the dataset - Attribute attr(dataset.createAttribute(ATTRNAME, PredType::NATIVE_INT, space)); + Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); // Get and verify file name file_name = attr.getFileName(); @@ -486,6 +496,116 @@ static void test_file_name() } // test_file_name() +#define NUM_OBJS 4 +#define NUM_ATTRS 3 +const int RANK1 = 1; +const int ATTR1_DIM1 = 3; +const H5std_string FILE5("tfattrs.h5"); +const H5std_string FATTR1_NAME ("file attribute 1"); +const H5std_string FATTR2_NAME ("file attribute 2"); +int fattr_data[ATTR1_DIM1]={512,-234,98123}; /* Test data for file attribute */ +int dattr_data[ATTR1_DIM1]={256,-123,1000}; /* Test data for dataset attribute */ +static void test_file_attribute() +{ + int rdata[ATTR1_DIM1]; + int i; + + // Output message about test being performed + SUBTEST("File Attribute"); + + H5std_string file_name; + try { + // Create a file using default properties. + H5File file5(FILE5, H5F_ACC_TRUNC); + + // Create the data space + hsize_t dims[RANK1] = {ATTR1_DIM1}; + DataSpace space(RANK1, dims); + + // Create two attributes for the file + Attribute fattr1(file5.createAttribute(FATTR1_NAME, PredType::NATIVE_FLOAT, space)); + Attribute fattr2(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space)); + + fattr2.write(PredType::NATIVE_INT, fattr_data); + + try { + // Try to create the same attribute again (should fail) + Attribute fattr_dup(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space)); + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File createAttribute", "Attempted to create an existing attribute."); + } + catch( AttributeIException E ) // catch creating existing attribute + {} // do nothing, FAIL expected + + // Create a new dataset + DataSet dataset(file5.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); + + // Create an attribute for the dataset + Attribute dattr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); + + // Write data to the second file attribute + dattr.write(PredType::NATIVE_INT, dattr_data); + + // Test flushing out the data from the attribute object + dattr.flush(H5F_SCOPE_GLOBAL); + + // Get and verify the number of all objects in the file + // Current: 1 file, 2 file attr, 1 ds, and 1 ds attr. + ssize_t num_objs = file5.getObjCount(H5F_OBJ_ALL); + verify_val(num_objs, 5, "H5File::getObjCount", __LINE__, __FILE__); + + num_objs = file5.getObjCount(H5F_OBJ_GROUP); + verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_GROUP)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_DATASET); + verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_DATASET)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_ATTR); + verify_val(num_objs, 3, "H5File::getObjCount(H5F_OBJ_ATTR)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_DATATYPE); + verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_DATATYPE)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_FILE); + verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_FILE)", __LINE__, __FILE__); + + // Get the file name using the attributes + H5std_string fname = fattr1.getFileName(); + verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); + + fname.clear(); + fname = dattr.getFileName(); + verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); + + // Get the class of a file attribute's datatype + H5T_class_t atclass = fattr1.getTypeClass(); + verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__); + + // Get and verify the number of attributes attached to a file + int n_attrs = file5.getNumAttrs(); + verify_val(n_attrs, 2, "H5File::getNumAttrs()", __LINE__, __FILE__); + + // Get and verify the number of attributes attached to a dataset + n_attrs = 0; + n_attrs = dataset.getNumAttrs(); + verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__); + + // Read back attribute's data + HDmemset(rdata, 0, sizeof(rdata)); + dattr.read(PredType::NATIVE_INT, rdata); + /* Check results */ + for (i = 0; i < ATTR1_DIM1; i++) { + if (rdata[i] != dattr_data[i]) { + H5_FAILED(); + cerr << endl; + cerr << "element [" << i << "] is " << rdata[i] << + "but should have been " << dattr_data[i] << endl; + } + } + PASSED(); + } // end of try block + + catch (Exception E) { + issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg()); + } +} // test_file_attribute() + /*------------------------------------------------------------------------- * Function: test_file * @@ -513,6 +633,7 @@ void test_file() test_file_open(); // Test file opening test_file_size(); // Test file size test_file_name(); // Test getting file's name + test_file_attribute(); // Test file attribute feature } // test_file() diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 221a61b..32c40d5 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -188,7 +188,7 @@ static void test_h5s_basic() * If this test fails and the H5S_MAX_RANK variable has changed, follow * the instructions in space_overflow.c for regenating the th5s.h5 file. */ - const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str()); + const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str()); // Create file H5File fid1(testfile, H5F_ACC_RDONLY); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 7f63d33..4eb5b21 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -149,34 +149,25 @@ static void test_reference_obj(void) // Create a dataset dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); - // Create reference to dataset + // Create reference to dataset and test getRefObjType file1->reference(&wbuf[0], "/Group1/Dataset1"); + H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); -#ifndef H5_NO_DEPRECATED_SYMBOLS - H5G_obj_t obj_type = dataset.getObjType(&wbuf[0], H5R_OBJECT); - verify_val(obj_type, H5G_DATASET, "DataSet::getObjType", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - // Create reference to dataset + // Create reference to dataset and test getRefObjType file1->reference(&wbuf[1], "/Group1/Dataset2"); -#ifndef H5_NO_DEPRECATED_SYMBOLS - obj_type = dataset.getObjType(&wbuf[1], H5R_OBJECT); - verify_val(obj_type, H5G_DATASET, "DataSet::getObjType", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); // Create reference to group file1->reference(&wbuf[2], "/Group1"); -#ifndef H5_NO_DEPRECATED_SYMBOLS - obj_type = dataset.getObjType(&wbuf[2], H5R_OBJECT); - verify_val(obj_type, H5G_GROUP, "DataSet::getObjType", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType", __LINE__, __FILE__); // Create reference to named datatype file1->reference(&wbuf[3], "/Group1/Datatype1"); -#ifndef H5_NO_DEPRECATED_SYMBOLS - obj_type = dataset.getObjType(&wbuf[3], H5R_OBJECT); - verify_val(obj_type, H5G_TYPE, "DataSet::getObjType", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType", __LINE__, __FILE__); // Write selection to disk dataset.write(wbuf, PredType::STD_REF_OBJ); @@ -253,7 +244,7 @@ static void test_reference_obj(void) // Test getting the type of objects // Test getObjTypeByIdx(hsize_t idx) - obj_type = group.getObjTypeByIdx(0); + H5G_obj_t obj_type = group.getObjTypeByIdx(0); verify_val(obj_type, H5G_DATASET, "Group::getObjTypeByIdx(index)", __LINE__, __FILE__); // Test getObjTypeByIdx(hsize_t idx, char* type_name) @@ -333,6 +324,18 @@ static void test_reference_obj(void) /**************************************************************** ** +** test_reference_compat(): Test basic object reference functionality. +** Tests references to various kinds of objects using deprecated API. +** +****************************************************************/ +static void test_reference_compat(void) +{ + // Not yet +} // test_reference_compat() + + +/**************************************************************** +** ** test_reference(): Main reference testing routine. ** ****************************************************************/ @@ -346,6 +349,7 @@ void test_reference(void) MESSAGE(5, ("Testing References\n")); test_reference_obj(); // Test basic object reference functionality + test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() diff --git a/config/ibm-aix b/config/ibm-aix index c8b1fc3..28498e2 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -56,12 +56,12 @@ fi # to ensure the flag is present for both configure as well as for the build. if test "X-" = "X-$f9x_flags_set"; then F9XSUFFIXFLAG="-qsuffix=f=f90" - FCFLAGS="$FCFLAGS -O ${F9XSUFFIXFLAG}" - H5_FCFLAGS="$H5_FCFLAGS -O ${F9XSUFFIXFLAG}" + FCFLAGS="$FCFLAGS ${F9XSUFFIXFLAG}" + H5_FCFLAGS="$H5_FCFLAGS ${F9XSUFFIXFLAG}" FSEARCH_DIRS="-I./ -I../src" - DEBUG_FCFLAGS="-O" + DEBUG_FCFLAGS="-g" PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-O" + PROFILE_FCFLAGS="-g -pg" f9x_flags_set=yes fi diff --git a/config/lt_vers.am b/config/lt_vers.am index 9abc39d..53af6ed 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 121 +LT_VERS_REVISION = 122 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.131. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.132. # # Report bugs to <help@hdfgroup.org>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.131' -PACKAGE_STRING='HDF5 1.9.131' +PACKAGE_VERSION='1.9.132' +PACKAGE_STRING='HDF5 1.9.132' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -771,6 +771,8 @@ ac_ct_CC LDFLAGS CFLAGS CC +HDF5_USE_SHLIB +H5BLD_STATIC UNAME_INFO enable_static enable_shared @@ -1484,7 +1486,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.131 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.132 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1554,7 +1556,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.131:";; + short | recursive ) echo "Configuration of HDF5 1.9.132:";; esac cat <<\_ACEOF @@ -1750,7 +1752,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.131 +HDF5 configure 1.9.132 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2844,7 +2846,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.131, which was +It was created by HDF5 $as_me 1.9.132, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3676,7 +3678,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.131' + VERSION='1.9.132' cat >>confdefs.h <<_ACEOF @@ -3997,6 +3999,13 @@ $as_echo "done" >&6; } UNAME_INFO=`uname -a` +## Define symbol variables to allow h5cc.in and its companions to determine +## whether static libraries are built or not. When they are not built, the +## compile scripts should use shared libraries by default + + H5BLD_STATIC=yes + + ## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check ## that it actually does what it's supposed to do. Catch this early @@ -31084,6 +31093,14 @@ fi ## Build the Makefiles. ## +## If $enable_static = "no", set HDF5_USE_SHLIB to "yes" so that the compile +## scripts will default to use shared libraries instead of defaulting to +## use static libraries. Otherwise they fail because the static libraries +## don't exist. +if test "X$enable_static" = "Xno"; then + HDF5_USE_SHLIB="yes" +fi + ## The directory search list SEARCH='$(srcdir) $(top_builddir)/src $(top_srcdir)/src' cmd='echo $SEARCH |sed "s/ /'$SEARCH_SEP'/g"' @@ -31715,7 +31732,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.131, which was +This file was extended by HDF5 $as_me 1.9.132, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31781,7 +31798,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.131 +HDF5 config.status 1.9.132 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -34554,7 +34571,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -HDF5 config.lt 1.9.131 +HDF5 config.lt 1.9.132 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. diff --git a/configure.ac b/configure.ac index 7f75326..96d04f2 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.131], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.132], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) @@ -194,6 +194,13 @@ AC_SUBST([enable_shared]) AC_SUBST([enable_static]) AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a` +## Define symbol variables to allow h5cc.in and its companions to determine +## whether static libraries are built or not. When they are not built, the +## compile scripts should use shared libraries by default + +AC_SUBST([H5BLD_STATIC]) H5BLD_STATIC=yes +AC_SUBST([HDF5_USE_SHLIB]) + ## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check ## that it actually does what it's supposed to do. Catch this early @@ -4369,6 +4376,14 @@ AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"]) ## Build the Makefiles. ## +## If $enable_static = "no", set HDF5_USE_SHLIB to "yes" so that the compile +## scripts will default to use shared libraries instead of defaulting to +## use static libraries. Otherwise they fail because the static libraries +## don't exist. +if test "X$enable_static" = "Xno"; then + HDF5_USE_SHLIB="yes" +fi + ## The directory search list AC_SUBST([SEARCH]) SEARCH='$(srcdir) $(top_builddir)/src $(top_srcdir)/src' cmd='echo $SEARCH |sed "s/ /'$SEARCH_SEP'/g"' diff --git a/examples/Makefile.in b/examples/Makefile.in index fc0f541..fa42f22 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -177,6 +177,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -191,6 +192,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/fortran/Makefile.in b/fortran/Makefile.in index c4597cc..9923f85 100644 --- a/fortran/Makefile.in +++ b/fortran/Makefile.in @@ -214,6 +214,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -228,6 +229,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index d19d231..e38919e 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -185,6 +185,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -199,6 +200,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/fortran/src/H5FDmpiof.c b/fortran/src/H5FDmpiof.c index 89b4180..993b5ac 100644 --- a/fortran/src/H5FDmpiof.c +++ b/fortran/src/H5FDmpiof.c @@ -300,3 +300,40 @@ nh5pget_fapl_mpiposix_c(hid_t_f *prp_id, int_f* comm, int_f* flag) ret_value = 0; return ret_value; } + +/****if* H5Pf/h5pget_mpio_actual_io_mode_c + * NAME + * h5pget_mpio_actual_io_mode_c + * PURPOSE + * Calls H5Pget_mpio_actual_io_mode + * + * INPUTS + * dxpl_id - Dataset transfer property list identifier. + * OUTPUTS + * actual_io_mode - The type of I/O performed by this process. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * July 27, 2012 + * SOURCE +*/ +int_f +nh5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode) +/******/ +{ + int ret_value = -1; + H5D_mpio_actual_io_mode_t c_actual_io_mode; + + /* + * Call H5Pget_mpio_actual_io_mode_f function. + */ + if( (H5Pget_mpio_actual_io_mode((hid_t)*dxpl_id, &c_actual_io_mode)) <0 ) + return ret_value; /* error occurred */ + + *actual_io_mode =(int_f)c_actual_io_mode; + + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5FDmpioff.f90 b/fortran/src/H5FDmpioff.f90 index ea9283c..f6f3108 100644 --- a/fortran/src/H5FDmpioff.f90 +++ b/fortran/src/H5FDmpioff.f90 @@ -234,4 +234,49 @@ CONTAINS IF (flag .EQ. 1) use_gpfs = .TRUE. END SUBROUTINE h5pget_fapl_mpiposix_f + +!****s* H5P/h5pget_mpio_actual_io_mode_f +! NAME +! h5pget_mpio_actual_io_mode_f +! +! PURPOSE +! Retrieves the type of I/O that HDF5 actually performed on the last +! parallel I/O call. This is not necessarily the type of I/O requested. +! +! INPUTS +! dxpl_id - Dataset transfer property list identifier. +! OUTPUTS +! actual_io_mode - The type of I/O performed by this process. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! July 27, 2012 +! +! HISTORY +! +! Fortran90 Interface: + SUBROUTINE h5pget_mpio_actual_io_mode_f(dxpl_id, actual_io_mode, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dxpl_id + INTEGER , INTENT(OUT) :: actual_io_mode + INTEGER , INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER FUNCTION h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5PGET_MPIO_ACTUAL_IO_MODE_C'::h5pget_mpio_actual_io_mode_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dxpl_id + INTEGER , INTENT(OUT) :: actual_io_mode + END FUNCTION h5pget_mpio_actual_io_mode_c + END INTERFACE + + actual_io_mode = -1 + + hdferr = h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode) + + END SUBROUTINE h5pget_mpio_actual_io_mode_f + END MODULE H5FDMPIO diff --git a/fortran/src/H5Gff.f90 b/fortran/src/H5Gff.f90 index 6bcee7c..155185a 100644 --- a/fortran/src/H5Gff.f90 +++ b/fortran/src/H5Gff.f90 @@ -927,7 +927,7 @@ CONTAINS ! Buffer to hold a comment INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Lenghth of the current_name string + INTEGER :: namelen ! Length of the current_name string INTERFACE INTEGER FUNCTION h5gget_comment_c(loc_id, name, namelen, size, buffer) diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 531f09c..8e75989 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -24,6 +24,83 @@ #include "H5f90.h" #include "H5Eprivate.h" +int_f +fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { + + struct tm *ts; + + object_info->fileno = Oinfo.fileno; + object_info->addr = (haddr_t_f)Oinfo.addr; + + object_info->type = (int_f)Oinfo.type; + object_info->rc = (int_f)Oinfo.rc; + + ts = HDgmtime(&Oinfo.atime); + + object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->atime[2] = (int_f)ts->tm_mday; + object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->atime[4] = (int_f)ts->tm_hour; + object_info->atime[5] = (int_f)ts->tm_min; + object_info->atime[6] = (int_f)ts->tm_sec; + object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.btime); + + object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->btime[2] = (int_f)ts->tm_mday; + object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->btime[4] = (int_f)ts->tm_hour; + object_info->btime[5] = (int_f)ts->tm_min; + object_info->btime[6] = (int_f)ts->tm_sec; + object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.ctime); + + object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->ctime[2] = (int_f)ts->tm_mday; + object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->ctime[4] = (int_f)ts->tm_hour; + object_info->ctime[5] = (int_f)ts->tm_min; + object_info->ctime[6] = (int_f)ts->tm_sec; + object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.mtime); + + object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->mtime[2] = (int_f)ts->tm_mday; + object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->mtime[4] = (int_f)ts->tm_hour; + object_info->mtime[5] = (int_f)ts->tm_min; + object_info->mtime[6] = (int_f)ts->tm_sec; + object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs; + + object_info->hdr.version = (int_f)Oinfo.hdr.version; + object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs; + object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks; + object_info->hdr.flags = (int_f)Oinfo.hdr.flags; + + object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total; + object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta; + object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg; + object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free; + + object_info->hdr.mesg.present = Oinfo.hdr.mesg.present; + object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared; + + object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; + object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; + + return 0; + +} + /****if* H5Of/h5olink_c * NAME * h5olink_c @@ -215,7 +292,7 @@ nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) return ret_value; } -/* ***if* H5Of/H5Oget_info_by_name_c +/****if* H5Of/H5Oget_info_by_name_c * NAME * H5Oget_info_by_name_c * PURPOSE @@ -226,10 +303,7 @@ nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) * namelen - Name length. * lapl_id - Link access property list. * OUTPUTS - * corder_valid - Indicates whether the the creation order data is valid for this attribute. - * corder - Is a positive integer containing the creation order of the attribute. - * cset - Indicates the character set used for the attribute’s name. - * data_size - indicates the size, in the number of characters, of the attribute. + * object_info - Buffer in which to return object information. * * RETURNS * 0 on success, -1 on failure @@ -261,74 +335,100 @@ nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f * &Oinfo, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); - object_info->fileno = Oinfo.fileno; - object_info->addr = (haddr_t_f)Oinfo.addr; - - - object_info->type = (int_f)Oinfo.type; - object_info->rc = (int_f)Oinfo.rc; - - ts = HDgmtime(&Oinfo.atime); - - object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->atime[2] = (int_f)ts->tm_mday; - object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ - object_info->atime[4] = (int_f)ts->tm_hour; - object_info->atime[5] = (int_f)ts->tm_min; - object_info->atime[6] = (int_f)ts->tm_sec; - object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ - - ts = HDgmtime(&Oinfo.btime); - - object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->btime[2] = (int_f)ts->tm_mday; - object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ - object_info->btime[4] = (int_f)ts->tm_hour; - object_info->btime[5] = (int_f)ts->tm_min; - object_info->btime[6] = (int_f)ts->tm_sec; - object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + ret_value = fill_h5o_info_t_f(Oinfo,object_info); - ts = HDgmtime(&Oinfo.ctime); - - object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->ctime[2] = (int_f)ts->tm_mday; - object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ - object_info->ctime[4] = (int_f)ts->tm_hour; - object_info->ctime[5] = (int_f)ts->tm_min; - object_info->ctime[6] = (int_f)ts->tm_sec; - object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + done: + if(c_name) + HDfree(c_name); + return ret_value; +} - ts = HDgmtime(&Oinfo.mtime); +/****if* H5Of/H5Oget_info_by_idx_c + * NAME + * H5Oget_info_by_idx_c + * PURPOSE + * Calls H5Oget_info_by_idx + * INPUTS + * loc_id - File or group identifier specifying location of group in which object is located. + * name - Name of group, relative to loc_id. + * namelen - Name length. + * lapl_id - Link access property list. + * OUTPUTS + * object_info - Buffer in which to return object information. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * December 1, 2008 + * SOURCE +*/ +int_f +nh5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, + int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info) +/******/ +{ + char *c_group_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + H5O_info_t Oinfo; + H5_index_t c_index_field; + H5_iter_order_t c_order; + + /* + * Convert FORTRAN name to C name + */ + if((c_group_name = HD5f2cstring( group_name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); - object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->mtime[2] = (int_f)ts->tm_mday; - object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ - object_info->mtime[4] = (int_f)ts->tm_hour; - object_info->mtime[5] = (int_f)ts->tm_min; - object_info->mtime[6] = (int_f)ts->tm_sec; - object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + c_index_field = (H5_index_t)*index_field; + c_order = (H5_iter_order_t)*order; - object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs; + /* + * Call H5Oinfo_by_idx function. + */ + if(H5Oget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + &Oinfo, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL); - object_info->hdr.version = (int_f)Oinfo.hdr.version; - object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs; - object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks; - object_info->hdr.flags = (int_f)Oinfo.hdr.flags; + ret_value = fill_h5o_info_t_f(Oinfo,object_info); - object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total; - object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta; - object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg; - object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free; + done: + if(c_group_name) + HDfree(c_group_name); + return ret_value; +} - object_info->hdr.mesg.present = Oinfo.hdr.mesg.present; - object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared; +/****if* H5Of/H5Oget_info_c + * NAME + * H5Oget_info_c + * PURPOSE + * Calls H5Oget_info + * INPUTS + * object_id - Identifier for target object. + * OUTPUTS + * object_info - Buffer in which to return object information. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) +/******/ +{ + int_f ret_value = 0; /* Return value */ + H5O_info_t Oinfo; + + /* + * Call H5Oinfo_by_name function. + */ + if(H5Oget_info((hid_t)*object_id, &Oinfo) < 0) + HGOTO_DONE(FAIL); - object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; - object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; + ret_value = fill_h5o_info_t_f(Oinfo,object_info); done: return ret_value; @@ -391,3 +491,428 @@ nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, return ret_value; } + +/****if* H5Of/h5ovisit_by_name_c + * NAME + * h5ovisit_by_name_c + * PURPOSE + * Calls H5Ovisit_by_name + * INPUTS + * object_id - Identifier specifying subject group + * index_type - Type of index which determines the order + * order - Order within index + * idx - Iteration position at which to start + * op - Callback function passing data regarding the link to the calling application + * op_data - User-defined pointer to data required by the application for its processing of the link + * + * OUTPUTS + * idx - Position at which an interrupted iteration may be restarted + * + * RETURNS + * >0 on success, 0< on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, + H5O_iterate_t op, void *op_data, hid_t_f *lapl_id ) +/******/ +{ + int_f ret_value = -1; /* Return value */ + herr_t func_ret_value; /* H5Linterate return value */ + char *c_object_name = NULL; /* Buffer to hold C string */ + + + /* + * Convert FORTRAN name to C name + */ + if( (c_object_name = HD5f2cstring(object_name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Ovisit + */ + func_ret_value = H5Ovisit_by_name( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, + op, op_data, (hid_t)*lapl_id); + ret_value = (int_f)func_ret_value; + + done: + if(c_object_name) + HDfree(c_object_name); + return ret_value; + +} + +/****if* H5Of/h5odecr_refcount_c + * NAME + * h5odecr_refcount_c + * PURPOSE + * Calls H5Odecr_refcount + * INPUTS + * object_id - Object identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5odecr_refcount_c (hid_t_f *object_id) +/******/ +{ + int_f ret_value = 0; /* Return value */ + + /* + * Call H5Odecr_refcount function. + */ + if((hid_t_f)H5Odecr_refcount((hid_t)*object_id) < 0) + HGOTO_DONE(FAIL); + + done: + return ret_value; +} + +/****if* H5Of/h5oexists_by_name_c + * NAME + * h5oexists_by_name_c + * PURPOSE + * Calls H5Oexists_by_name + * INPUTS + * loc_id - File or group identifier + * name - Attribute access property list + * namelen - Size of name + * lapl_id - Link access property list + * + * RETURNS + * link status: 0 = false, 1 = true, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id) +/******/ +{ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + htri_t status = 0; + + /* + * Convert FORTRAN name to C name + */ + if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oopen function. + */ + if((ret_value = (int_f)H5Oexists_by_name((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_name) + HDfree(c_name); + return ret_value; +} + +/****if* H5Of/h5oincr_refcount_c + * NAME + * h5oincr_refcount_c + * PURPOSE + * Calls H5Oincr_refcount + * INPUTS + * object_id - Object identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5oincr_refcount_c (hid_t_f *object_id) +/******/ +{ + int_f ret_value = 0; /* Return value */ + + /* + * Call H5Oincr_refcount function. + */ + if((hid_t_f)H5Oincr_refcount((hid_t)*object_id) < 0) + HGOTO_DONE(FAIL); + + done: + return ret_value; +} + +/****if* H5Of/h5oset_comment_c + * NAME + * h5oset_comment_c + * PURPOSE + * Calls H5Oset_comment + * INPUTS + * object_id - Identifier of the target object. + * comment - The new comment. + * commentlen - Length of the comment. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + + /* + * Convert FORTRAN string to C string + */ + if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oset_comment function. + */ + if((hid_t_f)H5Oset_comment((hid_t)*object_id, c_comment) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_comment) + HDfree(c_comment); + return ret_value; +} + +/****if* H5Of/h5oset_comment_by_name_c + * NAME + * h5oset_comment_by_name_c + * PURPOSE + * Calls H5Oset_comment_by_name + * INPUTS + * object_id - Identifier of the target object. + * name - Name of the object whose comment is to be set or reset, + * specified as a path relative to loc_id. + * namelen - Length of the name. + * comment - The new comment. + * commentlen - Length of the comment. + * lapl_id - Link access property list identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + + /* + * Convert FORTRAN string to C string + */ + if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL) + HGOTO_DONE(FAIL); + /* + * Convert FORTRAN string to C string + */ + if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oset_comment_by_name function. + */ + if((hid_t_f)H5Oset_comment_by_name((hid_t)*object_id, c_name, c_comment, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_name) + HDfree(c_name); + if(c_comment) + HDfree(c_comment); + return ret_value; +} +/****if* H5Of/h5oopen_by_idx_c + * NAME + * h5oopen_by_idx_c + * PURPOSE + * Calls H5Oopen_by_idx_c + * INPUTS + * loc_id - A file or group identifier. + * group_name - Name of group, relative to loc_id, in which object is located. + * group_namelen - Length of group_name + * index_type - Type of index by which objects are ordered. + * order - Order of iteration within index. + * n - Object to open. + * lapl_id - Link access property list. + * OUTPUTS + * obj_id - An object identifier for the opened object. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, + int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id) +/******/ +{ + char *c_group_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; + H5_index_t c_index_type; + H5_iter_order_t c_order; + + /* + * Convert FORTRAN string to C string + */ + if((c_group_name = HD5f2cstring( group_name, (size_t)*group_namelen)) == NULL) + HGOTO_DONE(FAIL); + + c_index_type = (H5_index_t)*index_type; + c_order = (H5_iter_order_t)*order; + + /* + * Call H5Oopen_by_idx function. + */ + if((*obj_id =(hid_t_f)H5Oopen_by_idx((hid_t)*loc_id, c_group_name, c_index_type, c_order, (hsize_t)*n, (hid_t)*lapl_id)) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_group_name) + HDfree(c_group_name); + return ret_value; +} + +/****if* H5Of/h5oget_comment_c + * NAME + * h5oget_comment_c + * PURPOSE + * Calls H5Oget_comment + * INPUTS + * object_id - Identifier for the target object. + * bufsize - Anticipated required size of the comment buffer. + * OUTPUTS + * comment - The comment. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * June 24, 2012 + * SOURCE +*/ +int_f +nh5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + size_t c_commentsize; + + c_commentsize = (size_t)*commentsize + 1; + + /* + * Allocate buffer to hold comment name + */ + + if(NULL == (c_comment = (char *)HDmalloc(c_commentsize))) + HGOTO_DONE(FAIL); + + /* + * Call H5Oget_comment function. + */ + + if((*bufsize = (hssize_t_f)H5Oget_comment((hid_t)*object_id, c_comment, (size_t)*commentsize)) < 0) + HGOTO_DONE(FAIL); + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + if(c_comment) + HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1); + return ret_value; + + done: + if(c_comment) + HDfree(c_comment); + + return ret_value; +} + +/****if* H5Of/h5oget_comment_by_name_c + * NAME + * h5oget_comment_by_name_c + * PURPOSE + * Calls H5Oget_comment_by_name + * INPUTS + * object_id - Identifier for the target object. + * bufsize - Anticipated required size of the comment buffer. + * OUTPUTS + * comment - The comment. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * July 6, 2012 + * SOURCE +*/ +int_f +nh5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, + _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + size_t c_commentsize; + + /* + * Convert FORTRAN string to C string + */ + if((c_name = HD5f2cstring(name, (size_t)*name_size)) == NULL) + HGOTO_DONE(FAIL); + + c_commentsize = (size_t)*commentsize + 1; + + /* + * Allocate buffer to hold comment name + */ + + if(NULL == (c_comment = (char *)HDmalloc(c_commentsize))) + HGOTO_DONE(FAIL); + + /* + * Call H5Oget_comment_by_name function. + */ + + if((*bufsize = (size_t_f)H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,(hid_t)*lapl_id )) < 0) + HGOTO_DONE(FAIL); + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + if(c_comment) + HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1); + return ret_value; + + done: + if(c_comment) + HDfree(c_comment); + if(c_name) + HDfree(c_name); + + return ret_value; +} diff --git a/fortran/src/H5Off.f90 b/fortran/src/H5Off.f90 index 4f1ea18..ce8c55c 100644 --- a/fortran/src/H5Off.f90 +++ b/fortran/src/H5Off.f90 @@ -119,15 +119,15 @@ CONTAINS ! Opens an object in an HDF5 file by location identifier and path name. ! ! Inputs: -! loc_id - File or group identifier. -! name - Path to the object, relative to loc_id. +! loc_id - File or group identifier. +! name - Path to the object, relative to loc_id. ! ! Outputs: -! obj_id - Object identifier for the opened object. -! hdferr - Returns 0 if successful and -1 if fails. +! obj_id - Object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! lapl_id - Access property list identifier for the link pointing to the object. +! lapl_id - Access property list identifier for the link pointing to the object. ! ! AUTHOR ! M. Scot Breitenfeld @@ -215,12 +215,12 @@ CONTAINS ! Opens an object using its address within an HDF5 file. ! ! Inputs: -! loc_id - File or group identifier. -! addr - Object’s address in the file. +! loc_id - File or group identifier. +! addr - Object’s address in the file. ! ! Outputs: -! obj_id - Object identifier for the opened object. -! hdferr - Returns 0 if successful and -1 if fails. +! obj_id - Object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. ! ! AUTHOR ! M. Scot Breitenfeld @@ -321,5 +321,455 @@ CONTAINS END SUBROUTINE h5ocopy_f +!****s* H5O/h5odecr_refcount_f +! NAME +! h5odecr_refcount_f +! +! PURPOSE +! Decrements an object reference count. +! +! Inputs: +! object_id - Object identifier. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5odecr_refcount_f(object_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: object_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5odecr_refcount_c(object_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5ODECR_REFCOUNT_C'::h5odecr_refcount_c + !DEC$ENDIF + INTEGER(HID_T) , INTENT(IN) :: object_id + END FUNCTION h5odecr_refcount_c + END INTERFACE + + hdferr = h5odecr_refcount_c(object_id) + + END SUBROUTINE h5odecr_refcount_f + +!****s* H5O/h5oexists_by_name_f +! NAME +! h5oexists_by_name_f +! +! PURPOSE +! Determines whether a link resolves to an actual object. +! +! Inputs: +! loc_id - Identifier of the file or group to query. +! name - The name of the link to check. +! +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! Outputs: +! link_exists - Existing link resolves to an object. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oexists_by_name_f(loc_id, name, link_exists, hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + LOGICAL , INTENT(OUT) :: link_exists + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN), OPTIONAL :: lapl_id +!***** + + INTEGER(size_t) :: namelen + INTEGER :: status + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oexists_by_name_c(loc_id, name, namelen, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OEXISTS_BY_NAME_C'::h5oexists_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER(HID_T) , INTENT(IN) :: lapl_id + + END FUNCTION h5oexists_by_name_c + END INTERFACE + + namelen = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + status = h5oexists_by_name_c(loc_id, name, namelen, lapl_id_default) + + link_exists = .FALSE. + IF(status.EQ.1)THEN + link_exists = .TRUE. + ENDIF + + hdferr = 0 + IF(status.LT.0)THEN + hdferr = -1 + ENDIF + + END SUBROUTINE h5oexists_by_name_f + +!****s* H5O/h5oget_comment_f +! NAME +! h5oget_comment_f +! +! PURPOSE +! Retrieves comment for specified object. +! +! Inputs: +! obj_id - Identifier for the target object. +! +! Optional parameters: +! bufsize - Size of the comment buffer. +! +! Outputs: +! comment - The comment. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oget_comment_f(obj_id, comment, hdferr, bufsize) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*) , INTENT(OUT) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HSSIZE_T), INTENT(OUT), OPTIONAL :: bufsize +!***** + + INTEGER(SIZE_T) :: commentsize_default + INTEGER(HSSIZE_T) :: bufsize_default + + INTERFACE + INTEGER FUNCTION h5oget_comment_c(obj_id, comment, commentsize_default, bufsize) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_COMMENT_C'::h5oget_comment_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentsize_default + INTEGER(HSSIZE_T) , INTENT(OUT) :: bufsize + END FUNCTION h5oget_comment_c + END INTERFACE + + commentsize_default = LEN(comment) + + hdferr = h5oget_comment_c(obj_id, comment, commentsize_default, bufsize_default) + + IF(PRESENT(bufsize)) bufsize = bufsize_default + + END SUBROUTINE h5oget_comment_f + +!****s* H5O/h5oget_comment_by_name_f +! NAME +! h5oget_comment_by_name_f +! +! PURPOSE +! Retrieves comment for specified object. +! +! Inputs: +! loc_id - Identifier of a file, group, dataset, or named datatype. +! name - Name of the object whose comment is to be retrieved, +! specified as a path relative to loc_id. +! +! Optional parameters: +! bufsize - Size of the comment buffer. +! +! Outputs: +! comment - The comment. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! July 6, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oget_comment_by_name_f(loc_id, name, comment, hdferr, bufsize, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(SIZE_T) , INTENT(OUT), OPTIONAL :: bufsize + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + + INTEGER(SIZE_T) :: commentsize_default + INTEGER(SIZE_T) :: name_size + INTEGER(SIZE_T) :: bufsize_default + INTEGER(HID_T) :: lapl_id_default + INTERFACE + INTEGER FUNCTION h5oget_comment_by_name_c(loc_id, name, name_size, & + comment, commentsize_default, bufsize_default, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_COMMENT_BY_NAME_C'::h5oget_comment_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment, name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: name_size + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentsize_default + INTEGER(SIZE_T) , INTENT(OUT) :: bufsize_default + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5oget_comment_by_name_c + END INTERFACE + + commentsize_default = LEN(comment) + name_size = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oget_comment_by_name_c(loc_id, name, name_size, & + comment, commentsize_default, bufsize_default, lapl_id_default) + + IF(PRESENT(bufsize)) bufsize = bufsize_default + + END SUBROUTINE h5oget_comment_by_name_f + +!****s* H5O/h5oincr_refcount_f +! NAME +! h5oincr_refcount_f +! +! PURPOSE +! Increments an object reference count. +! +! Inputs: +! obj_id - Object identifier. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oincr_refcount_f(obj_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5oincr_refcount_c(obj_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OINCR_REFCOUNT_C'::h5oincr_refcount_c + !DEC$ENDIF + INTEGER(HID_T) , INTENT(IN) :: obj_id + END FUNCTION h5oincr_refcount_c + END INTERFACE + + hdferr = h5oincr_refcount_c(obj_id) + + END SUBROUTINE h5oincr_refcount_f + +!****s* H5O/h5oopen_by_idx_f +! +! NAME +! h5oopen_by_idx_f +! +! PURPOSE +! Open the nth object in a group. +! +! Inputs: +! loc_id - A file or group identifier. +! group_name - Name of group, relative to loc_id, in which object is located. +! index_type - Type of index by which objects are ordered. +! order - Order of iteration within index, NOTE: zero-based. +! n - Object to open. +! +! Outputs: +! obj_id - An object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list. +! +! AUTHOR +! M. Scot Breitenfeld +! May 17, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oopen_by_idx_f(loc_id, group_name, index_type, order, n, obj_id, & + hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(OUT) :: obj_id + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + INTEGER(SIZE_T) :: group_namelen + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oopen_by_idx_c(loc_id, group_name, group_namelen, index_type, order, n, obj_id, lapl_id_default) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OOPEN_BY_IDX_C'::h5oopen_by_idx_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: group_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER(SIZE_T) , INTENT(IN) :: group_namelen + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(OUT) :: obj_id + INTEGER(HID_T) , INTENT(IN) :: lapl_id_default + + END FUNCTION h5oopen_by_idx_c + END INTERFACE + + group_namelen = LEN(group_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oopen_by_idx_c(loc_id, group_name, group_namelen, index_type, order, n, obj_id, lapl_id_default) + + END SUBROUTINE H5Oopen_by_idx_f + +!****s* H5O/h5oset_comment_f +! NAME +! h5oset_comment_f +! +! PURPOSE +! Sets comment for specified object. +! +! Inputs: +! obj_id - Identifier of the target object. +! comment - The new comment. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oset_comment_f(obj_id, comment, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER , INTENT(OUT) :: hdferr +!***** + INTEGER(SIZE_T) :: commentlen + + INTERFACE + INTEGER FUNCTION h5oset_comment_c(obj_id, comment, commentlen) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OSET_COMMENT_C'::h5oset_comment_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentlen + + END FUNCTION h5oset_comment_c + END INTERFACE + + commentlen = LEN(comment) + + hdferr = h5oset_comment_c(obj_id, comment, commentlen) + + END SUBROUTINE h5oset_comment_f + +!****s* H5O/h5oset_comment_by_name_f +! NAME +! h5oset_comment_by_name_f +! +! PURPOSE +! Sets comment for specified object. +! +! Inputs: +! loc_id - Identifier of a file, group, dataset, or named datatype. +! name - Name of the object whose comment is to be set or reset, +! specified as a path relative to loc_id. +! comment - The new comment. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oset_comment_by_name_f(loc_id, name, comment, hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN), OPTIONAL :: lapl_id +!***** + INTEGER(SIZE_T) :: commentlen + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oset_comment_by_name_c(loc_id, name, namelen, comment, commentlen, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OSET_COMMENT_BY_NAME_C'::h5oset_comment_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name, comment + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentlen + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5oset_comment_by_name_c + END INTERFACE + + commentlen = LEN(comment) + namelen = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oset_comment_by_name_c(loc_id, name, namelen, comment, commentlen, lapl_id_default) + + END SUBROUTINE h5oset_comment_by_name_f + END MODULE H5O diff --git a/fortran/src/H5Off_F03.f90 b/fortran/src/H5Off_F03.f90 index 8eb7a4b..f4ddd3e 100644 --- a/fortran/src/H5Off_F03.f90 +++ b/fortran/src/H5Off_F03.f90 @@ -82,9 +82,9 @@ MODULE H5O_PROVISIONAL ENDTYPE meta_size_t TYPE, BIND(C) :: h5o_info_t - INTEGER(c_long) :: fileno ! File number that object is located in + INTEGER(C_LONG) :: fileno ! File number that object is located in INTEGER(haddr_t) :: addr ! Object address in file - INTEGER :: type ! Basic object type (group, dataset, etc.) + INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) INTEGER :: rc ! Reference count of object INTEGER, DIMENSION(8) :: atime ! Access time ! -- NOTE -- @@ -181,14 +181,14 @@ CONTAINS ! Inputs: ! loc_id - File or group identifier specifying location of group ! in which object is located. -! name - Name of group, relative to loc_id +! name - Name of group, relative to loc_id. ! ! Outputs: -! object_info - Buffer in which to return object information -! hdferr - Returns 0 if successful and -1 if fails +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! lapl_id - Link access property list +! lapl_id - Link access property list. ! ! AUTHOR ! M. Scot Breitenfeld @@ -218,11 +218,12 @@ CONTAINS !DEC$IF DEFINED(HDF5F90_WINDOWS) !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_BY_NAME_C'::h5oget_info_by_name_c !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name INTEGER(HID_T) , INTENT(IN) :: loc_id CHARACTER(LEN=*), INTENT(IN) :: name INTEGER(SIZE_T) , INTENT(IN) :: namelen INTEGER(HID_T) , INTENT(IN) :: lapl_id_default - TYPE(C_PTR),value :: object_info + TYPE(C_PTR),VALUE :: object_info END FUNCTION h5oget_info_by_name_c END INTERFACE @@ -238,5 +239,222 @@ CONTAINS END SUBROUTINE H5Oget_info_by_name_f +!****s* H5O (F03)/h5oget_info_f_F03 +! +! NAME +! h5oget_info_f +! +! PURPOSE +! Retrieves the metadata for an object specified by an identifier. +! +! Inputs: +! object_id - Identifier for target object. +! +! Outputs: +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5oget_info_f(object_id, object_info, hdferr) + + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: object_id + TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info + INTEGER , INTENT(OUT) :: hdferr +!***** + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5oget_info_c(object_id, object_info) + USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_C'::h5oget_info_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: object_id + TYPE(C_PTR), VALUE :: object_info + + END FUNCTION h5oget_info_c + END INTERFACE + + ptr = C_LOC(object_info) + hdferr = H5Oget_info_c(object_id, ptr) + + END SUBROUTINE H5Oget_info_f + +!****s* H5O (F03)/h5oget_info_by_idx_f_F03 +! +! NAME +! h5oget_info_by_idx_f +! +! PURPOSE +! Retrieves the metadata for an object, identifying the object by an index position. +! +! Inputs: +! loc_id - File or group identifier specifying location of group +! in which object is located. +! group_name - Name of group in which object is located. +! index_field - Index or field that determines the order. +! order - Order within field or index. +! n - Object for which information is to be returned +! +! Outputs: +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list. (Not currently used.) +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5oget_info_by_idx_f(loc_id, group_name, index_field, order, n, & + object_info, hdferr, lapl_id) + + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER , INTENT(IN) :: index_field + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + INTEGER :: corder_valid + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5oget_info_by_idx_c(loc_id, group_name, namelen, & + index_field, order, n, lapl_id_default, object_info) + USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_BY_IDX_C'::h5oget_info_by_idx_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: group_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER , INTENT(IN) :: index_field + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(IN) :: lapl_id_default + TYPE(C_PTR), VALUE :: object_info + + END FUNCTION h5oget_info_by_idx_c + END INTERFACE + + namelen = LEN(group_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + ptr = C_LOC(object_info) + hdferr = H5Oget_info_by_idx_c(loc_id, group_name, namelen, index_field, order, n, lapl_id_default, ptr) + + END SUBROUTINE H5Oget_info_by_idx_f + + +!****s* H5O (F03)/h5ovisit_by_name_f_F03 +! +! NAME +! h5ovisit_by_name_f +! +! PURPOSE +! Recursively visits all objects starting from a specified object. +! +! Inputs: +! loc_id - Identifier of a file or group. +! object_name - Name of the object, generally relative to loc_id, that will serve as root of the iteration +! index_type - Type of index; valid values include: +! H5_INDEX_NAME_F +! H5_INDEX_CRT_ORDER_F +! order - Order in which index is traversed; valid values include: +! H5_ITER_DEC_F +! H5_ITER_INC_F +! H5_ITER_NATIVE_F +! op - Callback function passing data regarding the group to the calling application +! op_data - User-defined pointer to data required by the application for its processing of the group +! +! Outputs: +! return_value - Returns the return value of the first operator that returns a positive value, or +! zero if all members were processed with no operator returning non-zero. +! hdferr - Returns 0 if successful and -1 if fails +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! AUTHOR +! M. Scot Breitenfeld +! November 19, 2008 +! +! Fortran2003 Interface: + SUBROUTINE h5ovisit_by_name_f(loc_id, object_name, index_type, order, op, op_data, & + return_value, hdferr, lapl_id) + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: object_name + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + + TYPE(C_FUNPTR) :: op + TYPE(C_PTR) :: op_data + INTEGER , INTENT(OUT) :: return_value + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, & + op, op_data, lapl_id) + USE, INTRINSIC :: ISO_C_BINDING + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OVISIT_BY_NAME_C'::h5ovisit_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: object_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: object_name + INTEGER(SIZE_T) :: namelen + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + TYPE(C_FUNPTR) , VALUE :: op + TYPE(C_PTR) , VALUE :: op_data + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5ovisit_by_name_c + END INTERFACE + + namelen = LEN(object_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + return_value = h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, & + op, op_data, lapl_id_default) + + IF(return_value.GE.0)THEN + hdferr = 0 + ELSE + hdferr = -1 + END IF + + END SUBROUTINE h5ovisit_by_name_f + END MODULE H5O_PROVISIONAL diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90 index d50e3b9..4254b7f 100644 --- a/fortran/src/H5Pff.f90 +++ b/fortran/src/H5Pff.f90 @@ -6419,3 +6419,5 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END MODULE H5P + + diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c index 86e0e61..0799e11 100644 --- a/fortran/src/H5Rf.c +++ b/fortran/src/H5Rf.c @@ -331,6 +331,47 @@ done: return ret_value; } /* end nh5rget_region_region_c() */ +/****if* H5Rf/h5rget_region_ptr_c + * NAME + * h5rget_region_ptr_c + * PURPOSE + * Call H5Rget_region to dereference dataspace region + * INPUTS + * dset_id - dataset identifier + * ref - reference to the dataset region + * OUTPUTS + * space_id - dereferenced dataset dataspace identifier + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * August 4, 2012 + * HISTORY + * + * SOURCE +*/ +int_f +nh5rget_region_ptr_c(hid_t_f *dset_id, void *ref, hid_t_f *space_id) +/******/ +{ + hid_t c_space_id; + hdset_reg_ref_t ref_c; + int_f ret_value = 0; + + /* + * Call H5Rget_region function. + */ + if((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, ref)) < 0) + HGOTO_DONE(FAIL) + + /* Copy the dataspace ID */ + *space_id = (hid_t_f)c_space_id; + +done: + return ret_value; +} /* end nh5rget_region_ptr_c() */ + + /****if* H5Rf/h5rget_object_type_obj_c * NAME * h5rget_object_type_obj_c diff --git a/fortran/src/H5Rff.f90 b/fortran/src/H5Rff.f90 index 35a3ed6..89ffc10 100644 --- a/fortran/src/H5Rff.f90 +++ b/fortran/src/H5Rff.f90 @@ -53,12 +53,6 @@ MODULE H5R ! END TYPE ! - INTERFACE h5rget_region_f - - MODULE PROCEDURE h5rget_region_region_f - - END INTERFACE - INTERFACE h5rget_object_type_f MODULE PROCEDURE h5rget_object_type_obj_f @@ -67,61 +61,6 @@ MODULE H5R CONTAINS -!****s* H5R/h5rget_region_region_f -! -! NAME -! h5rget_region_region_f -! -! PURPOSE -! Retrieves a dataspace with the specified region selected -! -! INPUTS -! dset_id - identifier of the dataset containing -! reference to the regions -! ref - reference to open -! OUTPUTS -! space_id - dataspace identifier -! hdferr - Returns 0 if successful and -1 if fails -! AUTHOR -! Elena Pourmal -! August 12, 1999 -! -! HISTORY -! Explicit Fortran interfaces were added for -! called C functions (it is needed for Windows -! port). February 28, 2001 -! -! NOTES -! This is a module procedure for the h5rget_region_f subroutine. -! -! SOURCE - SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr) - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier - TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference - INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier - INTEGER, INTENT(OUT) :: hdferr ! Error code -!***** - INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference - - INTERFACE - INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id) - USE H5GLOBAL - !DEC$IF DEFINED(HDF5F90_WINDOWS) - !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c - !DEC$ENDIF - INTEGER(HID_T), INTENT(IN) :: dset_id - ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 - INTEGER :: ref_f(REF_REG_BUF_LEN) - INTEGER(HID_T), INTENT(OUT) :: space_id - END FUNCTION h5rget_region_region_c - END INTERFACE - - ref_f = ref%ref - hdferr = h5rget_region_region_c(dset_id, ref_f, space_id ) - - END SUBROUTINE h5rget_region_region_f - !****s* H5R/h5rget_object_type_obj_f ! ! NAME diff --git a/fortran/src/H5Rff_F03.f90 b/fortran/src/H5Rff_F03.f90 index 7f66745..88ec8cf 100644 --- a/fortran/src/H5Rff_F03.f90 +++ b/fortran/src/H5Rff_F03.f90 @@ -37,6 +37,7 @@ !***** MODULE H5R_PROVISIONAL USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING ! If you change the value of these parameters, do not forget to change corresponding ! values in the H5f90.h file. @@ -51,6 +52,19 @@ MODULE H5R_PROVISIONAL ! INTEGER ref(REF_REG_BUF_LEN) ! END TYPE ! + + TYPE :: hdset_reg_ref_t_f03 + INTEGER(C_SIGNED_CHAR), DIMENSION(1:H5R_DSET_REG_REF_BUF_SIZE_F) :: ref + END TYPE hdset_reg_ref_t_f03 + + INTERFACE h5rget_region_f + + MODULE PROCEDURE h5rget_region_region_f ! obsolete + MODULE PROCEDURE h5rget_region_ptr_f ! F2003 + + END INTERFACE + + INTERFACE h5rcreate_f MODULE PROCEDURE h5rcreate_object_f ! obsolete @@ -123,8 +137,114 @@ MODULE H5R_PROVISIONAL END FUNCTION h5rcreate_ptr_c END INTERFACE + INTERFACE + INTEGER FUNCTION h5rget_region_ptr_c(dset_id, ref, space_id) + USE, INTRINSIC :: ISO_C_BINDING + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_PTR_C':: h5rget_region_ptr_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dset_id + TYPE(C_PTR), VALUE :: ref + INTEGER(HID_T), INTENT(OUT) :: space_id + END FUNCTION h5rget_region_ptr_c + END INTERFACE + CONTAINS +!****s* H5R/h5rget_region_region_f +! +! NAME +! h5rget_region_region_f +! +! PURPOSE +! Retrieves a dataspace with the specified region selected +! +! INPUTS +! dset_id - identifier of the dataset containing +! reference to the regions +! ref - reference to open +! OUTPUTS +! space_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails +! AUTHOR +! Elena Pourmal +! August 12, 1999 +! +! HISTORY +! Explicit Fortran interfaces were added for +! called C functions (it is needed for Windows +! port). February 28, 2001 +! +! NOTES +! This is a module procedure for the h5rget_region_f subroutine. +! +! SOURCE + SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference + INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code +!***** + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference + + INTERFACE + INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dset_id + ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 + INTEGER :: ref_f(REF_REG_BUF_LEN) + INTEGER(HID_T), INTENT(OUT) :: space_id + END FUNCTION h5rget_region_region_c + END INTERFACE + + ref_f = ref%ref + hdferr = h5rget_region_region_c(dset_id, ref_f, space_id ) + + END SUBROUTINE h5rget_region_region_f + +!****s* H5R/h5rget_region_ptr_f +! +! NAME +! h5rget_region_ptr_f +! +! PURPOSE +! Retrieves a dataspace with the specified region +! selected using pointer +! +! INPUTS +! dset_id - identifier of the dataset containing +! reference to the regions +! ref - reference to open +! OUTPUTS +! space_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails +! AUTHOR +! M. Scot Breitenfeld +! August 4, 2012 +! +! NOTES +! This is a module procedure for the h5rget_region_f subroutine. +! +! SOURCE + SUBROUTINE h5rget_region_ptr_f(dset_id, ref, space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(C_PTR), INTENT(IN) :: ref ! Dataset region reference + INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code +!***** + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference + + hdferr = h5rget_region_ptr_c(dset_id, ref, space_id ) + + END SUBROUTINE h5rget_region_ptr_f + + !****s* H5R (F03)/h5rcreate_object_f ! ! NAME @@ -175,7 +295,7 @@ CONTAINS END SUBROUTINE h5rcreate_object_f -!****s* H5R (F03)/h5rcreate_region_f +!****s* H5R (F90)/h5rcreate_region_f ! ! NAME ! h5rcreate_region_f @@ -183,16 +303,15 @@ CONTAINS ! PURPOSE ! Creates reference to the dataset region ! -! Inputs: +! INPUTS ! loc_id - location identifier ! name - name of the dataset at the specified location ! space_id - dataspace identifier that describes selected region -! Outputs: +! OUTPUTS ! ref - reference to the dataset region ! hdferr: - error code ! Success: 0 ! Failure: -1 -! ! AUTHOR ! Elena Pourmal ! August 12, 1999 @@ -205,46 +324,39 @@ CONTAINS ! NOTES ! This is a module procedure for the h5rcreate_f subroutine. ! -! Signature: +! SOURCE SUBROUTINE h5rcreate_region_f(loc_id, name, space_id, ref, hdferr) - USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: loc_id ! Location identifier CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the dataset at location specified ! by loc_id identifier INTEGER(HID_T), INTENT(IN) :: space_id ! Dataset's dataspace identifier - TYPE(hdset_reg_ref_t_f), INTENT(INOUT), TARGET :: ref ! Dataset region reference + TYPE(hdset_reg_ref_t_f), INTENT(OUT) :: ref ! Dataset region reference INTEGER, INTENT(OUT) :: hdferr ! Error code !***** INTEGER :: namelen ! Name length INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference - TYPE(C_PTR) :: f_ptr - -! !$ INTERFACE -! !$ INTEGER FUNCTION h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id) -! !$ USE H5GLOBAL -! !$ !DEC$IF DEFINED(HDF5F90_WINDOWS) -! !$ !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_REGION_C':: h5rcreate_region_c -! !$ !DEC$ENDIF -! !$ !DEC$ATTRIBUTES reference :: name -! !$ ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 -! !$ INTEGER :: ref_f(REF_REG_BUF_LEN) -! !$ INTEGER(HID_T), INTENT(IN) :: loc_id -! !$ CHARACTER(LEN=*), INTENT(IN) :: name -! !$ INTEGER :: namelen -! !$ INTEGER(HID_T), INTENT(IN) :: space_id -! !$ END FUNCTION h5rcreate_region_c -! !$ END INTERFACE - - f_ptr = C_LOC(ref) + INTERFACE + INTEGER FUNCTION h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_REGION_C':: h5rcreate_region_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name + ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 + INTEGER :: ref_f(REF_REG_BUF_LEN) + INTEGER(HID_T), INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER :: namelen + INTEGER(HID_T), INTENT(IN) :: space_id + END FUNCTION h5rcreate_region_c + END INTERFACE namelen = LEN(name) - hdferr = h5rcreate_ptr_c(f_ptr, loc_id, name, namelen, 1, space_id) - -! !$ ref_f = 0 -! !$ hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id ) -! !$ ref%ref = ref_f + ref_f = 0 + hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id ) + ref%ref = ref_f END SUBROUTINE h5rcreate_region_f diff --git a/fortran/src/H5Rff_F90.f90 b/fortran/src/H5Rff_F90.f90 index 3f02825..0190e57 100644 --- a/fortran/src/H5Rff_F90.f90 +++ b/fortran/src/H5Rff_F90.f90 @@ -72,8 +72,73 @@ MODULE H5R_PROVISIONAL END INTERFACE + INTERFACE h5rget_region_f + + MODULE PROCEDURE h5rget_region_region_f + + END INTERFACE + + CONTAINS + +!****s* H5R/h5rget_region_region_f +! +! NAME +! h5rget_region_region_f +! +! PURPOSE +! Retrieves a dataspace with the specified region selected +! +! INPUTS +! dset_id - identifier of the dataset containing +! reference to the regions +! ref - reference to open +! OUTPUTS +! space_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails +! AUTHOR +! Elena Pourmal +! August 12, 1999 +! +! HISTORY +! Explicit Fortran interfaces were added for +! called C functions (it is needed for Windows +! port). February 28, 2001 +! +! NOTES +! This is a module procedure for the h5rget_region_f subroutine. +! +! SOURCE + SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference + INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code +!***** + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference + + INTERFACE + INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dset_id + ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 + INTEGER :: ref_f(REF_REG_BUF_LEN) + INTEGER(HID_T), INTENT(OUT) :: space_id + END FUNCTION h5rget_region_region_c + END INTERFACE + + ref_f = ref%ref + hdferr = h5rget_region_region_c(dset_id, ref_f, space_id ) + + END SUBROUTINE h5rget_region_region_f + + + !****s* H5R (F90)/h5rcreate_object_f ! ! NAME diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 7b55384..4c85df2 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -398,7 +398,11 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5e_flags, hid_t_f *h5e_hid_flags, int h5d_flags[19] = (int_f)H5D_CHUNK_CACHE_NSLOTS_DEFAULT; h5d_flags[20] = (int_f)H5D_CHUNK_CACHE_NBYTES_DEFAULT; h5d_flags[21] = (int_f)H5D_CHUNK_CACHE_W0_DEFAULT; - + h5d_flags[22] = (int_f)H5D_MPIO_NO_COLLECTIVE; + h5d_flags[23] = (int_f)H5D_MPIO_CHUNK_INDEPENDENT; + h5d_flags[24] = (int_f)H5D_MPIO_CHUNK_COLLECTIVE; + h5d_flags[25] = (int_f)H5D_MPIO_CHUNK_MIXED; + h5d_flags[26] = (int_f)H5D_MPIO_CONTIGUOUS_COLLECTIVE; /* * H5E flags */ diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90 index 3d4f7f8..a6168d52 100644 --- a/fortran/src/H5f90global.f90 +++ b/fortran/src/H5f90global.f90 @@ -354,7 +354,7 @@ MODULE H5GLOBAL ! H5D flags declaration ! - INTEGER, PARAMETER :: H5D_FLAGS_LEN = 22 + INTEGER, PARAMETER :: H5D_FLAGS_LEN = 27 INTEGER H5D_flags(H5D_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) !DEC$ATTRIBUTES DLLEXPORT :: /H5D_FLAGS/ @@ -387,10 +387,17 @@ MODULE H5GLOBAL ! shortened "_DEFAULT" to "_DFLT" to satisfy the limit of 31 ! characters for variable names in Fortran. +! shortened "_CONTIGUOUS" to "_CONTIG" to satisfy the limit of 31 +! characters for variable names in Fortran. INTEGER :: H5D_CHUNK_CACHE_NSLOTS_DFLT_F INTEGER :: H5D_CHUNK_CACHE_NBYTES_DFLT_F INTEGER :: H5D_CHUNK_CACHE_W0_DFLT_F + INTEGER :: H5D_MPIO_NO_COLLECTIVE_F + INTEGER :: H5D_MPIO_CHUNK_INDEPENDENT_F + INTEGER :: H5D_MPIO_CHUNK_COLLECTIVE_F + INTEGER :: H5D_MPIO_CHUNK_MIXED_F + INTEGER :: H5D_MPIO_CONTIG_COLLECTIVE_F EQUIVALENCE(H5D_flags(1), H5D_COMPACT_F) EQUIVALENCE(H5D_flags(2), H5D_CONTIGUOUS_F) @@ -419,6 +426,11 @@ MODULE H5GLOBAL EQUIVALENCE(H5D_flags(20), H5D_CHUNK_CACHE_NSLOTS_DFLT_F) EQUIVALENCE(H5D_flags(21), H5D_CHUNK_CACHE_NBYTES_DFLT_F) EQUIVALENCE(H5D_flags(22), H5D_CHUNK_CACHE_W0_DFLT_F) + EQUIVALENCE(H5D_flags(23), H5D_MPIO_NO_COLLECTIVE_F) + EQUIVALENCE(H5D_flags(24), H5D_MPIO_CHUNK_INDEPENDENT_F) + EQUIVALENCE(H5D_flags(25), H5D_MPIO_CHUNK_COLLECTIVE_F) + EQUIVALENCE(H5D_flags(26), H5D_MPIO_CHUNK_MIXED_F) + EQUIVALENCE(H5D_flags(27), H5D_MPIO_CONTIG_COLLECTIVE_F) ! ! H5E flags declaration diff --git a/fortran/src/H5f90kit.c b/fortran/src/H5f90kit.c index 059685e..0bc721f 100644 --- a/fortran/src/H5f90kit.c +++ b/fortran/src/H5f90kit.c @@ -53,7 +53,7 @@ HD5f2cstring(_fcd fdesc, size_t len) /* Search for the end of the string */ str = _fcdtocp(fdesc); - for(i = (int)len - 1; i >= 0 && !HDisgraph((int)str[i]); i--) + for(i = (int)len - 1; i >= 0 && HDisspace((int)str[i]) && str[i] == ' '; i--) /*EMPTY*/; /* Allocate C string */ diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index d0a8361..9340c2a 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -61,7 +61,7 @@ typedef struct H5O_hdr_info_t_f { typedef struct H5O_info_t_f { unsigned long fileno; /* File number that object is located in */ haddr_t_f addr; /* Object address in file */ - int_f type; /* Basic object type (group, dataset, etc.) */ + int type; /* Basic object type (group, dataset, etc.) */ int_f rc; /* Reference count of object */ int_f atime[8]; /* Access time */ int_f mtime[8]; /* Modification time */ @@ -806,11 +806,21 @@ H5_FCDLL int_f nh5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, #define nh5olink_c H5_FC_FUNC_(h5olink_c, H5OLINK_C) #define nh5oopen_c H5_FC_FUNC_(h5oopen_c, H5OOPEN_C) #define nh5oclose_c H5_FC_FUNC_(h5oclose_c, H5OCLOSE_C) -#define nh5ovisit_c H5_FC_FUNC_(h5ovisit_c,H5OVISIT_C) +#define nh5ovisit_c H5_FC_FUNC_(h5ovisit_c, H5OVISIT_C) +#define nh5ovisit_by_name_c H5_FC_FUNC_(h5ovisit_by_name_c, H5OVISIT_BY_NAME_C) +#define nh5oget_info_c H5_FC_FUNC_(h5oget_info_c, H5OGET_INFO_C) +#define nh5oget_info_by_idx_c H5_FC_FUNC_(h5oget_info_by_idx_c ,H5OGET_INFO_BY_IDX_C) #define nh5oget_info_by_name_c H5_FC_FUNC_(h5oget_info_by_name_c ,H5OGET_INFO_BY_NAME_C) #define nh5oopen_by_addr_c H5_FC_FUNC_(h5oopen_by_addr_c, H5OOPEN_BY_ADDR_C) #define nh5ocopy_c H5_FC_FUNC_(h5ocopy_c, H5OCOPY_C) - +#define nh5odecr_refcount_c H5_FC_FUNC_(h5odecr_refcount_c, H5ODECR_REFCOUNT_C) +#define nh5oincr_refcount_c H5_FC_FUNC_(h5oincr_refcount_c, H5OINCR_REFCOUNT_C) +#define nh5oexists_by_name_c H5_FC_FUNC_(h5oexists_by_name_c, H5OEXISTS_BY_NAME_C) +#define nh5oset_comment_c H5_FC_FUNC_(h5oset_comment_c, H5OSET_COMMENT_C) +#define nh5oset_comment_by_name_c H5_FC_FUNC_(h5oset_comment_by_name_c, H5OSET_COMMENT_BY_NAME_C) +#define nh5oopen_by_idx_c H5_FC_FUNC_(h5oopen_by_idx_c, H5OOPEN_BY_IDX_C) +#define nh5oget_comment_c H5_FC_FUNC_(h5oget_comment_c, H5OGET_COMMENT_C) +#define nh5oget_comment_by_name_c H5_FC_FUNC_(h5oget_comment_by_name_c, H5OGET_COMMENT_BY_NAME_C) H5_FCDLL int_f nh5oopen_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_t_f *obj_id); H5_FCDLL int_f nh5oclose_c (hid_t_f *object_id ); @@ -818,11 +828,26 @@ H5_FCDLL int_f nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *ob H5_FCDLL int_f nh5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id); H5_FCDLL int_f nh5ovisit_c (hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data); -H5_FCDLL int_f nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen,hid_t_f *lapl_id, +H5_FCDLL int_f nh5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, + H5O_iterate_t op, void *op_data, hid_t_f *lapl_id ); +H5_FCDLL int_f nh5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info); +H5_FCDLL int_f nh5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, + int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info); +H5_FCDLL int_f nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, H5O_info_t_f *object_info); H5_FCDLL int_f nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len, hid_t_f *ocpypl_id, hid_t_f *lcpl_id ); +H5_FCDLL int_f nh5odecr_refcount_c (hid_t_f *object_id); +H5_FCDLL int_f nh5oincr_refcount_c (hid_t_f *object_id); +H5_FCDLL int_f nh5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id); +H5_FCDLL int_f nh5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen); +H5_FCDLL int_f nh5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id); +H5_FCDLL int_f nh5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, + int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id); +H5_FCDLL int_f nh5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize); +H5_FCDLL int_f nh5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, + _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id); /* * Functions from H5Pf.c */ @@ -982,6 +1007,7 @@ H5_FCDLL int_f nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_nam #define nh5pget_nlinks_c H5_FC_FUNC_(h5pget_nlinks_c, H5PGET_NLINKS_C) #define nh5pset_chunk_cache_c H5_FC_FUNC_(h5pset_chunk_cache_c, H5PSET_CHUNK_CACHE_C) #define nh5pget_chunk_cache_c H5_FC_FUNC_(h5pget_chunk_cache_c, H5PGET_CHUNK_CACHE_C) +#define nh5pget_mpio_actual_io_mode_c H5_FC_FUNC_(h5pget_mpio_actual_io_mode_c, H5PGET_MPIO_ACTUAL_IO_MODE_C) H5_FCDLL int_f nh5pcreate_c ( hid_t_f *cls, hid_t_f *prp_id ); H5_FCDLL int_f nh5pclose_c ( hid_t_f *prp_id ); @@ -1142,6 +1168,7 @@ H5_FCDLL int_f nh5pset_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks); H5_FCDLL int_f nh5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks); H5_FCDLL int_f nh5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0); H5_FCDLL int_f nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0); +H5_FCDLL int_f nh5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode); /* * Functions frome H5Rf.c */ @@ -1152,6 +1179,7 @@ H5_FCDLL int_f nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, si #define nh5rdereference_object_c H5_FC_FUNC_(h5rdereference_object_c, H5RDEREFERENCE_OBJECT_C) #define nh5rdereference_ptr_c H5_FC_FUNC_(h5rdereference_ptr_c, H5RDEREFERENCE_PTR_C) #define nh5rget_region_region_c H5_FC_FUNC_(h5rget_region_region_c, H5RGET_REGION_REGION_C) +#define nh5rget_region_ptr_c H5_FC_FUNC_(h5rget_region_ptr_c, H5RGET_REGION_PTR_C) #define nh5rget_object_type_obj_c H5_FC_FUNC_(h5rget_object_type_obj_c, H5RGET_OBJECT_TYPE_OBJ_C) #define nh5rget_name_object_c H5_FC_FUNC_(h5rget_name_object_c, H5RGET_NAME_OBJECT_C) #define nh5rget_name_region_c H5_FC_FUNC_(h5rget_name_region_c, H5RGET_NAME_REGION_C) @@ -1166,6 +1194,7 @@ H5_FCDLL int_f nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f * H5_FCDLL int_f nh5rdereference_object_c (hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id); H5_FCDLL int_f nh5rdereference_ptr_c (hid_t_f *obj_id, int_f *ref_type, void *ref, hid_t_f *ref_obj_id); H5_FCDLL int_f nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id); +H5_FCDLL int_f nh5rget_region_ptr_c(hid_t_f *dset_id, void *ref, hid_t_f *space_id); H5_FCDLL int_f nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type); H5_FCDLL int_f nh5rget_name_object_c (hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default); H5_FCDLL int_f nh5rget_name_region_c (hid_t_f *loc_id, int_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default); diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 61504ec..4c83d21 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -533,7 +533,21 @@ int main(void) /* double_f */ #if defined H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND - writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND); + if(H5_C_HAS_REAL_NATIVE_16 != 0) { /* Check if C has 16 byte floats */ + writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND); + } else { +#if defined H5_FORTRAN_HAS_REAL_NATIVE_8_KIND /* Fall back to 8 byte floats */ + writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_REAL_NATIVE_8_KIND); + } +#elif defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND /* Fall back to 4 byte floats */ + writeFloatToFiles("Fortran_DOUBLE", "double_f", 4, H5_FORTRAN_HAS_REAL_NATIVE_4_KIND); + } +#else + /* Error: couldn't find a size for double_f when fortran has 16 byte reals */ + return -1; + } +#endif + #elif defined H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND); #else @@ -541,6 +555,14 @@ int main(void) return -1; #endif + /* Need the buffer size for the fortran derive type 'hdset_reg_ref_t_f03' + * in order to be interoperable with C's structure, the C buffer size + * H5R_DSET_REG_REF_BUF_SIZE is (sizeof(haddr_t)+4) + */ + + fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n", H5_SIZEOF_HADDR_T + 4 ); + + /* Close files */ endCfile(); endFfile(); diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index c362c2e..fe32739 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -297,6 +297,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -311,6 +312,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -507,7 +509,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 121 +LT_VERS_REVISION = 122 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index 2d7b5b4..4985650 100644 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -98,6 +98,10 @@ FFLAGS="${HDF5_FFLAGS:-$FFLAGSBASE}" LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" LIBS="${HDF5_LIBS:-$LIBSBASE}" +# If static was disabled, @HDF5_USE_SHLIB@ will be yes. In that case +# HDF5_USE_SHLIB should be set to yes because there are no static +# lib files. +HDF5_USE_SHLIB="@HDF5_USE_SHLIB@" USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" usage() { diff --git a/fortran/src/hdf5_fortrandll.def b/fortran/src/hdf5_fortrandll.def index 29e83f5..267c27f 100644 --- a/fortran/src/hdf5_fortrandll.def +++ b/fortran/src/hdf5_fortrandll.def @@ -284,10 +284,25 @@ H5L_mp_H5LIS_REGISTERED_F H5L_mp_H5LMOVE_F
H5L_mp_H5LGET_NAME_BY_IDX_F
; H5O
+H5O_mp_H5OCLOSE_F
H5O_mp_H5OCOPY_F
+H5O_mp_H5ODECR_REFCOUNT_F
+H5O_mp_H5OEXISTS_BY_NAME_F
+H5O_mp_H5OGET_COMMENT_F
+H5O_mp_H5OGET_COMMENT_BY_NAME_F
+H5O_mp_H5OGET_INFO_BY_IDX_F
+H5O_mp_H5OGET_INFO_BY_NAME_F
+H5O_mp_H5OGET_INFO_F
+H5O_mp_H5OINCR_REFCOUNT_F
H5O_mp_H5OLINK_F
-H5O_mp_H5OOPEN_F
H5O_mp_H5OOPEN_BY_ADDR_F
+H5O_mp_H5OOPEN_BY_IDX_F
+H5O_mp_H5OOPEN_F
+H5O_mp_H5OSET_COMMENT_F
+H5O_mp_H5OSET_COMMENT_BY_NAME_F
+H5O_mp_H5OVISIT_BY_NAME_F
+H5O_mp_H5OVISIT_F
+
; H5P
H5P_mp_H5PCREATE_F
H5P_mp_H5PSET_PRESERVE_F
@@ -429,7 +444,8 @@ H5R_PROVISIONAL_mp_H5RCREATE_OBJECT_F H5R_PROVISIONAL_mp_H5RCREATE_REGION_F
H5R_PROVISIONAL_mp_H5RDEREFERENCE_OBJECT_F
H5R_PROVISIONAL_mp_H5RDEREFERENCE_REGION_F
-H5R_mp_H5RGET_REGION_REGION_F
+H5R_PROVISIONAL_mp_H5RGET_REGION_REGION_F
+
H5R_mp_H5RGET_OBJECT_TYPE_OBJ_F
H5R_PROVISIONAL_mp_H5RGET_NAME_OBJECT_F
H5R_PROVISIONAL_mp_H5RGET_NAME_REGION_F
diff --git a/fortran/src/phdf5_fortrandll.def b/fortran/src/phdf5_fortrandll.def index 7a196cd..c3342d3 100644 --- a/fortran/src/phdf5_fortrandll.def +++ b/fortran/src/phdf5_fortrandll.def @@ -528,4 +528,9 @@ H5Z_mp_H5ZFILTER_AVAIL_F H5Z_mp_H5ZGET_FILTER_INFO_F
; Parallel
H5FDMPIO_mp_H5PSET_FAPL_MPIO_F
+H5FDMPIO_mp_H5PGET_FAPL_MPIO_F
H5FDMPIO_mp_H5PSET_DXPL_MPIO_F
+H5FDMPIO_mp_H5PGET_DXPL_MPIO_F
+H5FDMPIO_mp_H5PSET_FAPL_MPIPOSIX_F
+H5FDMPIO_mp_H5PGET_FAPL_MPIPOSIX_F
+H5FDMPIO_mp_H5PGET_MPIO_ACTUAL_IO_MODE_F
\ No newline at end of file diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index d19baea..3a3d084 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -106,6 +106,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 + tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 ) diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index b261785..42dd127 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -68,7 +68,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ if FORTRAN_2003_CONDITIONAL_F fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 endif diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index b4f0c4c..694e553 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -136,11 +136,13 @@ fortranlib_test_1_8_LDADD = $(LDADD) fortranlib_test_1_8_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) \ $(LIBH5F) $(LIBHDF5) am__fortranlib_test_F03_SOURCES_DIST = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 \ + tH5T_F03.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@am_fortranlib_test_F03_OBJECTS = fortranlib_test_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5E_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5L_F03.$(OBJEXT) \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5O_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5P_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5T_F03.$(OBJEXT) fortranlib_test_F03_OBJECTS = $(am_fortranlib_test_F03_OBJECTS) @@ -280,6 +282,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -294,6 +297,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -515,7 +519,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ -@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 fflush1_SOURCES = fflush1.f90 fflush2_SOURCES = fflush2.f90 diff --git a/fortran/test/fortranlib_test_1_8.f90 b/fortran/test/fortranlib_test_1_8.f90 index 321cb99..d3ced72 100644 --- a/fortran/test/fortranlib_test_1_8.f90 +++ b/fortran/test/fortranlib_test_1_8.f90 @@ -94,12 +94,6 @@ PROGRAM fortranlibtest total_error) ret_total_error = 0 - CALL test_nbit(cleanup, ret_total_error ) - CALL write_test_status(ret_total_error, & - ' Testing nbit filter', & - total_error) - - ret_total_error = 0 CALL test_scaleoffset(cleanup, ret_total_error ) CALL write_test_status(ret_total_error, & ' Testing scaleoffset filter', & @@ -401,141 +395,6 @@ SUBROUTINE test_h5s_encode(cleanup, total_error) END SUBROUTINE test_h5s_encode !------------------------------------------------------------------------- -! Function: test_nbit -! -! Purpose: Tests (real) datatype for nbit filter -! -! Return: Success: 0 -! Failure: >0 -! -! Programmer: M. Scot Breitenfeld -! Decemeber 7, 2010 -! -! Modifications: -! -!------------------------------------------------------------------------- -! - -SUBROUTINE test_nbit(cleanup, total_error ) - - USE HDF5 - - IMPLICIT NONE - INTEGER, PARAMETER :: wp = KIND(1.0) - LOGICAL, INTENT(IN) :: cleanup - INTEGER, INTENT(INOUT) :: total_error - INTEGER(hid_t) :: file - - INTEGER(hid_t) :: dataset, datatype, space, dc - INTEGER(hsize_t), DIMENSION(1:2) :: dims = (/2,5/) - INTEGER(hsize_t), DIMENSION(1:2) :: chunk_dim = (/2,5/) - ! orig_data[] are initialized to be within the range that can be represented by - ! dataset datatype (no precision loss during datatype conversion) - ! - REAL(kind=wp), DIMENSION(1:2,1:5) :: orig_data = RESHAPE( (/188384.00, 19.103516, -1.0831790e9, -84.242188, & - 5.2045898, -49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000/) , (/2,5/) ) - REAL(kind=wp), DIMENSION(1:2,1:5) :: new_data - INTEGER(size_t) :: PRECISION, offset - INTEGER :: error - LOGICAL :: status - INTEGER*8 :: ii - INTEGER(size_t) :: i, j - - - ! check to see if filter is available - CALL H5Zfilter_avail_f(H5Z_FILTER_NBIT_F, status, error) - IF(.NOT.status)THEN ! We don't have H5Z_FILTER_NBIT_F filter - total_error = -1 ! so return - RETURN - ENDIF - - CALL H5Fcreate_f("nbit.h5", H5F_ACC_TRUNC_F, file, error) - CALL check("H5Fcreate_f", error, total_error) - - ! Define dataset datatype (integer), and set precision, offset - CALL H5Tcopy_f(H5T_IEEE_F32BE, datatype, error) - CALL CHECK(" H5Tcopy_f", error, total_error) - CALL H5Tset_fields_f(datatype, 26_size_t, 20_size_t, 6_size_t, 7_size_t, 13_size_t, error) - CALL CHECK(" H5Tset_fields_f", error, total_error) - offset = 7 - CALL H5Tset_offset_f(datatype, offset, error) - CALL CHECK(" H5Tset_offset_f", error, total_error) - PRECISION = 20 - CALL H5Tset_precision_f(datatype,PRECISION, error) - CALL CHECK(" H5Tset_precision_f", error, total_error) - - CALL H5Tset_size_f(datatype, 4_size_t, error) - CALL CHECK(" H5Tset_size_f", error, total_error) - - CALL H5Tset_ebias_f(datatype, 31_size_t, error) - CALL CHECK(" H5Tset_ebias_f", error, total_error) - - ! Create the data space - CALL H5Screate_simple_f(2, dims, space, error) - CALL CHECK(" H5Screate_simple_f", error, total_error) - - ! USE nbit filter - CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dc, error) - CALL CHECK(" H5Pcreate_f", error, total_error) - - CALL H5Pset_chunk_f(dc, 2, chunk_dim, error) - CALL CHECK(" H5Pset_chunk_f", error, total_error) - CALL H5Pset_nbit_f(dc, error) - CALL CHECK(" H5Pset_nbit_f", error, total_error) - - ! Create the dataset - CALL H5Dcreate_f(file, "nbit_real", datatype, & - space, dataset, error, dc) - CALL CHECK(" H5Dcreate_f", error, total_error) - - !---------------------------------------------------------------------- - ! STEP 1: Test nbit by setting up a chunked dataset and writing - ! to it. - !---------------------------------------------------------------------- - ! - CALL H5Dwrite_f(dataset, H5T_NATIVE_REAL, orig_data, dims, error) - CALL CHECK(" H5Dwrite_f", error, total_error) - - !---------------------------------------------------------------------- - ! STEP 2: Try to read the data we just wrote. - !---------------------------------------------------------------------- - ! - CALL H5Dread_f(dataset, H5T_NATIVE_REAL, new_data, dims, error) - CALL CHECK(" H5Dread_f", error, total_error) - - ! Check that the values read are the same as the values written - ! Assume size of long long = size of double - ! - i_loop: DO i = 1, dims(1) - j_loop: DO j = 1, dims(2) - IF(.NOT.(orig_data(i,j).EQ.orig_data(i,j))) CYCLE ! skip IF value is NaN - IF(new_data(i,j) .NE. orig_data(i,j))THEN - total_error = total_error + 1 - WRITE(*,'(" Read different values than written.")') - WRITE(*,'(" At index ", 2(1X,I0))') i, j - EXIT i_loop - END IF - ENDDO j_loop - ENDDO i_loop - - !---------------------------------------------------------------------- - ! Cleanup - !---------------------------------------------------------------------- - ! - CALL H5Tclose_f(datatype, error) - CALL CHECK(" H5Tclose_f", error, total_error) - CALL H5Pclose_f(dc, error) - CALL CHECK(" H5Pclose_f", error, total_error) - CALL H5Sclose_f(space, error) - CALL CHECK(" H5Sclose_f", error, total_error) - CALL H5Dclose_f(dataset, error) - CALL CHECK(" H5Dclose_f", error, total_error) - CALL H5Fclose_f(file, error) - CALL CHECK(" H5Fclose_f", error, total_error) - -END SUBROUTINE test_nbit - -!------------------------------------------------------------------------- ! Function: test_scaleoffset ! ! Purpose: Tests the integer datatype for scaleoffset filter diff --git a/fortran/test/fortranlib_test_F03.f90 b/fortran/test/fortranlib_test_F03.f90 index 1b69f7f..a03241c 100644 --- a/fortran/test/fortranlib_test_F03.f90 +++ b/fortran/test/fortranlib_test_F03.f90 @@ -64,10 +64,7 @@ PROGRAM fortranlibtest_F03 ! CALL write_test_status(ret_total_error, ' Test error API based on data I/O', total_error) WRITE(*,*) -! write(*,*) -! write(*,*) '=========================================' -! write(*,*) 'Testing DATATYPE interface ' -! write(*,*) '=========================================' + ret_total_error = 0 CALL test_array_compound_atomic(ret_total_error) CALL write_test_status(ret_total_error, ' Testing 1-D Array of Compound Datatypes Functionality', total_error) @@ -117,16 +114,16 @@ PROGRAM fortranlibtest_F03 CALL write_test_status(ret_total_error, ' Testing writing/reading string datatypes, using C_LOC', total_error) ret_total_error = 0 + CALL vl_test_special_char(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing string datatypes containing control characters', total_error) + + ret_total_error = 0 CALL test_create(ret_total_error) - CALL write_test_status(ret_total_error, & - ' Testing filling functions', & - total_error) + CALL write_test_status(ret_total_error, ' Testing filling functions', total_error) ret_total_error = 0 CALL test_h5kind_to_type(total_error) - CALL write_test_status(ret_total_error, & - ' Test function h5kind_to_type', & - total_error) + CALL write_test_status(ret_total_error, ' Test function h5kind_to_type', total_error) ret_total_error = 0 CALL test_array_bkg(ret_total_error) @@ -138,14 +135,30 @@ PROGRAM fortranlibtest_F03 ret_total_error = 0 CALL test_iter_group(ret_total_error) - CALL write_test_status(ret_total_error, ' Testing Group Iteration Functionality', total_error) + CALL write_test_status(ret_total_error, ' Testing group iteration functionality', total_error) + + ret_total_error = 0 + CALL test_nbit(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing nbit filter', total_error) + ! write(*,*) ! write(*,*) '=========================================' ! write(*,*) 'Testing GROUP interface ' ! write(*,*) '=========================================' - + ret_total_error = 0 + CALL test_h5o_refcount(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object functions ', total_error) + + ret_total_error = 0 + CALL obj_visit(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object visiting functions ', total_error) + + ret_total_error = 0 + CALL obj_info(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object info functions ', total_error) + WRITE(*,*) WRITE(*,*) ' ============================================ ' diff --git a/fortran/test/tH5A.f90 b/fortran/test/tH5A.f90 index 03522f7..cecaded 100644 --- a/fortran/test/tH5A.f90 +++ b/fortran/test/tH5A.f90 @@ -100,7 +100,7 @@ CHARACTER(LEN=35), DIMENSION(2) :: aread_data ! Buffer to put read back ! string attr data CHARACTER :: attr_character_data = 'A' - DOUBLE PRECISION, DIMENSION(1) :: attr_double_data = 3.459 + REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: attr_double_data = 3.459 REAL, DIMENSION(1) :: attr_real_data = 4.0 INTEGER, DIMENSION(1) :: attr_integer_data = 5 INTEGER(HSIZE_T), DIMENSION(7) :: data_dims @@ -109,7 +109,7 @@ CHARACTER :: aread_character_data ! variable to put read back Character attr data INTEGER, DIMENSION(1) :: aread_integer_data ! variable to put read back integer attr data INTEGER, DIMENSION(1) :: aread_null_data = 7 ! variable to put read back null attr data - DOUBLE PRECISION, DIMENSION(1) :: aread_double_data ! variable to put read back double attr data + REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: aread_double_data ! variable to put read back double attr data REAL, DIMENSION(1) :: aread_real_data ! variable to put read back real attr data ! diff --git a/fortran/test/tH5O.f90 b/fortran/test/tH5O.f90 index 247d1d0..b68e7ca 100644 --- a/fortran/test/tH5O.f90 +++ b/fortran/test/tH5O.f90 @@ -35,15 +35,8 @@ SUBROUTINE test_h5o(cleanup, total_error) INTEGER, INTENT(OUT) :: total_error INTEGER :: error - ! /* Output message about test being performed */ - ! WRITE(*,*) "Testing Objects" - -!!$ test_h5o_open(); /* Test generic OPEN FUNCTION */ -!!$ test_h5o_open_by_addr(); /* Test opening objects by address */ -!!$ test_h5o_close(); /* Test generic CLOSE FUNCTION */ -!!$ test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - CALL test_h5o_plist(total_error) ! /* Test object creation properties */ - CALL test_h5o_link(total_error) ! /* Test object link routine */ + CALL test_h5o_plist(total_error) ! Test object creation properties + CALL test_h5o_link(total_error) ! Test object link routine IF(cleanup) CALL h5_cleanup_f("TestFile", H5P_DEFAULT_F, error) CALL check("h5_cleanup_f", error, total_error) @@ -100,6 +93,19 @@ SUBROUTINE test_h5o_link(total_error) INTEGER(HSIZE_T), DIMENSION(1:1) :: dims2 = (/dim0/) ! size read/write buffer INTEGER , DIMENSION(1:dim0) :: wdata2, & ! Write buffer rdata2 ! Read buffer + LOGICAL :: link_exists + CHARACTER(LEN=8) :: chr_exact + CHARACTER(LEN=10) :: chr_lg + INTEGER(size_t) :: nlinks + INTEGER(HID_T) :: plist = -1 + + CHARACTER(LEN=20) :: dset_comment = "dataset comment" + CHARACTER(LEN=13) :: grp_comment = "group comment" + CHARACTER(LEN=10) :: comment_sm ! to small comment sized buffer + CHARACTER(LEN=15) :: comment ! exact comment sized buffer + CHARACTER(LEN=20) :: comment_lg ! large comment sized buffer + INTEGER(HSSIZE_T) :: comment_size + INTEGER(SIZE_T) :: comment_size2 ! Initialize the raw data DO i = 1, TEST6_DIM1 @@ -131,8 +137,6 @@ SUBROUTINE test_h5o_link(total_error) CALL H5Pset_libver_bounds_f(fapl_id, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error) CALL check("H5Pset_libver_bounds_f",error, total_error) -!!$ ret = H5Pset_libver_bounds(fapl_id, (new_format ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST); - ! Create a new HDF5 file CALL H5Fcreate_f(TEST_FILENAME, H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id) CALL check("H5Fcreate_f", error, total_error) @@ -155,10 +159,9 @@ SUBROUTINE test_h5o_link(total_error) ! Create a dataset with no name using the committed datatype CALL H5Dcreate_anon_f(file_id, type_id, space_id, dset_id, error ) ! using no optional parameters CALL check("H5Dcreate_anon_f",error,total_error) - - + ! ! Verify that we can write to and read from the dataset - + ! ! Write the data to the dataset !EP CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wdata, dims, error, & @@ -199,7 +202,6 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tclose_f(type_id, error) CALL check("h5tclose_f", error, total_error) - ! Re-open datatype using new link CALL H5Topen_f(group_id, "datatype", type_id, error) CALL check("h5topen_f", error, total_error) @@ -208,12 +210,10 @@ SUBROUTINE test_h5o_link(total_error) CALL H5Olink_f(group_id, file_id, "/group", error) CALL check("H5Olink_f", error, total_error) - CALL h5gclose_f(group_id, error) CALL check("h5gclose_f",error,total_error) ! Open dataset through root group and verify its data - CALL H5Dopen_f(file_id, "/group/inter_group/dataset", dset_id, error) CALL check("test_lcpl.h5dopen_f", error, total_error) @@ -236,7 +236,6 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tclose_f(type_id, error) CALL check("h5tclose_f",error,total_error) - ! Close remaining IDs CALL h5sclose_f(space_id, error) CALL check("h5sclose_f",error,total_error) @@ -264,16 +263,214 @@ SUBROUTINE test_h5o_link(total_error) CALL check("h5gcreate_f", error, total_error) CALL h5gcreate_f(file_id,"/G1/G2/G3",group_id,error) CALL check("h5gcreate_f", error, total_error) + + ! Try putting a comment on the group /G1/G2/G3 by name + CALL h5oset_comment_by_name_f(file_id, "/G1/G2/G3", grp_comment, error) + CALL check("h5oset_comment_by_name_f", error, total_error) + + comment_lg = ' ' + + CALL h5oget_comment_by_name_f(file_id, "/G1/G2/G3", comment_lg, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment_lg(1:13).NE.grp_comment)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + IF(comment_lg(14:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! Try putting a comment on the group /G1/G2/G3 by name with trailing blanks + + CALL h5oset_comment_by_name_f(file_id, "/G1/G2/G3"//' ', grp_comment, error) + CALL check("h5oset_comment_by_name_f", error, total_error) + + comment_lg = ' ' + + CALL h5oget_comment_by_name_f(file_id, "/G1/G2/G3"//' ', comment_lg, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment_lg(1:13).NE.grp_comment)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + IF(comment_lg(14:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + ! ! Create the dataset ! CALL h5dcreate_f(group_id, dataset, H5T_STD_I32LE, space_id, dset_id, error) CALL check("h5dcreate_f", error, total_error) + + ! Putting a comment on the dataset + CALL h5oset_comment_f(dset_id, dset_comment, error) + CALL check("h5oset_comment_f", error, total_error) + + ! Try reading into a buffer that is the correct size + + CALL h5oget_comment_f(dset_id, comment, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! Try reading into a buffer that is to small + + CALL h5oget_comment_f(dset_id, comment_sm, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment_sm(1:10).NE.dset_comment(1:10))THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! Try reading into a buffer that is larger then needed + + comment_lg = ' ' + + CALL h5oget_comment_f(dset_id, comment_lg, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment_lg(1:15).NE.dset_comment)THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + IF(comment_lg(16:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + ! + ! Check optional parameter + ! + CALL h5oget_comment_f(dset_id, comment_lg, error, comment_size) + CALL check("h5oget_comment_f", error, total_error) + + IF( comment_size.NE.15)THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! CHECK h5oget_comment_by_name_f + + ! Try reading into a buffer that is the correct size + + CALL h5oget_comment_by_name_f(dset_id, ".", comment, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! Try with trailing blanks in the name + + CALL h5oget_comment_by_name_f(dset_id, ". ", comment, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! + ! Check optional parameter + ! + CALL h5oget_comment_by_name_f(dset_id, ". ", comment_lg, error, comment_size2) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF( comment_size2.NE.15)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + ! ! Write the data to the dataset. ! CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wdata2, dims2, error) CALL check("h5dwrite_f", error, total_error) + + ! ************************* + ! CHECK H5OEXISTS_BY_NAME_F + ! ************************* + + ! Create a soft link to /G1 + CALL h5lcreate_soft_f("/G1", file_id, "/G1_LINK", error) + CALL check("h5lcreate_soft_f", error, total_error) + + + ! Create a soft link to /G1000, does not exist + CALL h5lcreate_soft_f("/G1000", file_id, "/G1_FALSE", error) + CALL check("h5lcreate_soft_f", error, total_error) + + ! Create a soft link to /G1_LINK + CALL h5lcreate_soft_f("/G1_FALSE", file_id, "/G2_FALSE", error) + CALL check("h5lcreate_soft_f", error, total_error) + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_LINK", link_exists, error) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_exact = "/G1_LINK" + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_exact, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_lg = "/G1_LINK" + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_lg, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_lg = "/G1_LINK " + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_lg, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_FALSE", link_exists, error) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should not exist + IF(link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + ! Check optional parameter + + CALL h5pcreate_f(H5P_LINK_ACCESS_F,plist,error) + CALL check("h5pcreate_f",error,total_error) + + nlinks = 2 + CALL h5pset_nlinks_f(plist, nlinks, error) + CALL check("h5pset_nlinks_f", error, total_error) + ! Ensure that nlinks was set successfully + nlinks = 0 + CALL h5pget_nlinks_f(plist, nlinks, error) + CALL check("h5pget_nlinks_f",error,total_error) + CALL VERIFY("h5pget_nlinks_f", INT(nlinks), 2, total_error) + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_LINK", link_exists, error, plist) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.not.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF ! ! Close and release resources. ! @@ -283,6 +480,14 @@ SUBROUTINE test_h5o_link(total_error) CALL check("h5sclose_f", error, total_error) CALL h5gclose_f(group_id, error) CALL check("h5gclose_f", error, total_error) + + ! Test opening an object by index, note + CALL h5oopen_by_idx_f(file_id, "/G1/G2/G3", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, group_id, error) + CALL check("h5oopen_by_idx_f", error, total_error) + + CALL h5oclose_f(group_id, error) + CALL check("h5gclose_f", error, total_error) + ! ! create property to pass copy options ! @@ -324,7 +529,7 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tcopy_f(H5T_NATIVE_INTEGER, tid, error) CALL check("h5tcopy_f", error, total_error) - ! create named datatype + ! create named datatype CALL h5tcommit_f(file_id, NAME_DATATYPE_SIMPLE, tid, error) CALL check("h5tcommit_f", error, total_error) @@ -346,8 +551,7 @@ SUBROUTINE test_h5o_link(total_error) ! Compare the datatypes CALL h5tequal_f(tid, tid2, flag, error) IF(.NOT.flag)THEN - WRITE(*,*) "h5ocopy_f FAILED" - total_error = total_error + 1 + CALL check("h5ocopy_f FAILED", -1, total_error) ENDIF ! close the destination datatype @@ -436,7 +640,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Create a group, dataset, and committed datatype within the file, ! using the respective type of creation property lists. ! @@ -472,7 +675,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL h5sclose_f(dspace, error) CALL check("h5sclose_f",error,total_error) - ! Close current creation property lists CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) @@ -482,7 +684,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL check("h5pclose_f", error, total_error) ! Retrieve each object's creation property list - CALL H5Gget_create_plist_f(grp, gcpl, error) CALL check("H5Gget_create_plist", error, total_error) @@ -492,7 +693,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL H5Dget_create_plist_f(dset, dcpl, error) CALL check("H5Dget_create_plist_f", error, total_error) - ! Retrieve attribute phase change values on each creation property list and verify CALL H5Pget_attr_phase_change_f(gcpl, max_compact, min_dense, error) CALL check("H5Pget_attr_phase_change_f", error, total_error) @@ -509,9 +709,7 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Close current objects - CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) CALL h5pclose_f(dcpl,error) @@ -552,7 +750,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL H5Dget_create_plist_f(dset, dcpl, error) CALL check("H5Dget_create_plist_f", error, total_error) - ! Retrieve attribute phase change values on each creation property list and verify CALL H5Pget_attr_phase_change_f(gcpl, max_compact, min_dense, error) CALL check("H5Pget_attr_phase_change_f", error, total_error) @@ -569,9 +766,7 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Close current objects - CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) CALL h5pclose_f(dcpl,error) diff --git a/fortran/test/tH5O_F03.f90 b/fortran/test/tH5O_F03.f90 new file mode 100644 index 0000000..f060a7d --- /dev/null +++ b/fortran/test/tH5O_F03.f90 @@ -0,0 +1,547 @@ +!****h* root/fortran/test/tH5O_F03.f90 +! +! NAME +! tH5O_F03.f90 +! +! FUNCTION +! Test FORTRAN HDF5 H5O APIs which are dependent on FORTRAN 2003 +! features. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +!***** + +! ***************************************** +! *** H 5 O T E S T S +! ***************************************** +MODULE visit_cb + + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, PARAMETER :: info_size = 9 + + !------------------------------------------------------------------------- + ! Function: visit_obj_cb + ! + ! Purpose: Callback routine for visiting objects in a file + ! + ! Return: Success: 0 + ! Failure: -1 + ! + ! Programmer: M.S. Breitenfeld + ! July 12, 2012 + ! Adopted from C test. + ! + !------------------------------------------------------------------------- + ! + ! Object visit structs + TYPE, bind(c) :: obj_visit_t + CHARACTER(LEN=1), DIMENSION(1:180) :: path ! Path to object + INTEGER :: type_obj ! type of object + END TYPE obj_visit_t + + TYPE, bind(c) :: ovisit_ud_t + INTEGER :: idx ! Index in object visit structure + TYPE(obj_visit_t), DIMENSION(1:info_size) :: info ! Pointer to the object visit structure to use + END TYPE ovisit_ud_t + +CONTAINS + + INTEGER FUNCTION visit_obj_cb( group_id, name, oinfo, op_data) bind(C) + + IMPLICIT NONE + + INTEGER(HID_T) :: group_id + CHARACTER(LEN=1), DIMENSION(1:180) :: name + TYPE(h5o_info_t) :: oinfo + TYPE(ovisit_ud_t) :: op_data + + INTEGER :: len, i + INTEGER :: idx + + visit_obj_cb = 0 + + ! Since the name is generated in C and passed to a Fortran string, it + ! will be NULL terminated, so we need to find the end of the string. + + len = 1 + DO len = 1, 180 + IF(name(len) .EQ. C_NULL_CHAR) EXIT + ENDDO + + len = len - 1 + + ! Check for correct object information + + idx = op_data%idx + + DO i = 1, len + IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN + visit_obj_cb = -1 + RETURN + ENDIF + + IF(op_data%info(idx)%type_obj .NE. oinfo%type)THEN + visit_obj_cb = -1 + RETURN + ENDIF + + ENDDO + + ! Advance to next location in expected output + op_data%idx = op_data%idx + 1 + + END FUNCTION visit_obj_cb + +END MODULE visit_cb + +!/**************************************************************** +!** +!** test_h5o_refcount(): Test H5O refcounting functions. +!** +!****************************************************************/ + +SUBROUTINE test_h5o_refcount(total_error) + + USE HDF5 + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + CHARACTER(LEN=11), PARAMETER :: FILENAME = "th5o_ref.h5" + INTEGER, PARAMETER :: DIM0 = 5 + INTEGER, PARAMETER :: DIM1 = 10 + INTEGER(hid_t) :: fid ! HDF5 File ID + INTEGER(hid_t) :: grp, dset, dtype, dspace ! Object identifiers + TYPE(h5o_info_t) :: oinfo ! Object info struct + INTEGER(hsize_t), DIMENSION(1:2) :: dims + INTEGER :: error ! Value returned from API calls + + ! Create a new HDF5 file + CALL h5fcreate_f(FILENAME,H5F_ACC_TRUNC_F,fid,error) + CALL check("h5fcreate_f", error, total_error) + + ! Create a group, dataset, and committed datatype within the file + ! Create the group + CALL h5gcreate_f(fid, "group", grp, error) + CALL check("h5gcreate_f",error, total_error) + + ! Commit the type inside the group + CALL h5tcopy_f(H5T_NATIVE_INTEGER, dtype, error) + CALL check("H5Tcopy_f",error, total_error) + CALL h5tcommit_f(fid, "datatype", dtype, error) + CALL check("h5tcommit_f", error, total_error) + + ! Create the data space for the dataset. + dims(1) = DIM0 + dims(2) = DIM1 + + CALL h5screate_simple_f(2, dims, dspace, error) + CALL check("h5screate_simple_f", error, total_error) + + ! Create the dataset. + CALL h5dcreate_f(fid, "dataset", H5T_NATIVE_INTEGER, dspace, dset, error) + CALL check("h5dcreate_f", error, total_error) + CALL h5sclose_f(dspace, error) + CALL check("h5sclose_f", error, total_error) + + ! Get ref counts for each object. They should all be 1, since each object has a hard link. + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + ! Check h5oget_info + CALL h5oget_info_f(grp, oinfo, error) + CALL check("h5oget_info_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_f", -1, total_error) + ENDIF + IF(oinfo%type.NE.H5O_TYPE_GROUP_F)THEN + CALL check("h5oget_info_f", -1, total_error) + ENDIF + + ! Increment each object's reference count. + CALL h5oincr_refcount_f(grp, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5oincr_refcount_f(dtype, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5oincr_refcount_f(dset, error) + CALL check("h5oincr_refcount_f", error, total_error) + + ! Get ref counts for each object. They should all be 2 now. + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + ! Decrement the reference counts and check that they decrease back to 1. + CALL h5odecr_refcount_f(grp, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5odecr_refcount_f(dtype, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5odecr_refcount_f(dset, error) + CALL check("h5oincr_refcount_f", error, total_error) + + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + CALL h5gclose_f(grp, error) + CALL check("h5gclose_f",error, total_error) + CALL h5tclose_f(dtype, error) + CALL check("h5tclose_f",error, total_error) + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f",error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f",error, total_error) + +END SUBROUTINE test_h5o_refcount + +!**************************************************************** +!** +!** test_h5o_refcount(): Test H5O visit functions. +!** +!**************************************************************** + +SUBROUTINE obj_visit(total_error) + + USE HDF5 + + USE visit_cb + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + TYPE(ovisit_ud_t), TARGET :: udata ! User-data for visiting + INTEGER(hid_t) :: fid = -1 + INTEGER(hid_t) :: gid = -1 ! Group ID + TYPE(C_PTR) :: f_ptr + TYPE(C_FUNPTR) :: fun_ptr + CHARACTER(LEN=180) :: object_name + INTEGER :: ret_val + INTEGER :: error + + ! Construct "interesting" file to visit + CALL build_visit_file(fid) + + ! Inialize udata for testing purposes + udata%info(1)%path(1:1) ="." + udata%info(1)%type_obj = H5O_TYPE_GROUP_F + udata%info(2)%path(1:12) = & + (/"D","a","t","a","s","e","t","_","z","e","r","o"/) + udata%info(2)%type_obj =H5O_TYPE_DATASET_F + udata%info(3)%path(1:6) = & + (/"G","r","o","u","p","1"/) + udata%info(3)%type_obj = H5O_TYPE_GROUP_F + udata%info(4)%path(1:18) =& + (/"G","r","o","u","p","1","/","D","a","t","a","s","e","t","_","o","n","e"/) + udata%info(4)%type_obj = H5O_TYPE_DATASET_F + udata%info(5)%path(1:13) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2"/) + udata%info(5)%type_obj = H5O_TYPE_GROUP_F + udata%info(6)%path(1:25) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2","/","D","a","t","a","s","e","t","_","t","w","o"/) + udata%info(6)%type_obj = H5O_TYPE_DATASET_F + udata%info(7)%path(1:22) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2","/","T","y","p","e","_","t","w","o"/) + udata%info(7)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + udata%info(8)%path(1:15) =& + (/"G","r","o","u","p","1","/","T","y","p","e","_","o","n","e"/) + udata%info(8)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + udata%info(9)%path(1:9) =& + (/"T","y","p","e","_","z","e","r","o"/) + udata%info(9)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + + ! Visit all the objects reachable from the root group (with file ID) + udata%idx = 1 + + fun_ptr = C_FUNLOC(visit_obj_cb) + f_ptr = C_LOC(udata) + + ! Test h5ovisit_f + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + + ! Test h5ovisit_by_name_f + + object_name = "/" + udata%idx = 1 + + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error) + CALL check("h5ovisit_by_name_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_by_name_f", -1, total_error) + ENDIF + + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f",error, total_error) + +END SUBROUTINE obj_visit + +!**************************************************************** +!** +!** test_h5o_refcount(): Test H5O info functions. +!** +!**************************************************************** + +SUBROUTINE obj_info(total_error) + + USE HDF5 + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + INTEGER(hid_t) :: fid = -1 ! File ID + INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs + INTEGER(hid_t) :: did ! Dataset ID + INTEGER(hid_t) :: sid ! Dataspace ID + TYPE(hobj_ref_t_f), TARGET :: wref ! Reference to write + TYPE(hobj_ref_t_f), TARGET :: rref ! Reference to read + TYPE(H5O_info_t) :: oinfo ! Object info struct + INTEGER :: count = 0 ! Count within iterated group + INTEGER :: error + TYPE(C_PTR) :: f_ptr + + CHARACTER(LEN=6) :: GROUPNAME = "/group" + CHARACTER(LEN=6) :: GROUPNAME2 = "group2" + CHARACTER(LEN=6) :: GROUPNAME3 = "group3" + CHARACTER(LEN=5) :: DSETNAME = "/dset" + CHARACTER(LEN=5) :: DSETNAME2 = "dset2" + + ! Create file with a group and a dataset containing an object reference to the group + CALL h5fcreate_f("get_info.h5", H5F_ACC_TRUNC_F, fid, error) + CALL check("h5fcreate_f",error, total_error) + + ! Create dataspace to use for dataset + CALL h5screate_f(H5S_SCALAR_F, sid, error) + CALL check("h5screate_f",error,total_error) + + ! Create group to refer to + CALL h5gcreate_f(fid, GROUPNAME, gid, error) + CALL check("h5gcreate_f",error,total_error) + + ! Create nested groups + CALL h5gcreate_f(gid, GROUPNAME2, gid2, error) + CALL check("h5gcreate_f",error,total_error) + CALL h5gclose_f(gid2, error) + CALL check("h5gclose_f",error,total_error) + + CALL h5gcreate_f(gid, GROUPNAME3, gid2, error) + CALL check("h5gcreate_f",error,total_error) + CALL h5gclose_f(gid2, error) + CALL check("h5gclose_f",error,total_error) + + ! Create bottom dataset + CALL h5dcreate_f(gid, DSETNAME2, H5T_NATIVE_INTEGER, sid, did, error) + CALL check("h5dcreate_f",error, total_error) + + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + + CALL h5gclose_f(gid, error) + CALL check("h5gclose_f",error,total_error) + + ! Create dataset + CALL h5dcreate_f(fid, DSETNAME, H5T_STD_REF_OBJ, sid, did, error) + CALL check("h5dcreate_f",error, total_error) + + f_ptr = C_LOC(wref) + + ! Create reference to group + CALL h5rcreate_f(fid, GROUPNAME, H5R_OBJECT_F, f_ptr, error) + CALL check("h5rcreate_f",error, total_error) + + ! Write reference to disk + CALL h5dwrite_f(did, H5T_STD_REF_OBJ, f_ptr, error) + CALL check("h5dwrite_f",error, total_error) + + ! Close objects + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + CALL h5sclose_f(sid, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f", error, total_error) + + ! Re-open file + CALL h5fopen_f("get_info.h5", H5F_ACC_RDWR_F, fid, error) + CALL check("h5fopen_f", error, total_error) + + ! Re-open dataset + CALL h5dopen_f(fid, DSETNAME, did, error) + CALL check("h5dopen_f", error, total_error) + + ! Read in the reference + + f_ptr = C_LOC(rref) + + CALL h5dread_f(did, H5T_STD_REF_OBJ, f_ptr, error) + CALL check("H5Dread_f",error, total_error) + + ! Dereference to get the group + + CALL h5rdereference_f(did, H5R_OBJECT_F, f_ptr, gid, error) + CALL check("h5rdereference_f", error, total_error) + + CALL h5oget_info_by_idx_f(gid, ".", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, oinfo, error) + CALL check("h5oget_info_by_idx_f", error, total_error) + + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + + IF(oinfo%type.NE.H5O_TYPE_DATASET_F)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + + ! Close objects + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + CALL h5gclose_f(gid, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f", error, total_error) + +END SUBROUTINE obj_info + +!------------------------------------------------------------------------- +! Function: build_visit_file +! +! Purpose: Build an "interesting" file to use for visiting links & objects +! +! Programmer: M. Scot Breitenfeld +! July 12, 2012 +! NOTE: Adapted from C test. +! +!------------------------------------------------------------------------- +! + +SUBROUTINE build_visit_file(fid) + + USE HDF5 + IMPLICIT NONE + + INTEGER(hid_t) :: fid ! File ID + INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs + INTEGER(hid_t) :: sid = -1 ! Dataspace ID + INTEGER(hid_t) :: did = -1 ! Dataset ID + INTEGER(hid_t) :: tid = -1 ! Datatype ID + CHARACTER(LEN=20) :: filename = 'visit.h5' + INTEGER :: error + + ! Create file for visiting + CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, fid, error) + + ! Create group + CALL H5Gcreate_f(fid, "/Group1", gid, error) + + ! Create nested group + CALL H5Gcreate_f(gid, "Group2", gid2, error) + + ! Close groups + CALL h5gclose_f(gid2, error) + CALL h5gclose_f(gid, error) + + ! Create soft links to groups created + CALL H5Lcreate_soft_f("/Group1", fid, "/soft_one", error) + CALL H5Lcreate_soft_f("/Group1/Group2", fid, "/soft_two", error) + + ! Create dangling soft link + CALL H5Lcreate_soft_f("nowhere", fid, "/soft_dangle", error) + + ! Create hard links to all groups + CALL H5Lcreate_hard_f(fid, "/", fid, "hard_zero", error) + CALL H5Lcreate_hard_f(fid, "/Group1", fid, "hard_one", error) + CALL H5Lcreate_hard_f(fid, "/Group1/Group2", fid, "hard_two", error) + + ! Create loops w/hard links + CALL H5Lcreate_hard_f(fid, "/Group1", fid, "/Group1/hard_one", error) + CALL H5Lcreate_hard_f(fid, "/", fid, "/Group1/Group2/hard_zero", error) + + ! Create dataset in each group + CALL H5Screate_f(H5S_SCALAR_F, sid, error) + + CALL H5Dcreate_f(fid, "/Dataset_zero", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Dcreate_f(fid, "/Group1/Dataset_one", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Dcreate_f(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Sclose_f(sid, error) + + ! Create named datatype in each group + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + + CALL H5Tcommit_f(fid, "/Type_zero", tid, error) + CALL H5Tclose_f(tid, error) + + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + CALL H5Tcommit_f(fid, "/Group1/Type_one", tid, error) + CALL H5Tclose_f(tid, error) + + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + CALL H5Tcommit_f(fid, "/Group1/Group2/Type_two", tid, error) + CALL H5Tclose_f(tid, error) + +END SUBROUTINE build_visit_file diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90 index 9605c45..b42a8e6 100644 --- a/fortran/test/tH5T.f90 +++ b/fortran/test/tH5T.f90 @@ -86,8 +86,8 @@ CHARACTER(LEN=2), DIMENSION(dimsize) :: char_member_out ! Buffer to read data out INTEGER, DIMENSION(dimsize) :: int_member INTEGER, DIMENSION(dimsize) :: int_member_out - DOUBLE PRECISION, DIMENSION(dimsize) :: double_member - DOUBLE PRECISION, DIMENSION(dimsize) :: double_member_out + REAL(KIND=Fortran_DOUBLE), DIMENSION(dimsize) :: double_member + REAL(KIND=Fortran_DOUBLE), DIMENSION(dimsize) :: double_member_out REAL, DIMENSION(dimsize) :: real_member REAL, DIMENSION(dimsize) :: real_member_out INTEGER :: i diff --git a/fortran/test/tH5T_F03.f90 b/fortran/test/tH5T_F03.f90 index 215ac9e..1c4da8b 100644 --- a/fortran/test/tH5T_F03.f90 +++ b/fortran/test/tH5T_F03.f90 @@ -103,7 +103,7 @@ SUBROUTINE test_array_compound_atomic(total_error) ! Create file CALL h5fcreate_f(FILENAME,H5F_ACC_TRUNC_F,fid1,error) - CALL check("h5fcreate_f", error, total_error) + CALL check("h5fcreate_f", error, total_error) ! Create dataspace for datasets CALL h5screate_simple_f(SPACE1_RANK, sdims1, sid1, error) @@ -1976,8 +1976,8 @@ SUBROUTINE t_regref(total_error) INTEGER(HSIZE_T), DIMENSION(1:1) :: maxdims INTEGER(hssize_t) :: npoints - TYPE(hdset_reg_ref_t_f), DIMENSION(1:dim0), TARGET :: wdata ! Write buffer - TYPE(hdset_reg_ref_t_f), DIMENSION(:), ALLOCATABLE, TARGET :: rdata ! Read buffer + TYPE(hdset_reg_ref_t_f03), DIMENSION(1:dim0), TARGET :: wdata ! Write buffer + TYPE(hdset_reg_ref_t_f03), DIMENSION(:), ALLOCATABLE, TARGET :: rdata ! Read buffer INTEGER(size_t) :: size CHARACTER(LEN=1), DIMENSION(1:ds2dim0,1:ds2dim1), TARGET :: wdata2 @@ -2058,7 +2058,6 @@ SUBROUTINE t_regref(total_error) CALL check("h5sclose_f",error, total_error) CALL h5fclose_f(file , error) CALL check("h5fclose_f",error, total_error) - ! ! Now we begin the read section of this example. ! @@ -2095,10 +2094,11 @@ SUBROUTINE t_regref(total_error) ! Open the referenced object, retrieve its region as a ! dataspace selection. ! - CALL H5Rdereference_f(dset, rdata(i), dset2, error) + f_ptr = C_LOC(rdata(i)) + CALL H5Rdereference_f(dset, H5R_DATASET_REGION_F, f_ptr, dset2, error) CALL check("H5Rdereference_f",error, total_error) - - CALL H5Rget_region_f(dset, rdata(i), space, error) + + CALL H5Rget_region_f(dset, f_ptr, space, error) CALL check("H5Rget_region_f",error, total_error) ! @@ -2754,7 +2754,7 @@ SUBROUTINE t_string(total_error) CALL check("H5Dget_type_f",error, total_error) CALL H5Tget_size_f(filetype, size, error) CALL check("H5Tget_size_f",error, total_error) - CALL VERIFY("H5Tget_size_f", size, sdim, total_error) + CALL VERIFY("H5Tget_size_f", INT(size), INT(sdim), total_error) ! ! Get dataspace. ! @@ -2800,4 +2800,295 @@ SUBROUTINE t_string(total_error) END SUBROUTINE t_string +SUBROUTINE vl_test_special_char(cleanup, total_error) + + USE hdf5 + IMPLICIT NONE + + INTERFACE + SUBROUTINE setup_buffer(data_in, line_lengths, char_type) + USE hdf5 + USE ISO_C_BINDING + IMPLICIT NONE + CHARACTER(len=*), DIMENSION(:) :: data_in + INTEGER(size_t), DIMENSION(:) :: line_lengths + CHARACTER(KIND=C_CHAR,LEN=*) :: char_type + END SUBROUTINE setup_buffer + END INTERFACE + + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=16), PARAMETER :: filename = "t_controlchar.h5" + INTEGER, PARAMETER :: line_length = 10 + INTEGER(hid_t) :: file + INTEGER(hid_t) :: dataset0 + CHARACTER(len=line_length), DIMENSION(1:100) :: data_in + CHARACTER(len=line_length), DIMENSION(1:100) :: data_out + INTEGER(size_t), DIMENSION(1:100) :: line_lengths + INTEGER(hid_t) :: string_id, space, dcpl + INTEGER(hsize_t), DIMENSION(1:1) :: dims = (/0/) + INTEGER(hsize_t), DIMENSION(1:1) :: max_dims = (/0/) + INTEGER(hsize_t), DIMENSION(1:2) :: data_dims = (/0,0/) + INTEGER(hsize_t), DIMENSION(1:1) :: chunk =(/10/) + INTEGER, PARAMETER :: ncontrolchar = 7 + CHARACTER(KIND=C_CHAR,LEN=1), DIMENSION(1:ncontrolchar) :: controlchar = & + (/C_ALERT, C_BACKSPACE,C_CARRIAGE_RETURN, C_FORM_FEED,C_HORIZONTAL_TAB,C_VERTICAL_TAB, C_NEW_LINE/) + INTEGER :: i, j, n, error + n = 8 + ! + ! Create a new file using the default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file, error) + CALL check("h5fcreate_f",error, total_error) + + max_dims = (/H5S_UNLIMITED_F/) + + ! + ! Create the memory datatype. + ! + CALL h5tcopy_f(h5t_string, string_id, error) + CALL check("h5tcopy_f", error, total_error) + CALL h5tset_strpad_f(string_id, h5t_str_nullpad_f, error) + CALL check("h5tset_strpad_f", error, total_error) + dims(1) = n + ! + ! Create dataspace. + ! + CALL h5screate_simple_f(1, dims, space, error, max_dims) + CALL check("h5screate_simple_f", error, total_error) + CALL h5pcreate_f(h5p_dataset_create_f, dcpl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_chunk_f(dcpl, 1, chunk, error) + CALL check("h5pset_chunk_f", error, total_error) + + data_dims(1) = line_length + data_dims(2) = n + ! + ! Create data with strings containing various control characters. + ! + DO i = 1, ncontrolchar + ! + ! Create the dataset, for the string with control character and write the string data to it. + ! + CALL h5dcreate_f(file, controlchar(i), string_id, space, dataset0, error, dcpl) + CALL check("h5dcreate_f", error, total_error) + CALL setup_buffer(data_in(1:n), line_lengths, controlchar(i)) + CALL h5dwrite_vl_f(dataset0, string_id, data_in(1:n), data_dims, line_lengths(1:n), error, space) + CALL check("h5dwrite_vl_f", error, total_error) + ! + ! Read the string back. + ! + CALL h5dread_vl_f(dataset0, string_id, data_out(1:n), data_dims, line_lengths(1:n), error, space) + CALL check("h5dread_vl_f", error, total_error) + + DO j = 1, n + IF(data_in(j).NE.data_out(j))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + CALL h5dclose_f(dataset0, error) + CALL check("h5dclose_f", error, total_error) + ENDDO + + CALL h5pclose_f(dcpl, error) + CALL check("h5pclose_f", error, total_error) + CALL h5sclose_f(space, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(file, error) + CALL check("h5fclose_f", error, total_error) + +END SUBROUTINE vl_test_special_char + + +SUBROUTINE setup_buffer(data_in, line_lengths, char_type) + + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + ! Creates a simple "Data_in" consisting of the letters of the alphabet, + ! one per line, with a control character. + + CHARACTER(len=10), DIMENSION(:) :: data_in + INTEGER(size_t), DIMENSION(:) :: line_lengths + INTEGER, DIMENSION(1:3) :: letters + CHARACTER(LEN=3) :: lets + CHARACTER(KIND=C_CHAR,LEN=*) :: char_type + CHARACTER(KIND=C_CHAR,LEN=1) :: char_tmp + INTEGER :: i, j, n, ff + + ! Convert the letters and special character to integers + lets = 'abc' + + READ(lets,'(3A1)') letters + READ(char_type,'(A1)') ff + n = SIZE(data_in) + j = 1 + DO i=1,n-1 + IF( j .EQ. 4 )THEN + WRITE(char_tmp,'(A1)') ff + data_in(i:i) = char_tmp + ELSE + WRITE(char_tmp,'(A1)') letters(j) + data_in(i:i) = char_tmp + ENDIF + line_lengths(i) = LEN_TRIM(data_in(i)) + j = j + 1 + IF( j .EQ. 5 ) j = 1 + END DO + WRITE(char_tmp,'(A1)') ff + data_in(n:n) = char_tmp + line_lengths(n) = 1 + +END SUBROUTINE setup_buffer + +!------------------------------------------------------------------------- +! Function: test_nbit +! +! Purpose: Tests (real, 4 byte) datatype for nbit filter +! +! Return: Success: 0 +! Failure: >0 +! +! Programmer: M. Scot Breitenfeld +! Decemeber 7, 2010 +! +! Modifications: Moved this subroutine from the 1.8 test file and +! modified it to use F2003 features. +! This routine requires 4 byte reals, so we use F2003 features to +! ensure the requirement is satisfied in a portable way. +! The need for this arises when a user specifies the default real is 8 bytes. +! MSB 7/31/12 +! +!------------------------------------------------------------------------- +! + +SUBROUTINE test_nbit(cleanup, total_error ) + + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + INTEGER, PARAMETER :: wp = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(INOUT) :: total_error + INTEGER(hid_t) :: file + + INTEGER(hid_t) :: dataset, datatype, space, dc, mem_type_id + INTEGER(hsize_t), DIMENSION(1:2) :: dims = (/2,5/) + INTEGER(hsize_t), DIMENSION(1:2) :: chunk_dim = (/2,5/) + ! orig_data[] are initialized to be within the range that can be represented by + ! dataset datatype (no precision loss during datatype conversion) + ! + REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: orig_data = & + RESHAPE( (/188384.00, 19.103516, -1.0831790e9, -84.242188, & + 5.2045898, -49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000/) , (/2,5/) ) + REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: new_data + INTEGER(size_t) :: PRECISION, offset + INTEGER :: error + LOGICAL :: status + INTEGER(size_t) :: i, j + TYPE(C_PTR) :: f_ptr + + ! check to see if filter is available + CALL H5Zfilter_avail_f(H5Z_FILTER_NBIT_F, status, error) + IF(.NOT.status)THEN ! We don't have H5Z_FILTER_NBIT_F filter + total_error = -1 ! so return + RETURN + ENDIF + + CALL H5Fcreate_f("nbit.h5", H5F_ACC_TRUNC_F, file, error) + CALL check("H5Fcreate_f", error, total_error) + + ! Define dataset datatype (integer), and set precision, offset + CALL H5Tcopy_f(H5T_IEEE_F32BE, datatype, error) + CALL CHECK(" H5Tcopy_f", error, total_error) + CALL H5Tset_fields_f(datatype, 26_size_t, 20_size_t, 6_size_t, 7_size_t, 13_size_t, error) + CALL CHECK(" H5Tset_fields_f", error, total_error) + offset = 7 + CALL H5Tset_offset_f(datatype, offset, error) + CALL CHECK(" H5Tset_offset_f", error, total_error) + PRECISION = 20 + CALL H5Tset_precision_f(datatype,PRECISION, error) + CALL CHECK(" H5Tset_precision_f", error, total_error) + + CALL H5Tset_size_f(datatype, 4_size_t, error) + CALL CHECK(" H5Tset_size_f", error, total_error) + + CALL H5Tset_ebias_f(datatype, 31_size_t, error) + CALL CHECK(" H5Tset_ebias_f", error, total_error) + + ! Create the data space + CALL H5Screate_simple_f(2, dims, space, error) + CALL CHECK(" H5Screate_simple_f", error, total_error) + + ! USE nbit filter + CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dc, error) + CALL CHECK(" H5Pcreate_f", error, total_error) + + CALL H5Pset_chunk_f(dc, 2, chunk_dim, error) + CALL CHECK(" H5Pset_chunk_f", error, total_error) + CALL H5Pset_nbit_f(dc, error) + CALL CHECK(" H5Pset_nbit_f", error, total_error) + + ! Create the dataset + CALL H5Dcreate_f(file, "nbit_real", datatype, & + space, dataset, error, dc) + CALL CHECK(" H5Dcreate_f", error, total_error) + + !---------------------------------------------------------------------- + ! STEP 1: Test nbit by setting up a chunked dataset and writing + ! to it. + !---------------------------------------------------------------------- + ! + mem_type_id = h5kind_to_type(wp,H5_REAL_KIND) + + f_ptr = C_LOC(orig_data(1,1)) + CALL H5Dwrite_f(dataset, mem_type_id, f_ptr, error) + CALL CHECK(" H5Dwrite_f", error, total_error) + + !---------------------------------------------------------------------- + ! STEP 2: Try to read the data we just wrote. + !---------------------------------------------------------------------- + ! + f_ptr = C_LOC(new_data(1,1)) + CALL H5Dread_f(dataset, mem_type_id, f_ptr, error) + CALL CHECK(" H5Dread_f", error, total_error) + + ! Check that the values read are the same as the values written + ! Assume size of long long = size of double + ! + i_loop: DO i = 1, dims(1) + j_loop: DO j = 1, dims(2) + IF(.NOT.(orig_data(i,j).EQ.orig_data(i,j))) CYCLE ! skip IF value is NaN + IF(new_data(i,j) .NE. orig_data(i,j))THEN + total_error = total_error + 1 + WRITE(*,'(" Read different values than written.")') + WRITE(*,'(" At index ", 2(1X,I0))') i, j + EXIT i_loop + END IF + ENDDO j_loop + ENDDO i_loop + + !---------------------------------------------------------------------- + ! Cleanup + !---------------------------------------------------------------------- + ! + CALL H5Tclose_f(datatype, error) + CALL CHECK(" H5Tclose_f", error, total_error) + CALL H5Pclose_f(dc, error) + CALL CHECK(" H5Pclose_f", error, total_error) + CALL H5Sclose_f(space, error) + CALL CHECK(" H5Sclose_f", error, total_error) + CALL H5Dclose_f(dataset, error) + CALL CHECK(" H5Dclose_f", error, total_error) + CALL H5Fclose_f(file, error) + CALL CHECK(" H5Fclose_f", error, total_error) + +END SUBROUTINE test_nbit + diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index 3fc3dd9..d381b2a 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -209,6 +209,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -223,6 +224,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/fortran/testpar/hyper.f90 b/fortran/testpar/hyper.f90 index 1d65ae1..1a580ca 100644 --- a/fortran/testpar/hyper.f90 +++ b/fortran/testpar/hyper.f90 @@ -50,6 +50,7 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) INTEGER :: icount ! number of elements in array CHARACTER(len=80) :: filename ! filename INTEGER :: i + INTEGER :: actual_io_mode ! The type of I/O performed by this process !////////////////////////////////////////////////////////// ! initialize the array data between the processes (3) @@ -180,6 +181,24 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5dwrite_f", hdferror, nerrors) + ! Check h5pget_mpio_actual_io_mode_f function + CALL h5pget_mpio_actual_io_mode_f(dxpl_id, actual_io_mode, hdferror) + CALL check("h5pget_mpio_actual_io_mode_f", hdferror, nerrors) + + IF(do_collective.AND.do_chunk)THEN + IF(actual_io_mode.NE.H5D_MPIO_CHUNK_COLLECTIVE_F)THEN + CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors) + ENDIF + ELSEIF(.NOT.do_collective)THEN + IF(actual_io_mode.NE.H5D_MPIO_NO_COLLECTIVE_F)THEN + CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors) + ENDIF + ELSEIF( do_collective.AND.(.NOT.do_chunk))THEN + IF(actual_io_mode.NE.H5D_MPIO_CONTIG_COLLECTIVE_F)THEN + CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors) + ENDIF + ENDIF + !////////////////////////////////////////////////////////// ! close HDF5 I/O !////////////////////////////////////////////////////////// diff --git a/hl/Makefile.in b/hl/Makefile.in index 162f80c..7eddea8 100644 --- a/hl/Makefile.in +++ b/hl/Makefile.in @@ -214,6 +214,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -228,6 +229,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in index 0a8677c..9e64681 100644 --- a/hl/c++/Makefile.in +++ b/hl/c++/Makefile.in @@ -210,6 +210,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -224,6 +225,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in index cbc0e90..a6504a7 100644 --- a/hl/c++/examples/Makefile.in +++ b/hl/c++/examples/Makefile.in @@ -176,6 +176,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -190,6 +191,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 83c7d68..ddef71c 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -240,6 +240,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -254,6 +255,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -450,7 +452,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 121 +LT_VERS_REVISION = 122 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in index cba6959..96264af 100644 --- a/hl/c++/test/Makefile.in +++ b/hl/c++/test/Makefile.in @@ -206,6 +206,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -220,6 +221,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in index 3435edb..b434852 100644 --- a/hl/examples/Makefile.in +++ b/hl/examples/Makefile.in @@ -176,6 +176,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -190,6 +191,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index fa03794..d3e02eb 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -214,6 +214,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -228,6 +229,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index 622868c..7aec62b 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -177,6 +177,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -191,6 +192,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index d38c0ae..706ab12 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -254,6 +254,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -268,6 +269,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -464,7 +466,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 121 +LT_VERS_REVISION = 122 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index 4039fe1..021b5bf 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -220,6 +220,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -234,6 +235,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index c2ccd69..d7be223 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -239,6 +239,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -253,6 +254,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -449,7 +451,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 121 +LT_VERS_REVISION = 122 LT_VERS_AGE = 0 # This library is our main target. diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in index 611863f..ca0b40c 100644 --- a/hl/test/Makefile.in +++ b/hl/test/Makefile.in @@ -242,6 +242,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -256,6 +257,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 4cef1b4..a4a10e4 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -676,7 +676,7 @@ static int test_generate(void) goto out; /* Indicate success */ - retval = 0; + return 0; /* error zone, gracefully close */ out: diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in index 2f35748..79bd635 100644 --- a/hl/tools/Makefile.in +++ b/hl/tools/Makefile.in @@ -211,6 +211,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -225,6 +226,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in index a64180b..3b0124d 100644 --- a/hl/tools/gif2h5/Makefile.in +++ b/hl/tools/gif2h5/Makefile.in @@ -222,6 +222,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -236,6 +237,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/perform/Makefile.am b/perform/Makefile.am index 5d0e11d..988ec63 100644 --- a/perform/Makefile.am +++ b/perform/Makefile.am @@ -37,8 +37,9 @@ h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # Some programs are not built or run by default, but can be built by hand or by # specifying --enable-build-all at configure time. # Also, some of these programs should only be built in parallel. +# Currently there is no such program. if BUILD_PARALLEL_CONDITIONAL - PARA_BUILD_ALL=benchpar + PARA_BUILD_ALL= endif if BUILD_ALL_CONDITIONAL BUILD_ALL_PROGS=$(PARA_BUILD_ALL) diff --git a/perform/Makefile.in b/perform/Makefile.in index 31d30ec..42dda1c 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -91,20 +91,17 @@ CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" -@BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_1 = benchpar$(EXEEXT) +am__EXEEXT_1 = @BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_2 = $(am__EXEEXT_1) PROGRAMS = $(bin_PROGRAMS) -benchpar_SOURCES = benchpar.c -benchpar_OBJECTS = benchpar.$(OBJEXT) -benchpar_LDADD = $(LDADD) -benchpar_DEPENDENCIES = $(LIBHDF5) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent chunk_SOURCES = chunk.c chunk_OBJECTS = chunk.$(OBJEXT) chunk_LDADD = $(LDADD) chunk_DEPENDENCIES = $(LIBHDF5) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = am_h5perf_OBJECTS = pio_perf.$(OBJEXT) pio_engine.$(OBJEXT) \ pio_timer.$(OBJEXT) h5perf_OBJECTS = $(am_h5perf_OBJECTS) @@ -161,12 +158,10 @@ am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -SOURCES = benchpar.c chunk.c $(h5perf_SOURCES) \ - $(h5perf_serial_SOURCES) iopipe.c overhead.c perf.c \ - perf_meta.c zip_perf.c -DIST_SOURCES = benchpar.c chunk.c $(h5perf_SOURCES) \ - $(h5perf_serial_SOURCES) iopipe.c overhead.c perf.c \ - perf_meta.c zip_perf.c +SOURCES = chunk.c $(h5perf_SOURCES) $(h5perf_serial_SOURCES) iopipe.c \ + overhead.c perf.c perf_meta.c zip_perf.c +DIST_SOURCES = chunk.c $(h5perf_SOURCES) $(h5perf_serial_SOURCES) \ + iopipe.c overhead.c perf.c perf_meta.c zip_perf.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -254,6 +249,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -268,6 +264,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -469,7 +466,8 @@ h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # Some programs are not built or run by default, but can be built by hand or by # specifying --enable-build-all at configure time. # Also, some of these programs should only be built in parallel. -@BUILD_PARALLEL_CONDITIONAL_TRUE@PARA_BUILD_ALL = benchpar +# Currently there is no such program. +@BUILD_PARALLEL_CONDITIONAL_TRUE@PARA_BUILD_ALL = @BUILD_ALL_CONDITIONAL_TRUE@BUILD_ALL_PROGS = $(PARA_BUILD_ALL) # Define programs that will be run in 'make check' @@ -604,9 +602,6 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -benchpar$(EXEEXT): $(benchpar_OBJECTS) $(benchpar_DEPENDENCIES) $(EXTRA_benchpar_DEPENDENCIES) - @rm -f benchpar$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(benchpar_OBJECTS) $(benchpar_LDADD) $(LIBS) chunk$(EXEEXT): $(chunk_OBJECTS) $(chunk_DEPENDENCIES) $(EXTRA_chunk_DEPENDENCIES) @rm -f chunk$(EXEEXT) $(AM_V_CCLD)$(LINK) $(chunk_OBJECTS) $(chunk_LDADD) $(LIBS) @@ -638,7 +633,6 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchpar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iopipe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overhead.Po@am__quote@ diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index d3459f5..8c1c8b0 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.131 currently under development +HDF5 version 1.9.132 currently under development ================================================================================ @@ -39,6 +39,9 @@ New Features Configuration: ------------- + - Fixed AIX Fortran compiler flags to use appropriate settings for + debugging, profiling, optimization situations. HDFFV-8069. (AKC + 2012/09/27) - Updated to latest autotools and changed all hard *.sh scripts to configure managed *.sh.in files. Removed overloading of autotools TESTS variable by examples and tests. Renamed configure.in to @@ -698,6 +701,9 @@ Bug Fixes since HDF5-1.8.0 release Performance ------------- + - Removed program perform/benchpar from the enable-build-all list. The + program will be retired or moved to another location. HDFFV-8156 + (AKC 2012/10/01) - Retired program perform/mpi-perf. Its purpose has been incorporated into h5perf before. (AKC 2012/09/20) - ifdefs added to tests around include unistd.h and function to simulate diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9df014c..876711a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -458,6 +458,7 @@ SET (H5P_SRCS ${HDF5_SRC_DIR}/H5Pdcpl.c ${HDF5_SRC_DIR}/H5Pdeprec.c ${HDF5_SRC_DIR}/H5Pdxpl.c + ${HDF5_SRC_DIR}/H5Pencdec.c ${HDF5_SRC_DIR}/H5Pfapl.c ${HDF5_SRC_DIR}/H5Pfcpl.c ${HDF5_SRC_DIR}/H5Pfmpl.c diff --git a/src/H5public.h b/src/H5public.h index 7e17461..88e514d 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 131 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 132 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.131" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.132" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index 19c6404..c3b2e88 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -304,6 +304,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -318,6 +319,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ @@ -514,7 +516,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 121 +LT_VERS_REVISION = 122 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8e63326..5551fa3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -78,6 +78,47 @@ FOREACH (ref_file ${HDF5_REFERENCE_FILES}) ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES}) # -------------------------------------------------------------------- +# Copy test files from test/testfiles/plist_files dir to test dir +# -------------------------------------------------------------------- +SET (HDF5_REFERENCE_PLIST_FILES + acpl_be + acpl_le + dapl_be + dapl_le + dcpl_be + dcpl_le + dxpl_be + dxpl_le + fapl_be + fapl_le + fcpl_be + fcpl_le + gcpl_be + gcpl_le + lapl_be + lapl_le + lcpl_be + lcpl_le + ocpl_be + ocpl_le + ocpypl_be + ocpypl_le + strcpl_be + strcpl_le +) + +FOREACH (plistfile ${HDF5_REFERENCE_PLIST_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/${plistfile}") + #MESSAGE (STATUS " Copying ${plistfile} to ${dset}") + ADD_CUSTOM_COMMAND ( + TARGET ${HDF5_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest} + ) +ENDFOREACH (plistfile ${HDF5_REFERENCE_PLIST_FILES}) + +# -------------------------------------------------------------------- #-- Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- SET (HDF5_REFERENCE_TEST_FILES @@ -314,6 +355,8 @@ SET (H5_TESTS testmeta #links_env file_image + enc_dec_plist + enc_dec_plist_with_endianess ) FOREACH (test ${H5_TESTS}) @@ -638,6 +681,7 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) gen_specmetaread gen_sizes_lheap gen_file_image + gen_plist ) FOREACH (gen ${H5_GENERATORS}) diff --git a/test/Makefile.in b/test/Makefile.in index 6632526..5314d2e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -573,6 +573,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -587,6 +588,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 5d594a6..88c47f5 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -23,6 +23,7 @@ SET (testphdf5_SRCS ${HDF5_TEST_PAR_SOURCE_DIR}/t_span_tree.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c + ${HDF5_TEST_PAR_SOURCE_DIR}/t_prop.c ) #-- Adding test for testhdf5 diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 4b5ca13..8bb57e2 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -235,6 +235,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -249,6 +250,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/Makefile.in b/tools/Makefile.in index 646b46a..13ea995 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -211,6 +211,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -225,6 +226,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index 1c1a58c..4c985f6 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -214,6 +214,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -228,6 +229,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 93494dc..a208d15 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -221,6 +221,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -235,6 +236,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index dc60048..8766eb6 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -1088,13 +1088,15 @@ IF (BUILD_TESTING) # test for compound signed/unsigned datasets ADD_H5_TEST (tcmpdintsize 0 --enable-error-stack tcmpdintsize.h5) # test for signed/unsigned scalar datasets - ADD_H5_TEST (tscalarintsize 0 --enable-error-stack tscalarintsize.h5) + # TODO: failed on mac with intel compiler. (Allen will work on it) + #ADD_H5_TEST (tscalarintsize 0 --enable-error-stack tscalarintsize.h5) # test for signed/unsigned attributes ADD_H5_TEST (tattrintsize 0 --enable-error-stack tattrintsize.h5) # test for compound signed/unsigned attributes ADD_H5_TEST (tcmpdattrintsize 0 --enable-error-stack tcmpdattrintsize.h5) # test for signed/unsigned scalar attributes - ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5) + # TODO: failed on mac with intel compiler. (Allen will work on it) + #ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5) # test for displaying groups ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5) # test for displaying the selected groups diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 883337a..65d0466 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -220,6 +220,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -234,6 +235,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index c90c364..f1eaf0c 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -683,13 +683,15 @@ TOOLTEST packedbits.ddl --enable-error-stack packedbits.h5 # test for compound signed/unsigned datasets TOOLTEST tcmpdintsize.ddl --enable-error-stack tcmpdintsize.h5 # test for signed/unsigned scalar datasets -TOOLTEST tscalarintsize.ddl --enable-error-stack tscalarintsize.h5 +# TODO: failed on mac with intel compiler. (Allen will work on it) +#TOOLTEST tscalarintsize.ddl --enable-error-stack tscalarintsize.h5 # test for signed/unsigned attributes TOOLTEST tattrintsize.ddl --enable-error-stack tattrintsize.h5 # test for compound signed/unsigned attributes TOOLTEST tcmpdattrintsize.ddl --enable-error-stack tcmpdattrintsize.h5 # test for signed/unsigned scalar attributes -TOOLTEST tscalarattrintsize.ddl --enable-error-stack tscalarattrintsize.h5 +# TODO: failed on mac with intel compiler. (Allen will work on it) +#TOOLTEST tscalarattrintsize.ddl --enable-error-stack tscalarattrintsize.h5 # test for displaying groups TOOLTEST tgroup-1.ddl --enable-error-stack tgroup.h5 # test for displaying the selected groups diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index b3217d2..542bc33 100644 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -214,6 +214,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -228,6 +229,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index 96b4190..4bdb6d5 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -228,6 +228,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -242,6 +243,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index 3611a59..986ba65 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -208,6 +208,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -222,6 +223,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 2892649..0d00a3e 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -228,6 +228,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -242,6 +243,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index 6473b69..43c19f6 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -243,6 +243,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -257,6 +258,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index caad7ee..936311f 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -206,6 +206,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -220,6 +221,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index 961c943..2aeafbe 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -268,6 +268,7 @@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ GPFS = @GPFS@ GREP = @GREP@ +H5BLD_STATIC = @H5BLD_STATIC@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -282,6 +283,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ +HDF5_USE_SHLIB = @HDF5_USE_SHLIB@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ HDF_FORTRAN2003 = @HDF_FORTRAN2003@ diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in index 233c80a..d05b920 100644 --- a/tools/misc/h5cc.in +++ b/tools/misc/h5cc.in @@ -102,6 +102,10 @@ CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" LIBS="${HDF5_LIBS:-$LIBSBASE}" +# If static was disabled, @HDF5_USE_SHLIB@ will be yes. In that case +# HDF5_USE_SHLIB should be set to yes because there are no static +# lib files. +HDF5_USE_SHLIB="@HDF5_USE_SHLIB@" USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" usage() { diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 8e41032..0891765 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -505,7 +505,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.131" +#define H5_PACKAGE_STRING "HDF5 1.9.132" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -514,7 +514,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.131" +#define H5_PACKAGE_VERSION "1.9.132" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -677,7 +677,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.131" +#define H5_VERSION "1.9.132" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h index 5beaea6..76e37d0 100644 --- a/windows/src/H5pubconf.h +++ b/windows/src/H5pubconf.h @@ -530,7 +530,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.131" +#define H5_PACKAGE_STRING "HDF5 1.9.132" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -539,7 +539,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.131" +#define H5_PACKAGE_VERSION "1.9.132" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "I64" @@ -710,7 +710,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.131" +#define H5_VERSION "1.9.132" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ |