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
2545e4ab
Commit
2545e4ab
authored
May 31, 2017
by
Matthieu Schaller
Browse files
Merge branch 'master' into testPeriodicBC
parents
6842e754
bd229c7a
Changes
18
Hide whitespace changes
Inline
Side-by-side
doc/Doxyfile.in
View file @
2545e4ab
...
@@ -1988,6 +1988,9 @@ INCLUDE_FILE_PATTERNS =
...
@@ -1988,6 +1988,9 @@ INCLUDE_FILE_PATTERNS =
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = "__attribute__(x)= "
PREDEFINED = "__attribute__(x)= "
PREDEFINED += HAVE_HDF5
PREDEFINED += WITH_MPI
PREDEFINED += WITH_VECTORIZATION
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
# tag can be used to specify a list of macro names that should be expanded. The
...
...
src/collectgroup.c
View file @
2545e4ab
...
@@ -170,7 +170,7 @@ static void doreduce1(struct mpicollectgroup1 *mpigrp11,
...
@@ -170,7 +170,7 @@ static void doreduce1(struct mpicollectgroup1 *mpigrp11,
}
}
/**
/**
* @brief MPI reduce operator for #mpicollectgroup structures.
* @brief MPI reduce operator for #mpicollectgroup
1
structures.
*/
*/
static
void
mpicollectgroup1_reduce
(
void
*
in
,
void
*
inout
,
int
*
len
,
static
void
mpicollectgroup1_reduce
(
void
*
in
,
void
*
inout
,
int
*
len
,
MPI_Datatype
*
datatype
)
{
MPI_Datatype
*
datatype
)
{
...
...
src/runner.c
View file @
2545e4ab
...
@@ -1818,13 +1818,8 @@ void *runner_main(void *data) {
...
@@ -1818,13 +1818,8 @@ void *runner_main(void *data) {
break
;
break
;
case
task_type_pair
:
case
task_type_pair
:
if
(
t
->
subtype
==
task_subtype_density
)
{
if
(
t
->
subtype
==
task_subtype_density
)
#if defined(WITH_VECTORIZATION) && defined(GADGET2_SPH)
runner_dopair1_branch_density
(
r
,
ci
,
cj
);
runner_dopair1_density_vec
(
r
,
ci
,
cj
);
#else
runner_dopair1_density
(
r
,
ci
,
cj
);
#endif
}
#ifdef EXTRA_HYDRO_LOOP
#ifdef EXTRA_HYDRO_LOOP
else
if
(
t
->
subtype
==
task_subtype_gradient
)
else
if
(
t
->
subtype
==
task_subtype_gradient
)
runner_dopair1_gradient
(
r
,
ci
,
cj
);
runner_dopair1_gradient
(
r
,
ci
,
cj
);
...
...
src/runner_doiact.h
View file @
2545e4ab
...
@@ -884,8 +884,11 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
...
@@ -884,8 +884,11 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
* @param r The #runner.
* @param r The #runner.
* @param ci The first #cell.
* @param ci The first #cell.
* @param cj The second #cell.
* @param cj The second #cell.
* @param sid The direction of the pair
* @param shift The shift vector to apply to the particles in ci.
*/
*/
void
DOPAIR1
(
struct
runner
*
r
,
struct
cell
*
ci
,
struct
cell
*
cj
)
{
void
DOPAIR1
(
struct
runner
*
r
,
struct
cell
*
ci
,
struct
cell
*
cj
,
const
int
sid
,
const
double
*
shift
)
{
const
struct
engine
*
restrict
e
=
r
->
e
;
const
struct
engine
*
restrict
e
=
r
->
e
;
...
@@ -900,22 +903,6 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
...
@@ -900,22 +903,6 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
TIMER_TIC
;
TIMER_TIC
;
/* Anything to do here? */
if
(
!
cell_is_active
(
ci
,
e
)
&&
!
cell_is_active
(
cj
,
e
))
return
;
if
(
!
cell_are_part_drifted
(
ci
,
e
)
||
!
cell_are_part_drifted
(
cj
,
e
))
error
(
"Interacting undrifted cells."
);
/* Get the sort ID. */
double
shift
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
};
const
int
sid
=
space_getsid
(
e
->
s
,
&
ci
,
&
cj
,
shift
);
/* Have the cells been sorted? */
if
(
!
(
ci
->
sorted
&
(
1
<<
sid
))
||
ci
->
dx_max_sort
>
space_maxreldx
*
ci
->
dmin
)
runner_do_sort
(
r
,
ci
,
(
1
<<
sid
),
1
);
if
(
!
(
cj
->
sorted
&
(
1
<<
sid
))
||
cj
->
dx_max_sort
>
space_maxreldx
*
cj
->
dmin
)
runner_do_sort
(
r
,
cj
,
(
1
<<
sid
),
1
);
/* Get the cutoff shift. */
/* Get the cutoff shift. */
double
rshift
=
0
.
0
;
double
rshift
=
0
.
0
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
rshift
+=
shift
[
k
]
*
runner_shift
[
sid
][
k
];
for
(
int
k
=
0
;
k
<
3
;
k
++
)
rshift
+=
shift
[
k
]
*
runner_shift
[
sid
][
k
];
...
@@ -1116,6 +1103,51 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
...
@@ -1116,6 +1103,51 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
TIMER_TOC
(
TIMER_DOPAIR
);
TIMER_TOC
(
TIMER_DOPAIR
);
}
}
/**
* @brief Determine which version of DOPAIR1 needs to be called depending on the
* orientation of the cells or whether DOPAIR1 needs to be called at all.
*
* @param r #runner
* @param ci #cell ci
* @param cj #cell cj
*
*/
void
DOPAIR1_BRANCH
(
struct
runner
*
r
,
struct
cell
*
ci
,
struct
cell
*
cj
)
{
const
struct
engine
*
restrict
e
=
r
->
e
;
/* Anything to do here? */
if
(
!
cell_is_active
(
ci
,
e
)
&&
!
cell_is_active
(
cj
,
e
))
return
;
/* Check that cells are drifted. */
if
(
!
cell_are_part_drifted
(
ci
,
e
)
||
!
cell_are_part_drifted
(
cj
,
e
))
error
(
"Interacting undrifted cells."
);
/* Get the sort ID. */
double
shift
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
};
const
int
sid
=
space_getsid
(
e
->
s
,
&
ci
,
&
cj
,
shift
);
/* Have the cells been sorted? */
if
(
!
(
ci
->
sorted
&
(
1
<<
sid
))
||
ci
->
dx_max_sort
>
space_maxreldx
*
ci
->
dmin
)
runner_do_sort
(
r
,
ci
,
(
1
<<
sid
),
1
);
if
(
!
(
cj
->
sorted
&
(
1
<<
sid
))
||
cj
->
dx_max_sort
>
space_maxreldx
*
cj
->
dmin
)
runner_do_sort
(
r
,
cj
,
(
1
<<
sid
),
1
);
/* Have the cells been sorted? */
if
(
!
(
ci
->
sorted
&
(
1
<<
sid
))
||
!
(
cj
->
sorted
&
(
1
<<
sid
)))
error
(
"Trying to interact unsorted cells."
);
#if defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && \
(DOPAIR1_BRANCH == runner_dopair1_density_branch)
if
(
!
sort_is_corner
(
sid
))
runner_dopair1_density_vec
(
r
,
ci
,
cj
,
sid
,
shift
);
else
DOPAIR1
(
r
,
ci
,
cj
,
sid
,
shift
);
#else
DOPAIR1
(
r
,
ci
,
cj
,
sid
,
shift
);
#endif
}
/**
/**
* @brief Compute the interactions between a cell pair (symmetric)
* @brief Compute the interactions between a cell pair (symmetric)
*
*
...
@@ -2290,13 +2322,8 @@ void DOSUB_PAIR1(struct runner *r, struct cell *ci, struct cell *cj, int sid,
...
@@ -2290,13 +2322,8 @@ void DOSUB_PAIR1(struct runner *r, struct cell *ci, struct cell *cj, int sid,
cj
->
dx_max_sort
>
cj
->
dmin
*
space_maxreldx
)
cj
->
dx_max_sort
>
cj
->
dmin
*
space_maxreldx
)
runner_do_sort
(
r
,
cj
,
(
1
<<
sid
),
1
);
runner_do_sort
(
r
,
cj
,
(
1
<<
sid
),
1
);
/* Compute the interactions. */
/* Compute the interactions. */
#if (DOPAIR1 == runner_dopair1_density) && defined(WITH_VECTORIZATION) && \
DOPAIR1_BRANCH
(
r
,
ci
,
cj
);
defined(GADGET2_SPH)
runner_dopair1_density_vec
(
r
,
ci
,
cj
);
#else
DOPAIR1
(
r
,
ci
,
cj
);
#endif
}
}
if
(
gettimer
)
TIMER_TOC
(
TIMER_DOSUB_PAIR
);
if
(
gettimer
)
TIMER_TOC
(
TIMER_DOSUB_PAIR
);
...
...
src/runner_doiact_vec.c
View file @
2545e4ab
...
@@ -20,13 +20,12 @@
...
@@ -20,13 +20,12 @@
/* Config parameters. */
/* Config parameters. */
#include
"../config.h"
#include
"../config.h"
#include
"swift.h"
#include
"active.h"
/* This object's header. */
/* This object's header. */
#include
"runner_doiact_vec.h"
#include
"runner_doiact_vec.h"
/* Local headers. */
#include
"active.h"
#ifdef WITH_VECTORIZATION
#ifdef WITH_VECTORIZATION
/**
/**
* @brief Compute the vector remainder interactions from the secondary cache.
* @brief Compute the vector remainder interactions from the secondary cache.
...
@@ -262,40 +261,40 @@ __attribute__((always_inline)) INLINE static void storeInteractions(
...
@@ -262,40 +261,40 @@ __attribute__((always_inline)) INLINE static void storeInteractions(
}
}
}
}
/* @brief Populates the arrays max_di and max_dj with the maximum distances of
/**
* @brief Populates the arrays max_di and max_dj with the maximum distances of
* particles into their neighbouring cells. Also finds the first pi that
* 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
* interacts with any particle in cj and the last pj that interacts with any
* particle in ci.
* particle in ci.
*
* @param ci #cell pointer to ci
* @param ci #cell pointer to ci
* @param cj #cell pointer to cj
* @param cj #cell pointer to cj
* @param sort_i #entry array for particle distance in ci
* @param sort_i #entry array for particle distance in ci
* @param sort_j #entry array for particle distance in cj
* @param sort_j #entry array for particle distance in cj
* @param ci_cache #cache for cell ci
* @param cj_cache #cache for cell cj
* @param dx_max maximum particle movement allowed in cell
* @param dx_max maximum particle movement allowed in cell
* @param rshift cutoff shift
* @param rshift cutoff shift
* @param hi_max Maximal smoothing length in cell ci
* @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_di array to hold the maximum distances of pi particles into cell
* @param max_di array to hold the maximum distances of pi particles into cell
* cj
* cj
* @param max_dj array to hold the maximum distances of pj particles into cell
* @param max_dj array to hold the maximum distances of pj particles into cell
* cj
* cj
* @param init_pi first pi to interact with a pj particle
* @param init_pi first pi to interact with a pj particle
* @param init_pj last pj to interact with a pi 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_d_no_cache
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
const
struct
entry
*
restrict
sort_i
,
const
struct
entry
*
restrict
sort_j
,
const
struct
entry
*
restrict
sort_i
,
const
struct
entry
*
restrict
sort_j
,
const
float
dx_max
,
const
float
rshift
,
float
*
max_di
,
float
*
max_dj
,
const
float
dx_max
,
const
float
rshift
,
const
double
hi_max
,
int
*
init_pi
,
int
*
init_pj
,
const
struct
engine
*
e
)
{
const
double
hj_max
,
const
double
di_max
,
const
double
dj_min
,
float
*
max_di
,
float
*
max_dj
,
int
*
init_pi
,
int
*
init_pj
,
const
struct
engine
*
e
)
{
struct
part
*
restrict
parts_i
=
ci
->
parts
;
const
struct
part
*
restrict
parts_i
=
ci
->
parts
;
struct
part
*
restrict
parts_j
=
cj
->
parts
;
const
struct
part
*
restrict
parts_j
=
cj
->
parts
;
struct
part
*
p
=
&
parts_i
[
sort_i
[
0
].
i
];
float
h
,
d
;
/* Get the distance of the last pi and the first pj on the sorted axis.*/
const
float
di_max
=
sort_i
[
ci
->
count
-
1
].
d
-
rshift
;
const
float
dj_min
=
sort_j
[
0
].
d
;
int
first_pi
=
0
,
last_pj
=
cj
->
count
-
1
;
int
first_pi
=
0
,
last_pj
=
cj
->
count
-
1
;
...
@@ -304,19 +303,19 @@ __attribute__((always_inline)) INLINE static void populate_max_d_no_cache(
...
@@ -304,19 +303,19 @@ __attribute__((always_inline)) INLINE static void populate_max_d_no_cache(
/* Populate max_di with distances. */
/* Populate max_di with distances. */
int
active_id
=
ci
->
count
-
1
;
int
active_id
=
ci
->
count
-
1
;
for
(
int
k
=
ci
->
count
-
1
;
k
>=
0
;
k
--
)
{
for
(
int
k
=
ci
->
count
-
1
;
k
>=
0
;
k
--
)
{
p
=
&
parts_i
[
sort_i
[
k
].
i
];
const
struct
part
*
pi
=
&
parts_i
[
sort_i
[
k
].
i
];
h
=
p
->
h
;
const
float
d
=
sort_i
[
k
].
d
+
dx_max
;
d
=
sort_i
[
k
].
d
+
h
*
kernel_gamma
+
dx_max
-
rshift
;
max_di
[
k
]
=
d
;
// max_di[k] = d + h * kernel_gamma - rshift;
max_di
[
k
]
=
d
+
hi_max
;
/* If the particle is out of range set the index to
/* If the particle is out of range set the index to
* the last active particle within range. */
* the last active particle within range. */
if
(
d
<
dj_min
)
{
if
(
d
+
hi_max
<
dj_min
)
{
first_pi
=
active_id
;
first_pi
=
active_id
;
break
;
break
;
}
else
{
}
else
{
if
(
part_is_active
(
p
,
e
))
active_id
=
k
;
if
(
part_is_active
(
p
i
,
e
))
active_id
=
k
;
}
}
}
}
...
@@ -329,19 +328,20 @@ __attribute__((always_inline)) INLINE static void populate_max_d_no_cache(
...
@@ -329,19 +328,20 @@ __attribute__((always_inline)) INLINE static void populate_max_d_no_cache(
/* Populate max_dj with distances. */
/* Populate max_dj with distances. */
active_id
=
0
;
active_id
=
0
;
for
(
int
k
=
0
;
k
<
cj
->
count
;
k
++
)
{
for
(
int
k
=
0
;
k
<
cj
->
count
;
k
++
)
{
p
=
&
parts_j
[
sort_j
[
k
].
i
];
const
struct
part
*
pj
=
&
parts_j
[
sort_j
[
k
].
i
];
h
=
p
->
h
;
const
float
d
=
sort_j
[
k
].
d
-
dx_max
;
d
=
sort_j
[
k
].
d
-
h
*
kernel_gamma
-
dx_max
-
rshift
;
max_dj
[
k
]
=
d
;
/*TODO: don't think rshift should be taken off here, waiting on Pedro. */
// max_dj[k] = d - h * kernel_gamma - rshift;
max_dj
[
k
]
=
d
-
hj_max
;
/* If the particle is out of range set the index to
/* If the particle is out of range set the index to
* the last active particle within range. */
* the last active particle within range. */
if
(
d
>
di_max
)
{
if
(
d
-
hj_max
>
di_max
)
{
last_pj
=
active_id
;
last_pj
=
active_id
;
break
;
break
;
}
else
{
}
else
{
if
(
part_is_active
(
p
,
e
))
active_id
=
k
;
if
(
part_is_active
(
p
j
,
e
))
active_id
=
k
;
}
}
}
}
...
@@ -611,9 +611,12 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec(
...
@@ -611,9 +611,12 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec(
* @param r The #runner.
* @param r The #runner.
* @param ci The first #cell.
* @param ci The first #cell.
* @param cj The second #cell.
* @param cj The second #cell.
* @param sid The direction of the pair
* @param shift The shift vector to apply to the particles in ci.
*/
*/
void
runner_dopair1_density_vec
(
struct
runner
*
r
,
struct
cell
*
ci
,
void
runner_dopair1_density_vec
(
struct
runner
*
r
,
struct
cell
*
ci
,
struct
cell
*
cj
)
{
struct
cell
*
cj
,
const
int
sid
,
const
double
*
shift
)
{
#ifdef WITH_VECTORIZATION
#ifdef WITH_VECTORIZATION
const
struct
engine
*
restrict
e
=
r
->
e
;
const
struct
engine
*
restrict
e
=
r
->
e
;
...
@@ -622,22 +625,6 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
...
@@ -622,22 +625,6 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
TIMER_TIC
;
TIMER_TIC
;
/* Anything to do here? */
if
(
!
cell_is_active
(
ci
,
e
)
&&
!
cell_is_active
(
cj
,
e
))
return
;
if
(
!
cell_are_part_drifted
(
ci
,
e
)
||
!
cell_are_part_drifted
(
cj
,
e
))
error
(
"Interacting undrifted cells."
);
/* Get the sort ID. */
double
shift
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
};
const
int
sid
=
space_getsid
(
e
->
s
,
&
ci
,
&
cj
,
shift
);
/* Have the cells been sorted? */
if
(
!
(
ci
->
sorted
&
(
1
<<
sid
))
||
ci
->
dx_max_sort
>
space_maxreldx
*
ci
->
dmin
)
runner_do_sort
(
r
,
ci
,
(
1
<<
sid
),
1
);
if
(
!
(
cj
->
sorted
&
(
1
<<
sid
))
||
cj
->
dx_max_sort
>
space_maxreldx
*
cj
->
dmin
)
runner_do_sort
(
r
,
cj
,
(
1
<<
sid
),
1
);
/* Get the cutoff shift. */
/* Get the cutoff shift. */
double
rshift
=
0
.
0
;
double
rshift
=
0
.
0
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
rshift
+=
shift
[
k
]
*
runner_shift
[
sid
][
k
];
for
(
int
k
=
0
;
k
<
3
;
k
++
)
rshift
+=
shift
[
k
]
*
runner_shift
[
sid
][
k
];
...
@@ -726,8 +713,9 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
...
@@ -726,8 +713,9 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* 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
/* Also find the first pi that interacts with any particle in cj and the last
* pj that interacts with any particle in ci. */
* pj that interacts with any particle in ci. */
populate_max_d_no_cache
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
max_di
,
populate_max_d_no_cache
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
hi_max
,
max_dj
,
&
first_pi
,
&
last_pj
,
e
);
hj_max
,
di_max
,
dj_min
,
max_di
,
max_dj
,
&
first_pi
,
&
last_pj
,
e
);
/* Find the maximum index into cj that is required by a particle in ci. */
/* Find the maximum index into cj that is required by a particle in ci. */
/* Find the maximum index into ci that is required by a particle in cj. */
/* Find the maximum index into ci that is required by a particle in cj. */
...
@@ -770,13 +758,22 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
...
@@ -770,13 +758,22 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
if
(
cell_is_active
(
ci
,
e
))
{
if
(
cell_is_active
(
ci
,
e
))
{
/* Loop over the parts in ci. */
/* Loop over the parts in ci
until nothing is within range in cj
. */
for
(
int
pid
=
count_i
-
1
;
pid
>=
first_pi_loop
&&
max_ind_j
>=
0
;
pid
--
)
{
for
(
int
pid
=
count_i
-
1
;
pid
>=
first_pi_loop
&&
max_ind_j
>=
0
;
pid
--
)
{
/* Get a hold of the ith part in ci. */
/* Get a hold of the ith part in ci. */
struct
part
*
restrict
pi
=
&
parts_i
[
sort_i
[
pid
].
i
];
struct
part
*
restrict
pi
=
&
parts_i
[
sort_i
[
pid
].
i
];
if
(
!
part_is_active
(
pi
,
e
))
continue
;
if
(
!
part_is_active
(
pi
,
e
))
continue
;
/* Set the cache index. */
int
ci_cache_idx
=
pid
-
first_pi_align
;
/* Skip this particle if no particle in cj is within range of it. */
const
float
hi
=
ci_cache
->
h
[
ci_cache_idx
];
const
double
di_test
=
sort_i
[
pid
].
d
+
hi
*
kernel_gamma
+
dx_max
-
rshift
;
if
(
di_test
<
dj_min
)
continue
;
/* Determine the exit iteration of the interaction loop. */
/* Determine the exit iteration of the interaction loop. */
dj
=
sort_j
[
max_ind_j
].
d
;
dj
=
sort_j
[
max_ind_j
].
d
;
while
(
max_ind_j
>
0
&&
max_di
[
pid
]
<
dj
)
{
while
(
max_ind_j
>
0
&&
max_di
[
pid
]
<
dj
)
{
...
@@ -786,10 +783,6 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
...
@@ -786,10 +783,6 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
}
}
int
exit_iteration
=
max_ind_j
+
1
;
int
exit_iteration
=
max_ind_j
+
1
;
/* Set the cache index. */
int
ci_cache_idx
=
pid
-
first_pi_align
;
const
float
hi
=
ci_cache
->
h
[
ci_cache_idx
];
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
vector
pix
,
piy
,
piz
;
vector
pix
,
piy
,
piz
;
...
@@ -903,13 +896,24 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
...
@@ -903,13 +896,24 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
}
}
if
(
cell_is_active
(
cj
,
e
))
{
if
(
cell_is_active
(
cj
,
e
))
{
/* Loop over the parts in cj. */
/* Loop over the parts in cj until nothing is within range in ci. */
for
(
int
pjd
=
0
;
pjd
<=
last_pj_loop
&&
max_ind_i
<
count_i
;
pjd
++
)
{
for
(
int
pjd
=
0
;
pjd
<=
last_pj_loop
&&
max_ind_i
<
count_i
;
pjd
++
)
{
/* Get a hold of the jth part in cj. */
/* Get a hold of the jth part in cj. */
struct
part
*
restrict
pj
=
&
parts_j
[
sort_j
[
pjd
].
i
];
struct
part
*
restrict
pj
=
&
parts_j
[
sort_j
[
pjd
].
i
];
if
(
!
part_is_active
(
pj
,
e
))
continue
;
if
(
!
part_is_active
(
pj
,
e
))
continue
;
/* Set the cache index. */
int
cj_cache_idx
=
pjd
;
/*TODO: rshift term. */
/* Skip this particle if no particle in ci is within range of it. */
const
float
hj
=
cj_cache
->
h
[
cj_cache_idx
];
const
double
dj_test
=
sort_j
[
pjd
].
d
-
hj
*
kernel_gamma
-
dx_max
-
rshift
;
if
(
dj_test
>
di_max
)
continue
;
/* Determine the exit iteration of the interaction loop. */
/* Determine the exit iteration of the interaction loop. */
di
=
sort_i
[
max_ind_i
].
d
;
di
=
sort_i
[
max_ind_i
].
d
;
while
(
max_ind_i
<
count_i
-
1
&&
max_dj
[
pjd
]
>
di
)
{
while
(
max_ind_i
<
count_i
-
1
&&
max_dj
[
pjd
]
>
di
)
{
...
@@ -919,10 +923,6 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
...
@@ -919,10 +923,6 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
}
}
int
exit_iteration
=
max_ind_i
;
int
exit_iteration
=
max_ind_i
;
/* Set the cache index. */
int
cj_cache_idx
=
pjd
;
const
float
hj
=
cj_cache
->
h
[
cj_cache_idx
];
const
float
hjg2
=
hj
*
hj
*
kernel_gamma2
;
const
float
hjg2
=
hj
*
hj
*
kernel_gamma2
;
vector
pjx
,
pjy
,
pjz
;
vector
pjx
,
pjy
,
pjz
;
...
...
src/runner_doiact_vec.h
View file @
2545e4ab
...
@@ -35,8 +35,8 @@
...
@@ -35,8 +35,8 @@
/* Function prototypes. */
/* Function prototypes. */
void
runner_doself1_density_vec
(
struct
runner
*
r
,
struct
cell
*
restrict
c
);
void
runner_doself1_density_vec
(
struct
runner
*
r
,
struct
cell
*
restrict
c
);
void
runner_doself1_density_vec_2
(
struct
runner
*
r
,
struct
cell
*
restrict
c
);
void
runner_dopair1_density_vec
(
struct
runner
*
r
,
struct
cell
*
restrict
ci
,
void
runner_dopair1_density_vec
(
struct
runner
*
r
,
struct
cell
*
restrict
ci
,
struct
cell
*
restrict
cj
);
struct
cell
*
restrict
cj
,
const
int
sid
,
const
double
*
shift
);
#endif
/* SWIFT_RUNNER_VEC_H */
#endif
/* SWIFT_RUNNER_VEC_H */
src/serial_io.c
View file @
2545e4ab
...
@@ -59,19 +59,15 @@
...
@@ -59,19 +59,15 @@
* @brief Reads a data array from a given HDF5 group.
* @brief Reads a data array from a given HDF5 group.
*
*
* @param grp The group from which to read.
* @param grp The group from which to read.
* @param name The name of the array to read.
* @param props The #io_props of the field to read
* @param type The #DATA_TYPE of the attribute.
* @param N The number of particles to read on this rank.
* @param N The number of particles.
* @param N_total The total number of particles on all ranks.
* @param dim The dimension of the data (1 for scalar, 3 for vector)
* @param offset The offset position where this rank starts reading.
* @param part_c A (char*) pointer on the first occurrence of the field of
* @param internal_units The #unit_system used internally
*interest in the parts array
* @param ic_units The #unit_system used in the ICs
* @param partSize The size in bytes of the particle structure.
* @param importance If COMPULSORY, the data must be present in the IC file. If
*OPTIONAL, the array will be zeroed when the data is not present.
*
*
* @todo A better version using HDF5 hyper-slabs to read the file directly into
* @todo A better version using HDF5 hyper-slabs to read the file directly into
*the part array
* the part array will be written once the structures have been stabilized.
* will be written once the structures have been stabilized.
*/
*/
void
readArray
(
hid_t
grp
,
const
struct
io_props
props
,
size_t
N
,
void
readArray
(
hid_t
grp
,
const
struct
io_props
props
,
size_t
N
,
long
long
N_total
,
long
long
offset
,
long
long
N_total
,
long
long
offset
,
...
@@ -274,16 +270,17 @@ void prepareArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
...
@@ -274,16 +270,17 @@ void prepareArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
* @param fileName The name of the file in which the data is written
* @param fileName The name of the file in which the data is written
* @param xmfFile The FILE used to write the XMF description
* @param xmfFile The FILE used to write the XMF description
* @param partTypeGroupName The name of the group containing the particles in
* @param partTypeGroupName The name of the group containing the particles in
*the HDF5 file.
* the HDF5 file.
* @param name The name of the array to write.
* @param props The #io_props of the field to read
* @param type The #DATA_TYPE of the array.
* @param N The number of particles to write.
* @param N The number of particles to write.
* @param dim The dimension of the data (1 for scalar, 3 for vector)
* @param N_total The total number of particles on all ranks.
* @param part_c A (char*) pointer on the first occurrence of the field of
* @param offset The offset position where this rank starts writing.
*interest in the parts array
* @param mpi_rank The MPI rank of this node
* @param partSize The size in bytes of the particle structure.
* @param internal_units The #unit_system used internally
* @param us The unit_system currently in use
* @param snapshot_units The #unit_system used in the snapshots
* @param convFactor The UnitConversionFactor for this arrayo
*
* @todo A better version using HDF5 hyper-slabs to write the file directly from
* the part array will be written once the structures have been stabilized.
*/
*/
void
writeArray
(
struct
engine
*
e
,
hid_t
grp
,
char
*
fileName
,
FILE
*
xmfFile
,
void
writeArray
(
struct
engine
*
e
,
hid_t
grp
,
char
*
fileName
,
FILE
*
xmfFile
,
char
*
partTypeGroupName
,
const
struct
io_props
props
,
size_t
N
,
char
*
partTypeGroupName
,
const
struct
io_props
props
,
size_t
N
,
...
...
src/single_io.c
View file @
2545e4ab
...
@@ -64,8 +64,7 @@
...
@@ -64,8 +64,7 @@
* @param ic_units The #unit_system used in the ICs
* @param ic_units The #unit_system used in the ICs
*
*
* @todo A better version using HDF5 hyper-slabs to read the file directly into
* @todo A better version using HDF5 hyper-slabs to read the file directly into
*the part array
* the part array will be written once the structures have been stabilized.
* will be written once the structures have been stabilized.
*/
*/
void
readArray
(
hid_t
h_grp
,
const
struct
io_props
prop
,
size_t
N
,
void
readArray
(
hid_t
h_grp
,
const
struct
io_props
prop
,
size_t
N
,
const
struct
unit_system
*
internal_units
,
const
struct
unit_system
*
internal_units
,
...
...
tests/Makefile.am
View file @
2545e4ab
...
@@ -97,6 +97,6 @@ EXTRA_DIST = testReading.sh makeInput.py testPair.sh testPairPerturbed.sh \
...
@@ -97,6 +97,6 @@ EXTRA_DIST = testReading.sh makeInput.py testPair.sh testPairPerturbed.sh \
test27cells.sh test27cellsPerturbed.sh testParser.sh testPeriodicBC.sh
\
test27cells.sh test27cellsPerturbed.sh testParser.sh testPeriodicBC.sh
\
testPeriodicBCPerturbed.sh test125cells.sh test125cellsPerturbed.sh testParserInput.yaml
\
testPeriodicBCPerturbed.sh test125cells.sh test125cellsPerturbed.sh testParserInput.yaml
\
difffloat.py tolerance_125_normal.dat tolerance_125_perturbed.dat
\
difffloat.py tolerance_125_normal.dat tolerance_125_perturbed.dat
\
tolerance_27_normal.dat tolerance_27_perturbed.dat
\
tolerance_27_normal.dat tolerance_27_perturbed.dat
tolerance_27_perturbed_h.dat
\
tolerance_pair_normal.dat tolerance_pair_perturbed.dat
\
tolerance_pair_normal.dat tolerance_pair_perturbed.dat
\
fft_params.yml tolerance_periodic_BC_normal.dat tolerance_periodic_BC_perturbed.dat
fft_params.yml tolerance_periodic_BC_normal.dat tolerance_periodic_BC_perturbed.dat
tests/difffloat.py
View file @
2545e4ab