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
54f944b6
Commit
54f944b6
authored
8 years ago
by
Berenger Bramas
Browse files
Options
Downloads
Patches
Plain Diff
Update io -- update output hdf5 to follow a format with number as dataset names
parent
a85824f5
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!21
Bugfix/nansampling
,
!3
Bugfix/event manager show html
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bfps/NSVorticityEquation.py
+3
-2
3 additions, 2 deletions
bfps/NSVorticityEquation.py
bfps/cpp/particles/particles_output_hdf5.hpp
+29
-12
29 additions, 12 deletions
bfps/cpp/particles/particles_output_hdf5.hpp
with
32 additions
and
14 deletions
bfps/NSVorticityEquation.py
+
3
−
2
View file @
54f944b6
...
...
@@ -146,7 +146,8 @@ class NSVorticityEquation(_fluid_particle_base):
tracers0_neighbours, // parameter (interpolation no neighbours)
tracers0_smoothness, // parameter
MPI_COMM_WORLD);
particles_output_hdf5<double,3,3> particles_output_writer_mpi(MPI_COMM_WORLD, fname, nparticles, tracers0_integration_steps);
particles_output_hdf5<double,3,3> particles_output_writer_mpi(MPI_COMM_WORLD, fname, nparticles, tracers0_integration_steps,
"
/tracers0/state/
"
,
"
/tracers0/rhs/
"
);
"""
self
.
particle_loop
+=
"""
fs->compute_velocity(fs->cvorticity);
...
...
@@ -158,7 +159,7 @@ class NSVorticityEquation(_fluid_particle_base):
ps->getParticlesRhs(),
ps->getParticlesIndexes(),
ps->getLocalNbParticles(),
iteration);
iteration
+1
);
"""
self
.
fluid_output
+=
output_particles
self
.
particle_end
+=
'
ps.release();
\n
'
...
...
This diff is collapsed.
Click to expand it.
bfps/cpp/particles/particles_output_hdf5.hpp
+
29
−
12
View file @
54f944b6
...
...
@@ -17,14 +17,25 @@ class particles_output_hdf5 : public abstract_particles_output<real_number, size
hid_t
file_id
;
const
int
total_nb_particles
;
const
std
::
string
datagroup_basename
;
const
std
::
string
datagroup_basename_state
;
const
std
::
string
datagroup_basename_rhs
;
hid_t
dset_id_state
;
hid_t
dset_id_rhs
;
public:
particles_output_hdf5
(
MPI_Comm
in_mpi_com
,
const
std
::
string
in_filename
,
const
int
inTotalNbParticles
,
const
int
in_nb_rhs
,
const
std
::
string
in_datagroup_basename
=
std
::
string
(
"tracers"
))
const
int
in_nb_rhs
,
const
std
::
string
in_datagroup_basename_state
,
const
std
::
string
in_datagroup_basename_rhs
)
:
abstract_particles_output
<
real_number
,
size_particle_positions
,
size_particle_rhs
>
(
in_mpi_com
,
inTotalNbParticles
,
in_nb_rhs
),
filename
(
in_filename
),
file_id
(
0
),
total_nb_particles
(
inTotalNbParticles
),
datagroup_basename
(
in_datagroup_basename
){
file_id
(
0
),
total_nb_particles
(
inTotalNbParticles
),
datagroup_basename_state
(
in_datagroup_basename_state
),
datagroup_basename_rhs
(
in_datagroup_basename_rhs
),
dset_id_state
(
0
),
dset_id_rhs
(
0
){
if
(
datagroup_basename_state
==
datagroup_basename_rhs
){
DEBUG_MSG
(
"The same dataset names have been passed to particles_output_hdf5 for the state and the rhs
\n
"
"It will result into an undefined behavior.
\n
"
"Dataset name = %s
\n
"
,
datagroup_basename_state
.
c_str
());
}
TIMEZONE
(
"particles_output_hdf5::H5Pcreate"
);
hid_t
plist_id_par
=
H5Pcreate
(
H5P_FILE_ACCESS
);
...
...
@@ -37,11 +48,23 @@ public:
// file_id = H5Fcreate(filename.c_str(), H5F_ACC_TRUNC | H5F_ACC_DEBUG/*H5F_ACC_EXCL*/, H5P_DEFAULT/*H5F_ACC_RDWR*/, plist_id_par);
assert
(
file_id
>=
0
);
H5Pclose
(
plist_id_par
);
dset_id_state
=
H5Gopen
(
file_id
,
datagroup_basename_state
.
c_str
(),
H5P_DEFAULT
);
assert
(
dset_id_state
>=
0
);
dset_id_rhs
=
H5Gopen
(
file_id
,
datagroup_basename_rhs
.
c_str
(),
H5P_DEFAULT
);
assert
(
dset_id_rhs
>=
0
);
}
~
particles_output_hdf5
(){
TIMEZONE
(
"particles_output_hdf5::H5Dclose"
);
int
rethdf
=
H5Fclose
(
file_id
);
int
rethdf
=
H5Gclose
(
dset_id_state
);
assert
(
rethdf
>=
0
);
rethdf
=
H5Gclose
(
dset_id_rhs
);
assert
(
rethdf
>=
0
);
rethdf
=
H5Fclose
(
file_id
);
assert
(
rethdf
>=
0
);
}
...
...
@@ -52,10 +75,6 @@ public:
assert
(
particles_idx_offset
<
Parent
::
getTotalNbParticles
());
assert
(
particles_idx_offset
+
nb_particles
<=
Parent
::
getTotalNbParticles
());
const
std
::
string
target_dset_name
=
(
datagroup_basename
+
std
::
to_string
(
idx_time_step
));
hid_t
dset_id
=
H5Gcreate
(
file_id
,
target_dset_name
.
c_str
(),
H5P_DEFAULT
,
H5P_DEFAULT
,
H5P_DEFAULT
);
assert
(
dset_id
>=
0
);
static_assert
(
std
::
is_same
<
real_number
,
double
>::
value
||
std
::
is_same
<
real_number
,
float
>::
value
,
"real_number must be double or float"
);
const
hid_t
type_id
=
(
sizeof
(
real_number
)
==
8
?
H5T_NATIVE_DOUBLE
:
H5T_NATIVE_FLOAT
);
...
...
@@ -67,7 +86,7 @@ public:
hid_t
dataspace
=
H5Screate_simple
(
3
,
datacount
,
NULL
);
assert
(
dataspace
>=
0
);
hid_t
dataset_id
=
H5Dcreate
(
dset_id
,
"
st
ate"
,
type_id
,
dataspace
,
H5P_DEFAULT
,
hid_t
dataset_id
=
H5Dcreate
(
dset_id
_state
,
st
d
::
to_string
(
idx_time_step
).
c_str
()
,
type_id
,
dataspace
,
H5P_DEFAULT
,
H5P_DEFAULT
,
H5P_DEFAULT
);
assert
(
dataset_id
>=
0
);
...
...
@@ -103,7 +122,7 @@ public:
hid_t
dataspace
=
H5Screate_simple
(
3
,
datacount
,
NULL
);
assert
(
dataspace
>=
0
);
hid_t
dataset_id
=
H5Dcreate
(
dset_id
,
"rhs"
,
type_id
,
dataspace
,
H5P_DEFAULT
,
hid_t
dataset_id
=
H5Dcreate
(
dset_id
_rhs
,
std
::
to_string
(
idx_time_step
).
c_str
()
,
type_id
,
dataspace
,
H5P_DEFAULT
,
H5P_DEFAULT
,
H5P_DEFAULT
);
assert
(
dataset_id
>=
0
);
...
...
@@ -135,8 +154,6 @@ public:
int
rethdf
=
H5Dclose
(
dataset_id
);
assert
(
rethdf
>=
0
);
}
int
rethdf
=
H5Gclose
(
dset_id
);
assert
(
rethdf
>=
0
);
}
};
...
...
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