Skip to content
GitLab
Menu
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
50329fc8
Commit
50329fc8
authored
Nov 03, 2016
by
Matthieu Schaller
Browse files
Don't move 'cell_is_drift_needed()' inactive.h
parent
c235205c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/active.h
View file @
50329fc8
...
...
@@ -64,37 +64,6 @@ __attribute__((always_inline)) INLINE static int cell_is_all_active(
return
(
c
->
ti_end_max
==
e
->
ti_current
);
}
/**
* @brief Checks whether a given cell needs drifting or not.
*
* @param c the #cell.
* @param e The #engine (holding current time information).
*
* @return 1 If the cell needs drifting, 0 otherwise.
*/
INLINE
static
int
cell_is_drift_needed
(
struct
cell
*
c
,
const
struct
engine
*
e
)
{
/* Do we have at least one active particle in the cell ?*/
if
(
cell_is_active
(
c
,
e
))
return
1
;
/* Loop over the pair tasks that involve this cell */
for
(
struct
link
*
l
=
c
->
density
;
l
!=
NULL
;
l
=
l
->
next
)
{
if
(
l
->
t
->
type
!=
task_type_pair
&&
l
->
t
->
type
!=
task_type_sub_pair
)
continue
;
/* Is the other cell in the pair active ? */
if
((
l
->
t
->
ci
==
c
&&
cell_is_active
(
l
->
t
->
cj
,
e
))
||
(
l
->
t
->
cj
==
c
&&
cell_is_active
(
l
->
t
->
ci
,
e
)))
return
1
;
}
/* No neighbouring cell has active particles. Drift not necessary */
return
0
;
}
/**
* @brief Is this particle active ?
*
...
...
src/cell.c
View file @
50329fc8
...
...
@@ -47,6 +47,7 @@
#include "cell.h"
/* Local headers. */
#include "active.h"
#include "atomic.h"
#include "error.h"
#include "gravity.h"
...
...
@@ -863,6 +864,35 @@ void cell_clean(struct cell *c) {
if
(
c
->
progeny
[
k
])
cell_clean
(
c
->
progeny
[
k
]);
}
/**
* @brief Checks whether a given cell needs drifting or not.
*
* @param c the #cell.
* @param e The #engine (holding current time information).
*
* @return 1 If the cell needs drifting, 0 otherwise.
*/
int
cell_is_drift_needed
(
struct
cell
*
c
,
const
struct
engine
*
e
)
{
/* Do we have at least one active particle in the cell ?*/
if
(
cell_is_active
(
c
,
e
))
return
1
;
/* Loop over the pair tasks that involve this cell */
for
(
struct
link
*
l
=
c
->
density
;
l
!=
NULL
;
l
=
l
->
next
)
{
if
(
l
->
t
->
type
!=
task_type_pair
&&
l
->
t
->
type
!=
task_type_sub_pair
)
continue
;
/* Is the other cell in the pair active ? */
if
((
l
->
t
->
ci
==
c
&&
cell_is_active
(
l
->
t
->
cj
,
e
))
||
(
l
->
t
->
cj
==
c
&&
cell_is_active
(
l
->
t
->
ci
,
e
)))
return
1
;
}
/* No neighbouring cell has active particles. Drift not necessary */
return
0
;
}
/**
* @brief Un-skips all the tasks associated with a given cell and checks
* if the space needs to be rebuilt.
...
...
src/cell.h
View file @
50329fc8
...
...
@@ -37,6 +37,7 @@
#include "task.h"
/* Avoid cyclic inclusions */
struct
engine
;
struct
space
;
struct
scheduler
;
...
...
@@ -290,6 +291,7 @@ int cell_are_neighbours(const struct cell *restrict ci,
const
struct
cell
*
restrict
cj
);
void
cell_check_multipole
(
struct
cell
*
c
,
void
*
data
);
void
cell_clean
(
struct
cell
*
c
);
int
cell_is_drift_needed
(
struct
cell
*
c
,
const
struct
engine
*
e
);
int
cell_unskip_tasks
(
struct
cell
*
c
,
struct
scheduler
*
s
);
void
cell_set_super
(
struct
cell
*
c
,
struct
cell
*
super
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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