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
eec60d76
Commit
eec60d76
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added functions to remove a part/gpart/spart from a cell.
parent
91b56f3b
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/cell.c
+63
-0
63 additions, 0 deletions
src/cell.c
src/cell.h
+4
-0
4 additions, 0 deletions
src/cell.h
with
67 additions
and
0 deletions
src/cell.c
+
63
−
0
View file @
eec60d76
...
...
@@ -3202,6 +3202,69 @@ void cell_check_timesteps(struct cell *c) {
#endif
}
/**
* @brief "Remove" a gas particle from the calculation.
*
* The particle is inhibited and will officially be removed at the next rebuild.
*
* @param c The #cell from which to remove the particle.
* @param p The #part to remove.
* @param xp The extended data of the particle to remove.
*/
void
cell_remove_part
(
const
struct
engine
*
e
,
struct
cell
*
c
,
struct
part
*
p
,
struct
xpart
*
xp
)
{
/* Quick cross-check */
if
(
c
->
nodeID
!=
e
->
nodeID
)
error
(
"Can't remove a particle in a foreign cell."
);
/* Mark the particle as inhibited */
p
->
time_bin
=
time_bin_inhibited
;
if
(
p
->
gpart
)
p
->
gpart
->
time_bin
=
time_bin_inhibited
;
}
/**
* @brief "Remove" a gravity particle from the calculation.
*
* The particle is inhibited and will officially be removed at the next rebuild.
*
* @param c The #cell from which to remove the particle.
* @param gp The #gpart to remove.
*/
void
cell_remove_gpart
(
const
struct
engine
*
e
,
struct
cell
*
c
,
struct
gpart
*
gp
)
{
/* Quick cross-check */
if
(
c
->
nodeID
!=
e
->
nodeID
)
error
(
"Can't remove a particle in a foreign cell."
);
if
(
gp
->
type
!=
swift_type_dark_matter
)
error
(
"Trying to remove a non-dark matter gpart."
);
/* Mark the particle as inhibited */
gp
->
time_bin
=
time_bin_inhibited
;
}
/**
* @brief "Remove" a star particle from the calculation.
*
* The particle is inhibited and will officially be removed at the next rebuild.
*
* @param c The #cell from which to remove the particle.
* @param sp The #spart to remove.
*/
void
cell_remove_spart
(
const
struct
engine
*
e
,
struct
cell
*
c
,
struct
spart
*
sp
)
{
/* Quick cross-check */
if
(
c
->
nodeID
!=
e
->
nodeID
)
error
(
"Can't remove a particle in a foreign cell."
);
/* Mark the particle as inhibited */
sp
->
time_bin
=
time_bin_inhibited
;
if
(
sp
->
gpart
)
sp
->
gpart
->
time_bin
=
time_bin_inhibited
;
}
/**
* @brief Can we use the MM interactions fo a given pair of cells?
*
...
...
This diff is collapsed.
Click to expand it.
src/cell.h
+
4
−
0
View file @
eec60d76
...
...
@@ -616,6 +616,10 @@ void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s);
void
cell_clear_drift_flags
(
struct
cell
*
c
,
void
*
data
);
void
cell_set_super_mapper
(
void
*
map_data
,
int
num_elements
,
void
*
extra_data
);
int
cell_has_tasks
(
struct
cell
*
c
);
void
cell_remove_part
(
const
struct
engine
*
e
,
struct
cell
*
c
,
struct
part
*
p
,
struct
xpart
*
xp
);
void
cell_remove_gpart
(
const
struct
engine
*
e
,
struct
cell
*
c
,
struct
gpart
*
gp
);
void
cell_remove_spart
(
const
struct
engine
*
e
,
struct
cell
*
c
,
struct
spart
*
sp
);
int
cell_can_use_pair_mm
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
const
struct
engine
*
e
,
const
struct
space
*
s
);
int
cell_can_use_pair_mm_rebuild
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
...
...
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