Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
fe341a24
There was a problem fetching the pipeline summary.
Commit
fe341a24
authored
8 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
add "require_size" hdf5 functionality
parent
8c6fe88e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!21
Bugfix/nansampling
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bfps/_base.py
+5
-2
5 additions, 2 deletions
bfps/_base.py
bfps/cpp/hdf5_tools.cpp
+53
-0
53 additions, 0 deletions
bfps/cpp/hdf5_tools.cpp
bfps/cpp/hdf5_tools.hpp
+15
-0
15 additions, 0 deletions
bfps/cpp/hdf5_tools.hpp
with
73 additions
and
2 deletions
bfps/_base.py
+
5
−
2
View file @
fe341a24
...
@@ -175,9 +175,12 @@ class _base(object):
...
@@ -175,9 +175,12 @@ class _base(object):
def
rewrite_par
(
def
rewrite_par
(
self
,
self
,
group
=
None
,
group
=
None
,
parameters
=
None
):
parameters
=
None
,
file_name
=
None
):
assert
(
group
!=
'
parameters
'
)
assert
(
group
!=
'
parameters
'
)
ofile
=
h5py
.
File
(
os
.
path
.
join
(
self
.
work_dir
,
self
.
simname
+
'
.h5
'
),
'
r+
'
)
if
type
(
file_name
)
==
None
:
file_name
=
os
.
path
.
join
(
self
.
work_dir
,
self
.
simname
+
'
.h5
'
)
ofile
=
h5py
.
File
(
file_name
,
'
a
'
)
for
k
in
parameters
.
keys
():
for
k
in
parameters
.
keys
():
if
group
not
in
ofile
.
keys
():
if
group
not
in
ofile
.
keys
():
ofile
.
create_group
(
group
)
ofile
.
create_group
(
group
)
...
...
This diff is collapsed.
Click to expand it.
bfps/cpp/hdf5_tools.cpp
+
53
−
0
View file @
fe341a24
#include
"hdf5_tools.hpp"
#include
"hdf5_tools.hpp"
int
hdf5_tools
::
require_size_single_dataset
(
hid_t
dset
,
int
tsize
)
{
int
ndims
;
hsize_t
space
;
space
=
H5Dget_space
(
dset
);
ndims
=
H5Sget_simple_extent_ndims
(
space
);
hsize_t
*
dims
=
new
hsize_t
[
ndims
];
H5Sget_simple_extent_dims
(
space
,
dims
,
NULL
);
if
(
dims
[
0
]
<
tsize
)
{
dims
[
0
]
=
tsize
;
H5Dset_extent
(
dset
,
dims
);
}
H5Sclose
(
space
);
delete
[]
dims
;
return
EXIT_SUCCESS
;
}
int
hdf5_tools
::
grow_single_dataset
(
hid_t
dset
,
int
tincrement
)
int
hdf5_tools
::
grow_single_dataset
(
hid_t
dset
,
int
tincrement
)
{
{
int
ndims
;
int
ndims
;
...
@@ -15,6 +33,21 @@ int hdf5_tools::grow_single_dataset(hid_t dset, int tincrement)
...
@@ -15,6 +33,21 @@ int hdf5_tools::grow_single_dataset(hid_t dset, int tincrement)
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
herr_t
hdf5_tools
::
require_size_dataset_visitor
(
hid_t
o_id
,
const
char
*
name
,
const
H5O_info_t
*
info
,
void
*
op_data
)
{
if
(
info
->
type
==
H5O_TYPE_DATASET
)
{
hsize_t
dset
=
H5Dopen
(
o_id
,
name
,
H5P_DEFAULT
);
require_size_single_dataset
(
dset
,
*
((
int
*
)(
op_data
)));
H5Dclose
(
dset
);
}
return
EXIT_SUCCESS
;
}
herr_t
hdf5_tools
::
grow_dataset_visitor
(
herr_t
hdf5_tools
::
grow_dataset_visitor
(
hid_t
o_id
,
hid_t
o_id
,
const
char
*
name
,
const
char
*
name
,
...
@@ -50,6 +83,26 @@ int hdf5_tools::grow_file_datasets(
...
@@ -50,6 +83,26 @@ int hdf5_tools::grow_file_datasets(
return
file_problems
;
return
file_problems
;
}
}
int
hdf5_tools
::
require_size_file_datasets
(
const
hid_t
stat_file
,
const
std
::
string
group_name
,
int
tsize
)
{
int
file_problems
=
0
;
hid_t
group
;
group
=
H5Gopen
(
stat_file
,
group_name
.
c_str
(),
H5P_DEFAULT
);
H5Ovisit
(
group
,
H5_INDEX_NAME
,
H5_ITER_NATIVE
,
require_size_dataset_visitor
,
&
tsize
);
H5Gclose
(
group
);
return
file_problems
;
}
template
<
typename
number
>
template
<
typename
number
>
std
::
vector
<
number
>
hdf5_tools
::
read_vector
(
std
::
vector
<
number
>
hdf5_tools
::
read_vector
(
const
hid_t
group
,
const
hid_t
group
,
...
...
This diff is collapsed.
Click to expand it.
bfps/cpp/hdf5_tools.hpp
+
15
−
0
View file @
fe341a24
...
@@ -48,6 +48,21 @@ namespace hdf5_tools
...
@@ -48,6 +48,21 @@ namespace hdf5_tools
const
std
::
string
group_name
,
const
std
::
string
group_name
,
int
tincrement
);
int
tincrement
);
int
require_size_single_dataset
(
hid_t
dset
,
int
tincrement
);
herr_t
require_size_dataset_visitor
(
hid_t
o_id
,
const
char
*
name
,
const
H5O_info_t
*
info
,
void
*
op_data
);
int
require_size_file_datasets
(
const
hid_t
stat_file
,
const
std
::
string
group_name
,
int
tincrement
);
template
<
typename
number
>
template
<
typename
number
>
std
::
vector
<
number
>
read_vector
(
std
::
vector
<
number
>
read_vector
(
const
hid_t
group
,
const
hid_t
group
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment