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
79b0d507
Commit
79b0d507
authored
Mar 15, 2018
by
Matthieu Schaller
Browse files
Improve the interface of the gravity cache construction.
parent
d86953f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/gravity/Default/gravity.h
View file @
79b0d507
...
...
@@ -41,6 +41,7 @@ __attribute__((always_inline)) INLINE static float gravity_get_mass(
* @brief Returns the softening of a particle
*
* @param gp The particle of interest
* @param grav_props The global gravity properties.
*/
__attribute__
((
always_inline
))
INLINE
static
float
gravity_get_softening
(
const
struct
gpart
*
gp
,
const
struct
gravity_props
*
restrict
grav_props
)
{
...
...
src/gravity_cache.h
View file @
79b0d507
...
...
@@ -149,15 +149,17 @@ static INLINE void gravity_cache_init(struct gravity_cache *c, int count) {
* @param shift A shift to apply to all the particles.
* @param CoM The position of the multipole.
* @param r_max2 The square of the multipole radius.
* @param theta_crit2 The square of the opening angle.
* @param cell The cell we play with (to get reasonable padding positions).
* @param grav_props The global gravity properties.
*/
__attribute__
((
always_inline
))
INLINE
static
void
gravity_cache_populate
(
timebin_t
max_active_bin
,
struct
gravity_cache
*
c
,
const
struct
gpart
*
restrict
gparts
,
int
gcount
,
int
gcount_padded
,
const
double
shift
[
3
],
const
float
CoM
[
3
],
float
r_max2
,
float
theta_crit2
,
const
double
shift
[
3
],
const
float
CoM
[
3
],
float
r_max2
,
const
struct
cell
*
cell
,
const
struct
gravity_props
*
grav_props
)
{
const
float
theta_crit2
=
grav_props
->
theta_crit2
;
/* Make the compiler understand we are in happy vectorization land */
swift_declare_aligned_ptr
(
float
,
x
,
c
->
x
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
float
,
y
,
c
->
y
,
SWIFT_CACHE_ALIGNMENT
);
...
...
@@ -220,6 +222,7 @@ __attribute__((always_inline)) INLINE static void gravity_cache_populate(
* multiple of the vector length.
* @param shift A shift to apply to all the particles.
* @param cell The cell we play with (to get reasonable padding positions).
* @param grav_props The global gravity properties.
*/
__attribute__
((
always_inline
))
INLINE
static
void
gravity_cache_populate_no_mpole
(
timebin_t
max_active_bin
,
...
...
src/runner_doiact_grav.h
View file @
79b0d507
...
...
@@ -466,7 +466,6 @@ static INLINE void runner_dopair_grav_pp(struct runner *r, struct cell *ci,
struct
space
*
s
=
e
->
s
;
const
int
periodic
=
s
->
periodic
;
const
double
cell_width
=
s
->
width
[
0
];
const
float
theta_crit2
=
e
->
gravity_properties
->
theta_crit2
;
const
double
a_smooth
=
e
->
gravity_properties
->
a_smooth
;
const
double
r_cut_min
=
e
->
gravity_properties
->
r_cut_min
;
const
double
rlr
=
cell_width
*
a_smooth
;
...
...
@@ -532,11 +531,11 @@ static INLINE void runner_dopair_grav_pp(struct runner *r, struct cell *ci,
/* Fill the caches */
gravity_cache_populate
(
e
->
max_active_bin
,
ci_cache
,
ci
->
gparts
,
gcount_i
,
gcount_padded_i
,
shift_i
,
CoM_j
,
rmax2_j
,
theta_crit2
,
ci
,
e
->
gravity_properties
);
gcount_padded_i
,
shift_i
,
CoM_j
,
rmax2_j
,
ci
,
e
->
gravity_properties
);
gravity_cache_populate
(
e
->
max_active_bin
,
cj_cache
,
cj
->
gparts
,
gcount_j
,
gcount_padded_j
,
shift_j
,
CoM_i
,
rmax2_i
,
theta_crit2
,
cj
,
e
->
gravity_properties
);
gcount_padded_j
,
shift_j
,
CoM_i
,
rmax2_i
,
cj
,
e
->
gravity_properties
);
/* Can we use the Newtonian version or do we need the truncated one ? */
if
(
!
periodic
)
{
...
...
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