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
dc1ff243
Commit
dc1ff243
authored
Feb 17, 2017
by
Matthieu Schaller
Browse files
Code formatting and doxygen documentation
parent
f595959b
Changes
7
Show whitespace changes
Inline
Side-by-side
examples/main.c
View file @
dc1ff243
...
...
@@ -333,7 +333,7 @@ int main(int argc, char *argv[]) {
MPI_Bcast
(
params
,
sizeof
(
struct
swift_params
),
MPI_BYTE
,
0
,
MPI_COMM_WORLD
);
#endif
/* Prepare the domain decomposition scheme */
/* Prepare the domain decomposition scheme */
enum
repartition_type
reparttype
=
REPART_NONE
;
#ifdef WITH_MPI
struct
partition
initial_partition
;
...
...
@@ -507,8 +507,8 @@ int main(int argc, char *argv[]) {
if
(
myrank
==
0
)
clocks_gettime
(
&
tic
);
struct
engine
e
;
engine_init
(
&
e
,
&
s
,
params
,
nr_nodes
,
myrank
,
nr_threads
,
with_aff
,
engine_policies
,
talking
,
reparttype
,
&
us
,
&
prog_const
,
&
hydro_properties
,
&
potential
,
&
cooling_func
,
&
sourceterms
);
engine_policies
,
talking
,
reparttype
,
&
us
,
&
prog_const
,
&
hydro_properties
,
&
potential
,
&
cooling_func
,
&
sourceterms
);
if
(
myrank
==
0
)
{
clocks_gettime
(
&
toc
);
message
(
"engine_init took %.3f %s."
,
clocks_diff
(
&
tic
,
&
toc
),
...
...
src/cell.c
View file @
dc1ff243
...
...
@@ -948,21 +948,26 @@ void cell_check_drift_point(struct cell *c, void *data) {
const
integertime_t
ti_drift
=
*
(
integertime_t
*
)
data
;
/* Only check local cells */
if
(
c
->
nodeID
!=
engine_rank
)
return
;
if
(
c
->
nodeID
!=
engine_rank
)
return
;
if
(
c
->
ti_old
!=
ti_drift
)
error
(
"Cell in an incorrect time-zone! c->ti_old=%lld ti_drift=%lld"
,
c
->
ti_old
,
ti_drift
);
for
(
int
i
=
0
;
i
<
c
->
count
;
++
i
)
if
(
c
->
parts
[
i
].
ti_drift
!=
ti_drift
)
for
(
int
i
=
0
;
i
<
c
->
count
;
++
i
)
if
(
c
->
parts
[
i
].
ti_drift
!=
ti_drift
)
error
(
"part in an incorrect time-zone! p->ti_drift=%lld ti_drift=%lld"
,
c
->
parts
[
i
].
ti_drift
,
ti_drift
);
for
(
int
i
=
0
;
i
<
c
->
gcount
;
++
i
)
if
(
c
->
gparts
[
i
].
ti_drift
!=
ti_drift
)
for
(
int
i
=
0
;
i
<
c
->
gcount
;
++
i
)
if
(
c
->
gparts
[
i
].
ti_drift
!=
ti_drift
)
error
(
"g-part in an incorrect time-zone! gp->ti_drift=%lld ti_drift=%lld"
,
c
->
gparts
[
i
].
ti_drift
,
ti_drift
);
for
(
int
i
=
0
;
i
<
c
->
scount
;
++
i
)
if
(
c
->
sparts
[
i
].
ti_drift
!=
ti_drift
)
error
(
"s-part in an incorrect time-zone! sp->ti_drift=%lld ti_drift=%lld"
,
c
->
sparts
[
i
].
ti_drift
,
ti_drift
);
#else
error
(
"Calling debugging code without debugging flag activated."
);
#endif
...
...
src/engine.c
View file @
dc1ff243
...
...
@@ -2506,8 +2506,6 @@ int engine_marktasks(struct engine *e) {
const
ticks
tic
=
getticks
();
int
rebuild_space
=
0
;
message
(
"marktasks"
);
/* Run through the tasks and mark as skip or not. */
size_t
extra_data
[
3
]
=
{(
size_t
)
e
,
rebuild_space
,
(
size_t
)
&
e
->
sched
};
threadpool_map
(
&
e
->
threadpool
,
engine_marktasks_mapper
,
s
->
tasks
,
s
->
nr_tasks
,
...
...
@@ -2575,12 +2573,6 @@ void engine_rebuild(struct engine *e) {
/* Clear the forcerebuild flag, whatever it was. */
e
->
forcerebuild
=
0
;
message
(
"rebuild"
);
fflush
(
stdout
);
#ifdef WITH_MPI
MPI_Barrier
(
MPI_COMM_WORLD
);
#endif
/* Re-build the space. */
space_rebuild
(
e
->
s
,
e
->
verbose
);
...
...
@@ -2599,8 +2591,8 @@ void engine_rebuild(struct engine *e) {
if
(
engine_marktasks
(
e
))
error
(
"engine_marktasks failed after space_rebuild."
);
/* Print the status of the system */
// if (e->verbose) engine_print_task_counts(e);
/* Print the status of the system */
// if (e->verbose) engine_print_task_counts(e);
#ifdef SWIFT_DEBUG_CHECKS
/* Check that all cells have been drifted to the current time.
...
...
@@ -2624,7 +2616,7 @@ void engine_prepare(struct engine *e) {
TIMER_TIC
;
#ifdef SWIFT_DEBUG_CHECKS
if
(
e
->
forcerepart
||
e
->
forcerebuild
)
{
if
(
e
->
forcerepart
||
e
->
forcerebuild
)
{
/* Check that all cells have been drifted to the current time.
* That can include cells that have not
* previously been active on this rank. */
...
...
@@ -3030,9 +3022,6 @@ void engine_step(struct engine *e) {
e
->
tic_step
=
getticks
();
message
(
"START snap=%d, rebuild=%d repart=%d"
,
e
->
dump_snapshot
,
e
->
forcerebuild
,
e
->
forcerepart
);
/* Move forward in time */
e
->
ti_old
=
e
->
ti_current
;
e
->
ti_current
=
e
->
ti_end_min
;
...
...
@@ -3044,7 +3033,7 @@ void engine_step(struct engine *e) {
if
(
e
->
nodeID
==
0
)
{
/* Print some information to the screen */
printf
(
" %6d
%lld
%14e %14e %10zu %10zu %10zu %21.3f
\n
"
,
e
->
step
,
e
->
ti_current
,
e
->
time
,
printf
(
" %6d %14e %14e %10zu %10zu %10zu %21.3f
\n
"
,
e
->
step
,
e
->
time
,
e
->
timeStep
,
e
->
updates
,
e
->
g_updates
,
e
->
s_updates
,
e
->
wallclock_time
);
fflush
(
stdout
);
...
...
@@ -3058,7 +3047,7 @@ void engine_step(struct engine *e) {
/* Prepare the tasks to be launched, rebuild or repartition if needed. */
engine_prepare
(
e
);
/* Repartition the space amongst the nodes? */
/* Repartition the space amongst the nodes? */
#ifdef WITH_MPI
if
(
e
->
step
%
100
==
2
)
e
->
forcerepart
=
1
;
#endif
...
...
@@ -3086,9 +3075,6 @@ void engine_step(struct engine *e) {
e
->
forcerebuild
=
buff
;
#endif
message
(
"MIDDLE snap=%d, rebuild=%d repart=%d ti_current=%lld"
,
e
->
dump_snapshot
,
e
->
forcerebuild
,
e
->
forcerepart
,
e
->
ti_current
);
/* Do we want a snapshot? */
if
(
e
->
ti_end_min
>=
e
->
ti_nextSnapshot
&&
e
->
ti_nextSnapshot
>
0
)
e
->
dump_snapshot
=
1
;
...
...
@@ -3098,9 +3084,6 @@ void engine_step(struct engine *e) {
if
(
e
->
dump_snapshot
||
e
->
forcerebuild
||
e
->
forcerepart
)
engine_drift_all
(
e
);
message
(
"END snap=%d, rebuild=%d repart=%d"
,
e
->
dump_snapshot
,
e
->
forcerebuild
,
e
->
forcerepart
);
/* Write a snapshot ? */
if
(
e
->
dump_snapshot
)
{
...
...
@@ -3136,8 +3119,6 @@ int engine_is_done(struct engine *e) {
*/
void
engine_unskip
(
struct
engine
*
e
)
{
message
(
"unskip"
);
const
ticks
tic
=
getticks
();
threadpool_map
(
&
e
->
threadpool
,
runner_do_unskip_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
...
...
@@ -3154,8 +3135,6 @@ void engine_unskip(struct engine *e) {
*/
void
engine_drift_all
(
struct
engine
*
e
)
{
message
(
"drift all"
);
const
ticks
tic
=
getticks
();
threadpool_map
(
&
e
->
threadpool
,
runner_do_drift_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
...
...
@@ -3383,8 +3362,6 @@ void engine_dump_snapshot(struct engine *e) {
if
(
e
->
verbose
)
message
(
"writing snapshot at t=%e."
,
e
->
time
);
message
(
"dump"
);
/* Dump... */
#if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5)
...
...
@@ -3477,6 +3454,7 @@ void engine_unpin() {
* @param with_aff use processor affinity, if supported.
* @param policy The queuing policy to use.
* @param verbose Is this #engine talkative ?
* @param reparttype What type of repartition algorithm are we using ?
* @param internal_units The system of units used internally.
* @param physical_constants The #phys_const used for this run.
* @param hydro The #hydro_props used for this run.
...
...
src/engine.h
View file @
dc1ff243
src/gravity/Default/gravity.h
View file @
dc1ff243
...
...
@@ -91,8 +91,8 @@ __attribute__((always_inline)) INLINE static void gravity_kick_extra(
*
* @param gp The particle.
*/
__attribute__
((
always_inline
))
INLINE
static
void
gravity_reset_predicted_values
(
struct
gpart
*
gp
)
{}
__attribute__
((
always_inline
))
INLINE
static
void
gravity_reset_predicted_values
(
struct
gpart
*
gp
)
{}
/**
* @brief Initialises the g-particles for the first time
...
...
src/runner.c
View file @
dc1ff243
...
...
@@ -1017,8 +1017,7 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
#ifdef SWIFT_DEBUG_CHECKS
/* Check that kick and the drift are synchronized */
if
(
p
->
ti_drift
!=
p
->
ti_kick
)
error
(
"Error integrating part in time."
);
if
(
p
->
ti_drift
!=
p
->
ti_kick
)
error
(
"Error integrating part in time."
);
#endif
/* Prepare the values to be drifted */
...
...
@@ -1049,7 +1048,7 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
#ifdef SWIFT_DEBUG_CHECKS
/* Check that kick and the drift are synchronized */
if
(
gp
->
ti_drift
!=
gp
->
ti_kick
)
if
(
gp
->
ti_drift
!=
gp
->
ti_kick
)
error
(
"Error integrating g-part in time."
);
#endif
...
...
@@ -1081,7 +1080,7 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
#ifdef SWIFT_DEBUG_CHECKS
/* Check that kick and the drift are synchronized */
if
(
sp
->
ti_drift
!=
sp
->
ti_kick
)
if
(
sp
->
ti_drift
!=
sp
->
ti_kick
)
error
(
"Error integrating s-part in time."
);
#endif
...
...
src/space.c
View file @
dc1ff243
...
...
@@ -251,7 +251,6 @@ void space_regrid(struct space *s, int verbose) {
const
size_t
nr_parts
=
s
->
nr_parts
;
const
ticks
tic
=
getticks
();
//const integertime_t ti_current = (s->e != NULL) ? s->e->ti_current : 0;
const
integertime_t
ti_old
=
(
s
->
e
!=
NULL
)
?
s
->
e
->
ti_old
:
0
;
/* Run through the cells and get the current h_max. */
...
...
@@ -488,7 +487,6 @@ void space_rebuild(struct space *s, int verbose) {
size_t
nr_gparts
=
s
->
nr_gparts
;
size_t
nr_sparts
=
s
->
nr_sparts
;
struct
cell
*
restrict
cells_top
=
s
->
cells_top
;
//const integertime_t ti_current = (s->e != NULL) ? s->e->ti_current : 0;
const
integertime_t
ti_old
=
(
s
->
e
!=
NULL
)
?
s
->
e
->
ti_old
:
0
;
/* Run through the particles and get their cell index. Allocates
...
...
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