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
8c5487c1
Commit
8c5487c1
authored
Aug 08, 2017
by
James Willis
Browse files
Renamed max_d to max_index and updated comments.
parent
7a15cc38
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cache.h
View file @
8c5487c1
...
...
@@ -63,8 +63,8 @@ struct cache {
/* Particle z velocity. */
float
*
restrict
vz
__attribute__
((
aligned
(
CACHE_ALIGN
)));
/* Maximum
distance of particles into neighbouring cell
. */
int
*
restrict
max_
d
__attribute__
((
aligned
(
CACHE_ALIGN
)));
/* Maximum
index into neighbouring cell for particles that are in range
. */
int
*
restrict
max_
index
__attribute__
((
aligned
(
CACHE_ALIGN
)));
/* Cache size. */
int
count
;
...
...
@@ -127,7 +127,7 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c,
free
(
c
->
vy
);
free
(
c
->
vz
);
free
(
c
->
h
);
free
(
c
->
max_
d
);
free
(
c
->
max_
index
);
}
error
+=
posix_memalign
((
void
**
)
&
c
->
x
,
CACHE_ALIGN
,
sizeBytes
);
...
...
@@ -138,7 +138,7 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c,
error
+=
posix_memalign
((
void
**
)
&
c
->
vy
,
CACHE_ALIGN
,
sizeBytes
);
error
+=
posix_memalign
((
void
**
)
&
c
->
vz
,
CACHE_ALIGN
,
sizeBytes
);
error
+=
posix_memalign
((
void
**
)
&
c
->
h
,
CACHE_ALIGN
,
sizeBytes
);
error
+=
posix_memalign
((
void
**
)
&
c
->
max_
d
,
CACHE_ALIGN
,
sizeIntBytes
);
error
+=
posix_memalign
((
void
**
)
&
c
->
max_
index
,
CACHE_ALIGN
,
sizeIntBytes
);
if
(
error
!=
0
)
error
(
"Couldn't allocate cache, no. of particles: %d"
,
(
int
)
count
);
...
...
@@ -431,7 +431,7 @@ static INLINE void cache_clean(struct cache *c) {
free
(
c
->
vy
);
free
(
c
->
vz
);
free
(
c
->
h
);
free
(
c
->
max_
d
);
free
(
c
->
max_
index
);
}
}
...
...
src/runner_doiact_vec.c
View file @
8c5487c1
...
...
@@ -228,7 +228,7 @@ __attribute__((always_inline)) INLINE static void storeInteractions(
}
/**
* @brief Populates the arrays max_
d
i and max_
d
j with the maximum di
stan
ces of
* @brief Populates the arrays max_
index_
i and max_
index_
j with the maximum
in
dices of
* particles into their neighbouring cells. Also finds the first pi that
* interacts with any particle in cj and the last pj that interacts with any
* particle in ci.
...
...
@@ -243,15 +243,15 @@ __attribute__((always_inline)) INLINE static void storeInteractions(
* @param hj_max Maximal smoothing length in cell cj
* @param di_max Maximal position on the axis that can interact in cell ci
* @param dj_min Minimal position on the axis that can interact in cell ci
* @param max_
d
i array to hold the maximum distances of pi particles into cell
* @param max_
index_
i array to hold the maximum distances of pi particles into cell
* cj
* @param max_
d
j array to hold the maximum distances of pj particles into cell
* @param max_
index_
j array to hold the maximum distances of pj particles into cell
* cj
* @param init_pi first pi to interact with a pj particle
* @param init_pj last pj to interact with a pi particle
* @param e The #engine.
*/
__attribute__
((
always_inline
))
INLINE
static
void
populate_max_
d
_no_cache
(
__attribute__
((
always_inline
))
INLINE
static
void
populate_max_
index
_no_cache
(
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
,
...
...
@@ -695,13 +695,13 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
int
*
max_index_i
__attribute__
((
aligned
(
sizeof
(
int
)
*
VEC_SIZE
)));
int
*
max_index_j
__attribute__
((
aligned
(
sizeof
(
int
)
*
VEC_SIZE
)));
max_index_i
=
r
->
ci_cache
.
max_
d
;
max_index_j
=
r
->
cj_cache
.
max_
d
;
max_index_i
=
r
->
ci_cache
.
max_
index
;
max_index_j
=
r
->
cj_cache
.
max_
index
;
/* Find particles maximum
distance
into cj, max_
d
i[] and ci, max_
d
j[]. */
/* Find particles maximum
index
into cj, max_
index_
i[] and ci, max_
index_
j[]. */
/* 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_
d
_no_cache
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
hi_max
,
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
,
e
);
...
...
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