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
50329fc8
Commit
50329fc8
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Don't move 'cell_is_drift_needed()' inactive.h
parent
c235205c
No related branches found
No related tags found
1 merge request
!279
Improve readability of active/inactive condition
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/active.h
+0
-31
0 additions, 31 deletions
src/active.h
src/cell.c
+30
-0
30 additions, 0 deletions
src/cell.c
src/cell.h
+2
-0
2 additions, 0 deletions
src/cell.h
with
32 additions
and
31 deletions
src/active.h
+
0
−
31
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 ?
*
...
...
This diff is collapsed.
Click to expand it.
src/cell.c
+
30
−
0
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.
...
...
This diff is collapsed.
Click to expand it.
src/cell.h
+
2
−
0
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
);
...
...
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