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
fa153c4c
Commit
fa153c4c
authored
Nov 16, 2017
by
James Willis
Browse files
Comments and formatting.
parent
4452cf5e
Changes
1
Show whitespace changes
Inline
Side-by-side
src/runner_doiact_vec.c
View file @
fa153c4c
...
...
@@ -273,7 +273,8 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
int
first_pi
=
0
,
last_pj
=
cj
->
count
-
1
;
int
temp
,
active_id
;
if
(
active_ci
)
{
/* Only populate max_index array for local actve cells. */
if
(
active_ci
)
{
/* Find the leftmost active particle in cell i that interacts with any
* particle in cell j. */
...
...
@@ -289,7 +290,8 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
/* Set the first active pi in range of any particle in cell j. */
first_pi
=
active_id
;
/* Find the maximum index into cell j for each particle in range in cell i. */
/* Find the maximum index into cell j for each particle in range in cell i.
*/
if
(
first_pi
<
ci
->
count
)
{
/* Start from the first particle in cell j. */
...
...
@@ -321,15 +323,16 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
/* Make sure that max index is set to first particle in cj.*/
max_index_i
[
ci
->
count
-
1
]
=
0
;
}
}
else
{
/* Make sure that foreign cells are only read into the cache if the local
cell requires it.
}
else
{
/* Make sure that foreign cells are only read into the cache if the local
*
cell requires it.
* Also ensure that it does not require any particles from cj. */
first_pi
=
ci
->
count
-
1
;
max_index_i
[
ci
->
count
-
1
]
=
0
;
}
if
(
active_cj
)
{
/* Only populate max_index array for local actve cells. */
if
(
active_cj
)
{
/* Find the rightmost active particle in cell j that interacts with any
* particle in cell i. */
last_pj
=
-
1
;
...
...
@@ -345,7 +348,8 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
/* Set the last active pj in range of any particle in cell i. */
last_pj
=
active_id
;
/* Find the maximum index into cell i for each particle in range in cell j. */
/* Find the maximum index into cell i for each particle in range in cell j.
*/
if
(
last_pj
>=
0
)
{
/* Start from the last particle in cell i. */
...
...
@@ -374,9 +378,9 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
/* Make sure that max index is set to last particle in ci.*/
max_index_j
[
0
]
=
ci
->
count
-
1
;
}
}
else
{
/* Make sure that foreign cells are only read into the cache if the local
cell requires it.
}
else
{
/* Make sure that foreign cells are only read into the cache if the local
*
cell requires it.
* Also ensure that it does not require any particles from ci. */
last_pj
=
0
;
max_index_j
[
0
]
=
ci
->
count
-
1
;
...
...
@@ -414,14 +418,12 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
* @param max_active_bin The largest time-bin active during this step.
*/
__attribute__
((
always_inline
))
INLINE
static
void
populate_max_index_no_cache_force
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
const
struct
entry
*
restrict
sort_i
,
const
struct
entry
*
restrict
sort_j
,
const
float
dx_max
,
const
float
rshift
,
const
double
hi_max_raw
,
const
double
hj_max_raw
,
const
double
hi_max
,
const
double
hj_max
,
const
double
di_max
,
const
double
dj_min
,
int
*
max_index_i
,
populate_max_index_no_cache_force
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
const
struct
entry
*
restrict
sort_i
,
const
struct
entry
*
restrict
sort_j
,
const
float
dx_max
,
const
float
rshift
,
const
double
hi_max_raw
,
const
double
hj_max_raw
,
const
double
hi_max
,
const
double
hj_max
,
const
double
di_max
,
const
double
dj_min
,
int
*
max_index_i
,
int
*
max_index_j
,
int
*
init_pi
,
int
*
init_pj
,
const
timebin_t
max_active_bin
,
const
int
active_ci
,
const
int
active_cj
)
{
...
...
@@ -431,7 +433,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
int
first_pi
=
0
,
last_pj
=
cj
->
count
-
1
;
int
temp
,
active_id
;
if
(
active_ci
)
{
/* Only populate max_index array for local actve cells. */
if
(
active_ci
)
{
/* Find the leftmost active particle in cell i that interacts with any
* particle in cell j. */
...
...
@@ -448,7 +451,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
/* Set the first active pi in range of any particle in cell j. */
first_pi
=
active_id
;
/* Find the maximum index into cell j for each particle in range in cell i. */
/* Find the maximum index into cell j for each particle in range in cell i.
*/
if
(
first_pi
<
ci
->
count
)
{
/* Start from the first particle in cell j. */
...
...
@@ -470,8 +474,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
temp
=
max_index_i
[
i
-
1
];
pi
=
&
parts_i
[
sort_i
[
i
].
i
];
const
float
di
=
sort_i
[
i
].
d
+
max
(
pi
->
h
,
hj_max_raw
)
*
kernel_gamma
+
dx_max
-
rshift
;
const
float
di
=
sort_i
[
i
].
d
+
max
(
pi
->
h
,
hj_max_raw
)
*
kernel_gamma
+
dx_max
-
rshift
;
/* Make sure that temp stays between 0 and cj->count - 1.*/
while
(
temp
<
cj
->
count
-
1
&&
di
>
sort_j
[
temp
].
d
)
temp
++
;
...
...
@@ -482,15 +486,16 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
/* Make sure that max index is set to first particle in cj.*/
max_index_i
[
ci
->
count
-
1
]
=
0
;
}
}
else
{
/* Make sure that foreign cells are only read into the cache if the local
cell requires it.
}
else
{
/* Make sure that foreign cells are only read into the cache if the local
*
cell requires it.
* Also ensure that it does not require any particles from cj. */
first_pi
=
ci
->
count
-
1
;
max_index_i
[
ci
->
count
-
1
]
=
0
;
}
if
(
active_cj
)
{
/* Only populate max_index array for local actve cells. */
if
(
active_cj
)
{
/* Find the rightmost active particle in cell j that interacts with any
* particle in cell i. */
last_pj
=
-
1
;
...
...
@@ -506,7 +511,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
/* Set the last active pj in range of any particle in cell i. */
last_pj
=
active_id
;
/* Find the maximum index into cell i for each particle in range in cell j. */
/* Find the maximum index into cell i for each particle in range in cell j.
*/
if
(
last_pj
>=
0
)
{
/* Start from the last particle in cell i. */
...
...
@@ -537,9 +543,9 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
/* Make sure that max index is set to last particle in ci.*/
max_index_j
[
0
]
=
ci
->
count
-
1
;
}
}
else
{
/* Make sure that foreign cells are only read into the cache if the local
cell requires it.
}
else
{
/* Make sure that foreign cells are only read into the cache if the local
*
cell requires it.
* Also ensure that it does not require any particles from ci. */
last_pj
=
0
;
max_index_j
[
0
]
=
ci
->
count
-
1
;
...
...
@@ -1157,12 +1163,13 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
TIMER_TIC
;
/* Check whether cells are local to the node. */
#ifdef WITH_MPI
const
int
ci_local
=
(
ci
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
cj_local
=
(
cj
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
ci_local
=
(
ci
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
cj_local
=
(
cj
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
#else
const
int
ci_local
=
1
;
const
int
cj_local
=
1
;
const
int
ci_local
=
1
;
const
int
cj_local
=
1
;
#endif
/* Get the cutoff shift. */
...
...
@@ -1238,7 +1245,8 @@ const int cj_local = 1;
* pj that interacts with any particle in ci. */
populate_max_index_no_cache
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
hi_max
,
hj_max
,
di_max
,
dj_min
,
max_index_i
,
max_index_j
,
&
first_pi
,
&
last_pj
,
max_active_bin
,
active_ci
,
active_cj
);
&
first_pi
,
&
last_pj
,
max_active_bin
,
active_ci
,
active_cj
);
/* Limits of the outer loops. */
int
first_pi_loop
=
first_pi
;
...
...
@@ -1514,12 +1522,13 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
TIMER_TIC
;
/* Check whether cells are local to the node. */
#ifdef WITH_MPI
const
int
ci_local
=
(
ci
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
cj_local
=
(
cj
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
ci_local
=
(
ci
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
cj_local
=
(
cj
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
#else
const
int
ci_local
=
1
;
const
int
cj_local
=
1
;
const
int
ci_local
=
1
;
const
int
cj_local
=
1
;
#endif
/* Get the cutoff shift. */
...
...
@@ -1599,10 +1608,10 @@ const int cj_local = 1;
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* Also find the first pi that interacts with any particle in cj and the last
* pj that interacts with any particle in ci. */
populate_max_index_no_cache_force
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
hi_max_raw
,
hj_max_raw
,
hi_max
,
hj_max
,
di_max
,
dj_min
,
max_index_i
,
max_index_j
,
&
first_pi
,
&
last_pj
,
max_active_bin
,
active_ci
,
active_cj
);
populate_max_index_no_cache_force
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
hi_max_raw
,
hj_max_raw
,
hi_max
,
hj_max
,
di_max
,
dj_min
,
max_index_i
,
max_index_j
,
&
first_pi
,
&
last_pj
,
max_active_bin
,
active_ci
,
active_cj
);
/* Limits of the outer loops. */
const
int
first_pi_loop
=
first_pi
;
...
...
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