Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
5f4e2f14
Commit
5f4e2f14
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Pass the unit systems to the read and write functions
parent
125bfdca
No related branches found
No related tags found
1 merge request
!194
Io unit conversion
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gravity/Default/gravity_io.h
+11
-8
11 additions, 8 deletions
src/gravity/Default/gravity_io.h
src/hydro/Gadget2/hydro_io.h
+15
-13
15 additions, 13 deletions
src/hydro/Gadget2/hydro_io.h
with
26 additions
and
21 deletions
src/gravity/Default/gravity_io.h
+
11
−
8
View file @
5f4e2f14
...
...
@@ -24,23 +24,26 @@
* @param N The number of particles on that MPI rank.
* @param N_total The total number of particles (only used in MPI mode)
* @param offset The offset of the particles for this MPI rank (only used in MPI
*mode)
*
mode)
* @param gparts The particle array
* @param internal_units The #UnitSystem used internally
* @param ic_units The #UnitSystem used in the snapshots
*
*/
__attribute__
((
always_inline
))
INLINE
static
void
darkmatter_read_particles
(
hid_t
h_grp
,
int
N
,
long
long
N_total
,
long
long
offset
,
struct
gpart
*
gparts
)
{
struct
gpart
*
gparts
,
const
struct
UnitSystem
*
internal_units
,
struct
UnitSystem
*
ic_units
)
{
/* Read arrays */
readArray
(
h_grp
,
"Coordinates"
,
DOUBLE
,
N
,
3
,
gparts
,
N_total
,
offset
,
x
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_LENGTH
);
readArray
(
h_grp
,
"Masses"
,
FLOAT
,
N
,
1
,
gparts
,
N_total
,
offset
,
mass
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_MASS
);
readArray
(
h_grp
,
"Velocities"
,
FLOAT
,
N
,
3
,
gparts
,
N_total
,
offset
,
v_full
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_SPEED
);
readArray
(
h_grp
,
"ParticleIDs"
,
ULONGLONG
,
N
,
1
,
gparts
,
N_total
,
offset
,
id
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_NO_UNITS
);
}
/**
...
...
@@ -49,13 +52,13 @@ __attribute__((always_inline)) INLINE static void darkmatter_read_particles(
* @param h_grp The HDF5 group in which to write the arrays.
* @param fileName The name of the file (unsued in MPI mode).
* @param partTypeGroupName The name of the group containing the particles in
*the HDF5 file.
*
the HDF5 file.
* @param xmfFile The XMF file to write to (unused in MPI mode).
* @param Ndm The number of DM particles on that MPI rank.
* @param Ndm_total The total number of g-particles (only used in MPI mode)
* @param mpi_rank The MPI rank of this node (only used in MPI mode)
* @param offset The offset of the particles for this MPI rank (only used in MPI
*mode)
*
mode)
* @param gparts The #gpart array
* @param internal_units The #UnitSystem used internally
* @param snapshot_units The #UnitSystem used in the snapshots
...
...
This diff is collapsed.
Click to expand it.
src/hydro/Gadget2/hydro_io.h
+
15
−
13
View file @
5f4e2f14
...
...
@@ -24,31 +24,33 @@
* @param N The number of particles on that MPI rank.
* @param N_total The total number of particles (only used in MPI mode)
* @param offset The offset of the particles for this MPI rank (only used in MPI
*mode)
*
mode)
* @param parts The particle array
* @param internal_units The #UnitSystem used internally
* @param ic_units The #UnitSystem used in the snapshots
*
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_read_particles
(
hid_t
h_grp
,
int
N
,
long
long
N_total
,
long
long
offset
,
struct
part
*
par
ts
)
{
hid_t
h_grp
,
int
N
,
long
long
N_total
,
long
long
offset
,
struct
part
*
parts
,
const
struct
UnitSystem
*
internal_units
,
struct
UnitSystem
*
ic_uni
ts
)
{
/* Read arrays */
readArray
(
h_grp
,
"Coordinates"
,
DOUBLE
,
N
,
3
,
parts
,
N_total
,
offset
,
x
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_LENGTH
);
readArray
(
h_grp
,
"Velocities"
,
FLOAT
,
N
,
3
,
parts
,
N_total
,
offset
,
v
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_SPEED
);
readArray
(
h_grp
,
"Masses"
,
FLOAT
,
N
,
1
,
parts
,
N_total
,
offset
,
mass
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_MASS
);
readArray
(
h_grp
,
"SmoothingLength"
,
FLOAT
,
N
,
1
,
parts
,
N_total
,
offset
,
h
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_LENGTH
);
readArray
(
h_grp
,
"InternalEnergy"
,
FLOAT
,
N
,
1
,
parts
,
N_total
,
offset
,
entropy
,
COMPULSORY
);
entropy
,
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_ENERGY
);
readArray
(
h_grp
,
"ParticleIDs"
,
ULONGLONG
,
N
,
1
,
parts
,
N_total
,
offset
,
id
,
COMPULSORY
);
COMPULSORY
,
internal_units
,
ic_units
,
UNIT_CONV_NO_UNITS
);
readArray
(
h_grp
,
"Acceleration"
,
FLOAT
,
N
,
3
,
parts
,
N_total
,
offset
,
a_hydro
,
OPTIONAL
);
OPTIONAL
,
internal_units
,
ic_units
,
UNIT_CONV_ACCELERATION
);
readArray
(
h_grp
,
"Density"
,
FLOAT
,
N
,
1
,
parts
,
N_total
,
offset
,
rho
,
OPTIONAL
);
OPTIONAL
,
internal_units
,
ic_units
,
UNIT_CONV_DENSITY
);
}
/**
...
...
@@ -57,13 +59,13 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles(
* @param h_grp The HDF5 group in which to write the arrays.
* @param fileName The name of the file (unsued in MPI mode).
* @param partTypeGroupName The name of the group containing the particles in
*the HDF5 file.
*
the HDF5 file.
* @param xmfFile The XMF file to write to (unused in MPI mode).
* @param N The number of particles on that MPI rank.
* @param N_total The total number of particles (only used in MPI mode)
* @param mpi_rank The MPI rank of this node (only used in MPI mode)
* @param offset The offset of the particles for this MPI rank (only used in MPI
*mode)
*
mode)
* @param parts The particle array
* @param internal_units The #UnitSystem used internally
* @param snapshot_units The #UnitSystem used in the snapshots
...
...
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