tshow last output file in status, add debugging output - slidergrid - grid of e… | |
git clone git://src.adamsgaard.dk/slidergrid | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit bb5690a5dfaf1895126205eceaf2f36aff4155a4 | |
parent e74cb395a9425ba9819ff606866e77e5ee9dfa93 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 22 Mar 2016 14:50:34 -0700 | |
show last output file in status, add debugging output | |
Diffstat: | |
M slidergrid/main.c | 23 ++++++++++++++++++++--- | |
M test.c | 8 -------- | |
2 files changed, 20 insertions(+), 11 deletions(-) | |
--- | |
diff --git a/slidergrid/main.c b/slidergrid/main.c | |
t@@ -35,9 +35,11 @@ void print_version(char* argv0) | |
void print_status(simulation sim) | |
{ | |
- printf("\r%s: t = %.3f s, t_end = %.3f s (%2.0f%%) ", | |
+ printf("\r%s: t = %.3f s, t_end = %.3f s (%2.0f%%), " | |
+ "last output = %06d ", | |
sim.id, sim.time, sim.time_end, | |
- sim.time/sim.time_end*100.); | |
+ sim.time/sim.time_end*100., | |
+ sim.file_number); | |
} | |
int main(int argc, char** argv) | |
t@@ -70,7 +72,7 @@ int main(int argc, char** argv) | |
// external function which defines the simulation setup and parameters | |
simulation sim = setup_simulation(); | |
- if (verbose == 1) { | |
+ if (verbose) { | |
sim.verbose = 1; | |
printf("Sliders N = %d\n", sim.N); | |
} | |
t@@ -127,8 +129,23 @@ int main(int argc, char** argv) | |
sim.time += sim.dt) { | |
for (i=0; i<sim.N; i++) | |
+ printf("%d: vel = %f %f %f\n", i, | |
+ sim.sliders[i].vel.x, | |
+ sim.sliders[i].vel.y, | |
+ sim.sliders[i].vel.z); | |
+ | |
+ for (i=0; i<sim.N; i++) | |
project_slider_position(&sim.sliders[i], sim.dt, sim.iteration); | |
+ for (i=0; i<sim.N; i++) | |
+ printf("%d: pos = %f %f %f, pos_future = %f %f %f\n", i, | |
+ sim.sliders[i].pos.x, | |
+ sim.sliders[i].pos.y, | |
+ sim.sliders[i].pos.z, | |
+ sim.sliders[i].pos_future.x, | |
+ sim.sliders[i].pos_future.y, | |
+ sim.sliders[i].pos_future.z); | |
+ | |
// resolve slider-to-slider interaction | |
for (i=0; i<sim.N; i++) { | |
diff --git a/test.c b/test.c | |
t@@ -40,13 +40,5 @@ simulation setup_simulation() | |
sim.time_end = 1.0; | |
sim.file_interval = 0.1; | |
- if (write_simulation_output(&sim, ".")) { | |
- fprintf(stderr, "\nFatal error: Could not write one or more " | |
- "output files.\n"); | |
- } | |
- | |
- | |
- | |
- | |
return sim; | |
} |