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
297b1a65
Commit
297b1a65
authored
Apr 26, 2017
by
Pedro Gonnet
Browse files
Merge branch 'rebuild_criteria' of gitlab.cosma.dur.ac.uk:swift/swiftsim into rebuild_criteria
parents
245ae7e3
03d02a24
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/runner_doiact.h
View file @
297b1a65
...
...
@@ -459,9 +459,7 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
struct
part
*
restrict
parts_i
,
int
*
restrict
ind
,
int
count
,
struct
cell
*
restrict
cj
)
{
struct
engine
*
e
=
r
->
e
;
// error("Don't use in actual runs ! Slow code !");
const
struct
engine
*
e
=
r
->
e
;
#ifdef WITH_OLD_VECTORIZATION
int
icount
=
0
;
...
...
@@ -496,6 +494,12 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
const
float
hi
=
pi
->
h
;
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
#ifdef SWIFT_DEBUG_CHECKS
if
(
!
part_is_active
(
pi
,
e
))
error
(
"Trying to correct smoothing length of inactive particle !"
);
#endif
/* Loop over the parts in cj. */
for
(
int
pjd
=
0
;
pjd
<
count_j
;
pjd
++
)
{
...
...
@@ -510,6 +514,14 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
r2
+=
dx
[
k
]
*
dx
[
k
];
}
#ifdef SWIFT_DEBUG_CHECKS
/* Check that particles have been drifted to the current time */
if
(
pi
->
ti_drift
!=
e
->
ti_current
)
error
(
"Particle pi not drifted to current time"
);
if
(
pj
->
ti_drift
!=
e
->
ti_current
)
error
(
"Particle pj not drifted to current time"
);
#endif
/* Hit or miss? */
if
(
r2
<
hig2
)
{
...
...
@@ -912,7 +924,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
p
->
x
[
1
]
*
runner_shift
[
sid
][
1
]
+
p
->
x
[
2
]
*
runner_shift
[
sid
][
2
];
if
(
fabsf
(
d
-
sort_j
[
pjd
].
d
)
-
cj
->
dx_max_sort
>
1.0e-6
*
max
(
fabsf
(
d
),
c
i
->
dx_max_sort
))
1.0e-6
*
max
(
fabsf
(
d
),
c
j
->
dx_max_sort
))
error
(
"particle shift diff exceeds dx_max_sort."
);
}
#endif
/* SWIFT_DEBUG_CHECKS */
...
...
tests/test125cells.c
View file @
297b1a65
...
...
@@ -188,8 +188,9 @@ void get_solution(const struct cell *main_cell, struct solution_part *solution,
}
}
void
reset_particles
(
struct
cell
*
c
,
enum
velocity_field
vel
,
enum
pressure_field
press
,
float
size
,
float
density
)
{
void
reset_particles
(
struct
cell
*
c
,
struct
hydro_space
*
hs
,
enum
velocity_field
vel
,
enum
pressure_field
press
,
float
size
,
float
density
)
{
for
(
int
i
=
0
;
i
<
c
->
count
;
++
i
)
{
...
...
@@ -198,6 +199,8 @@ void reset_particles(struct cell *c, enum velocity_field vel,
set_velocity
(
p
,
vel
,
size
);
set_energy_state
(
p
,
press
,
size
,
density
);
hydro_init_part
(
p
,
hs
);
#if defined(GIZMO_SPH) || defined(SHADOWFAX_SPH)
float
volume
=
p
->
conserved
.
mass
/
density
;
#if defined(GIZMO_SPH)
...
...
@@ -313,6 +316,7 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h,
cell
->
count
=
count
;
cell
->
gcount
=
0
;
cell
->
dx_max
=
0
.;
cell
->
dx_max_sort
=
0
.;
cell
->
width
[
0
]
=
size
;
cell
->
width
[
1
]
=
size
;
cell
->
width
[
2
]
=
size
;
...
...
@@ -323,6 +327,7 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h,
cell
->
ti_old
=
8
;
cell
->
ti_end_min
=
8
;
cell
->
ti_end_max
=
8
;
cell
->
ti_sort
=
0
;
// shuffle_particles(cell->parts, cell->count);
...
...
@@ -519,7 +524,11 @@ int main(int argc, char *argv[]) {
/* Build the infrastructure */
struct
space
space
;
space
.
periodic
=
0
;
space
.
periodic
=
1
;
space
.
dim
[
0
]
=
3
.;
space
.
dim
[
1
]
=
3
.;
space
.
dim
[
2
]
=
3
.;
hydro_space_init
(
&
space
.
hs
,
&
space
);
struct
phys_const
prog_const
;
prog_const
.
const_newton_G
=
1
.
f
;
...
...
@@ -582,18 +591,13 @@ int main(int argc, char *argv[]) {
const
ticks
tic
=
getticks
();
/* Start with a gentle kick */
// runner_do_kick1(&runner, main_cell, 0);
/* And a gentle drift */
// runner_do_drift_particles(&runner, main_cell, 0);
/* Initialise the particles */
for
(
int
j
=
0
;
j
<
125
;
++
j
)
runner_do_drift_particles
(
&
runner
,
cells
[
j
],
0
);
/* First, sort stuff */
for
(
int
j
=
0
;
j
<
125
;
++
j
)
runner_do_sort
(
&
runner
,
cells
[
j
],
0x1FFF
,
0
);
/* Initialise the particles */
for
(
int
j
=
0
;
j
<
125
;
++
j
)
runner_do_init
(
&
runner
,
cells
[
j
],
0
);
/* Do the density calculation */
#if !(defined(MINIMAL_SPH) && defined(WITH_VECTORIZATION))
...
...
@@ -657,8 +661,6 @@ int main(int argc, char *argv[]) {
/* Finally, give a gentle kick */
runner_do_end_force
(
&
runner
,
main_cell
,
0
);
// runner_do_kick2(&runner, main_cell, 0);
const
ticks
toc
=
getticks
();
time
+=
toc
-
tic
;
...
...
@@ -674,20 +676,21 @@ int main(int argc, char *argv[]) {
message
(
"SWIFT calculation took : %15lli ticks."
,
time
/
runs
);
for
(
int
j
=
0
;
j
<
125
;
++
j
)
reset_particles
(
cells
[
j
],
vel
,
press
,
size
,
rho
);
reset_particles
(
cells
[
j
],
&
space
.
hs
,
vel
,
press
,
size
,
rho
);
/* NOW BRUTE-FORCE CALCULATION */
const
ticks
tic
=
getticks
();
/* Kick the central cell */
// runner_do_kick1(&runner, main_cell, 0);
/* Kick the central cell */
// runner_do_kick1(&runner, main_cell, 0);
/* And drift it */
runner_do_drift_particles
(
&
runner
,
main_cell
,
0
);
/* And drift it */
//
runner_do_drift_particles(&runner, main_cell, 0);
/* Initialise the particles */
for
(
int
j
=
0
;
j
<
125
;
++
j
)
runner_do_init
(
&
runner
,
cells
[
j
],
0
);
/* Initialise the particles */
// for (int j = 0; j < 125; ++j) runner_do_drift_particles(&runner, cells[j],
// 0);
/* Do the density calculation */
#if !(defined(MINIMAL_SPH) && defined(WITH_VECTORIZATION))
...
...
tests/test27cells.c
View file @
297b1a65
...
...
@@ -152,6 +152,7 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
cell
->
h_max
=
h
;
cell
->
count
=
count
;
cell
->
dx_max
=
0
.;
cell
->
dx_max_sort
=
0
.;
cell
->
width
[
0
]
=
size
;
cell
->
width
[
1
]
=
size
;
cell
->
width
[
2
]
=
size
;
...
...
@@ -162,6 +163,7 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
cell
->
ti_old
=
8
;
cell
->
ti_end_min
=
8
;
cell
->
ti_end_max
=
8
;
cell
->
ti_sort
=
8
;
shuffle_particles
(
cell
->
parts
,
cell
->
count
);
...
...
@@ -397,7 +399,10 @@ int main(int argc, char *argv[]) {
/* Build the infrastructure */
struct
space
space
;
space
.
periodic
=
0
;
space
.
periodic
=
1
;
space
.
dim
[
0
]
=
3
.;
space
.
dim
[
1
]
=
3
.;
space
.
dim
[
2
]
=
3
.;
struct
engine
engine
;
engine
.
s
=
&
space
;
...
...
@@ -419,6 +424,8 @@ int main(int argc, char *argv[]) {
cells
[
i
*
9
+
j
*
3
+
k
]
=
make_cell
(
particles
,
offset
,
size
,
h
,
rho
,
&
partId
,
perturbation
,
vel
);
runner_do_drift_particles
(
&
runner
,
cells
[
i
*
9
+
j
*
3
+
k
],
0
);
runner_do_sort
(
&
runner
,
cells
[
i
*
9
+
j
*
3
+
k
],
0x1FFF
,
0
);
}
}
...
...
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