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
889bc505
Commit
889bc505
authored
9 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
try to be smarter about resizing datasets
parent
bd831135
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bfps/NavierStokes.py
+5
-13
5 additions, 13 deletions
bfps/NavierStokes.py
bfps/fluid_base.py
+16
-0
16 additions, 0 deletions
bfps/fluid_base.py
with
21 additions
and
13 deletions
bfps/NavierStokes.py
+
5
−
13
View file @
889bc505
...
@@ -52,7 +52,8 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -52,7 +52,8 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
//begincpp
//begincpp
std::string temp_string;
std::string temp_string;
hsize_t dims[4];
hsize_t dims[4];
hid_t Cdset, Cspace;
hid_t group;
hid_t Cspace, Cdset;
int ndims;
int ndims;
// store kspace information
// store kspace information
Cdset = H5Dopen(stat_file,
"
/kspace/kshell
"
, H5P_DEFAULT);
Cdset = H5Dopen(stat_file,
"
/kspace/kshell
"
, H5P_DEFAULT);
...
@@ -75,20 +76,11 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -75,20 +76,11 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
Cdset = H5Dopen(stat_file,
"
/kspace/dk
"
, H5P_DEFAULT);
Cdset = H5Dopen(stat_file,
"
/kspace/dk
"
, H5P_DEFAULT);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &fs->dk);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &fs->dk);
H5Dclose(Cdset);
H5Dclose(Cdset);
group = H5Gopen(stat_file,
"
/statistics
"
, H5P_DEFAULT);
H5Ovisit(group, H5_INDEX_NAME, H5_ITER_NATIVE, grow_statistics_dataset, NULL);
H5Gclose(group);
//endcpp
//endcpp
"""
"""
for
field
in
[
'
velocity
'
,
'
vorticity
'
]:
for
key
in
[
'
/statistics/xlines/{0}
'
.
format
(
field
),
'
/statistics/moments/{0}
'
.
format
(
field
),
'
/statistics/histograms/{0}
'
.
format
(
field
),
'
/statistics/spectra/{0}_{0}
'
.
format
(
field
)]:
self
.
file_datasets_grow
+=
(
'
Cdset = H5Dopen(stat_file,
"
{0}
"
, H5P_DEFAULT);
\n
'
.
format
(
key
)
+
'
Cspace = H5Dget_space(Cdset);
\n
'
+
'
ndims = H5Sget_simple_extent_dims(Cspace, dims, NULL);
\n
'
+
'
dims[0] += niter_todo/niter_stat;
\n
'
+
'
H5Dset_extent(Cdset, dims);
\n
'
+
'
H5Sclose(Cspace);
\n
'
+
'
H5Dclose(Cdset);
\n
'
)
self
.
style
=
{}
self
.
style
=
{}
self
.
statistics
=
{}
self
.
statistics
=
{}
self
.
fluid_output
=
'
fs->write(
\'
v
\'
,
\'
c
\'
);
\n
'
self
.
fluid_output
=
'
fs->write(
\'
v
\'
,
\'
c
\'
);
\n
'
...
...
This diff is collapsed.
Click to expand it.
bfps/fluid_base.py
+
16
−
0
View file @
889bc505
...
@@ -102,6 +102,22 @@ class fluid_particle_base(bfps.code):
...
@@ -102,6 +102,22 @@ class fluid_particle_base(bfps.code):
self
.
includes
+=
self
.
particle_includes
self
.
includes
+=
self
.
particle_includes
self
.
variables
+=
self
.
particle_variables
self
.
variables
+=
self
.
particle_variables
self
.
definitions
+=
self
.
particle_definitions
self
.
definitions
+=
self
.
particle_definitions
self
.
definitions
+=
(
'
int grow_single_dataset(hid_t dset, int tincrement)
\n
{
\n
'
+
'
int ndims;
\n
'
+
'
hsize_t dims[4];
\n
'
+
'
hsize_t space;
\n
'
+
'
space = H5Dget_space(dset);
\n
'
+
'
ndims = H5Sget_simple_extent_dims(space, dims, NULL);
\n
'
+
'
dims[0] += tincrement;
\n
'
+
'
H5Dset_extent(dset, dims);
\n
'
+
'
H5Sclose(space);
\n
'
+
'
return EXIT_SUCCESS;
\n
}
\n
'
)
self
.
definitions
+=
(
'
herr_t grow_statistics_dataset(hid_t o_id, const char *name, const H5O_info_t *info, void *op_data)
\n
{
\n
'
+
'
if (info->type == H5O_TYPE_DATASET)
\n
{
\n
'
+
'
hsize_t dset = H5Dopen(o_id, name, H5P_DEFAULT);
\n
'
+
'
grow_single_dataset(dset, niter_todo/niter_stat);
\n
'
'
H5Dclose(dset);
\n
}
\n
'
+
'
return 0;
\n
}
\n
'
)
self
.
definitions
+=
(
'
int grow_file_datasets()
\n
{
\n
'
+
self
.
definitions
+=
(
'
int grow_file_datasets()
\n
{
\n
'
+
'
int file_problems = 0;
\n
'
+
'
int file_problems = 0;
\n
'
+
self
.
file_datasets_grow
+
self
.
file_datasets_grow
+
...
...
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