summaryrefslogtreecommitdiffstats
path: root/src/H5Spkg.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-06-13 19:08:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-06-13 19:08:17 (GMT)
commit925f2ba71017081543f904a6a113055432693dab (patch)
treeb0f6e886d3da273d6588c453eab6f18bc8e827e8 /src/H5Spkg.h
parentb33344a7bebf46ff905b10c751cf39f7974e88d3 (diff)
downloadhdf5-925f2ba71017081543f904a6a113055432693dab.zip
hdf5-925f2ba71017081543f904a6a113055432693dab.tar.gz
hdf5-925f2ba71017081543f904a6a113055432693dab.tar.bz2
[svn-r8673] Purpose:
Code optimization Description: Revised dataspace selections to use a more "object oriented" mechanism to set the function pointers for each selection and selection iterator. This reduces the amount and number of times that dataspace selection info has to be copied. Additionally, change hyperslab selection information to be dynamically allocated instead of an inline struct. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel Too minor to require h5committest
Diffstat (limited to 'src/H5Spkg.h')
-rw-r--r--src/H5Spkg.h152
1 files changed, 71 insertions, 81 deletions
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 24fc8f3..72f9fd6 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -113,6 +113,8 @@ typedef struct {
} H5S_hyper_sel_t;
/* Selection information methods */
+/* Method to copy a selection */
+typedef herr_t (*H5S_sel_copy_func_t)(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
/* Method to retrieve a list of offset/length sequences for selection */
typedef herr_t (*H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
@@ -125,6 +127,8 @@ typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space);
typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space);
/* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t *buf);
+/* Method to store create selection from "serialized" form (a byte sequence suitable for storing on disk) */
+typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, const uint8_t *buf);
/* Method to determine to smallest n-D bounding box containing the current selection */
typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hssize_t *start, hssize_t *end);
/* Method to determine if current selection is contiguous */
@@ -136,26 +140,34 @@ typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space);
/* Method to initialize iterator for current selection */
typedef herr_t (*H5S_sel_iter_init_func_t)(H5S_sel_iter_t *sel_iter, const H5S_t *space);
-/* Selection information object */
+/* Selection class information */
typedef struct {
- H5S_sel_type type; /* Type of selection (list of points or hyperslabs) */
- hssize_t offset[H5S_MAX_RANK]; /* Offset within the extent */
- hsize_t *order; /* Selection order. (NULL means a specific ordering of points) */
- hsize_t num_elem; /* Number of elements in selection */
- union {
- H5S_pnt_list_t *pnt_lst; /* List of selected points (order is important) */
- H5S_hyper_sel_t hslab; /* Info about new-style hyperslab selections */
- } sel_info;
+ H5S_sel_type type; /* Type of selection (all, none, points or hyperslab) */
+
+ /* Methods */
+ H5S_sel_copy_func_t copy; /* Method to make a copy of a selection */
H5S_sel_get_seq_list_func_t get_seq_list; /* Method to retrieve a list of offset/length sequences for selection */
H5S_sel_release_func_t release; /* Method to release current selection */
H5S_sel_is_valid_func_t is_valid; /* Method to determine if current selection is valid for dataspace */
H5S_sel_serial_size_func_t serial_size; /* Method to determine number of bytes required to store current selection */
H5S_sel_serialize_func_t serialize; /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
+ H5S_sel_deserialize_func_t deserialize; /* Method to store create selection from "serialized" form (a byte sequence suitable for storing on disk) */
H5S_sel_bounds_func_t bounds; /* Method to determine to smallest n-D bounding box containing the current selection */
H5S_sel_is_contiguous_func_t is_contiguous; /* Method to determine if current selection is contiguous */
H5S_sel_is_single_func_t is_single; /* Method to determine if current selection is a single block */
H5S_sel_is_regular_func_t is_regular; /* Method to determine if current selection is "regular" */
H5S_sel_iter_init_func_t iter_init; /* Method to initialize iterator for current selection */
+} H5S_select_class_t;
+
+/* Selection information object */
+typedef struct {
+ const H5S_select_class_t *type; /* Pointer to selection's class info */
+ hssize_t offset[H5S_MAX_RANK]; /* Offset within the extent */
+ hsize_t num_elem; /* Number of elements in selection */
+ union {
+ H5S_pnt_list_t *pnt_lst; /* List of selected points (order is important) */
+ H5S_hyper_sel_t *hslab; /* Info about hyperslab selections */
+ } sel_info;
} H5S_select_t;
/* Main dataspace structure (typedef'd in H5Sprivate.h) */
@@ -164,6 +176,56 @@ struct H5S_t {
H5S_select_t select; /* Dataspace selection */
};
+/* Selection iteration methods */
+/* Method to retrieve the current coordinates of iterator for current selection */
+typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hssize_t *coords);
+/* Method to retrieve the current block of iterator for current selection */
+typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+/* Method to determine number of elements left in iterator for current selection */
+typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter);
+/* Method to determine if there are more blocks left in the current selection */
+typedef htri_t (*H5S_sel_iter_has_next_block_func_t)(const H5S_sel_iter_t *iter);
+/* Method to move selection iterator to the next element in the selection */
+typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, size_t nelem);
+/* Method to move selection iterator to the next block in the selection */
+typedef herr_t (*H5S_sel_iter_next_block_func_t)(H5S_sel_iter_t *iter);
+/* Method to release iterator for current selection */
+typedef herr_t (*H5S_sel_iter_release_func_t)(H5S_sel_iter_t *iter);
+
+/* Selection iteration class */
+typedef struct H5S_sel_iter_class_t {
+ H5S_sel_type type; /* Type of selection (all, none, points or hyperslab) */
+
+ /* Methods on selections */
+ H5S_sel_iter_coords_func_t iter_coords; /* Method to retrieve the current coordinates of iterator for current selection */
+ H5S_sel_iter_block_func_t iter_block; /* Method to retrieve the current block of iterator for current selection */
+ H5S_sel_iter_nelmts_func_t iter_nelmts; /* Method to determine number of elements left in iterator for current selection */
+ H5S_sel_iter_has_next_block_func_t iter_has_next_block; /* Method to query if there is another block left in the selection */
+ H5S_sel_iter_next_func_t iter_next; /* Method to move selection iterator to the next element in the selection */
+ H5S_sel_iter_next_block_func_t iter_next_block; /* Method to move selection iterator to the next block in the selection */
+ H5S_sel_iter_release_func_t iter_release; /* Method to release iterator for current selection */
+} H5S_sel_iter_class_t;
+
+/*
+ * All selection class methods.
+ */
+H5_DLLVAR const H5S_select_class_t H5S_sel_all[1];
+
+/*
+ * Hyperslab selection class methods.
+ */
+H5_DLLVAR const H5S_select_class_t H5S_sel_hyper[1];
+
+/*
+ * None selection class methods.
+ */
+H5_DLLVAR const H5S_select_class_t H5S_sel_none[1];
+
+/*
+ * Pointer selection class methods.
+ */
+H5_DLLVAR const H5S_select_class_t H5S_sel_point[1];
+
/* Extent functions */
H5_DLL herr_t H5S_close_simple(H5S_simple_t *simple);
H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent);
@@ -171,78 +233,6 @@ H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src);
/* Operations on selections */
-/* Point selection iterator functions */
-H5_DLL herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
-
-/* Point selection functions */
-H5_DLL herr_t H5S_point_release(H5S_t *space);
-H5_DLL herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src);
-H5_DLL htri_t H5S_point_is_valid(const H5S_t *space);
-H5_DLL hssize_t H5S_point_serial_size(const H5S_t *space);
-H5_DLL herr_t H5S_point_serialize(const H5S_t *space, uint8_t *buf);
-H5_DLL herr_t H5S_point_deserialize(H5S_t *space, const uint8_t *buf);
-H5_DLL herr_t H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
-H5_DLL htri_t H5S_point_is_contiguous(const H5S_t *space);
-H5_DLL htri_t H5S_point_is_single(const H5S_t *space);
-H5_DLL htri_t H5S_point_is_regular(const H5S_t *space);
-H5_DLL herr_t H5S_point_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);
-
-/* "All" selection iterator functions */
-H5_DLL herr_t H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
-
-/* "All" selection functions */
-H5_DLL herr_t H5S_all_release(H5S_t *space);
-H5_DLL herr_t H5S_all_copy(H5S_t *dst, const H5S_t *src);
-H5_DLL htri_t H5S_all_is_valid(const H5S_t *space);
-H5_DLL hssize_t H5S_all_serial_size(const H5S_t *space);
-H5_DLL herr_t H5S_all_serialize(const H5S_t *space, uint8_t *buf);
-H5_DLL herr_t H5S_all_deserialize(H5S_t *space, const uint8_t *buf);
-H5_DLL herr_t H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
-H5_DLL htri_t H5S_all_is_contiguous(const H5S_t *space);
-H5_DLL htri_t H5S_all_is_single(const H5S_t *space);
-H5_DLL htri_t H5S_all_is_regular(const H5S_t *space);
-H5_DLL herr_t H5S_all_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);
-
-/* Hyperslab selection iterator functions */
-H5_DLL herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
-
-/* Hyperslab selection functions */
-H5_DLL herr_t H5S_hyper_release(H5S_t *space);
-H5_DLL herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-H5_DLL htri_t H5S_hyper_is_valid(const H5S_t *space);
-H5_DLL hssize_t H5S_hyper_serial_size(const H5S_t *space);
-H5_DLL herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t *buf);
-H5_DLL herr_t H5S_hyper_deserialize(H5S_t *space, const uint8_t *buf);
-H5_DLL herr_t H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
-H5_DLL htri_t H5S_hyper_is_contiguous(const H5S_t *space);
-H5_DLL htri_t H5S_hyper_is_single(const H5S_t *space);
-H5_DLL htri_t H5S_hyper_is_regular(const H5S_t *space);
-H5_DLL herr_t H5S_hyper_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);
-
-/* "None" selection iterator functions */
-H5_DLL herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
-
-/* "None" selection functions */
-H5_DLL herr_t H5S_none_release(H5S_t *space);
-H5_DLL herr_t H5S_none_copy(H5S_t *dst, const H5S_t *src);
-H5_DLL htri_t H5S_none_is_valid(const H5S_t *space);
-H5_DLL hssize_t H5S_none_serial_size(const H5S_t *space);
-H5_DLL herr_t H5S_none_serialize(const H5S_t *space, uint8_t *buf);
-H5_DLL herr_t H5S_none_deserialize(H5S_t *space, const uint8_t *buf);
-H5_DLL herr_t H5S_none_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
-H5_DLL htri_t H5S_none_is_contiguous(const H5S_t *space);
-H5_DLL htri_t H5S_none_is_single(const H5S_t *space);
-H5_DLL htri_t H5S_none_is_regular(const H5S_t *space);
-H5_DLL herr_t H5S_none_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);
-
#ifdef H5_HAVE_PARALLEL
/* MPI-IO function to read directly from app buffer to file rky980813 */
H5_DLL herr_t H5S_mpio_spaces_read(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,