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
f26d1107
Commit
f26d1107
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Temporarily write the time-bins to the snapshots to make sure we only write real particles.
parent
17d568e2
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!688
Star formation (non-MPI)
,
!684
Add star particles on-the-fly
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/gravity/Default/gravity_io.h
+12
-1
12 additions, 1 deletion
src/gravity/Default/gravity_io.h
src/hydro/Gadget2/hydro_io.h
+14
-1
14 additions, 1 deletion
src/hydro/Gadget2/hydro_io.h
src/stars/Default/stars_io.h
+14
-2
14 additions, 2 deletions
src/stars/Default/stars_io.h
with
40 additions
and
4 deletions
src/gravity/Default/gravity_io.h
+
12
−
1
View file @
f26d1107
...
@@ -92,6 +92,15 @@ INLINE static void darkmatter_read_particles(struct gpart* gparts,
...
@@ -92,6 +92,15 @@ INLINE static void darkmatter_read_particles(struct gpart* gparts,
UNIT_CONV_NO_UNITS
,
gparts
,
id_or_neg_offset
);
UNIT_CONV_NO_UNITS
,
gparts
,
id_or_neg_offset
);
}
}
INLINE
static
void
test_time_bin_gpart
(
const
struct
engine
*
e
,
const
struct
gpart
*
gp
,
float
*
ret
)
{
if
(
gp
->
time_bin
>=
time_bin_inhibited
)
error
(
"Writing inhibited or extra particle time_bin=%d"
,
gp
->
time_bin
);
*
ret
=
gp
->
time_bin
;
}
/**
/**
* @brief Specifies which g-particle fields to write to a dataset
* @brief Specifies which g-particle fields to write to a dataset
*
*
...
@@ -104,7 +113,7 @@ INLINE static void darkmatter_write_particles(const struct gpart* gparts,
...
@@ -104,7 +113,7 @@ INLINE static void darkmatter_write_particles(const struct gpart* gparts,
int
*
num_fields
)
{
int
*
num_fields
)
{
/* Say how much we want to write */
/* Say how much we want to write */
*
num_fields
=
4
;
*
num_fields
=
5
;
/* List what we want to write */
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_gpart
(
list
[
0
]
=
io_make_output_field_convert_gpart
(
...
@@ -115,6 +124,8 @@ INLINE static void darkmatter_write_particles(const struct gpart* gparts,
...
@@ -115,6 +124,8 @@ INLINE static void darkmatter_write_particles(const struct gpart* gparts,
io_make_output_field
(
"Masses"
,
FLOAT
,
1
,
UNIT_CONV_MASS
,
gparts
,
mass
);
io_make_output_field
(
"Masses"
,
FLOAT
,
1
,
UNIT_CONV_MASS
,
gparts
,
mass
);
list
[
3
]
=
io_make_output_field
(
"ParticleIDs"
,
ULONGLONG
,
1
,
list
[
3
]
=
io_make_output_field
(
"ParticleIDs"
,
ULONGLONG
,
1
,
UNIT_CONV_NO_UNITS
,
gparts
,
id_or_neg_offset
);
UNIT_CONV_NO_UNITS
,
gparts
,
id_or_neg_offset
);
list
[
4
]
=
io_make_output_field_convert_gpart
(
"TimeBin"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
gparts
,
test_time_bin_gpart
);
}
}
#endif
/* SWIFT_DEFAULT_GRAVITY_IO_H */
#endif
/* SWIFT_DEFAULT_GRAVITY_IO_H */
This diff is collapsed.
Click to expand it.
src/hydro/Gadget2/hydro_io.h
+
14
−
1
View file @
f26d1107
...
@@ -128,6 +128,16 @@ INLINE static void convert_part_potential(const struct engine* e,
...
@@ -128,6 +128,16 @@ INLINE static void convert_part_potential(const struct engine* e,
ret
[
0
]
=
0
.
f
;
ret
[
0
]
=
0
.
f
;
}
}
INLINE
static
void
test_time_bin_part
(
const
struct
engine
*
e
,
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
float
*
ret
)
{
if
(
p
->
time_bin
>=
time_bin_inhibited
)
error
(
"Writing inhibited or extra particle time_bin=%d"
,
p
->
time_bin
);
*
ret
=
p
->
time_bin
;
}
/**
/**
* @brief Specifies which particle fields to write to a dataset
* @brief Specifies which particle fields to write to a dataset
*
*
...
@@ -141,7 +151,7 @@ INLINE static void hydro_write_particles(const struct part* parts,
...
@@ -141,7 +151,7 @@ INLINE static void hydro_write_particles(const struct part* parts,
struct
io_props
*
list
,
struct
io_props
*
list
,
int
*
num_fields
)
{
int
*
num_fields
)
{
*
num_fields
=
1
0
;
*
num_fields
=
1
1
;
/* List what we want to write */
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_part
(
"Coordinates"
,
DOUBLE
,
3
,
list
[
0
]
=
io_make_output_field_convert_part
(
"Coordinates"
,
DOUBLE
,
3
,
...
@@ -168,6 +178,9 @@ INLINE static void hydro_write_particles(const struct part* parts,
...
@@ -168,6 +178,9 @@ INLINE static void hydro_write_particles(const struct part* parts,
list
[
9
]
=
io_make_output_field_convert_part
(
"Potential"
,
FLOAT
,
1
,
list
[
9
]
=
io_make_output_field_convert_part
(
"Potential"
,
FLOAT
,
1
,
UNIT_CONV_POTENTIAL
,
parts
,
UNIT_CONV_POTENTIAL
,
parts
,
xparts
,
convert_part_potential
);
xparts
,
convert_part_potential
);
list
[
10
]
=
io_make_output_field_convert_part
(
"TimeBin"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
parts
,
xparts
,
test_time_bin_part
);
#ifdef DEBUG_INTERACTIONS_SPH
#ifdef DEBUG_INTERACTIONS_SPH
...
...
This diff is collapsed.
Click to expand it.
src/stars/Default/stars_io.h
+
14
−
2
View file @
f26d1107
...
@@ -22,6 +22,15 @@
...
@@ -22,6 +22,15 @@
#include
"io_properties.h"
#include
"io_properties.h"
#include
"stars_part.h"
#include
"stars_part.h"
INLINE
static
void
test_time_bin_spart
(
const
struct
engine
*
e
,
const
struct
spart
*
sp
,
float
*
ret
)
{
if
(
sp
->
time_bin
>=
time_bin_inhibited
)
error
(
"Writing inhibited or extra particle time_bin=%d"
,
sp
->
time_bin
);
*
ret
=
sp
->
time_bin
;
}
/**
/**
* @brief Specifies which s-particle fields to read from a dataset
* @brief Specifies which s-particle fields to read from a dataset
*
*
...
@@ -60,8 +69,8 @@ INLINE static void stars_write_particles(const struct spart *sparts,
...
@@ -60,8 +69,8 @@ INLINE static void stars_write_particles(const struct spart *sparts,
struct
io_props
*
list
,
struct
io_props
*
list
,
int
*
num_fields
)
{
int
*
num_fields
)
{
/* Say how much we want to
read
*/
/* Say how much we want to
write
*/
*
num_fields
=
5
;
*
num_fields
=
6
;
/* List what we want to read */
/* List what we want to read */
list
[
0
]
=
io_make_output_field
(
"Coordinates"
,
DOUBLE
,
3
,
UNIT_CONV_LENGTH
,
list
[
0
]
=
io_make_output_field
(
"Coordinates"
,
DOUBLE
,
3
,
UNIT_CONV_LENGTH
,
...
@@ -74,6 +83,9 @@ INLINE static void stars_write_particles(const struct spart *sparts,
...
@@ -74,6 +83,9 @@ INLINE static void stars_write_particles(const struct spart *sparts,
sparts
,
id
);
sparts
,
id
);
list
[
4
]
=
io_make_output_field
(
"SmoothingLength"
,
FLOAT
,
1
,
UNIT_CONV_LENGTH
,
list
[
4
]
=
io_make_output_field
(
"SmoothingLength"
,
FLOAT
,
1
,
UNIT_CONV_LENGTH
,
sparts
,
h
);
sparts
,
h
);
list
[
5
]
=
io_make_output_field_convert_spart
(
"TimeBin"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
sparts
,
test_time_bin_spart
);
}
}
/**
/**
...
...
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