Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
7997f926
Commit
7997f926
authored
Mar 21, 2020
by
Matthieu Schaller
Browse files
Do not lock the tree for gpart and mpoles for gravity tasks
parent
6c0d5eb8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
7997f926
...
...
@@ -1288,7 +1288,7 @@ int cell_locktree(struct cell *c) {
* @return 0 on success, 1 on failure
*/
int
cell_glocktree
(
struct
cell
*
c
)
{
TIMER_TIC
TIMER_TIC
;
/* First of all, try to lock this cell. */
if
(
c
->
grav
.
phold
||
lock_trylock
(
&
c
->
grav
.
plock
)
!=
0
)
{
...
...
@@ -1348,7 +1348,9 @@ int cell_glocktree(struct cell *c) {
* @return 0 on success, 1 on failure
*/
int
cell_mlocktree
(
struct
cell
*
c
)
{
TIMER_TIC
TIMER_TIC
;
error
(
"aa"
);
/* First of all, try to lock this cell. */
if
(
c
->
grav
.
mhold
||
lock_trylock
(
&
c
->
grav
.
mlock
)
!=
0
)
{
...
...
@@ -1546,7 +1548,7 @@ void cell_unlocktree(struct cell *c) {
* @param c The #cell.
*/
void
cell_gunlocktree
(
struct
cell
*
c
)
{
TIMER_TIC
TIMER_TIC
;
/* First of all, try to unlock this cell. */
if
(
lock_unlock
(
&
c
->
grav
.
plock
)
!=
0
)
error
(
"Failed to unlock cell."
);
...
...
@@ -1564,7 +1566,9 @@ void cell_gunlocktree(struct cell *c) {
* @param c The #cell.
*/
void
cell_munlocktree
(
struct
cell
*
c
)
{
TIMER_TIC
TIMER_TIC
;
error
(
"aa"
);
/* First of all, try to unlock this cell. */
if
(
lock_unlock
(
&
c
->
grav
.
mlock
)
!=
0
)
error
(
"Failed to unlock cell."
);
...
...
src/task.c
View file @
7997f926
...
...
@@ -456,8 +456,6 @@ void task_unlock(struct task *t) {
case
task_type_self
:
case
task_type_sub_self
:
if
(
subtype
==
task_subtype_grav
)
{
cell_gunlocktree
(
ci
);
cell_munlocktree
(
ci
);
}
else
if
((
subtype
==
task_subtype_stars_density
)
||
(
subtype
==
task_subtype_stars_feedback
))
{
cell_sunlocktree
(
ci
);
...
...
@@ -478,10 +476,6 @@ void task_unlock(struct task *t) {
case
task_type_pair
:
case
task_type_sub_pair
:
if
(
subtype
==
task_subtype_grav
)
{
cell_gunlocktree
(
ci
);
cell_gunlocktree
(
cj
);
cell_munlocktree
(
ci
);
cell_munlocktree
(
cj
);
}
else
if
((
subtype
==
task_subtype_stars_density
)
||
(
subtype
==
task_subtype_stars_feedback
))
{
cell_sunlocktree
(
ci
);
...
...
@@ -506,17 +500,12 @@ void task_unlock(struct task *t) {
break
;
case
task_type_grav_down
:
cell_gunlocktree
(
ci
);
cell_munlocktree
(
ci
);
break
;
case
task_type_grav_long_range
:
cell_munlocktree
(
ci
);
break
;
case
task_type_grav_mm
:
cell_munlocktree
(
ci
);
cell_munlocktree
(
cj
);
break
;
case
task_type_star_formation
:
...
...
@@ -612,14 +601,7 @@ int task_lock(struct task *t) {
case
task_type_self
:
case
task_type_sub_self
:
if
(
subtype
==
task_subtype_grav
)
{
/* Lock the gparts and the m-pole */
if
(
ci
->
grav
.
phold
||
ci
->
grav
.
mhold
)
return
0
;
if
(
cell_glocktree
(
ci
)
!=
0
)
return
0
;
else
if
(
cell_mlocktree
(
ci
)
!=
0
)
{
cell_gunlocktree
(
ci
);
return
0
;
}
return
1
;
}
else
if
((
subtype
==
task_subtype_stars_density
)
||
(
subtype
==
task_subtype_stars_feedback
))
{
if
(
ci
->
stars
.
hold
)
return
0
;
...
...
@@ -652,22 +634,7 @@ int task_lock(struct task *t) {
case
task_type_pair
:
case
task_type_sub_pair
:
if
(
subtype
==
task_subtype_grav
)
{
/* Lock the gparts and the m-pole in both cells */
if
(
ci
->
grav
.
phold
||
cj
->
grav
.
phold
)
return
0
;
if
(
cell_glocktree
(
ci
)
!=
0
)
return
0
;
if
(
cell_glocktree
(
cj
)
!=
0
)
{
cell_gunlocktree
(
ci
);
return
0
;
}
else
if
(
cell_mlocktree
(
ci
)
!=
0
)
{
cell_gunlocktree
(
ci
);
cell_gunlocktree
(
cj
);
return
0
;
}
else
if
(
cell_mlocktree
(
cj
)
!=
0
)
{
cell_gunlocktree
(
ci
);
cell_gunlocktree
(
cj
);
cell_munlocktree
(
ci
);
return
0
;
}
return
1
;
}
else
if
((
subtype
==
task_subtype_stars_density
)
||
(
subtype
==
task_subtype_stars_feedback
))
{
/* Lock the stars and the gas particles in both cells */
...
...
@@ -731,30 +698,15 @@ int task_lock(struct task *t) {
break
;
case
task_type_grav_down
:
/* Lock the gparts and the m-poles */
if
(
ci
->
grav
.
phold
||
ci
->
grav
.
mhold
)
return
0
;
if
(
cell_glocktree
(
ci
)
!=
0
)
return
0
;
else
if
(
cell_mlocktree
(
ci
)
!=
0
)
{
cell_gunlocktree
(
ci
);
return
0
;
}
return
1
;
break
;
case
task_type_grav_long_range
:
/* Lock the m-poles */
if
(
ci
->
grav
.
mhold
)
return
0
;
if
(
cell_mlocktree
(
ci
)
!=
0
)
return
0
;
return
1
;
break
;
case
task_type_grav_mm
:
/* Lock both m-poles */
if
(
ci
->
grav
.
mhold
||
cj
->
grav
.
mhold
)
return
0
;
if
(
cell_mlocktree
(
ci
)
!=
0
)
return
0
;
if
(
cell_mlocktree
(
cj
)
!=
0
)
{
cell_munlocktree
(
ci
);
return
0
;
}
return
1
;
break
;
case
task_type_star_formation
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment