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
28a01f67
Commit
28a01f67
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Changes to the single i/o mechanism to correctly collect only the non-inhibited DM gparts.
parent
63504ce1
No related branches found
No related tags found
1 merge request
!632
Add functions to permanently remove particles from a simulation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common_io.c
+3
-2
3 additions, 2 deletions
src/common_io.c
src/single_io.c
+6
-5
6 additions, 5 deletions
src/single_io.c
with
9 additions
and
7 deletions
src/common_io.c
+
3
−
2
View file @
28a01f67
...
...
@@ -805,8 +805,9 @@ void io_collect_dm_gparts(const struct gpart* const gparts, size_t Ntot,
/* message("i=%zd count=%zd id=%lld part=%p", i, count, gparts[i].id,
* gparts[i].part); */
/* And collect the DM ones */
if
(
gparts
[
i
].
type
==
swift_type_dark_matter
)
{
/* And collect the DM ones that have not been removed */
if
(
gparts
[
i
].
type
==
swift_type_dark_matter
&&
gparts
[
i
].
time_bin
!=
time_bin_inhibited
)
{
dmparts
[
count
]
=
gparts
[
i
];
count
++
;
}
...
...
This diff is collapsed.
Click to expand it.
src/single_io.c
+
6
−
5
View file @
28a01f67
...
...
@@ -603,15 +603,14 @@ void write_output_single(struct engine* e, const char* baseName,
const
struct
unit_system
*
snapshot_units
)
{
hid_t
h_file
=
0
,
h_grp
=
0
;
const
size_t
Ngas
=
e
->
s
->
nr
_parts
;
const
size_t
Nstars
=
e
->
s
->
nr
_sparts
;
const
size_t
Ntot
=
e
->
s
->
nr
_gparts
;
const
size_t
Ngas
=
e
->
total_nr_parts
-
e
->
nr_inhibited
_parts
;
const
size_t
Nstars
=
e
->
total_nr_sparts
-
e
->
nr_inhibited
_sparts
;
const
size_t
Ntot
=
e
->
total_nr_gparts
-
e
->
nr_inhibited
_gparts
;
int
periodic
=
e
->
s
->
periodic
;
int
numFiles
=
1
;
const
struct
part
*
parts
=
e
->
s
->
parts
;
const
struct
xpart
*
xparts
=
e
->
s
->
xparts
;
const
struct
gpart
*
gparts
=
e
->
s
->
gparts
;
struct
gpart
*
dmparts
=
NULL
;
const
struct
spart
*
sparts
=
e
->
s
->
sparts
;
const
struct
cooling_function_data
*
cooling
=
e
->
cooling_func
;
struct
swift_params
*
params
=
e
->
parameter_file
;
...
...
@@ -828,6 +827,8 @@ void write_output_single(struct engine* e, const char* baseName,
struct
io_props
list
[
100
];
size_t
N
=
0
;
struct
gpart
*
dmparts
=
NULL
;
/* Write particle fields from the particle structure */
switch
(
ptype
)
{
...
...
@@ -846,7 +847,7 @@ void write_output_single(struct engine* e, const char* baseName,
error
(
"Error while allocating temporart memory for DM particles"
);
bzero
(
dmparts
,
Ndm
*
sizeof
(
struct
gpart
));
/* Collect the DM particles from gpart */
/* Collect the
non-inhibited
DM particles from gpart */
io_collect_dm_gparts
(
gparts
,
Ntot
,
dmparts
,
Ndm
);
/* Write DM particles */
...
...
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