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
03d02a24
Commit
03d02a24
authored
Apr 26, 2017
by
Matthieu Schaller
Browse files
Update the test-suite since the init task does not exist any more.
parent
42d0b4e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/test125cells.c
View file @
03d02a24
...
...
@@ -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 @
03d02a24
...
...
@@ -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