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
8810779b
Commit
8810779b
authored
Aug 02, 2018
by
Matthieu Schaller
Browse files
Print some timing information in the PM calculation when verbosity is on.
parent
835167a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
8810779b
...
...
@@ -3905,7 +3905,7 @@ void engine_rebuild(struct engine *e, int clean_smoothing_length_values) {
/* Re-compute the mesh forces */
if
((
e
->
policy
&
engine_policy_self_gravity
)
&&
e
->
s
->
periodic
)
pm_mesh_compute_potential
(
e
->
mesh
,
e
);
pm_mesh_compute_potential
(
e
->
mesh
,
e
->
s
,
e
->
verbose
);
/* Re-compute the maximal RMS displacement constraint */
if
(
e
->
policy
&
engine_policy_cosmology
)
...
...
src/mesh_gravity.c
View file @
8810779b
...
...
@@ -278,13 +278,14 @@ void mesh_to_gparts_CIC(struct gpart* gp, const double* pot, int N, double fac,
* Note that there is no multiplication by G_newton at this stage.
*
* @param mesh The #pm_mesh used to store the potential.
* @param e The #engine from which to compute the forces.
* @param s The #space containing the particles.
* @param verbose Are we talkative?
*/
void
pm_mesh_compute_potential
(
struct
pm_mesh
*
mesh
,
const
struct
engine
*
e
)
{
void
pm_mesh_compute_potential
(
struct
pm_mesh
*
mesh
,
const
struct
space
*
s
,
int
verbose
)
{
#ifdef HAVE_FFTW
const
struct
space
*
s
=
e
->
s
;
const
double
r_s
=
mesh
->
r_s
;
const
double
box_size
=
s
->
dim
[
0
];
const
double
dim
[
3
]
=
{
s
->
dim
[
0
],
s
->
dim
[
1
],
s
->
dim
[
2
]};
...
...
@@ -313,14 +314,24 @@ void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct engine* e) {
fftw_plan
inverse_plan
=
fftw_plan_dft_c2r_3d
(
N
,
N
,
N
,
frho
,
rho
,
FFTW_ESTIMATE
|
FFTW_DESTROY_INPUT
);
const
ticks
tic
=
getticks
();
/* Zero everything */
bzero
(
rho
,
N
*
N
*
N
*
sizeof
(
double
));
/* Do a CIC mesh assignment of the gparts */
for
(
size_t
i
=
0
;
i
<
e
->
s
->
nr_gparts
;
++
i
)
gpart_to_mesh_CIC
(
&
e
->
s
->
gparts
[
i
],
rho
,
N
,
cell_fac
,
dim
);
for
(
size_t
i
=
0
;
i
<
s
->
nr_gparts
;
++
i
)
gpart_to_mesh_CIC
(
&
s
->
gparts
[
i
],
rho
,
N
,
cell_fac
,
dim
);
if
(
verbose
)
message
(
"gpart assignment took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
/* message("\n\n\n DENSITY"); */
/* print_array(rho, N); */
const
ticks
tic2
=
getticks
();
/* Fourier transform to go to magic-land */
fftw_execute
(
forward_plan
);
...
...
@@ -396,6 +407,10 @@ void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct engine* e) {
/* Let's store it in the structure */
mesh
->
potential
=
rho
;
if
(
verbose
)
message
(
"Fourier-space PM took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic2
),
clocks_getunit
());
/* message("\n\n\n POTENTIAL"); */
/* print_array(potential, N); */
...
...
src/mesh_gravity.h
View file @
8810779b
...
...
@@ -27,7 +27,7 @@
#include
"restart.h"
/* Forward declarations */
struct
engin
e
;
struct
spac
e
;
struct
gpart
;
/**
...
...
@@ -66,7 +66,8 @@ struct pm_mesh {
void
pm_mesh_init
(
struct
pm_mesh
*
mesh
,
const
struct
gravity_props
*
props
,
double
dim
[
3
]);
void
pm_mesh_init_no_mesh
(
struct
pm_mesh
*
mesh
,
double
dim
[
3
]);
void
pm_mesh_compute_potential
(
struct
pm_mesh
*
mesh
,
const
struct
engine
*
e
);
void
pm_mesh_compute_potential
(
struct
pm_mesh
*
mesh
,
const
struct
space
*
s
,
int
verbose
);
void
pm_mesh_interpolate_forces
(
const
struct
pm_mesh
*
mesh
,
const
struct
engine
*
e
,
struct
gpart
*
gparts
,
int
gcount
);
...
...
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