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
1fc52bf2
Commit
1fc52bf2
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Collect the inhibited particles in the parent function.
parent
3dd63969
Branches
Branches containing commit
Tags
Tags containing commit
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/space.c
+15
-13
15 additions, 13 deletions
src/space.c
src/space.h
+3
-3
3 additions, 3 deletions
src/space.h
with
18 additions
and
16 deletions
src/space.c
+
15
−
13
View file @
1fc52bf2
...
...
@@ -102,7 +102,6 @@ struct parallel_sort {
*/
struct
index_data
{
struct
space
*
s
;
struct
cell
*
cells
;
int
*
ind
;
int
*
cell_counts
;
int
count_inhibited_part
;
...
...
@@ -566,6 +565,9 @@ void space_rebuild(struct space *s, int verbose) {
size_t
nr_parts
=
s
->
nr_parts
;
size_t
nr_gparts
=
s
->
nr_gparts
;
size_t
nr_sparts
=
s
->
nr_sparts
;
int
count_inhibited_parts
=
0
;
int
count_inhibited_gparts
=
0
;
int
count_inhibited_sparts
=
0
;
struct
cell
*
restrict
cells_top
=
s
->
cells_top
;
const
integertime_t
ti_current
=
(
s
->
e
!=
NULL
)
?
s
->
e
->
ti_current
:
0
;
...
...
@@ -579,7 +581,8 @@ void space_rebuild(struct space *s, int verbose) {
if
(
cell_part_counts
==
NULL
)
error
(
"Failed to allocate cell part count buffer."
);
if
(
s
->
size_parts
>
0
)
space_parts_get_cell_index
(
s
,
ind
,
cell_part_counts
,
cells_top
,
verbose
);
space_parts_get_cell_index
(
s
,
ind
,
cell_part_counts
,
&
count_inhibited_parts
,
verbose
);
/* Run through the gravity particles and get their cell index. */
const
size_t
gind_size
=
s
->
size_gparts
+
100
;
...
...
@@ -589,7 +592,8 @@ void space_rebuild(struct space *s, int verbose) {
if
(
cell_gpart_counts
==
NULL
)
error
(
"Failed to allocate cell gpart count buffer."
);
if
(
s
->
size_gparts
>
0
)
space_gparts_get_cell_index
(
s
,
gind
,
cell_gpart_counts
,
cells_top
,
verbose
);
space_gparts_get_cell_index
(
s
,
gind
,
cell_gpart_counts
,
&
count_inhibited_gparts
,
verbose
);
/* Run through the star particles and get their cell index. */
const
size_t
sind_size
=
s
->
size_sparts
+
100
;
...
...
@@ -599,7 +603,8 @@ void space_rebuild(struct space *s, int verbose) {
if
(
cell_spart_counts
==
NULL
)
error
(
"Failed to allocate cell gpart count buffer."
);
if
(
s
->
size_sparts
>
0
)
space_sparts_get_cell_index
(
s
,
sind
,
cell_spart_counts
,
cells_top
,
verbose
);
space_sparts_get_cell_index
(
s
,
sind
,
cell_spart_counts
,
&
count_inhibited_sparts
,
verbose
);
#ifdef WITH_MPI
const
int
local_nodeID
=
s
->
e
->
nodeID
;
...
...
@@ -1366,11 +1371,11 @@ void space_sparts_get_cell_index_mapper(void *map_data, int nr_sparts,
* @param s The #space.
* @param ind The array of indices to fill.
* @param cell_counts The cell counters to update.
* @param c
ells The array of #cell to updat
e.
* @param c
ount_inhibited_parts (return) The number of #part to remov
e.
* @param verbose Are we talkative ?
*/
void
space_parts_get_cell_index
(
struct
space
*
s
,
int
*
ind
,
int
*
cell_counts
,
struct
cell
*
cell
s
,
int
verbose
)
{
int
*
count_inibibited_part
s
,
int
verbose
)
{
const
ticks
tic
=
getticks
();
...
...
@@ -1381,7 +1386,6 @@ void space_parts_get_cell_index(struct space *s, int *ind, int *cell_counts,
/* Pack the extra information */
struct
index_data
data
;
data
.
s
=
s
;
data
.
cells
=
cells
;
data
.
ind
=
ind
;
data
.
cell_counts
=
cell_counts
;
data
.
count_inhibited_part
=
0
;
...
...
@@ -1404,11 +1408,11 @@ void space_parts_get_cell_index(struct space *s, int *ind, int *cell_counts,
* @param s The #space.
* @param gind The array of indices to fill.
* @param cell_counts The cell counters to update.
* @param c
ells The array of #cell to updat
e.
* @param c
ount_inhibited_gparts (return) The number of #gpart to remov
e.
* @param verbose Are we talkative ?
*/
void
space_gparts_get_cell_index
(
struct
space
*
s
,
int
*
gind
,
int
*
cell_counts
,
struct
cell
*
cell
s
,
int
verbose
)
{
int
*
count_inibibited_gpart
s
,
int
verbose
)
{
const
ticks
tic
=
getticks
();
...
...
@@ -1419,7 +1423,6 @@ void space_gparts_get_cell_index(struct space *s, int *gind, int *cell_counts,
/* Pack the extra information */
struct
index_data
data
;
data
.
s
=
s
;
data
.
cells
=
cells
;
data
.
ind
=
gind
;
data
.
cell_counts
=
cell_counts
;
data
.
count_inhibited_part
=
0
;
...
...
@@ -1442,11 +1445,11 @@ void space_gparts_get_cell_index(struct space *s, int *gind, int *cell_counts,
* @param s The #space.
* @param sind The array of indices to fill.
* @param cell_counts The cell counters to update.
* @param c
ells The array of #cell to updat
e.
* @param c
ount_inhibited_gparts (return) The number of #gpart to remov
e.
* @param verbose Are we talkative ?
*/
void
space_sparts_get_cell_index
(
struct
space
*
s
,
int
*
sind
,
int
*
cell_counts
,
struct
cell
*
cell
s
,
int
verbose
)
{
int
*
count_inibibited_gpart
s
,
int
verbose
)
{
const
ticks
tic
=
getticks
();
...
...
@@ -1457,7 +1460,6 @@ void space_sparts_get_cell_index(struct space *s, int *sind, int *cell_counts,
/* Pack the extra information */
struct
index_data
data
;
data
.
s
=
s
;
data
.
cells
=
cells
;
data
.
ind
=
sind
;
data
.
cell_counts
=
cell_counts
;
data
.
count_inhibited_part
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/space.h
+
3
−
3
View file @
1fc52bf2
...
...
@@ -244,11 +244,11 @@ void space_split_mapper(void *map_data, int num_elements, void *extra_data);
void
space_list_local_cells
(
struct
space
*
s
);
void
space_list_cells_with_tasks
(
struct
space
*
s
);
void
space_parts_get_cell_index
(
struct
space
*
s
,
int
*
ind
,
int
*
cell_counts
,
struct
cell
*
cell
s
,
int
verbose
);
int
*
count_inibibited_part
s
,
int
verbose
);
void
space_gparts_get_cell_index
(
struct
space
*
s
,
int
*
gind
,
int
*
cell_counts
,
struct
cell
*
cell
s
,
int
verbose
);
int
*
count_inibibited_gpart
s
,
int
verbose
);
void
space_sparts_get_cell_index
(
struct
space
*
s
,
int
*
sind
,
int
*
cell_counts
,
struct
cell
*
cell
s
,
int
verbose
);
int
*
count_inibibited_spart
s
,
int
verbose
);
void
space_synchronize_particle_positions
(
struct
space
*
s
);
void
space_do_parts_sort
(
void
);
void
space_do_gparts_sort
(
void
);
...
...
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