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
f9d7ee7d
Commit
f9d7ee7d
authored
Mar 02, 2016
by
Matthieu Schaller
Browse files
Make the stop condition into a function for improved readability
parent
57f2c0c4
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/main.c
View file @
f9d7ee7d
...
...
@@ -192,8 +192,8 @@ int main(int argc, char *argv[]) {
with_outputs
=
0
;
break
;
case
'P'
:
/* Partition type is one of "g", "m", "w", or "v"; "g" can be
* followed by three numbers defining the grid. */
/* Partition type is one of "g", "m", "w", or "v"; "g" can be
* followed by three numbers defining the grid. */
#ifdef WITH_MPI
switch
(
optarg
[
0
])
{
case
'g'
:
...
...
@@ -224,8 +224,8 @@ int main(int argc, char *argv[]) {
error
(
"Error parsing number of queues."
);
break
;
case
'R'
:
/* Repartition type "n", "b", "v", "e" or "x".
* Note only none is available without METIS. */
/* Repartition type "n", "b", "v", "e" or "x".
* Note only none is available without METIS. */
#ifdef WITH_MPI
switch
(
optarg
[
0
])
{
case
'n'
:
...
...
@@ -468,7 +468,7 @@ int main(int argc, char *argv[]) {
"[ms]
\n
"
);
/* Let loose a runner on the space. */
for
(
j
=
0
;
e
.
ti_current
<
max_nr_timesteps
;
j
++
)
{
for
(
j
=
0
;
!
engine_is_done
(
&
e
)
;
j
++
)
{
/* Repartition the space amongst the nodes? */
#ifdef WITH_MPI
...
...
src/engine.c
View file @
f9d7ee7d
...
...
@@ -1624,6 +1624,13 @@ void engine_step(struct engine *e) {
// printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts);
}
/**
* @brief Returns 1 if the simulation has reached its end point, 0 otherwise
*/
int
engine_is_done
(
struct
engine
*
e
)
{
return
!
(
e
->
ti_current
<
max_nr_timesteps
);
}
/**
* @brief Create and fill the proxies.
*
...
...
@@ -1957,7 +1964,7 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
float
dt_max
=
timeEnd
-
timeBegin
;
while
(
dt_max
>
e
->
dt_max
)
dt_max
/=
2
.
f
;
message
(
"M
in
imal timestep size (on time-line): %e"
,
dt_max
);
message
(
"M
ax
imal timestep size (on time-line): %e"
,
dt_max
);
}
}
...
...
src/engine.h
View file @
f9d7ee7d
...
...
@@ -63,7 +63,6 @@ extern const char *engine_policy_names[];
#define engine_maxproxies 64
#define engine_tasksreweight 10
/* The rank of the engine as a global variable (for messages). */
extern
int
engine_rank
;
...
...
@@ -186,5 +185,6 @@ void engine_makeproxies(struct engine *e);
void
engine_redistribute
(
struct
engine
*
e
);
struct
link
*
engine_addlink
(
struct
engine
*
e
,
struct
link
*
l
,
struct
task
*
t
);
void
engine_print_policy
(
struct
engine
*
e
);
int
engine_is_done
(
struct
engine
*
e
);
#endif
/* SWIFT_ENGINE_H */
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