mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '5ad3891d9b861593ebe25d540bed2d913eb83aba': Remove ' ' (typo). Code improvement Removed an extra "using" statement Adding documentation More changes to align with incoming selection improvements. Added C++ wrapper for H5Ovisit2 Adding a C++ wrapper
This commit is contained in:
commit
67bc117efe
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
#SBATCH -C knl,quad, cache
|
||||
#SBATCH -C knl,quad,cache
|
||||
#SBATCH --nodes=1
|
||||
#SBATCH -t 00:30:00
|
||||
#SBATCH --mail-type=BEGIN,END,FAIL
|
||||
|
@ -12,9 +12,6 @@
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// Class LinkAccPropList represents the HDF5 file access property list and
|
||||
// inherits from DataType.
|
||||
|
||||
#ifndef __H5LinkAccPropList_H
|
||||
#define __H5LinkAccPropList_H
|
||||
|
||||
@ -22,15 +19,15 @@ namespace H5 {
|
||||
|
||||
/*! \class LinkAccPropList
|
||||
\brief Class LinkAccPropList inherits from PropList and provides
|
||||
wrappers for the HDF5 file access property list.
|
||||
wrappers for the HDF5 link access property list.
|
||||
*/
|
||||
// Inheritance: PropList -> IdComponent
|
||||
class H5_DLLCPP LinkAccPropList : public PropList {
|
||||
public:
|
||||
///\brief Default file access property list.
|
||||
///\brief Default link access property list.
|
||||
static const LinkAccPropList& DEFAULT;
|
||||
|
||||
// Creates a file access property list.
|
||||
// Creates a link access property list.
|
||||
LinkAccPropList();
|
||||
|
||||
///\brief Returns this class name.
|
||||
@ -39,7 +36,7 @@ class H5_DLLCPP LinkAccPropList : public PropList {
|
||||
// Copy constructor: same as the original LinkAccPropList.
|
||||
LinkAccPropList(const LinkAccPropList& original);
|
||||
|
||||
// Creates a copy of an existing file access property list
|
||||
// Creates a copy of an existing link access property list
|
||||
// using the property list id.
|
||||
LinkAccPropList (const hid_t plist_id);
|
||||
|
||||
|
@ -12,9 +12,6 @@
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// Class LinkCreatPropList represents the HDF5 file access property list and
|
||||
// inherits from DataType.
|
||||
|
||||
#ifndef __H5LinkCreatPropList_H
|
||||
#define __H5LinkCreatPropList_H
|
||||
|
||||
@ -22,15 +19,15 @@ namespace H5 {
|
||||
|
||||
/*! \class LinkCreatPropList
|
||||
\brief Class LinkCreatPropList inherits from PropList and provides
|
||||
wrappers for the HDF5 file access property list.
|
||||
wrappers for the HDF5 link creation property list.
|
||||
*/
|
||||
// Inheritance: PropList -> IdComponent
|
||||
class H5_DLLCPP LinkCreatPropList : public PropList {
|
||||
public:
|
||||
///\brief Default file access property list.
|
||||
///\brief Default link creation property list.
|
||||
static const LinkCreatPropList& DEFAULT;
|
||||
|
||||
// Creates a file access property list.
|
||||
// Creates a link creation property list.
|
||||
LinkCreatPropList();
|
||||
|
||||
///\brief Returns this class name.
|
||||
@ -39,7 +36,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList {
|
||||
// Copy constructor: same as the original LinkCreatPropList.
|
||||
LinkCreatPropList(const LinkCreatPropList& original);
|
||||
|
||||
// Creates a copy of an existing file access property list
|
||||
// Creates a copy of an existing link creation property list
|
||||
// using the property list id.
|
||||
LinkCreatPropList (const hid_t plist_id);
|
||||
|
||||
|
@ -40,9 +40,8 @@
|
||||
namespace H5 {
|
||||
|
||||
#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.
|
||||
// userAttrOpWrpr interfaces between the user's function and the
|
||||
// C library function H5Aiterate2
|
||||
extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
|
||||
const H5A_info_t *ainfo, void *op_data)
|
||||
{
|
||||
@ -52,6 +51,17 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// userVisitOpWrpr interfaces between the user's function and the
|
||||
// C library function H5Ovisit2
|
||||
extern "C" herr_t userVisitOpWrpr(hid_t obj_id, const char *attr_name,
|
||||
const H5O_info_t *obj_info, void *op_data)
|
||||
{
|
||||
H5std_string s_attr_name = H5std_string(attr_name);
|
||||
UserData4Visit* myData = reinterpret_cast<UserData4Visit *> (op_data);
|
||||
int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData);
|
||||
return status;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5Object default constructor (protected)
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
@ -197,8 +207,6 @@ Attribute H5Object::openAttribute(const unsigned int idx) const
|
||||
///\par Description
|
||||
/// The signature of user_op is
|
||||
/// void (*)(H5::H5Location&, H5std_string, void*).
|
||||
/// For information, please refer to the H5Aiterate2 API in
|
||||
/// the HDF5 C Reference Manual.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
|
||||
@ -227,6 +235,61 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
|
||||
throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5Object::visit
|
||||
///\brief Recursively visits all HDF5 objects accessible from this object.
|
||||
///\param idx_type - IN: Type of index; valid values include:
|
||||
/// \li \c H5_INDEX_NAME
|
||||
/// \li \c H5_INDEX_CRT_ORDER
|
||||
///\param order - IN: Order in which index is traversed; valid values include:
|
||||
/// \li \c H5_ITER_DEC
|
||||
/// \li \c H5_ITER_INC
|
||||
/// \li \c H5_ITER_NATIVE
|
||||
///\param user_op - IN: Callback function passing data regarding the
|
||||
/// object to the calling application
|
||||
///\param *op_data - IN: User-defined pointer to data required by the
|
||||
/// application for its processing of the object
|
||||
///\param fields - IN: Flags specifying the fields to be retrieved
|
||||
/// to the callback op via the H5O_info_t argument.
|
||||
/// \li \c H5O_INFO_BASIC fileno, addr, type, and rc fields
|
||||
/// \li \c H5O_INFO_TIME atime, mtime, ctime, and btime fields
|
||||
/// \li \c H5O_INFO_NUM_ATTRS num_attrs field
|
||||
/// \li \c H5O_INFO_HDR hdr field
|
||||
/// \li \c H5O_INFO_META_SIZE meta_size field
|
||||
/// \li \c H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE
|
||||
///\return
|
||||
/// \li On success:
|
||||
/// \li the return value of the first operator that returns a positive value
|
||||
/// \li zero if all members were processed with no operator returning non-zero
|
||||
/// \li On failure:
|
||||
/// \li an exception Exception will be thrown if something went
|
||||
/// wrong within the library or the operator failed
|
||||
///\exception H5::Exception
|
||||
///\par Description
|
||||
/// For information, please refer to the H5Ovisit2 API in the HDF5
|
||||
/// C Reference Manual.
|
||||
// Programmer Binh-Minh Ribler - Feb, 2019
|
||||
//--------------------------------------------------------------------------
|
||||
void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields)
|
||||
{
|
||||
// Store the user's function and data
|
||||
UserData4Visit* userData = new UserData4Visit;
|
||||
userData->opData = op_data;
|
||||
userData->op = user_op;
|
||||
userData->obj = this;
|
||||
|
||||
// Call the C API passing in op wrapper and info
|
||||
herr_t ret_value = H5Ovisit2(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields);
|
||||
|
||||
// Release memory
|
||||
delete userData;
|
||||
|
||||
// Throw exception if H5Ovisit2 failed, which could be a failure in
|
||||
// the library or in the call back operator
|
||||
if (ret_value < 0)
|
||||
throw Exception(inMemFunc("visit"), "H5Ovisit2 failed");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5Object::objVersion
|
||||
///\brief Returns the header version of this HDF5 object.
|
||||
|
@ -40,16 +40,30 @@ namespace H5 {
|
||||
// Inheritance: H5Location -> IdComponent
|
||||
|
||||
// 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*/);
|
||||
typedef void (*attr_operator_t)(H5Object& loc,
|
||||
const H5std_string attr_name,
|
||||
void *operator_data);
|
||||
|
||||
// Define the operator function pointer for H5Ovisit2().
|
||||
typedef int (*visit_operator_t)(H5Object& obj,
|
||||
const H5std_string attr_name,
|
||||
const H5O_info_t *oinfo,
|
||||
void *operator_data);
|
||||
|
||||
// User data for attribute iteration
|
||||
class UserData4Aiterate {
|
||||
public:
|
||||
attr_operator_t op;
|
||||
void* opData;
|
||||
H5Object* location;
|
||||
H5Object* location; // Consider changing to H5Location
|
||||
};
|
||||
|
||||
// User data for visit iteration
|
||||
class UserData4Visit {
|
||||
public:
|
||||
visit_operator_t op;
|
||||
void* opData;
|
||||
H5Object* obj;
|
||||
};
|
||||
|
||||
class H5_DLLCPP H5Object : public H5Location {
|
||||
@ -71,6 +85,9 @@ class H5_DLLCPP H5Object : public H5Location {
|
||||
// Iterate user's function over the attributes of this object.
|
||||
int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
|
||||
|
||||
// Recursively visit elements reachable from this object.
|
||||
void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields);
|
||||
|
||||
// Returns the object header version of an object
|
||||
unsigned objVersion() const;
|
||||
|
||||
@ -98,6 +115,7 @@ class H5_DLLCPP H5Object : public H5Location {
|
||||
ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
|
||||
H5std_string getObjName() const;
|
||||
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
protected:
|
||||
|
@ -286,7 +286,7 @@ H5::DataType getArr()
|
||||
*dims = 5;
|
||||
H5::ArrayType ret;
|
||||
ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims);
|
||||
delete[] dims;
|
||||
delete dims;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -371,7 +371,6 @@ static void test_array_info()
|
||||
s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in
|
||||
hsize_t sdims1[] = {SPACE1_DIM1};
|
||||
hsize_t tdims1[] = {ARRAY1_DIM1};
|
||||
int nmemb; // Number of compound members
|
||||
int ii; // counting variables
|
||||
hsize_t idxi, idxj, idxk; // dimension indicing variables
|
||||
H5T_class_t mclass; // Datatype class for field
|
||||
|
@ -31,288 +31,27 @@ using namespace H5;
|
||||
#include "h5test.h"
|
||||
#include "h5cpputil.h" // C++ utilility header file
|
||||
|
||||
// A lot of the definition inherited from C test links.c is left here until
|
||||
// the H5L API is implemented and tests are completed - BMR 10/19/2009
|
||||
/*
|
||||
* This file needs to access private information from the H5G package.
|
||||
* This file also needs to access the group testing code.
|
||||
*/
|
||||
//#define H5G_FRIEND
|
||||
//#define H5G_TESTING
|
||||
|
||||
//#include "h5test.h"
|
||||
//#include "H5Gpkg.h" /* Groups */
|
||||
//#include "H5Iprivate.h" /* IDs */
|
||||
//#include "H5Lprivate.h" /* Links */
|
||||
|
||||
/* File for external link test. Created with gen_udlinks.c */
|
||||
#define LINKED_FILE "be_extlink2.h5"
|
||||
|
||||
#if 0
|
||||
const char *FILENAME[] = {
|
||||
"links0",
|
||||
"links1",
|
||||
"links2",
|
||||
"links3",
|
||||
"links4a", /* 4 */
|
||||
"links4b", /* 5 */
|
||||
"links4c", /* 6 */
|
||||
"links4d", /* 7 */
|
||||
"links5", /* 8 */
|
||||
"links6", /* 9 */
|
||||
"links7", /* 10 */
|
||||
"links8", /* 11 */
|
||||
"extlinks0", /* 12: main files */
|
||||
"tmp/extlinks0", /* 13: */
|
||||
"extlinks1", /* 14: target files */
|
||||
"tmp/extlinks1", /* 15: */
|
||||
"extlinks2", /* 16: */
|
||||
"tmp/extlinks2", /* 17: */
|
||||
"extlinks3", /* 18: */
|
||||
"tmp/extlinks3", /* 19: */
|
||||
"extlinks4", /* 20: */
|
||||
"tmp/extlinks4", /* 21: */
|
||||
"extlinks5", /* 22: */
|
||||
"tmp/extlinks6", /* 23: */
|
||||
"extlinks7", /* 24: */
|
||||
"tmp/extlinks7", /* 25: */
|
||||
"tmp/extlinks8", /* 26: */
|
||||
"extlinks9", /* 27: */
|
||||
"tmp/extlinks9", /* 28: */
|
||||
"extlinks10", /* 29: */ /* TESTS for windows */
|
||||
"tmp/extlinks10", /* 30: */
|
||||
"tmp/extlinks11", /* 31: */
|
||||
"tmp/extlinks12", /* 32: */
|
||||
"extlinks13", /* 33: */
|
||||
"tmp/extlinks13", /* 34: */
|
||||
"tmp/extlinks14", /* 35: */
|
||||
"tmp/extlinks15", /* 36: */
|
||||
"extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
|
||||
"extlinks16B", /* 38: */
|
||||
"extlinks17", /* 39: */
|
||||
"extlinks18A", /* 40: */
|
||||
"extlinks18B", /* 41: */
|
||||
"extlinks19A", /* 42: */
|
||||
"extlinks19B", /* 43: */
|
||||
"extlinks20", /* 44: */
|
||||
NULL
|
||||
};
|
||||
|
||||
#endif // 0
|
||||
|
||||
#define TMPDIR "tmp"
|
||||
|
||||
#define FAMILY_SIZE 1024
|
||||
#define CORE_INCREMENT 1024
|
||||
#define NUM400 400
|
||||
|
||||
/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
|
||||
#define EXTSTOP 12
|
||||
|
||||
#define LINK_BUF_SIZE 1024
|
||||
#define NAME_BUF_SIZE 1024
|
||||
#define MAX_NAME_LEN ((64*1024)+1024)
|
||||
|
||||
/* Link type IDs */
|
||||
#define UD_HARD_TYPE 201
|
||||
#define UD_CB_TYPE H5L_TYPE_MAX
|
||||
#define UD_PLIST_TYPE 128
|
||||
#define UD_CBFAIL_TYPE UD_PLIST_TYPE
|
||||
#define UD_ERROR_TYPE 189
|
||||
#define UD_BAD_TYPE1 H5L_TYPE_HARD
|
||||
#define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5)
|
||||
#define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1)
|
||||
|
||||
#define DEST_PROP_NAME "destination_group"
|
||||
#define REREG_TARGET_NAME "rereg_target"
|
||||
|
||||
#define UD_CB_LINK_NAME "ud_callback_link"
|
||||
#define NEW_UD_CB_LINK_NAME "ud_callback_link2"
|
||||
#define UD_CB_TARGET "ud_target"
|
||||
#define UD_CB_TARGET_LEN 10
|
||||
|
||||
#define LE_FILENAME "le_extlink1.h5"
|
||||
#define BE_FILENAME "be_extlink1.h5"
|
||||
|
||||
#define ELINK_CB_FAM_SIZE (hsize_t) 100
|
||||
|
||||
#define H5L_DIM1 100
|
||||
#define H5L_DIM2 100
|
||||
|
||||
/* Creation order macros */
|
||||
#define CORDER_SOFT_GROUP_NAME "corder_soft_group"
|
||||
#define CORDER_NLINKS 18
|
||||
|
||||
/* Timestamp macros */
|
||||
#define TIMESTAMP_GROUP_1 "timestamp1"
|
||||
#define TIMESTAMP_GROUP_2 "timestamp2"
|
||||
|
||||
/* Link iteration struct */
|
||||
typedef struct {
|
||||
H5_iter_order_t order; /* Direction of iteration */
|
||||
unsigned ncalled; /* # of times callback is entered */
|
||||
unsigned nskipped; /* # of links skipped */
|
||||
int stop; /* # of iterations to stop after */
|
||||
int64_t curr; /* Current creation order value */
|
||||
size_t max_visit; /* Size of "visited link" flag array */
|
||||
hbool_t *visited; /* Pointer to array of "visited link" flags */
|
||||
} link_iter_info_t;
|
||||
|
||||
#if 0
|
||||
/* Link visit structs */
|
||||
typedef struct {
|
||||
const char *path; /* Path to link */
|
||||
H5L_type_t type; /* Type of link */
|
||||
} link_visit_t;
|
||||
static const link_visit_t lvisit0[] = {
|
||||
{"Dataset_zero", H5L_TYPE_HARD},
|
||||
{"Group1", H5L_TYPE_HARD},
|
||||
{"Group1/Dataset_one", H5L_TYPE_HARD},
|
||||
{"Group1/Group2", H5L_TYPE_HARD},
|
||||
{"Group1/Group2/Dataset_two", H5L_TYPE_HARD},
|
||||
{"Group1/Group2/Type_two", H5L_TYPE_HARD},
|
||||
{"Group1/Group2/hard_zero", H5L_TYPE_HARD},
|
||||
{"Group1/Type_one", H5L_TYPE_HARD},
|
||||
{"Group1/hard_one", H5L_TYPE_HARD},
|
||||
{"Type_zero", H5L_TYPE_HARD},
|
||||
{"ext_dangle", H5L_TYPE_EXTERNAL},
|
||||
{"ext_one", H5L_TYPE_EXTERNAL},
|
||||
{"hard_one", H5L_TYPE_HARD},
|
||||
{"hard_two", H5L_TYPE_HARD},
|
||||
{"hard_zero", H5L_TYPE_HARD},
|
||||
{"soft_dangle", H5L_TYPE_SOFT},
|
||||
{"soft_one", H5L_TYPE_SOFT},
|
||||
{"soft_two", H5L_TYPE_SOFT}
|
||||
};
|
||||
static const link_visit_t lvisit1[] = {
|
||||
{"Dataset_one", H5L_TYPE_HARD},
|
||||
{"Group2", H5L_TYPE_HARD},
|
||||
{"Group2/Dataset_two", H5L_TYPE_HARD},
|
||||
{"Group2/Type_two", H5L_TYPE_HARD},
|
||||
{"Group2/hard_zero", H5L_TYPE_HARD},
|
||||
{"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD},
|
||||
{"Group2/hard_zero/Group1", H5L_TYPE_HARD},
|
||||
{"Group2/hard_zero/Type_zero", H5L_TYPE_HARD},
|
||||
{"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
|
||||
{"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL},
|
||||
{"Group2/hard_zero/hard_one", H5L_TYPE_HARD},
|
||||
{"Group2/hard_zero/hard_two", H5L_TYPE_HARD},
|
||||
{"Group2/hard_zero/hard_zero", H5L_TYPE_HARD},
|
||||
{"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT},
|
||||
{"Group2/hard_zero/soft_one", H5L_TYPE_SOFT},
|
||||
{"Group2/hard_zero/soft_two", H5L_TYPE_SOFT},
|
||||
{"Type_one", H5L_TYPE_HARD},
|
||||
{"hard_one", H5L_TYPE_HARD}
|
||||
};
|
||||
static const link_visit_t lvisit2[] = {
|
||||
{"Dataset_two", H5L_TYPE_HARD},
|
||||
{"Type_two", H5L_TYPE_HARD},
|
||||
{"hard_zero", H5L_TYPE_HARD},
|
||||
{"hard_zero/Dataset_zero", H5L_TYPE_HARD},
|
||||
{"hard_zero/Group1", H5L_TYPE_HARD},
|
||||
{"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD},
|
||||
{"hard_zero/Group1/Group2", H5L_TYPE_HARD},
|
||||
{"hard_zero/Group1/Type_one", H5L_TYPE_HARD},
|
||||
{"hard_zero/Group1/hard_one", H5L_TYPE_HARD},
|
||||
{"hard_zero/Type_zero", H5L_TYPE_HARD},
|
||||
{"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
|
||||
{"hard_zero/ext_one", H5L_TYPE_EXTERNAL},
|
||||
{"hard_zero/hard_one", H5L_TYPE_HARD},
|
||||
{"hard_zero/hard_two", H5L_TYPE_HARD},
|
||||
{"hard_zero/hard_zero", H5L_TYPE_HARD},
|
||||
{"hard_zero/soft_dangle", H5L_TYPE_SOFT},
|
||||
{"hard_zero/soft_one", H5L_TYPE_SOFT},
|
||||
{"hard_zero/soft_two", H5L_TYPE_SOFT}
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
unsigned idx; /* Index in link visit structure */
|
||||
const link_visit_t *info; /* Pointer to the link visit structure to use */
|
||||
} lvisit_ud_t;
|
||||
|
||||
|
||||
/* Object visit structs */
|
||||
// Object visit structs
|
||||
typedef struct {
|
||||
const char *path; /* Path to object */
|
||||
H5O_type_t type; /* Type of object */
|
||||
} obj_visit_t;
|
||||
static const obj_visit_t ovisit0_old[] = {
|
||||
{".", H5O_TYPE_GROUP},
|
||||
{"Dataset_zero", H5O_TYPE_DATASET},
|
||||
{"Group1", H5O_TYPE_GROUP},
|
||||
{"Group1/Dataset_one", H5O_TYPE_DATASET},
|
||||
{"Group1/Group2", H5O_TYPE_GROUP},
|
||||
{"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
|
||||
{"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"Type_zero", H5O_TYPE_NAMED_DATATYPE}
|
||||
};
|
||||
static const obj_visit_t ovisit0_new[] = {
|
||||
{".", H5O_TYPE_GROUP},
|
||||
{"Dataset_zero", H5O_TYPE_DATASET},
|
||||
{"Group1", H5O_TYPE_GROUP},
|
||||
{"Group1/Dataset_one", H5O_TYPE_DATASET},
|
||||
{"Group1/Group2", H5O_TYPE_GROUP},
|
||||
{"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
|
||||
{"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"Type_zero", H5O_TYPE_NAMED_DATATYPE}
|
||||
};
|
||||
static const obj_visit_t ovisit1_old[] = {
|
||||
{".", H5O_TYPE_GROUP},
|
||||
{"Dataset_one", H5O_TYPE_DATASET},
|
||||
{"Group2", H5O_TYPE_GROUP},
|
||||
{"Group2/Dataset_two", H5O_TYPE_DATASET},
|
||||
{"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"Group2/hard_zero", H5O_TYPE_GROUP},
|
||||
{"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
|
||||
{"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"Type_one", H5O_TYPE_NAMED_DATATYPE}
|
||||
};
|
||||
static const obj_visit_t ovisit1_new[] = {
|
||||
{".", H5O_TYPE_GROUP},
|
||||
{"Dataset_one", H5O_TYPE_DATASET},
|
||||
{"Group2", H5O_TYPE_GROUP},
|
||||
{"Group2/Dataset_two", H5O_TYPE_DATASET},
|
||||
{"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"Group2/hard_zero", H5O_TYPE_GROUP},
|
||||
{"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
|
||||
{"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"Type_one", H5O_TYPE_NAMED_DATATYPE}
|
||||
};
|
||||
static const obj_visit_t ovisit2_old[] = {
|
||||
{".", H5O_TYPE_GROUP},
|
||||
{"Dataset_two", H5O_TYPE_DATASET},
|
||||
{"Type_two", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"hard_zero", H5O_TYPE_GROUP},
|
||||
{"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
|
||||
{"hard_zero/Group1", H5O_TYPE_GROUP},
|
||||
{"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
|
||||
{"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}
|
||||
};
|
||||
static const obj_visit_t ovisit2_new[] = {
|
||||
{".", H5O_TYPE_GROUP},
|
||||
{"Dataset_two", H5O_TYPE_DATASET},
|
||||
{"Type_two", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"hard_zero", H5O_TYPE_GROUP},
|
||||
{"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
|
||||
{"hard_zero/Group1", H5O_TYPE_GROUP},
|
||||
{"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
|
||||
{"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
|
||||
{"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}
|
||||
};
|
||||
|
||||
// User data for callback function
|
||||
typedef struct {
|
||||
unsigned idx; /* Index in object visit structure */
|
||||
const obj_visit_t *info; /* Pointer to the object visit structure to use */
|
||||
} ovisit_ud_t;
|
||||
#endif
|
||||
|
||||
static const char *FILENAME[] = {
|
||||
"link0",
|
||||
"link1.h5",
|
||||
"link2.h5",
|
||||
"visit",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -841,6 +580,140 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
|
||||
}
|
||||
} // test_num_links
|
||||
|
||||
|
||||
// Data for visit on the file
|
||||
static const obj_visit_t file_visit[] = {
|
||||
{".", H5O_TYPE_GROUP},
|
||||
{"Data", H5O_TYPE_GROUP},
|
||||
{"Data/Compressed_Data", H5O_TYPE_DATASET},
|
||||
{"Data/Float_Data", H5O_TYPE_DATASET},
|
||||
};
|
||||
|
||||
// Data for visit on the group
|
||||
static const obj_visit_t group_visit[] = {
|
||||
{".", H5O_TYPE_GROUP},
|
||||
{"Compressed_Data", H5O_TYPE_DATASET},
|
||||
{"Float_Data", H5O_TYPE_DATASET},
|
||||
};
|
||||
|
||||
const H5std_string FILE_NAME("tvisit.h5");
|
||||
const H5std_string GROUP_NAME("/Data");
|
||||
const H5std_string DSET1_NAME("/Data/Compressed_Data");
|
||||
const H5std_string DSET2_NAME("/Data/Float_Data");
|
||||
const int RANK = 2;
|
||||
const int DIM1 = 2;
|
||||
|
||||
// Operator function
|
||||
static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info_t *oinfo, void *_op_data)
|
||||
{
|
||||
ovisit_ud_t *op_data = static_cast <ovisit_ud_t *>(_op_data);
|
||||
|
||||
// Check for correct object information
|
||||
if(strcmp(op_data->info[op_data->idx].path, name.c_str())) return(H5_ITER_ERROR);
|
||||
if(op_data->info[op_data->idx].type != oinfo->type) return(H5_ITER_ERROR);
|
||||
|
||||
// Advance to next location
|
||||
op_data->idx++;
|
||||
|
||||
return(H5_ITER_CONT);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_visit
|
||||
*
|
||||
* Purpose Test H5Object::visit
|
||||
*
|
||||
* Return None
|
||||
*
|
||||
* February 8, 2019
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void test_visit(hid_t fapl_id, hbool_t new_format)
|
||||
{
|
||||
hsize_t dims[2];
|
||||
hsize_t cdims[2];
|
||||
char filename[NAME_BUF_SIZE];
|
||||
|
||||
if(new_format)
|
||||
SUBTEST("H5Object::visit (w/new group format)")
|
||||
else
|
||||
SUBTEST("H5Object::visit")
|
||||
|
||||
try
|
||||
{
|
||||
// Use the file access template id to create a file access prop. list
|
||||
FileAccPropList fapl(fapl_id);
|
||||
|
||||
// Build the hdf5 file name and create the file
|
||||
h5_fixname(FILENAME[3], fapl_id, filename, sizeof filename);
|
||||
H5File *file = new H5File(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
|
||||
|
||||
// Create a group
|
||||
Group* group = new Group(file->createGroup(GROUP_NAME));
|
||||
|
||||
// Create a chunked/compressed dataset within this group specified by path
|
||||
dims[0] = 20;
|
||||
dims[1] = 2;
|
||||
cdims[0] = 2;
|
||||
cdims[1] = 2;
|
||||
DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
|
||||
DSetCreatPropList ds_creatplist; // create dataset creation prop list
|
||||
ds_creatplist.setChunk(2, cdims); // then modify it for compression
|
||||
ds_creatplist.setDeflate(6);
|
||||
|
||||
DataSet* dataset = new DataSet(file->createDataSet(DSET1_NAME,
|
||||
PredType::NATIVE_INT, *dataspace, ds_creatplist));
|
||||
|
||||
delete dataset;
|
||||
delete dataspace;
|
||||
|
||||
// Create another dataset
|
||||
dims[0] = 5;
|
||||
dims[1] = 2;
|
||||
dataspace = new DataSpace(RANK, dims); // create second dspace
|
||||
dataset = new DataSet(file->createDataSet(DSET2_NAME,
|
||||
PredType::NATIVE_FLOAT, *dataspace));
|
||||
|
||||
// Close everything
|
||||
delete dataset;
|
||||
delete dataspace;
|
||||
delete group;
|
||||
delete file;
|
||||
|
||||
// Reopen the file and group in the file.
|
||||
file = new H5File(filename, H5F_ACC_RDWR);
|
||||
group = new Group(file->openGroup("Data"));
|
||||
|
||||
// Open the group
|
||||
dataset = new DataSet(group->openDataSet(DSET2_NAME));
|
||||
delete dataset;
|
||||
|
||||
// Visit objects in the file
|
||||
ovisit_ud_t udata; /* User-data for visiting */
|
||||
udata.idx = 0;
|
||||
udata.info = file_visit;
|
||||
|
||||
file->visit(H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC);
|
||||
|
||||
// Visit objects in the group
|
||||
udata.idx = 0;
|
||||
udata.info = group_visit;
|
||||
|
||||
group->visit(H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC);
|
||||
|
||||
// Close the group and file.
|
||||
delete group;
|
||||
delete file;
|
||||
|
||||
PASSED();
|
||||
} // end of try block
|
||||
catch (Exception& E)
|
||||
{
|
||||
cerr << "in catch" << endl;
|
||||
issue_fail_msg("test_visit()", __LINE__, __FILE__, E.getCDetailMsg());
|
||||
}
|
||||
} // test_visit()
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_links
|
||||
@ -858,7 +731,8 @@ void test_links()
|
||||
hid_t fapl_id, fapl2_id; /* File access property lists */
|
||||
unsigned new_format; /* Whether to use the new format or not */
|
||||
|
||||
fapl_id = h5_fileaccess();
|
||||
if((fapl_id = h5_fileaccess()) < 0)
|
||||
throw Exception("test_links", "Unable to get file access property list");
|
||||
|
||||
// Output message about test being performed
|
||||
MESSAGE(5, ("Testing Various Links\n"));
|
||||
@ -891,24 +765,18 @@ void test_links()
|
||||
test_move(my_fapl_id, new_format);
|
||||
test_copy(my_fapl_id, new_format);
|
||||
test_lcpl(my_fapl_id, new_format);
|
||||
test_visit(my_fapl_id, new_format);
|
||||
} /* end for */
|
||||
|
||||
/* Close 2nd FAPL */
|
||||
H5Pclose(fapl2_id);
|
||||
|
||||
h5_clean_files(FILENAME, fapl_id);
|
||||
|
||||
/* Test that external links can be used after a library reset. MUST be
|
||||
* called last so the reset doesn't interfere with the property lists. This
|
||||
* routine will delete its own file. */
|
||||
/* nerrors += external_reset_register() < 0 ? 1 : 0;
|
||||
*/
|
||||
}
|
||||
catch (Exception& E)
|
||||
{
|
||||
issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -926,7 +794,3 @@ void cleanup_links()
|
||||
HDremove(FILENAME[0]);
|
||||
HDremove(FILENAME[1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -995,167 +995,6 @@ done:
|
||||
}
|
||||
|
||||
|
||||
#ifdef NEW_HYPERSLAB_API
|
||||
/****if* H5Sf/h5scombine_hyperslab_c
|
||||
* NAME
|
||||
* h5scombine_hyperslab_c
|
||||
* PURPOSE
|
||||
* Call H5Scombine_hyperslab
|
||||
* INPUTS
|
||||
* space_id - identifier of the dataspace
|
||||
* operator - defines how the new selection is combined
|
||||
* start - offset of start of hyperslab
|
||||
* count - number of blocks included in the hyperslab
|
||||
* stride - hyperslab stride (interval between blocks)
|
||||
* block - size of block in the hyperslab
|
||||
* OUTPUTS
|
||||
* hyper_id - identifier for the new dataspace
|
||||
* RETURNS
|
||||
* 0 on success, -1 on failure
|
||||
* AUTHOR
|
||||
* Elena Pourmal
|
||||
* Monday, October 7, 2002
|
||||
* HISTORY
|
||||
*
|
||||
* SOURCE
|
||||
*/
|
||||
|
||||
int_f
|
||||
h5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id)
|
||||
/******/
|
||||
{
|
||||
int ret_value = -1;
|
||||
hid_t c_space_id;
|
||||
hid_t c_hyper_id;
|
||||
hsize_t *c_start = NULL;
|
||||
hsize_t *c_count = NULL;
|
||||
hsize_t *c_stride = NULL;
|
||||
hsize_t *c_block = NULL;
|
||||
|
||||
H5S_seloper_t c_op;
|
||||
herr_t status;
|
||||
int rank;
|
||||
int i;
|
||||
|
||||
rank = H5Sget_simple_extent_ndims(*space_id);
|
||||
if (rank < 0 ) return ret_value;
|
||||
c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
|
||||
if (c_start == NULL) goto DONE;
|
||||
|
||||
c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
|
||||
if (c_count == NULL) goto DONE;
|
||||
|
||||
c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
|
||||
if (c_stride == NULL) goto DONE;
|
||||
|
||||
c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
|
||||
if (c_block == NULL) goto DONE;
|
||||
|
||||
|
||||
/*
|
||||
* Reverse dimensions due to C-FORTRAN storage order.
|
||||
*/
|
||||
|
||||
for (i=0; i < rank; i++) {
|
||||
int t= (rank - i) - 1;
|
||||
c_start[i] = (hsize_t)start[t];
|
||||
c_count[i] = (hsize_t)count[t];
|
||||
c_stride[i] = (hsize_t)stride[t];
|
||||
c_block[i] = (hsize_t)block[t];
|
||||
}
|
||||
|
||||
c_op = (H5S_seloper_t)*op;
|
||||
|
||||
c_space_id = (hid_t)*space_id;
|
||||
c_hyper_id = H5Scombine_hyperslab(c_space_id, c_op, c_start, c_stride, c_count, c_block);
|
||||
if ( c_hyper_id < 0 ) goto DONE;
|
||||
*hyper_id = (hid_t_f)c_hyper_id;
|
||||
ret_value = 0;
|
||||
DONE:
|
||||
if(c_start != NULL) HDfree(c_start);
|
||||
if(c_count != NULL) HDfree(c_count);
|
||||
if(c_stride!= NULL) HDfree(c_stride);
|
||||
if(c_block != NULL) HDfree(c_block);
|
||||
return ret_value;
|
||||
}
|
||||
/****if* H5Sf/h5scombine_select_c
|
||||
* NAME
|
||||
* h5scombine_select_c
|
||||
* PURPOSE
|
||||
* Call H5Scombine_ select
|
||||
* INPUTS
|
||||
* space1_id - identifier of the first dataspace
|
||||
* operator - defines how the new selection is combined
|
||||
* space2_id - identifier of the second dataspace
|
||||
* OUTPUTS
|
||||
* ds_id - identifier for the new dataspace
|
||||
* RETURNS
|
||||
* 0 on success, -1 on failure
|
||||
* AUTHOR
|
||||
* Elena Pourmal
|
||||
* Monday, October 7, 2002
|
||||
* HISTORY
|
||||
*
|
||||
* SOURCE
|
||||
*/
|
||||
|
||||
int_f
|
||||
h5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id)
|
||||
/******/
|
||||
{
|
||||
int ret_value = -1;
|
||||
hid_t c_space1_id;
|
||||
hid_t c_space2_id;
|
||||
hid_t c_ds_id;
|
||||
H5S_seloper_t c_op;
|
||||
|
||||
c_op = (H5S_seloper_t)*op;
|
||||
|
||||
c_space1_id = (hid_t)*space1_id;
|
||||
c_space2_id = (hid_t)*space2_id;
|
||||
c_ds_id = H5Scombine_select(c_space1_id, c_op, c_space2_id);
|
||||
if ( c_ds_id < 0 ) return ret_value;
|
||||
*ds_id = (hid_t_f)c_ds_id;
|
||||
ret_value = 0;
|
||||
return ret_value;
|
||||
}
|
||||
/****if* H5Sf/h5sselect_select_c
|
||||
* NAME
|
||||
* h5sselect_select_c
|
||||
* PURPOSE
|
||||
* Call H5Sselect_ select
|
||||
* INPUTS
|
||||
* space1_id - identifier of the first dataspace to modify
|
||||
* operator - defines how the new selection is combined
|
||||
* space2_id - identifier of the second dataspace
|
||||
* RETURNS
|
||||
* 0 on success, -1 on failure
|
||||
* AUTHOR
|
||||
* Elena Pourmal
|
||||
* Monday, October 7, 2002
|
||||
* HISTORY
|
||||
*
|
||||
* SOURCE
|
||||
*/
|
||||
|
||||
int_f
|
||||
h5sselect_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
|
||||
/******/
|
||||
{
|
||||
int ret_value = -1;
|
||||
hid_t c_space1_id;
|
||||
hid_t c_space2_id;
|
||||
H5S_seloper_t c_op;
|
||||
|
||||
c_op = (H5S_seloper_t)*op;
|
||||
|
||||
c_space1_id = (hid_t)*space1_id;
|
||||
c_space2_id = (hid_t)*space2_id;
|
||||
if( H5Sselect_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value;
|
||||
ret_value = 0;
|
||||
return ret_value;
|
||||
}
|
||||
#endif /*NEW_HYPERSLAB_API*/
|
||||
/****if* H5Sf/h5sget_select_type_c
|
||||
* NAME
|
||||
* h5sget_select_type_c
|
||||
|
@ -1275,310 +1275,6 @@ CONTAINS
|
||||
DEALLOCATE(def_stride)
|
||||
|
||||
END SUBROUTINE h5sselect_hyperslab_f
|
||||
! !$!
|
||||
! !$!****s* H5S/h5scombine_hyperslab_f
|
||||
! !$!
|
||||
! !$! NAME
|
||||
! !$! h5scombine_hyperslab_f
|
||||
! !$!
|
||||
! !$! PURPOSE
|
||||
! !$! Combine a hyperslab selection with the current
|
||||
! !$! selection for a dataspace
|
||||
! !$!
|
||||
! !$! INPUTS
|
||||
! !$! space_id - dataspace of selection to use
|
||||
! !$! operator - flag, valid values are:
|
||||
! !$! H5S_SELECT_NOOP_F
|
||||
! !$! H5S_SELECT_SET_F
|
||||
! !$! H5S_SELECT_OR_F
|
||||
! !$! H5S_SELECT_AND_F
|
||||
! !$! H5S_SELECT_XOR_F
|
||||
! !$! H5S_SELECT_NOTB_F
|
||||
! !$! H5S_SELECT_NOTA_F
|
||||
! !$! H5S_SELECT_APPEND_F
|
||||
! !$! H5S_SELECT_PREPEND_F
|
||||
! !$! start - array with hyperslab offsets
|
||||
! !$! count - number of blocks included in the
|
||||
! !$! hyperslab
|
||||
! !$! OUTPUTS
|
||||
! !$! hyper_id - identifier for the new hyperslab
|
||||
! !$! hdferr: - error code
|
||||
! !$! Success: 0
|
||||
! !$! Failure: -1
|
||||
! !$! OPTIONAL PARAMETERS
|
||||
! !$! stride - array with hyperslab strides
|
||||
! !$! block - array with hyperslab block sizes
|
||||
! !$!
|
||||
! !$! AUTHOR
|
||||
! !$! Elena Pourmal
|
||||
! !$! October 7, 2002
|
||||
! !$!
|
||||
! !$! HISTORY
|
||||
! !$!
|
||||
! !$!
|
||||
! !$! NOTES
|
||||
! !$! Commented out until 1.6 ? 10/08/2002
|
||||
! !$!
|
||||
! !$! SOURCE
|
||||
! SUBROUTINE h5scombine_hyperslab_f(space_id, operator, start, count, &
|
||||
! hyper_id, hdferr, stride, block)
|
||||
! IMPLICIT NONE
|
||||
! INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier
|
||||
! INTEGER, INTENT(IN) :: operator ! Flag, valid values are:
|
||||
! H5S_SELECT_NOOP_F
|
||||
! H5S_SELECT_SET_F
|
||||
! H5S_SELECT_OR_F
|
||||
! H5S_SELECT_AND_F
|
||||
! H5S_SELECT_XOR_F
|
||||
! H5S_SELECT_NOTB_F
|
||||
! H5S_SELECT_NOTA_F
|
||||
! H5S_SELECT_APPEND_F
|
||||
! H5S_SELECT_PREPEND_F
|
||||
!
|
||||
! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start
|
||||
! Starting coordinates of the hyperslab
|
||||
! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count
|
||||
! Number of blocks to select
|
||||
! from dataspace
|
||||
! INTEGER(HID_T), INTENT(OUT) :: hyper_id ! New hyperslab identifier
|
||||
! INTEGER, INTENT(OUT) :: hdferr ! Error code
|
||||
! INTEGER(HSIZE_T), DIMENSION(:), OPTIONAL, INTENT(IN) :: stride
|
||||
! Array of how many elements to move
|
||||
! in each direction
|
||||
! INTEGER(HSIZE_T), DIMENSION(:), OPTIONAL, INTENT(IN) :: block
|
||||
! Sizes of element block
|
||||
! INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE :: def_block
|
||||
! INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE :: def_stride
|
||||
! INTEGER :: rank
|
||||
! INTEGER :: error1, error2
|
||||
|
||||
! INTERFACE
|
||||
! INTEGER FUNCTION h5scombine_hyperslab_c(space_id, operator, &
|
||||
! start, count, stride, block, hyper_id)
|
||||
! USE H5GLOBAL
|
||||
! !DEC$IF DEFINED(HDF5F90_WINDOWS)
|
||||
! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SCOMBINE_HYPERSLAB_C'::h5scombine_hyperslab_c
|
||||
! !DEC$ENDIF
|
||||
! INTEGER(HID_T), INTENT(IN) :: space_id
|
||||
! INTEGER, INTENT(IN) :: operator
|
||||
! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start
|
||||
! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count
|
||||
! INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: stride
|
||||
! INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: block
|
||||
! INTEGER(HID_T), INTENT(OUT) :: hyper_id
|
||||
! END FUNCTION h5scombine_hyperslab_c
|
||||
! END INTERFACE
|
||||
|
||||
! if (present(stride).and. present(block)) then
|
||||
! hdferr = h5scombine_hyperslab_c(space_id, operator, start, count, &
|
||||
! stride, block, hyper_id)
|
||||
! return
|
||||
! endif
|
||||
! Case of optional parameters.
|
||||
!
|
||||
! Find the rank of the dataspace to allocate memory for
|
||||
! default stride and block arrays.
|
||||
!
|
||||
! CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr)
|
||||
! if( hdferr .EQ. -1) return
|
||||
!
|
||||
! if (present(stride).and. .not.present(block)) then
|
||||
! allocate(def_block(rank), stat=error1)
|
||||
! if (error1.NE.0) then
|
||||
! hdferr = -1
|
||||
! return
|
||||
! endif
|
||||
! def_block = 1
|
||||
! hdferr = h5scombine_hyperslab_c(space_id, operator, start, count, &
|
||||
! stride, def_block, hyper_id)
|
||||
! deallocate(def_block)
|
||||
! return
|
||||
! endif
|
||||
|
||||
! if (.not.present(stride).and. present(block)) then
|
||||
! allocate(def_stride(rank), stat=error2)
|
||||
! if (error2.NE.0) then
|
||||
! hdferr = -1
|
||||
! return
|
||||
! endif
|
||||
! def_stride = 1
|
||||
! hdferr = h5scombine_hyperslab_c(space_id, operator, start, count, &
|
||||
! def_stride, block, hyper_id)
|
||||
! deallocate(def_stride)
|
||||
! return
|
||||
! endif
|
||||
! allocate(def_block(rank), stat=error1)
|
||||
! allocate(def_stride(rank), stat=error2)
|
||||
! if ((error1.NE.0) .OR. (error2.NE.0)) then
|
||||
! hdferr = -1
|
||||
! return
|
||||
! endif
|
||||
! def_block = 1
|
||||
! def_stride = 1
|
||||
! hdferr = h5scombine_hyperslab_c(space_id, operator, start, count, &
|
||||
! def_stride, def_block, hyper_id)
|
||||
! deallocate(def_block)
|
||||
! deallocate(def_stride)
|
||||
|
||||
! END SUBROUTINE h5scombine_hyperslab_f
|
||||
|
||||
! !$!
|
||||
! !$!****s* H5S/
|
||||
! !$!
|
||||
! !$! NAME
|
||||
! !$! h5scombine_select_f
|
||||
! !$!
|
||||
! !$! PURPOSE
|
||||
! !$! Combine two hyperslab selections with an operation
|
||||
! !$! and return a dataspace with resulting selection.
|
||||
! !$!
|
||||
! !$! INPUTS
|
||||
! !$! space1_id - dataspace of selection to use
|
||||
! !$! operator - flag, valid values are:
|
||||
! !$! H5S_SELECT_NOOP_F
|
||||
! !$! H5S_SELECT_SET_F
|
||||
! !$! H5S_SELECT_OR_F
|
||||
! !$! H5S_SELECT_AND_F
|
||||
! !$! H5S_SELECT_XOR_F
|
||||
! !$! H5S_SELECT_NOTB_F
|
||||
! !$! H5S_SELECT_NOTA_F
|
||||
! !$! H5S_SELECT_APPEND_F
|
||||
! !$! H5S_SELECT_PREPEND_F
|
||||
! !$! space2_id - dataspace of selection to use
|
||||
! !$! OUTPUTS
|
||||
! !$! ds_id - idataspace identifier with the new selection
|
||||
! !$! hdferr: - error code
|
||||
! !$! Success: 0
|
||||
! !$! Failure: -1
|
||||
! !$! OPTIONAL PARAMETERS - NONE
|
||||
! !$!
|
||||
! !$! AUTHOR
|
||||
! !$! Elena Pourmal
|
||||
! !$! October 7, 2002
|
||||
! !$!
|
||||
! !$! HISTORY
|
||||
! !$!
|
||||
! !$!
|
||||
! !$! NOTES commented out until 1.6 release(?) 10/08/2002
|
||||
! !$!
|
||||
|
||||
! ! SOURCE
|
||||
! !$ SUBROUTINE h5scombine_select_f(space1_id, operator, space2_id, &
|
||||
! ds_id, hdferr)
|
||||
! IMPLICIT NONE
|
||||
! INTEGER(HID_T), INTENT(IN) :: space1_id ! First dataspace identifier
|
||||
! INTEGER(HID_T), INTENT(IN) :: space2_id ! Second dataspace identifier
|
||||
! INTEGER, INTENT(IN) :: operator ! Flag, valid values are:
|
||||
! H5S_SELECT_NOOP_F
|
||||
! H5S_SELECT_SET_F
|
||||
! H5S_SELECT_OR_F
|
||||
! H5S_SELECT_AND_F
|
||||
! H5S_SELECT_XOR_F
|
||||
! H5S_SELECT_NOTB_F
|
||||
! H5S_SELECT_NOTA_F
|
||||
! H5S_SELECT_APPEND_F
|
||||
! H5S_SELECT_PREPEND_F
|
||||
!
|
||||
! INTEGER(HID_T), INTENT(OUT) :: ds_id ! New dataspace identifier
|
||||
! INTEGER, INTENT(OUT) :: hdferr ! Error code
|
||||
!
|
||||
! INTERFACE
|
||||
! INTEGER FUNCTION h5scombine_select_c(space1_id, operator, &
|
||||
! space2_id, ds_id)
|
||||
! USE H5GLOBAL
|
||||
! !DEC$IF DEFINED(HDF5F90_WINDOWS)
|
||||
! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SCOMBINE_SELECT_C'::h5scombine_select_c
|
||||
! !DEC$ENDIF
|
||||
! INTEGER(HID_T), INTENT(IN) :: space1_id
|
||||
! INTEGER(HID_T), INTENT(IN) :: space2_id
|
||||
! INTEGER, INTENT(IN) :: operator
|
||||
! INTEGER(HID_T), INTENT(OUT) :: ds_id
|
||||
! END FUNCTION h5scombine_select_c
|
||||
! END INTERFACE
|
||||
|
||||
! hdferr = h5scombine_select_c(space1_id, operator, space2_id, &
|
||||
! ds_id)
|
||||
! return
|
||||
|
||||
! END SUBROUTINE h5scombine_select_f
|
||||
|
||||
! !$!
|
||||
! !$!****s* H5S/
|
||||
! !$!
|
||||
! !$! NAME
|
||||
! !$! h5sselect_select_f
|
||||
! !$!
|
||||
! !$! PURPOSE
|
||||
! !$! Refine a hyperslab selection with an operation
|
||||
! !$! using second hyperslab
|
||||
! !$!
|
||||
! !$! INPUTS
|
||||
! !$! space1_id - dataspace of selection to modify
|
||||
! !$! operator - flag, valid values are:
|
||||
! !$! H5S_SELECT_NOOP_F
|
||||
! !$! H5S_SELECT_SET_F
|
||||
! !$! H5S_SELECT_OR_F
|
||||
! !$! H5S_SELECT_AND_F
|
||||
! !$! H5S_SELECT_XOR_F
|
||||
! !$! H5S_SELECT_NOTB_F
|
||||
! !$! H5S_SELECT_NOTA_F
|
||||
! !$! H5S_SELECT_APPEND_F
|
||||
! !$! H5S_SELECT_PREPEND_F
|
||||
! !$! space2_id - dataspace of selection to use
|
||||
! !$!
|
||||
! !$! OUTPUTS
|
||||
! !$! hdferr: - error code
|
||||
! !$! Success: 0
|
||||
! !$! Failure: -1
|
||||
! !$! OPTIONAL PARAMETERS - NONE
|
||||
! !$!
|
||||
! !$! AUTHOR
|
||||
! !$! Elena Pourmal
|
||||
! !$! October 7, 2002
|
||||
! !$!
|
||||
! !$! HISTORY
|
||||
! !$!
|
||||
! !$!
|
||||
! !$! NOTESCommented out until 1.6 release(?) 10/08/2002 EIP
|
||||
! !$!
|
||||
|
||||
! ! SOURCE
|
||||
! SUBROUTINE h5sselect_select_f(space1_id, operator, space2_id, &
|
||||
! hdferr)
|
||||
! IMPLICIT NONE
|
||||
! INTEGER(HID_T), INTENT(INOUT) :: space1_id ! Dataspace identifier to
|
||||
! modify
|
||||
! INTEGER(HID_T), INTENT(IN) :: space2_id ! Second dataspace identifier
|
||||
! INTEGER, INTENT(IN) :: operator ! Flag, valid values are:
|
||||
! H5S_SELECT_NOOP_F
|
||||
! H5S_SELECT_SET_F
|
||||
! H5S_SELECT_OR_F
|
||||
! H5S_SELECT_AND_F
|
||||
! H5S_SELECT_XOR_F
|
||||
! H5S_SELECT_NOTB_F
|
||||
! H5S_SELECT_NOTA_F
|
||||
! H5S_SELECT_APPEND_F
|
||||
! H5S_SELECT_PREPEND_F
|
||||
!
|
||||
! INTEGER, INTENT(OUT) :: hdferr ! Error code
|
||||
|
||||
! INTERFACE
|
||||
! INTEGER FUNCTION h5sselect_select_c(space1_id, operator, &
|
||||
! space2_id)
|
||||
! USE H5GLOBAL
|
||||
! !DEC$IF DEFINED(HDF5F90_WINDOWS)
|
||||
! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SSELECT_SELECT_C'::h5sselect_select_c
|
||||
! !DEC$ENDIF
|
||||
! INTEGER(HID_T), INTENT(INOUT) :: space1_id
|
||||
! INTEGER(HID_T), INTENT(IN) :: space2_id
|
||||
! INTEGER, INTENT(IN) :: operator
|
||||
! END FUNCTION h5sselect_select_c
|
||||
! END INTERFACE
|
||||
|
||||
! hdferr = h5sselect_select_c(space1_id, operator, space2_id)
|
||||
! return
|
||||
|
||||
! END SUBROUTINE h5sselect_select_f
|
||||
|
||||
!
|
||||
!****s* H5S/h5sget_select_type_f
|
||||
|
@ -120,9 +120,6 @@ H5_FCDLL int_f h5sset_extent_none_c( hid_t_f *space_id );
|
||||
H5_FCDLL int_f h5sselect_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block);
|
||||
H5_FCDLL int_f h5sget_select_type_c( hid_t_f *space_id , int_f *op);
|
||||
H5_FCDLL int_f h5sselect_elements_c( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord);
|
||||
H5_FCDLL int_f h5scombine_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id);
|
||||
H5_FCDLL int_f h5scombine_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id);
|
||||
H5_FCDLL int_f h5sselect_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id);
|
||||
H5_FCDLL int_f h5sdecode_c( _fcd buf, hid_t_f *obj_id );
|
||||
H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc );
|
||||
H5_FCDLL int_f h5sextent_equal_c( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal);
|
||||
|
@ -167,52 +167,12 @@ New Features
|
||||
|
||||
C++ Library:
|
||||
------------
|
||||
- New wrappers
|
||||
- Added new function to the C++ interface
|
||||
|
||||
Added the following items:
|
||||
Added wrapper for H5Ovisit2:
|
||||
H5Object::visit()
|
||||
|
||||
+ Class DSetAccPropList for the dataset access property list.
|
||||
|
||||
+ Wrapper for H5Dget_access_plist to class DataSet
|
||||
// Gets the access property list of this dataset.
|
||||
DSetAccPropList getAccessPlist() const;
|
||||
|
||||
+ Wrappers for H5Pset_chunk_cache and H5Pget_chunk_cache to class DSetAccPropList
|
||||
// Sets the raw data chunk cache parameters.
|
||||
void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0)
|
||||
|
||||
// Retrieves the raw data chunk cache parameters.
|
||||
void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0)
|
||||
|
||||
+ New operator!= to class DataType (HDFFV-10472)
|
||||
// Determines whether two datatypes are not the same.
|
||||
bool operator!=(const DataType& compared_type)
|
||||
|
||||
+ Wrappers for H5Oget_info2, H5Oget_info_by_name2, and H5Oget_info_by_idx2
|
||||
(HDFFV-10458)
|
||||
|
||||
// Retrieves information about an HDF5 object.
|
||||
void getObjinfo(H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC) const;
|
||||
|
||||
// Retrieves information about an HDF5 object, given its name.
|
||||
void getObjinfo(const char* name, H5O_info_t& objinfo,
|
||||
unsigned fields = H5O_INFO_BASIC,
|
||||
const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
|
||||
void getObjinfo(const H5std_string& name, H5O_info_t& objinfo,
|
||||
unsigned fields = H5O_INFO_BASIC,
|
||||
const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
|
||||
|
||||
// Retrieves information about an HDF5 object, given its index.
|
||||
void getObjinfo(const char* grp_name, H5_index_t idx_type,
|
||||
H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo,
|
||||
unsigned fields = H5O_INFO_BASIC,
|
||||
const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
|
||||
void getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
|
||||
H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo,
|
||||
unsigned fields = H5O_INFO_BASIC,
|
||||
const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
|
||||
|
||||
(BMR - 2018/07/22, HDFFV-10150, HDFFV-10458, HDFFV-1047)
|
||||
(BMR - 2019/02/14, HDFFV-10532)
|
||||
|
||||
|
||||
Java Library:
|
||||
|
@ -2869,7 +2869,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
|
||||
mem_iter_init = TRUE;
|
||||
|
||||
/* Collect the modification data into the buffer */
|
||||
if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t)iter_nelmts, mod_data_p))
|
||||
if(0 == H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t)iter_nelmts, mod_data_p))
|
||||
HGOTO_ERROR(H5E_IO, H5E_CANTGATHER, FAIL, "couldn't gather from write buffer")
|
||||
|
||||
/* Send modification data to new owner */
|
||||
@ -3214,7 +3214,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
|
||||
|
||||
/* Gather modification data from the application write buffer into a temporary buffer */
|
||||
if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
|
||||
if(0 == H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
|
||||
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't gather from write buffer")
|
||||
|
||||
if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
|
||||
|
148
src/H5Sall.c
148
src/H5Sall.c
@ -359,6 +359,80 @@ H5S__all_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
|
||||
FUNC_LEAVE_NOAPI(FAIL)
|
||||
} /* end H5S__all_iter_next_block() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5S__all_get_seq_list
|
||||
PURPOSE
|
||||
Create a list of offsets & lengths for a selection
|
||||
USAGE
|
||||
herr_t H5S__all_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
|
||||
H5S_t *space; IN: Dataspace containing selection to use.
|
||||
unsigned flags; IN: Flags for extra information about operation
|
||||
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
|
||||
position of interest in selection.
|
||||
size_t maxseq; IN: Maximum number of sequences to generate
|
||||
size_t maxelem; IN: Maximum number of elements to include in the
|
||||
generated sequences
|
||||
size_t *nseq; OUT: Actual number of sequences generated
|
||||
size_t *nelem; OUT: Actual number of elements in sequences generated
|
||||
hsize_t *off; OUT: Array of offsets
|
||||
size_t *len; OUT: Array of lengths
|
||||
RETURNS
|
||||
Non-negative on success/Negative on failure.
|
||||
DESCRIPTION
|
||||
Use the selection in the dataspace to generate a list of byte offsets and
|
||||
lengths for the region(s) selected. Start/Restart from the position in the
|
||||
ITER parameter. The number of sequences generated is limited by the MAXSEQ
|
||||
parameter and the number of sequences actually generated is stored in the
|
||||
NSEQ parameter.
|
||||
GLOBAL VARIABLES
|
||||
COMMENTS, BUGS, ASSUMPTIONS
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S__all_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
|
||||
size_t H5_ATTR_UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
|
||||
hsize_t *off, size_t *len)
|
||||
{
|
||||
size_t elem_used; /* The number of elements used */
|
||||
|
||||
FUNC_ENTER_STATIC_NOERR
|
||||
|
||||
/* Check args */
|
||||
HDassert(space);
|
||||
HDassert(iter);
|
||||
HDassert(maxseq > 0);
|
||||
HDassert(maxelem > 0);
|
||||
HDassert(nseq);
|
||||
HDassert(nelem);
|
||||
HDassert(off);
|
||||
HDassert(len);
|
||||
|
||||
/* Determine the actual number of elements to use */
|
||||
H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
|
||||
elem_used = MIN(maxelem, (size_t)iter->elmt_left);
|
||||
HDassert(elem_used > 0);
|
||||
|
||||
/* Compute the offset in the dataset */
|
||||
off[0] = iter->u.all.byte_offset;
|
||||
len[0] = elem_used * iter->elmt_size;
|
||||
|
||||
/* Should only need one sequence for 'all' selections */
|
||||
*nseq = 1;
|
||||
|
||||
/* Set the number of elements used */
|
||||
*nelem = elem_used;
|
||||
|
||||
/* Update the iterator */
|
||||
iter->elmt_left -= elem_used;
|
||||
iter->u.all.elmt_offset += elem_used;
|
||||
iter->u.all.byte_offset += len[0];
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5S__all_get_seq_list() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -993,77 +1067,3 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Sselect_all() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5S__all_get_seq_list
|
||||
PURPOSE
|
||||
Create a list of offsets & lengths for a selection
|
||||
USAGE
|
||||
herr_t H5S__all_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
|
||||
H5S_t *space; IN: Dataspace containing selection to use.
|
||||
unsigned flags; IN: Flags for extra information about operation
|
||||
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
|
||||
position of interest in selection.
|
||||
size_t maxseq; IN: Maximum number of sequences to generate
|
||||
size_t maxelem; IN: Maximum number of elements to include in the
|
||||
generated sequences
|
||||
size_t *nseq; OUT: Actual number of sequences generated
|
||||
size_t *nelem; OUT: Actual number of elements in sequences generated
|
||||
hsize_t *off; OUT: Array of offsets
|
||||
size_t *len; OUT: Array of lengths
|
||||
RETURNS
|
||||
Non-negative on success/Negative on failure.
|
||||
DESCRIPTION
|
||||
Use the selection in the dataspace to generate a list of byte offsets and
|
||||
lengths for the region(s) selected. Start/Restart from the position in the
|
||||
ITER parameter. The number of sequences generated is limited by the MAXSEQ
|
||||
parameter and the number of sequences actually generated is stored in the
|
||||
NSEQ parameter.
|
||||
GLOBAL VARIABLES
|
||||
COMMENTS, BUGS, ASSUMPTIONS
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S__all_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
|
||||
size_t H5_ATTR_UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
|
||||
hsize_t *off, size_t *len)
|
||||
{
|
||||
size_t elem_used; /* The number of elements used */
|
||||
|
||||
FUNC_ENTER_STATIC_NOERR
|
||||
|
||||
/* Check args */
|
||||
HDassert(space);
|
||||
HDassert(iter);
|
||||
HDassert(maxseq > 0);
|
||||
HDassert(maxelem > 0);
|
||||
HDassert(nseq);
|
||||
HDassert(nelem);
|
||||
HDassert(off);
|
||||
HDassert(len);
|
||||
|
||||
/* Determine the actual number of elements to use */
|
||||
H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
|
||||
elem_used = MIN(maxelem, (size_t)iter->elmt_left);
|
||||
HDassert(elem_used > 0);
|
||||
|
||||
/* Compute the offset in the dataset */
|
||||
off[0] = iter->u.all.byte_offset;
|
||||
len[0] = elem_used * iter->elmt_size;
|
||||
|
||||
/* Should only need one sequence for 'all' selections */
|
||||
*nseq = 1;
|
||||
|
||||
/* Set the number of elements used */
|
||||
*nelem = elem_used;
|
||||
|
||||
/* Update the iterator */
|
||||
iter->elmt_left -= elem_used;
|
||||
iter->u.all.elmt_offset += elem_used;
|
||||
iter->u.all.byte_offset += len[0];
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5S__all_get_seq_list() */
|
||||
|
||||
|
3788
src/H5Shyper.c
3788
src/H5Shyper.c
File diff suppressed because it is too large
Load Diff
@ -31,12 +31,7 @@
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Dprivate.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Fprivate.h" /* File access */
|
||||
#include "H5FDprivate.h" /* File drivers */
|
||||
#include "H5Iprivate.h" /* IDs */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5Oprivate.h" /* Object headers */
|
||||
#include "H5Pprivate.h" /* Property lists */
|
||||
#include "H5Spkg.h" /* Dataspaces */
|
||||
#include "H5VMprivate.h" /* Vector and array functions */
|
||||
|
||||
@ -97,6 +92,8 @@ static herr_t H5S__mpio_create_large_type(hsize_t, MPI_Aint, MPI_Datatype , MPI_
|
||||
static hsize_t bigio_count = H5S_MAX_MPI_COUNT;
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5S_mpio_set_bigio_count
|
||||
*
|
||||
|
116
src/H5Snone.c
116
src/H5Snone.c
@ -331,6 +331,64 @@ H5S__none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
|
||||
FUNC_LEAVE_NOAPI(FAIL)
|
||||
} /* end H5S__none_iter_next_block() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5S__none_get_seq_list
|
||||
PURPOSE
|
||||
Create a list of offsets & lengths for a selection
|
||||
USAGE
|
||||
herr_t H5S__none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
|
||||
H5S_t *space; IN: Dataspace containing selection to use.
|
||||
unsigned flags; IN: Flags for extra information about operation
|
||||
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
|
||||
position of interest in selection.
|
||||
size_t maxseq; IN: Maximum number of sequences to generate
|
||||
size_t maxelem; IN: Maximum number of elements to include in the
|
||||
generated sequences
|
||||
size_t *nseq; OUT: Actual number of sequences generated
|
||||
size_t *nelem; OUT: Actual number of elements in sequences generated
|
||||
hsize_t *off; OUT: Array of offsets
|
||||
size_t *len; OUT: Array of lengths
|
||||
RETURNS
|
||||
Non-negative on success/Negative on failure.
|
||||
DESCRIPTION
|
||||
Use the selection in the dataspace to generate a list of byte offsets and
|
||||
lengths for the region(s) selected. Start/Restart from the position in the
|
||||
ITER parameter. The number of sequences generated is limited by the MAXSEQ
|
||||
parameter and the number of sequences actually generated is stored in the
|
||||
NSEQ parameter.
|
||||
GLOBAL VARIABLES
|
||||
COMMENTS, BUGS, ASSUMPTIONS
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S__none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter,
|
||||
size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq, size_t *nelem,
|
||||
hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
|
||||
{
|
||||
FUNC_ENTER_STATIC_NOERR
|
||||
|
||||
/* Check args */
|
||||
HDassert(space);
|
||||
HDassert(iter);
|
||||
HDassert(maxseq > 0);
|
||||
HDassert(maxelem > 0);
|
||||
HDassert(nseq);
|
||||
HDassert(nelem);
|
||||
HDassert(off);
|
||||
HDassert(len);
|
||||
|
||||
/* "none" selections don't generate sequences of bytes */
|
||||
*nseq = 0;
|
||||
|
||||
/* They don't use any elements, either */
|
||||
*nelem = 0;
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5S__none_get_seq_list() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -941,61 +999,3 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Sselect_none() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5S__none_get_seq_list
|
||||
PURPOSE
|
||||
Create a list of offsets & lengths for a selection
|
||||
USAGE
|
||||
herr_t H5S__none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
|
||||
H5S_t *space; IN: Dataspace containing selection to use.
|
||||
unsigned flags; IN: Flags for extra information about operation
|
||||
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
|
||||
position of interest in selection.
|
||||
size_t maxseq; IN: Maximum number of sequences to generate
|
||||
size_t maxelem; IN: Maximum number of elements to include in the
|
||||
generated sequences
|
||||
size_t *nseq; OUT: Actual number of sequences generated
|
||||
size_t *nelem; OUT: Actual number of elements in sequences generated
|
||||
hsize_t *off; OUT: Array of offsets
|
||||
size_t *len; OUT: Array of lengths
|
||||
RETURNS
|
||||
Non-negative on success/Negative on failure.
|
||||
DESCRIPTION
|
||||
Use the selection in the dataspace to generate a list of byte offsets and
|
||||
lengths for the region(s) selected. Start/Restart from the position in the
|
||||
ITER parameter. The number of sequences generated is limited by the MAXSEQ
|
||||
parameter and the number of sequences actually generated is stored in the
|
||||
NSEQ parameter.
|
||||
GLOBAL VARIABLES
|
||||
COMMENTS, BUGS, ASSUMPTIONS
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S__none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter,
|
||||
size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq, size_t *nelem,
|
||||
hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
|
||||
{
|
||||
FUNC_ENTER_STATIC_NOERR
|
||||
|
||||
/* Check args */
|
||||
HDassert(space);
|
||||
HDassert(iter);
|
||||
HDassert(maxseq > 0);
|
||||
HDassert(maxelem > 0);
|
||||
HDassert(nseq);
|
||||
HDassert(nelem);
|
||||
HDassert(off);
|
||||
HDassert(len);
|
||||
|
||||
/* "none" selections don't generate sequences of bytes */
|
||||
*nseq = 0;
|
||||
|
||||
/* They don't use any elements, either */
|
||||
*nelem = 0;
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5S__none_get_seq_list() */
|
||||
|
||||
|
@ -116,7 +116,7 @@ struct H5S_hyper_span_info_t {
|
||||
struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */
|
||||
};
|
||||
|
||||
/* Information about new-style hyperslab selection */
|
||||
/* Information about 'diminfo' form of hyperslab selection */
|
||||
typedef struct {
|
||||
hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */
|
||||
H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
|
||||
@ -280,7 +280,7 @@ H5_DLL herr_t H5S__extent_release(H5S_extent_t *extent);
|
||||
H5_DLL herr_t H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
|
||||
hbool_t copy_max);
|
||||
|
||||
/* Operations on selections */
|
||||
/* Operations on hyperslab selections */
|
||||
H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space,
|
||||
const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space);
|
||||
H5_DLL herr_t H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space);
|
||||
|
279
src/H5Spoint.c
279
src/H5Spoint.c
@ -368,6 +368,144 @@ H5S__point_iter_next_block(H5S_sel_iter_t *iter)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5S__point_iter_next_block() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5S__point_get_seq_list
|
||||
PURPOSE
|
||||
Create a list of offsets & lengths for a selection
|
||||
USAGE
|
||||
herr_t H5S__point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
|
||||
H5S_t *space; IN: Dataspace containing selection to use.
|
||||
unsigned flags; IN: Flags for extra information about operation
|
||||
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
|
||||
position of interest in selection.
|
||||
size_t maxseq; IN: Maximum number of sequences to generate
|
||||
size_t maxelem; IN: Maximum number of elements to include in the
|
||||
generated sequences
|
||||
size_t *nseq; OUT: Actual number of sequences generated
|
||||
size_t *nelem; OUT: Actual number of elements in sequences generated
|
||||
hsize_t *off; OUT: Array of offsets (in bytes)
|
||||
size_t *len; OUT: Array of lengths (in bytes)
|
||||
RETURNS
|
||||
Non-negative on success/Negative on failure.
|
||||
DESCRIPTION
|
||||
Use the selection in the dataspace to generate a list of byte offsets and
|
||||
lengths for the region(s) selected. Start/Restart from the position in the
|
||||
ITER parameter. The number of sequences generated is limited by the MAXSEQ
|
||||
parameter and the number of sequences actually generated is stored in the
|
||||
NSEQ parameter.
|
||||
GLOBAL VARIABLES
|
||||
COMMENTS, BUGS, ASSUMPTIONS
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
|
||||
size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
|
||||
hsize_t *off, size_t *len)
|
||||
{
|
||||
size_t io_left; /* The number of bytes left in the selection */
|
||||
size_t start_io_left; /* The initial number of bytes left in the selection */
|
||||
H5S_pnt_node_t *node; /* Point node */
|
||||
hsize_t dims[H5S_MAX_RANK]; /* Total size of memory buf */
|
||||
int ndims; /* Dimensionality of space*/
|
||||
hsize_t acc; /* Coordinate accumulator */
|
||||
hsize_t loc; /* Coordinate offset */
|
||||
size_t curr_seq; /* Current sequence being operated on */
|
||||
int i; /* Local index variable */
|
||||
herr_t ret_value = SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
/* Check args */
|
||||
HDassert(space);
|
||||
HDassert(iter);
|
||||
HDassert(maxseq > 0);
|
||||
HDassert(maxelem > 0);
|
||||
HDassert(nseq);
|
||||
HDassert(nelem);
|
||||
HDassert(off);
|
||||
HDassert(len);
|
||||
|
||||
/* Choose the minimum number of bytes to sequence through */
|
||||
H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
|
||||
start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem);
|
||||
|
||||
/* Get the dataspace dimensions */
|
||||
if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve dataspace dimensions")
|
||||
|
||||
/* Walk through the points in the selection, starting at the current */
|
||||
/* location in the iterator */
|
||||
node = iter->u.pnt.curr;
|
||||
curr_seq = 0;
|
||||
while(NULL != node) {
|
||||
/* Compute the offset of each selected point in the buffer */
|
||||
for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) {
|
||||
loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc;
|
||||
acc *= dims[i];
|
||||
} /* end for */
|
||||
|
||||
/* Check if this is a later point in the selection */
|
||||
if(curr_seq > 0) {
|
||||
/* If a sorted sequence is requested, make certain we don't go backwards in the offset */
|
||||
if((flags&H5S_GET_SEQ_LIST_SORTED) && loc<off[curr_seq-1])
|
||||
break;
|
||||
|
||||
/* Check if this point extends the previous sequence */
|
||||
/* (Unlikely, but possible) */
|
||||
if(loc == (off[curr_seq - 1] + len[curr_seq - 1])) {
|
||||
/* Extend the previous sequence */
|
||||
len[curr_seq - 1] += iter->elmt_size;
|
||||
} /* end if */
|
||||
else {
|
||||
/* Add a new sequence */
|
||||
off[curr_seq] = loc;
|
||||
len[curr_seq] = iter->elmt_size;
|
||||
|
||||
/* Increment sequence count */
|
||||
curr_seq++;
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
else {
|
||||
/* Add a new sequence */
|
||||
off[curr_seq] = loc;
|
||||
len[curr_seq] = iter->elmt_size;
|
||||
|
||||
/* Increment sequence count */
|
||||
curr_seq++;
|
||||
} /* end else */
|
||||
|
||||
/* Decrement number of elements left to process */
|
||||
io_left--;
|
||||
|
||||
/* Move the iterator */
|
||||
iter->u.pnt.curr = node->next;
|
||||
iter->elmt_left--;
|
||||
|
||||
/* Check if we're finished with all sequences */
|
||||
if(curr_seq == maxseq)
|
||||
break;
|
||||
|
||||
/* Check if we're finished with all the elements available */
|
||||
if(io_left == 0)
|
||||
break;
|
||||
|
||||
/* Advance to the next point */
|
||||
node = node->next;
|
||||
} /* end while */
|
||||
|
||||
/* Set the number of sequences generated */
|
||||
*nseq = curr_seq;
|
||||
|
||||
/* Set the number of elements used */
|
||||
*nelem = start_io_left - io_left;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5S__point_get_seq_list() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -525,7 +663,7 @@ H5S__point_release(H5S_t *space)
|
||||
{
|
||||
H5S_pnt_node_t *curr, *next; /* Point selection nodes */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
FUNC_ENTER_STATIC_NOERR
|
||||
|
||||
/* Check args */
|
||||
HDassert(space);
|
||||
@ -640,6 +778,7 @@ H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selec
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
/* Sanity checks */
|
||||
HDassert(src);
|
||||
HDassert(dst);
|
||||
|
||||
@ -1651,141 +1790,3 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Sselect_elements() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5S__point_get_seq_list
|
||||
PURPOSE
|
||||
Create a list of offsets & lengths for a selection
|
||||
USAGE
|
||||
herr_t H5S__point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
|
||||
H5S_t *space; IN: Dataspace containing selection to use.
|
||||
unsigned flags; IN: Flags for extra information about operation
|
||||
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
|
||||
position of interest in selection.
|
||||
size_t maxseq; IN: Maximum number of sequences to generate
|
||||
size_t maxelem; IN: Maximum number of elements to include in the
|
||||
generated sequences
|
||||
size_t *nseq; OUT: Actual number of sequences generated
|
||||
size_t *nelem; OUT: Actual number of elements in sequences generated
|
||||
hsize_t *off; OUT: Array of offsets
|
||||
size_t *len; OUT: Array of lengths
|
||||
RETURNS
|
||||
Non-negative on success/Negative on failure.
|
||||
DESCRIPTION
|
||||
Use the selection in the dataspace to generate a list of byte offsets and
|
||||
lengths for the region(s) selected. Start/Restart from the position in the
|
||||
ITER parameter. The number of sequences generated is limited by the MAXSEQ
|
||||
parameter and the number of sequences actually generated is stored in the
|
||||
NSEQ parameter.
|
||||
GLOBAL VARIABLES
|
||||
COMMENTS, BUGS, ASSUMPTIONS
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
|
||||
size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
|
||||
hsize_t *off, size_t *len)
|
||||
{
|
||||
size_t io_left; /* The number of bytes left in the selection */
|
||||
size_t start_io_left; /* The initial number of bytes left in the selection */
|
||||
H5S_pnt_node_t *node; /* Point node */
|
||||
hsize_t dims[H5S_MAX_RANK]; /* Total size of memory buf */
|
||||
int ndims; /* Dimensionality of space*/
|
||||
hsize_t acc; /* Coordinate accumulator */
|
||||
hsize_t loc; /* Coordinate offset */
|
||||
size_t curr_seq; /* Current sequence being operated on */
|
||||
int i; /* Local index variable */
|
||||
herr_t ret_value=SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
/* Check args */
|
||||
HDassert(space);
|
||||
HDassert(iter);
|
||||
HDassert(maxseq > 0);
|
||||
HDassert(maxelem > 0);
|
||||
HDassert(nseq);
|
||||
HDassert(nelem);
|
||||
HDassert(off);
|
||||
HDassert(len);
|
||||
|
||||
/* Choose the minimum number of bytes to sequence through */
|
||||
H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
|
||||
start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem);
|
||||
|
||||
/* Get the dataspace dimensions */
|
||||
if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve dataspace dimensions")
|
||||
|
||||
/* Walk through the points in the selection, starting at the current */
|
||||
/* location in the iterator */
|
||||
node = iter->u.pnt.curr;
|
||||
curr_seq = 0;
|
||||
while(NULL != node) {
|
||||
/* Compute the offset of each selected point in the buffer */
|
||||
for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) {
|
||||
loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc;
|
||||
acc *= dims[i];
|
||||
} /* end for */
|
||||
|
||||
/* Check if this is a later point in the selection */
|
||||
if(curr_seq>0) {
|
||||
/* If a sorted sequence is requested, make certain we don't go backwards in the offset */
|
||||
if((flags&H5S_GET_SEQ_LIST_SORTED) && loc<off[curr_seq-1])
|
||||
break;
|
||||
|
||||
/* Check if this point extends the previous sequence */
|
||||
/* (Unlikely, but possible) */
|
||||
if(loc==(off[curr_seq-1]+len[curr_seq-1])) {
|
||||
/* Extend the previous sequence */
|
||||
len[curr_seq-1]+=iter->elmt_size;
|
||||
} /* end if */
|
||||
else {
|
||||
/* Add a new sequence */
|
||||
off[curr_seq]=loc;
|
||||
len[curr_seq]=iter->elmt_size;
|
||||
|
||||
/* Increment sequence count */
|
||||
curr_seq++;
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
else {
|
||||
/* Add a new sequence */
|
||||
off[curr_seq]=loc;
|
||||
len[curr_seq]=iter->elmt_size;
|
||||
|
||||
/* Increment sequence count */
|
||||
curr_seq++;
|
||||
} /* end else */
|
||||
|
||||
/* Decrement number of elements left to process */
|
||||
io_left--;
|
||||
|
||||
/* Move the iterator */
|
||||
iter->u.pnt.curr=node->next;
|
||||
iter->elmt_left--;
|
||||
|
||||
/* Check if we're finished with all sequences */
|
||||
if(curr_seq==maxseq)
|
||||
break;
|
||||
|
||||
/* Check if we're finished with all the elements available */
|
||||
if(io_left==0)
|
||||
break;
|
||||
|
||||
/* Advance to the next point */
|
||||
node=node->next;
|
||||
} /* end while */
|
||||
|
||||
/* Set the number of sequences generated */
|
||||
*nseq=curr_seq;
|
||||
|
||||
/* Set the number of elements used */
|
||||
*nelem=start_io_left-io_left;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5S__point_get_seq_list() */
|
||||
|
||||
|
@ -58,7 +58,7 @@ typedef struct H5S_hyper_dim_t {
|
||||
|
||||
/* Point selection iteration container */
|
||||
typedef struct {
|
||||
H5S_pnt_node_t *curr; /* Pointer to next node to output */
|
||||
H5S_pnt_node_t *curr; /* Pointer to next node to output */
|
||||
} H5S_point_iter_t;
|
||||
|
||||
/* Hyperslab selection iteration container */
|
||||
@ -286,9 +286,6 @@ H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank,
|
||||
const hsize_t *coords);
|
||||
H5_DLL herr_t H5S_hyper_reset_scratch(H5S_t *space);
|
||||
H5_DLL herr_t H5S_hyper_convert(H5S_t *space);
|
||||
#ifdef LATER
|
||||
H5_DLL htri_t H5S_hyper_intersect (H5S_t *space1, H5S_t *space2);
|
||||
#endif /* LATER */
|
||||
H5_DLL htri_t H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
|
||||
H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
|
||||
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
|
||||
@ -304,7 +301,8 @@ H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space,
|
||||
hsize_t clip_size, hbool_t *partial);
|
||||
|
||||
/* Operations on selection iterators */
|
||||
H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size);
|
||||
H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space,
|
||||
size_t elmt_size);
|
||||
H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords);
|
||||
H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter);
|
||||
H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
|
||||
|
@ -127,16 +127,6 @@ H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
|
||||
H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
|
||||
const hsize_t start[], const hsize_t _stride[], const hsize_t count[],
|
||||
const hsize_t _block[]);
|
||||
/* #define NEW_HYPERSLAB_API */
|
||||
/* Note that these haven't been working for a while and were never
|
||||
* publicly released - QAK */
|
||||
#ifdef NEW_HYPERSLAB_API
|
||||
H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
|
||||
const hsize_t start[], const hsize_t _stride[], const hsize_t count[],
|
||||
const hsize_t _block[]);
|
||||
H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id);
|
||||
H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id);
|
||||
#endif /* NEW_HYPERSLAB_API */
|
||||
H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
|
||||
H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
|
||||
hsize_t stride[], hsize_t count[], hsize_t block[]);
|
||||
|
@ -293,43 +293,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5S_select_release() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5S_select_get_seq_list
|
||||
*
|
||||
* Purpose: Retrieves the next sequence of offset/length pairs for an
|
||||
* iterator on a dataspace
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, May 18, 2004
|
||||
*
|
||||
* Note: This routine participates in the "Inlining C function pointers"
|
||||
* pattern, don't call it directly, use the appropriate macro
|
||||
* defined in H5Sprivate.h.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
|
||||
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
|
||||
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
|
||||
{
|
||||
herr_t ret_value = FAIL; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
HDassert(space);
|
||||
|
||||
/* Call the selection type's get_seq_list function */
|
||||
if((ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5S_select_get_seq_list() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5S_select_serial_size
|
||||
@ -1424,6 +1387,44 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
|
||||
} /* end H5S_select_iter_next_block() */
|
||||
#endif /* LATER */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5S_select_get_seq_list
|
||||
*
|
||||
* Purpose: Retrieves the next sequence of offset/length pairs for an
|
||||
* iterator on a dataspace
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, May 18, 2004
|
||||
*
|
||||
* Note: This routine participates in the "Inlining C function pointers"
|
||||
* pattern, don't call it directly, use the appropriate macro
|
||||
* defined in H5Sprivate.h.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
|
||||
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
|
||||
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
|
||||
{
|
||||
herr_t ret_value = FAIL; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(space);
|
||||
|
||||
/* Call the selection type's get_seq_list function */
|
||||
if((ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5S_select_get_seq_list() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -1731,8 +1732,6 @@ H5S_get_select_type(const H5S_t *space)
|
||||
Assumes that there is only a single "block" for hyperslab selections.
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
Modified function to view identical shapes with different dimensions
|
||||
as being the same under some circumstances.
|
||||
--------------------------------------------------------------------------*/
|
||||
htri_t
|
||||
H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
|
||||
@ -1912,11 +1911,11 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
|
||||
space_a_dim = (int)space_a_rank - 1;
|
||||
space_b_dim = (int)space_b_rank - 1;
|
||||
|
||||
/* The first block only compares the sizes and sets the
|
||||
* relative offsets for later blocks
|
||||
/* The first block only compares the sizes and sets the
|
||||
* relative offsets for later blocks
|
||||
*/
|
||||
if(first_block) {
|
||||
/* If the block sizes in the common dimensions from
|
||||
/* If the block sizes in the common dimensions from
|
||||
* each selection don't match, get out
|
||||
*/
|
||||
while(space_b_dim >= 0) {
|
||||
@ -1932,7 +1931,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
|
||||
space_b_dim--;
|
||||
} /* end while */
|
||||
|
||||
/* similarly, if the block size in any dimension that appears only
|
||||
/* Similarly, if the block size in any dimension that appears only
|
||||
* in space_a is not equal to 1, get out.
|
||||
*/
|
||||
while(space_a_dim >= 0) {
|
||||
@ -1950,7 +1949,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
|
||||
} /* end if */
|
||||
/* Check over the blocks for each selection */
|
||||
else {
|
||||
/* for dimensions that space_a and space_b have in common: */
|
||||
/* For dimensions that space_a and space_b have in common: */
|
||||
while(space_b_dim >= 0) {
|
||||
/* Check if the blocks are in the same relative location */
|
||||
if((start_a[space_a_dim] - off_a[space_a_dim]) !=
|
||||
|
366
test/tselect.c
366
test/tselect.c
@ -4910,365 +4910,6 @@ test_select_hyper_union(void)
|
||||
HDfree(rbuf);
|
||||
} /* test_select_hyper_union() */
|
||||
|
||||
#ifdef NEW_HYPERSLAB_API
|
||||
/****************************************************************
|
||||
**
|
||||
** test_select_hyper_union_stagger(): Test basic H5S (dataspace) selection code.
|
||||
** Tests unions of staggered hyperslabs. (Uses H5Scombine_hyperslab
|
||||
** and H5Sselect_select instead of H5Sselect_hyperslab)
|
||||
**
|
||||
****************************************************************/
|
||||
static void
|
||||
test_select_hyper_union_stagger(void)
|
||||
{
|
||||
hid_t file_id; /* File ID */
|
||||
hid_t dset_id; /* Dataset ID */
|
||||
hid_t dataspace; /* File dataspace ID */
|
||||
hid_t memspace; /* Memory dataspace ID */
|
||||
hid_t tmp_space; /* Temporary dataspace ID */
|
||||
hid_t tmp2_space; /* Another emporary dataspace ID */
|
||||
hsize_t dimsm[2]={7,7}; /* Memory array dimensions */
|
||||
hsize_t dimsf[2]={6,5}; /* File array dimensions */
|
||||
hsize_t count[2]={3,1}; /* 1st Hyperslab size */
|
||||
hsize_t count2[2]={3,1}; /* 2nd Hyperslab size */
|
||||
hsize_t count3[2]={2,1}; /* 3rd Hyperslab size */
|
||||
hssize_t offset[2]={0,0}; /* 1st Hyperslab offset */
|
||||
hssize_t offset2[2]={2,1}; /* 2nd Hyperslab offset */
|
||||
hssize_t offset3[2]={4,2}; /* 3rd Hyperslab offset */
|
||||
hsize_t count_out[2]={4,2}; /* Hyperslab size in memory */
|
||||
hssize_t offset_out[2]={0,3}; /* Hyperslab offset in memory */
|
||||
int data[6][5]; /* Data to write */
|
||||
int data_out[7][7]; /* Data read in */
|
||||
int input_loc[8][2]={{0,0},
|
||||
{1,0},
|
||||
{2,0},
|
||||
{2,1},
|
||||
{3,1},
|
||||
{4,1},
|
||||
{4,2},
|
||||
{5,2}};
|
||||
int output_loc[8][2]={{0,3},
|
||||
{0,4},
|
||||
{1,3},
|
||||
{1,4},
|
||||
{2,3},
|
||||
{2,4},
|
||||
{3,3},
|
||||
{3,4}};
|
||||
int dsetrank=2; /* File Dataset rank */
|
||||
int memrank=2; /* Memory Dataset rank */
|
||||
int i,j; /* Local counting variables */
|
||||
herr_t error;
|
||||
hsize_t stride[2]={1,1};
|
||||
hsize_t block[2]={1,1};
|
||||
|
||||
/* Initialize data to write */
|
||||
for(i=0; i<6; i++)
|
||||
for(j=0; j<5; j++)
|
||||
data[i][j] = j*10 + i;
|
||||
|
||||
/* Create file */
|
||||
file_id=H5Fcreate(FILENAME,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
|
||||
CHECK(file_id, FAIL, "H5Fcreate");
|
||||
|
||||
/* Create File Dataspace */
|
||||
dataspace=H5Screate_simple(dsetrank,dimsf,NULL);
|
||||
CHECK(dataspace, FAIL, "H5Screate_simple");
|
||||
|
||||
/* Create File Dataset */
|
||||
dset_id=H5Dcreate2(file_id,"IntArray",H5T_NATIVE_INT,dataspace,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
CHECK(dset_id, FAIL, "H5Dcreate2");
|
||||
|
||||
/* Write File Dataset */
|
||||
error=H5Dwrite(dset_id,H5T_NATIVE_INT,dataspace,dataspace,H5P_DEFAULT,data);
|
||||
CHECK(error, FAIL, "H5Dwrite");
|
||||
|
||||
/* Close things */
|
||||
error=H5Sclose(dataspace);
|
||||
CHECK(error, FAIL, "H5Sclose");
|
||||
error = H5Dclose(dset_id);
|
||||
CHECK(error, FAIL, "H5Dclose");
|
||||
error = H5Fclose(file_id);
|
||||
CHECK(error, FAIL, "H5Fclose");
|
||||
|
||||
/* Initialize intput buffer */
|
||||
memset(data_out, 0, 7 * 7 * sizeof(int));
|
||||
|
||||
/* Open file */
|
||||
file_id = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
CHECK(file_id, FAIL, "H5Fopen");
|
||||
|
||||
/* Open dataset */
|
||||
dset_id = H5Dopen2(file_id, "IntArray", H5P_DEFAULT);
|
||||
CHECK(dset_id, FAIL, "H5Dopen2");
|
||||
|
||||
/* Get the dataspace */
|
||||
dataspace = H5Dget_space(dset_id);
|
||||
CHECK(dataspace, FAIL, "H5Dget_space");
|
||||
|
||||
/* Select the hyperslabs */
|
||||
error = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
|
||||
CHECK(error, FAIL, "H5Sselect_hyperslab");
|
||||
tmp_space = H5Scombine_hyperslab(dataspace, H5S_SELECT_OR, offset2, stride, count2, block);
|
||||
CHECK(tmp_space, FAIL, "H5Scombine_hyperslab");
|
||||
|
||||
/* Copy the file dataspace and select hyperslab */
|
||||
tmp2_space = H5Scopy(dataspace);
|
||||
CHECK(tmp2_space, FAIL, "H5Scopy");
|
||||
error=H5Sselect_hyperslab(tmp2_space,H5S_SELECT_SET,offset3,stride,count3,block);
|
||||
CHECK(error, FAIL, "H5Sselect_hyperslab");
|
||||
|
||||
/* Combine the copied dataspace with the temporary dataspace */
|
||||
error=H5Sselect_select(tmp_space,H5S_SELECT_OR,tmp2_space);
|
||||
CHECK(error, FAIL, "H5Sselect_select");
|
||||
|
||||
/* Create Memory Dataspace */
|
||||
memspace=H5Screate_simple(memrank,dimsm,NULL);
|
||||
CHECK(memspace, FAIL, "H5Screate_simple");
|
||||
|
||||
/* Select hyperslab in memory */
|
||||
error=H5Sselect_hyperslab(memspace,H5S_SELECT_SET,offset_out,stride,count_out,block);
|
||||
CHECK(error, FAIL, "H5Sselect_hyperslab");
|
||||
|
||||
/* Read File Dataset */
|
||||
error=H5Dread(dset_id,H5T_NATIVE_INT,memspace,tmp_space,H5P_DEFAULT,data_out);
|
||||
CHECK(error, FAIL, "H5Dread");
|
||||
|
||||
/* Verify input data */
|
||||
for(i=0; i<8; i++) {
|
||||
if(data[input_loc[i][0]][input_loc[i][1]]!=data_out[output_loc[i][0]][output_loc[i][1]]) {
|
||||
printf("input data #%d is wrong!\n",i);
|
||||
printf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]);
|
||||
printf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]);
|
||||
printf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]);
|
||||
TestErrPrintf("data_out=%d\n",data_out[output_loc[i][0]][output_loc[i][1]]);
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
|
||||
/* Close things */
|
||||
error=H5Sclose(tmp2_space);
|
||||
CHECK(error, FAIL, "H5Sclose");
|
||||
error=H5Sclose(tmp_space);
|
||||
CHECK(error, FAIL, "H5Sclose");
|
||||
error=H5Sclose(dataspace);
|
||||
CHECK(error, FAIL, "H5Sclose");
|
||||
error=H5Sclose(memspace);
|
||||
CHECK(error, FAIL, "H5Sclose");
|
||||
error=H5Dclose(dset_id);
|
||||
CHECK(error, FAIL, "H5Dclose");
|
||||
error=H5Fclose(file_id);
|
||||
CHECK(error, FAIL, "H5Fclose");
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_select_hyper_union_3d(): Test basic H5S (dataspace) selection code.
|
||||
** Tests unions of hyperslabs in 3-D (Uses H5Scombine_hyperslab
|
||||
** and H5Scombine_select instead of H5Sselect_hyperslab)
|
||||
**
|
||||
****************************************************************/
|
||||
static void
|
||||
test_select_hyper_union_3d(void)
|
||||
{
|
||||
hid_t fid1; /* HDF5 File IDs */
|
||||
hid_t dataset; /* Dataset ID */
|
||||
hid_t sid1,sid2; /* Dataspace ID */
|
||||
hid_t tmp_space; /* Temporary Dataspace ID */
|
||||
hid_t tmp2_space; /* Another temporary Dataspace ID */
|
||||
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
|
||||
hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
|
||||
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
|
||||
hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
|
||||
hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
|
||||
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
|
||||
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
|
||||
struct row_list {
|
||||
size_t z;
|
||||
size_t y;
|
||||
size_t x;
|
||||
size_t l;
|
||||
} rows[]= { /* Array of x,y,z coordinates & length for each row written from memory */
|
||||
{0,0,0,6}, /* 1st face of 3-D object */
|
||||
{0,1,0,6},
|
||||
{0,2,0,6},
|
||||
{0,3,0,6},
|
||||
{0,4,0,6},
|
||||
{1,0,0,6}, /* 2nd face of 3-D object */
|
||||
{1,1,0,6},
|
||||
{1,2,0,6},
|
||||
{1,3,0,6},
|
||||
{1,4,0,6},
|
||||
{2,0,0,6}, /* 3rd face of 3-D object */
|
||||
{2,1,0,10},
|
||||
{2,2,0,10},
|
||||
{2,3,0,10},
|
||||
{2,4,0,10},
|
||||
{2,5,2,8},
|
||||
{2,6,2,8},
|
||||
{3,0,0,6}, /* 4th face of 3-D object */
|
||||
{3,1,0,10},
|
||||
{3,2,0,10},
|
||||
{3,3,0,10},
|
||||
{3,4,0,10},
|
||||
{3,5,2,8},
|
||||
{3,6,2,8},
|
||||
{4,0,0,6}, /* 5th face of 3-D object */
|
||||
{4,1,0,10},
|
||||
{4,2,0,10},
|
||||
{4,3,0,10},
|
||||
{4,4,0,10},
|
||||
{4,5,2,8},
|
||||
{4,6,2,8},
|
||||
{5,1,2,8}, /* 6th face of 3-D object */
|
||||
{5,2,2,8},
|
||||
{5,3,2,8},
|
||||
{5,4,2,8},
|
||||
{5,5,2,8},
|
||||
{5,6,2,8},
|
||||
{6,1,2,8}, /* 7th face of 3-D object */
|
||||
{6,2,2,8},
|
||||
{6,3,2,8},
|
||||
{6,4,2,8},
|
||||
{6,5,2,8},
|
||||
{6,6,2,8},
|
||||
{7,1,2,8}, /* 8th face of 3-D object */
|
||||
{7,2,2,8},
|
||||
{7,3,2,8},
|
||||
{7,4,2,8},
|
||||
{7,5,2,8},
|
||||
{7,6,2,8}};
|
||||
uint8_t *wbuf, /* buffer to write to disk */
|
||||
*rbuf, /* buffer read from disk */
|
||||
*tbuf, /* temporary buffer pointer */
|
||||
*tbuf2; /* temporary buffer pointer */
|
||||
int i,j,k; /* Counters */
|
||||
herr_t ret; /* Generic return value */
|
||||
hsize_t npoints; /* Number of elements in selection */
|
||||
|
||||
/* Output message about test being performed */
|
||||
MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of 3-D hyperslabs\n"));
|
||||
|
||||
/* Allocate write & read buffers */
|
||||
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3);
|
||||
CHECK(wbuf, NULL, "HDmalloc");
|
||||
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE3_DIM1 * SPACE3_DIM2);
|
||||
CHECK(rbuf, NULL, "HDcalloc");
|
||||
|
||||
/* Initialize write buffer */
|
||||
for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
|
||||
for(j=0; j<SPACE4_DIM2; j++)
|
||||
for(k=0; k<SPACE4_DIM3; k++)
|
||||
*tbuf++=(uint8_t)((((i*SPACE4_DIM2)+j)*SPACE4_DIM3)+k);
|
||||
|
||||
/* Create file */
|
||||
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
CHECK(fid1, FAIL, "H5Fcreate");
|
||||
|
||||
/* Test case of two blocks which overlap corners and must be split */
|
||||
/* Create dataspace for dataset on disk */
|
||||
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
|
||||
CHECK(sid1, FAIL, "H5Screate_simple");
|
||||
|
||||
/* Create dataspace for writing buffer */
|
||||
sid2 = H5Screate_simple(SPACE4_RANK, dims2, NULL);
|
||||
CHECK(sid2, FAIL, "H5Screate_simple");
|
||||
|
||||
/* Select 2x15x13 hyperslab for disk dataset */
|
||||
start[0]=1; start[1]=0; start[2]=0;
|
||||
stride[0]=1; stride[1]=1; stride[2]=1;
|
||||
count[0]=2; count[1]=15; count[2]=13;
|
||||
block[0]=1; block[1]=1; block[2]=1;
|
||||
ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
|
||||
CHECK(ret, FAIL, "H5Sselect_hyperslab");
|
||||
|
||||
/* Select 5x5x6 hyperslab for memory dataset */
|
||||
start[0]=0; start[1]=0; start[2]=0;
|
||||
stride[0]=1; stride[1]=1; stride[2]=1;
|
||||
count[0]=5; count[1]=5; count[2]=6;
|
||||
block[0]=1; block[1]=1; block[2]=1;
|
||||
ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
|
||||
CHECK(ret, FAIL, "H5Sselect_hyperslab");
|
||||
|
||||
/* Union overlapping 15x20 hyperslab for memory dataset (forming a irregularly shaped region) */
|
||||
start[0]=2; start[1]=1; start[2]=2;
|
||||
stride[0]=1; stride[1]=1; stride[2]=1;
|
||||
count[0]=6; count[1]=6; count[2]=8;
|
||||
block[0]=1; block[1]=1; block[2]=1;
|
||||
tmp_space = H5Scombine_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
|
||||
CHECK(tmp_space, FAIL, "H5Sselect_hyperslab");
|
||||
|
||||
/* Combine dataspaces and create new dataspace */
|
||||
tmp2_space = H5Scombine_select(sid2,H5S_SELECT_OR,tmp_space);
|
||||
CHECK(tmp2_space, FAIL, "H5Scombin_select");
|
||||
|
||||
npoints = (hsize_t)H5Sget_select_npoints(tmp2_space);
|
||||
VERIFY(npoints, 15*26, "H5Sget_select_npoints");
|
||||
|
||||
/* Create a dataset */
|
||||
dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
CHECK(dataset, FAIL, "H5Dcreate2");
|
||||
|
||||
/* Write selection to disk */
|
||||
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,tmp2_space,sid1,H5P_DEFAULT,wbuf);
|
||||
CHECK(ret, FAIL, "H5Dwrite");
|
||||
|
||||
/* Close temporary dataspaces */
|
||||
ret = H5Sclose(tmp_space);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(tmp2_space);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
/* Close memory dataspace */
|
||||
ret = H5Sclose(sid2);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
/* Create dataspace for reading buffer */
|
||||
sid2 = H5Screate_simple(SPACE3_RANK, dims3, NULL);
|
||||
CHECK(sid2, FAIL, "H5Screate_simple");
|
||||
|
||||
/* Select 15x26 hyperslab for reading memory dataset */
|
||||
start[0]=0; start[1]=0;
|
||||
stride[0]=1; stride[1]=1;
|
||||
count[0]=15; count[1]=26;
|
||||
block[0]=1; block[1]=1;
|
||||
ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
|
||||
CHECK(ret, FAIL, "H5Sselect_hyperslab");
|
||||
|
||||
/* Read selection from disk */
|
||||
ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
|
||||
CHECK(ret, FAIL, "H5Dread");
|
||||
|
||||
/* Compare data read with data written out */
|
||||
for(i=0,tbuf2=rbuf; i<(int)(sizeof(rows)/sizeof(struct row_list)); i++) {
|
||||
tbuf=wbuf+(rows[i].z*SPACE4_DIM3*SPACE4_DIM2)+(rows[i].y*SPACE4_DIM3)+rows[i].x;
|
||||
for(j=0; j<(int)rows[i].l; j++, tbuf++, tbuf2++) {
|
||||
if(*tbuf!=*tbuf2)
|
||||
TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
|
||||
} /* end for */
|
||||
} /* end for */
|
||||
|
||||
/* Close memory dataspace */
|
||||
ret = H5Sclose(sid2);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
/* Close disk dataspace */
|
||||
ret = H5Sclose(sid1);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
CHECK(ret, FAIL, "H5Dclose");
|
||||
|
||||
/* Close file */
|
||||
ret = H5Fclose(fid1);
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
|
||||
/* Free memory buffers */
|
||||
HDfree(wbuf);
|
||||
HDfree(rbuf);
|
||||
} /* test_select_hyper_union_3d() */
|
||||
#endif /* NEW_HYPERSLAB_API */
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_select_hyper_and_2d(): Test basic H5S (dataspace) selection code.
|
||||
@ -6222,9 +5863,6 @@ test_select_point_chunk(void)
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
unsigned *data_out; /* output buffer */
|
||||
#ifdef LATER
|
||||
unsigned *tmpdata_out; /* output buffer */
|
||||
#endif /* LATER */
|
||||
|
||||
hsize_t start[SPACE7_RANK]; /* hyperslab offset */
|
||||
hsize_t count[SPACE7_RANK]; /* size of the hyperslab */
|
||||
@ -13669,10 +13307,6 @@ test_select(void)
|
||||
test_select_hyper_offset2();/* Test more selection offset code with hyperslabs */
|
||||
test_select_point_offset(); /* Test selection offset code with elements */
|
||||
test_select_hyper_union(); /* Test hyperslab union code */
|
||||
#ifdef NEW_HYPERSLAB_API
|
||||
test_select_hyper_union_stagger(); /* Test hyperslab union code for staggered slabs */
|
||||
test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */
|
||||
#endif /* NEW_HYPERSLAB_API */
|
||||
test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */
|
||||
test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */
|
||||
test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */
|
||||
|
Loading…
Reference in New Issue
Block a user