Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
src
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
H5hut
src
Commits
3d623062
Commit
3d623062
authored
Apr 22, 2016
by
gsell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some missing query function implemented, see issue#1 in Gitlab
parent
44ffea4f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
166 additions
and
49 deletions
+166
-49
src/h5core/h5_attach.c
src/h5core/h5_attach.c
+38
-41
src/h5core/h5_openclose.c
src/h5core/h5_openclose.c
+12
-5
src/h5core/h5u_model.c
src/h5core/h5u_model.c
+17
-2
src/include/H5Part_io.h
src/include/H5Part_io.h
+55
-0
src/include/H5_model.h
src/include/H5_model.h
+18
-0
src/include/h5core/h5_model.h
src/include/h5core/h5_model.h
+8
-0
src/include/h5core/h5_types.h
src/include/h5core/h5_types.h
+11
-0
src/include/h5core/h5u_model.h
src/include/h5core/h5u_model.h
+7
-1
No files found.
src/h5core/h5_attach.c
View file @
3d623062
...
...
@@ -127,19 +127,15 @@ h5_add_attachment (
H5_CORE_API_RETURN
(
H5_SUCCESS
);
}
static
inline
hid_t
open_attachments
(
const
h5_file_p
f
h5_err_t
h5_has_attachments
(
const
h5_file_t
f_
)
{
h5_err_t
exists
=
hdf5_link_exists
(
f
->
file
,
H5_ATTACHMENT
);
if
(
exists
>
0
)
{
return
hdf5_open_group
(
f
->
file
,
H5_ATTACHMENT
);
}
else
if
(
exists
==
0
)
{
return
h5_warn
(
"No attachment group in file"
);
}
return
exists
;
h5_file_p
f
=
(
h5_file_p
)
f_
;
H5_CORE_API_ENTER
(
h5_ssize_t
,
"f=%p"
,
f
);
h5_err_t
exists
;
TRY
(
exists
=
hdf5_link_exists
(
f
->
file
,
H5_ATTACHMENT
));
H5_CORE_API_RETURN
(
exists
);
}
h5_ssize_t
...
...
@@ -148,12 +144,14 @@ h5_get_num_attachments (
)
{
h5_file_p
f
=
(
h5_file_p
)
f_
;
H5_CORE_API_ENTER
(
h5_ssize_t
,
"f=%p"
,
f
);
h5_ssize_t
num
=
0
;
hid_t
group_id
;
TRY
(
group_id
=
open_attachments
(
f
));
if
(
group_id
<
0
)
{
H5_CORE_API_LEAVE
(
0
);
h5_err_t
exists
;
TRY
(
exists
=
hdf5_link_exists
(
f
->
file
,
H5_ATTACHMENT
));
if
(
exists
==
0
)
{
return
0
;
}
hid_t
group_id
;
TRY
(
group_id
=
hdf5_open_group
(
f
->
file
,
H5_ATTACHMENT
));
h5_ssize_t
num
=
0
;
TRY
(
num
=
hdf5_get_num_datasets
(
group_id
));
TRY
(
hdf5_close_group
(
group_id
));
H5_CORE_API_RETURN
(
num
);
...
...
@@ -170,13 +168,11 @@ h5_get_attachment_info_by_idx (
h5_file_p
f
=
(
h5_file_p
)
f_
;
H5_CORE_API_ENTER
(
h5_err_t
,
"f=%p, idx=%llu, fname=%s, len_fname=%llu, fsize=%p"
,
f
,
(
unsigned
long
long
)
idx
,
fname
,
(
unsigned
long
long
)
len_fname
,
f
,
(
unsigned
long
long
)
idx
,
fname
,
(
unsigned
long
long
)
len_fname
,
fsize
);
hid_t
loc_id
;
TRY
(
loc_id
=
open_attachments
(
f
));
if
(
loc_id
<
0
)
{
// no attachment group in file
H5_CORE_API_LEAVE
(
0
);
}
TRY
(
loc_id
=
hdf5_open_group
(
f
->
file
,
H5_ATTACHMENT
));
TRY
(
hdf5_get_name_of_dataset_by_idx
(
loc_id
,
idx
,
...
...
@@ -192,6 +188,20 @@ h5_get_attachment_info_by_idx (
H5_CORE_API_RETURN
(
H5_SUCCESS
);
}
h5_err_t
h5_has_attachment
(
const
h5_file_t
f_
,
// [in]
const
char
*
const
fname
// [in]
)
{
h5_file_p
f
=
(
h5_file_p
)
f_
;
H5_CORE_API_ENTER
(
h5_err_t
,
"f=%p, fname='%s'"
,
f
,
fname
);
hid_t
loc_id
;
TRY
(
loc_id
=
hdf5_open_group
(
f
->
file
,
H5_ATTACHMENT
));
h5_err_t
exists
;
TRY
(
exists
=
hdf5_link_exists
(
f
->
file
,
fname
));
H5_CORE_API_RETURN
(
exists
);
}
h5_err_t
h5_get_attachment_info_by_name
(
const
h5_file_t
f_
,
...
...
@@ -202,10 +212,7 @@ h5_get_attachment_info_by_name (
H5_CORE_API_ENTER
(
h5_err_t
,
"f=%p, fname='%s', fsize=%p"
,
f
,
fname
,
fsize
);
hid_t
loc_id
;
TRY
(
loc_id
=
open_attachments
(
f
));
if
(
loc_id
<
0
)
{
H5_CORE_API_LEAVE
(
H5_NOK
);
}
TRY
(
loc_id
=
hdf5_open_group
(
f
->
file
,
H5_ATTACHMENT
));
if
(
fsize
)
{
// get number of elements, do not change value on error
h5_ssize_t
ssize
;
...
...
@@ -232,14 +239,6 @@ h5_get_attachment (
hid_t
loc_id
;
TRY
(
loc_id
=
hdf5_open_group
(
f
->
file
,
H5_ATTACHMENT
));
h5_err_t
exists
;
TRY
(
exists
=
hdf5_link_exists
(
loc_id
,
fname
));
if
(
!
exists
)
{
H5_PRIV_FUNC_LEAVE
(
h5_error
(
H5_ERR_H5
,
"Attachment '%s' doesn't exist"
,
fname
));
}
// read dataset
hid_t
dataset_id
,
diskspace_id
;
...
...
@@ -320,12 +319,10 @@ h5_delete_attachment (
)
{
h5_file_p
f
=
(
h5_file_p
)
f_
;
H5_CORE_API_ENTER
(
h5_err_t
,
"f=%p, fname='%s'"
,
f
,
fname
);
hid_t
group_id
;
TRY
(
group_id
=
open_attachments
(
f
));
if
(
group_id
<
0
)
{
H5_CORE_API_LEAVE
(
H5_NOK
);
}
TRY
(
hdf5_delete_link
(
group_id
,
fname
,
H5P_DEFAULT
));
TRY
(
hdf5_close_group
(
group_id
));
hid_t
loc_id
;
TRY
(
loc_id
=
hdf5_open_group
(
f
->
file
,
H5_ATTACHMENT
));
TRY
(
hdf5_delete_link
(
loc_id
,
fname
,
H5P_DEFAULT
));
TRY
(
hdf5_close_group
(
loc_id
));
H5_CORE_API_RETURN
(
H5_SUCCESS
);
}
src/h5core/h5_openclose.c
View file @
3d623062
...
...
@@ -97,7 +97,7 @@ mpi_init (
TRY
(
hdf5_set_dxpl_mpio_property
(
f
->
props
->
xfer_prop
,
H5FD_MPIO_INDEPENDENT
)
);
}
else
{
// default is MPI-IO coll
o
ctive mode
// default is MPI-IO coll
e
ctive mode
h5_info
(
"Selecting MPI-IO VFD, using collective mode"
);
TRY
(
hdf5_set_fapl_mpio_property
(
f
->
props
->
access_prop
,
f
->
props
->
comm
,
MPI_INFO_NULL
));
...
...
@@ -117,7 +117,7 @@ mpi_init (
TRY
(
hdf5_set_dxpl_mpio_property
(
f
->
props
->
xfer_prop
,
H5FD_MPIO_INDEPENDENT
)
);
}
else
{
// default is MPI-IO coll
o
ctive mode
// default is MPI-IO coll
e
ctive mode
h5_info
(
"Selecting MPI-IO VFD, using collective mode"
);
TRY
(
hdf5_set_fapl_mpio_property
(
f
->
props
->
access_prop
,
f
->
props
->
comm
,
MPI_INFO_NULL
));
...
...
@@ -717,7 +717,7 @@ h5_get_num_steps(
/*!
\ingroup h5_core_filehandling
Start traversing steps.
Start traversing steps.
\return \c H5_SUCCESS or error code
*/
...
...
@@ -726,8 +726,15 @@ h5_start_traverse_steps (
const
h5_file_t
f_
/*!< file handle */
)
{
h5_file_p
f
=
(
h5_file_p
)
f_
;
UNUSED_ARGUMENT
(
f
);
return
h5_error_not_implemented
();
H5_CORE_API_ENTER
(
int
,
"f=%p"
,
f
);
/*
fast test: Does Step#0 or Step#1 exist?
otherwise
loop over all steps and get smallest step number
*/
H5_CORE_API_RETURN
(
h5_error_not_implemented
());
}
/*!
...
...
src/h5core/h5u_model.c
View file @
3d623062
...
...
@@ -600,19 +600,34 @@ h5u_get_dataset_info (
dataset_name
,
len_dataset_name
)
);
H5_CORE_API_RETURN
(
h5u_get_dataset_info_by_name
(
f
,
dataset_name
,
type
,
nelem
));
h5u_get_dataset_info_by_name
(
f
h
,
dataset_name
,
type
,
nelem
));
}
h5_err_t
h5u_has_dataset
(
const
h5_file_t
fh
,
const
char
*
const
name
)
{
h5_file_p
f
=
(
h5_file_p
)
fh
;
H5_CORE_API_ENTER
(
h5_err_t
,
"f=%p, name='%s'"
,
f
,
name
);
h5_err_t
exists
;
TRY
(
exists
=
hdf5_link_exists
(
f
->
step_gid
,
name
));
H5_CORE_API_RETURN
(
exists
);
}
/*!
Get information about dataset in current index given by its index
*/
h5_err_t
h5u_get_dataset_info_by_name
(
const
h5_file_
p
f
,
/*!< [in] Handle to open file */
const
h5_file_
t
fh
,
/*!< [in] Handle to open file */
const
char
*
const
dataset_name
,
/*!< [in] Name of dataset */
h5_int64_t
*
const
type
,
/*!< [out] Type of data in dataset */
h5_size_t
*
const
nelem
/*!< [out] Number of elements. */
)
{
h5_file_p
f
=
(
h5_file_p
)
fh
;
H5_CORE_API_ENTER
(
h5_err_t
,
"f=%p, "
"dataset_name='%s', "
...
...
src/include/H5Part_io.h
View file @
3d623062
...
...
@@ -88,6 +88,9 @@ H5PartGetDatasetName (
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5PartGetNumDatasets()
\see H5PartGetDatasetInfoByName()
*/
static
inline
h5_err_t
H5PartGetDatasetInfo
(
...
...
@@ -110,6 +113,58 @@ H5PartGetDatasetInfo (
H5_API_RETURN
(
h5u_get_dataset_info
(
f
,
idx
,
name
,
len_name
,
type
,
nelems
));
}
/**
Determines whether a dataset with given name exists in current step.
\return true (value \c >0) if step exists
\return false (\c 0) if step does not exist
\return \c H5_FAILURE on error
*/
static
inline
h5_err_t
H5PartHasDataset
(
const
h5_file_t
f
,
///< [in] file handle
const
char
*
const
name
///< [in] name of dataset
)
{
H5_API_ENTER
(
h5_int64_t
,
"f=%p, name='%s'"
,
(
h5_file_p
)
f
,
name
);
H5_API_RETURN
(
h5u_has_dataset
(
f
,
name
));
}
/**
Gets the type and number of elements of a dataset based on its
name in the current timestep.
Type is one of the following values:
- \c H5_FLOAT64_T (for \c h5_float64_t)
- \c H5_FLOAT32_T (for \c h5_float32_t)
- \c H5_INT64_T (for \c h5_int64_t)
- \c H5_INT32_T (for \c h5_int32_t)
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
\see H5PartHasDataset()
\see H5PartGetDatasetInfo()
*/
static
inline
h5_err_t
H5PartGetDatasetInfoByName
(
const
h5_file_t
f
,
///< [in] file handle
const
char
*
const
name
,
///< [in] name of dataset
h5_int64_t
*
type
,
///< [out] type of data in dataset
h5_size_t
*
nelems
///< [out] number of elements
)
{
H5_API_ENTER
(
h5_int64_t
,
"f=%p, "
"name='%s', "
"type=%p, nelems=%p"
,
(
h5_file_p
)
f
,
name
,
type
,
nelems
);
H5_API_RETURN
(
h5u_get_dataset_info_by_name
(
f
,
name
,
type
,
nelems
));
}
/**
This function returns the number of particles in this processor's view,
...
...
src/include/H5_model.h
View file @
3d623062
...
...
@@ -235,6 +235,24 @@ H5GetAttachmentInfoByIdx (
f
,
idx
,
fname
,
len_fname
,
fsize
));
}
/**
Query whether a particular attachment exists in the file.
\return true (value \c >0) if attachment exists
\return false (\c 0) if attachment does not exist
\return \c H5_FAILURE on error
*/
static
inline
h5_err_t
H5HasAttachment
(
const
h5_file_t
f
,
///< [in] file handle.
const
char
*
const
fname
///< [in] original file name.
)
{
H5_API_ENTER
(
h5_err_t
,
"f=%p, name='%s'"
,
(
h5_file_p
)
f
,
fname
);
H5_API_RETURN
(
h5_has_attachment
(
f
,
fname
));
}
/**
Get size of attached file with name \c fname.
...
...
src/include/h5core/h5_model.h
View file @
3d623062
...
...
@@ -26,6 +26,14 @@ h5_err_t
h5_add_attachment
(
const
h5_file_t
,
const
char
*
const
);
h5_err_t
h5_has_attachments
(
const
h5_file_t
);
h5_err_t
h5_has_attachment
(
const
h5_file_t
,
const
char
*
const
);
h5_ssize_t
h5_get_num_attachments
(
const
h5_file_t
);
...
...
src/include/h5core/h5_types.h
View file @
3d623062
...
...
@@ -142,6 +142,17 @@ typedef struct h5_glb_idxlist {
h5_glb_idx_t
items
[
1
];
}
h5_glb_idxlist_t
;
enum
h5_iterators
{
step_iterator
};
struct
h5_iterator
;
typedef
struct
{
enum
h5_iterators
it_type
;
h5_file_t
file
;
h5_int64_t
(
*
iter
)(
struct
h5_iterator
*
);
}
h5_iterator_t
;
struct
h5_idxmap
;
typedef
struct
h5_idxmap
h5_idxmap_t
;
...
...
src/include/h5core/h5u_model.h
View file @
3d623062
...
...
@@ -75,9 +75,15 @@ h5u_get_dataset_info (
const
h5_id_t
,
char
*
const
,
const
h5_size_t
,
h5_int64_t
*
const
,
h5_size_t
*
const
);
h5_err_t
h5u_has_dataset
(
const
h5_file_t
fh
,
const
char
*
const
name
);
h5_err_t
h5u_get_dataset_info_by_name
(
const
h5_file_
p
f
,
const
h5_file_
t
f
,
const
char
*
const
dataset_name
,
h5_int64_t
*
const
type
,
h5_size_t
*
const
nelem
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment