Commit 8293e6a3 authored by Taddeüs Kroes's avatar Taddeüs Kroes

ModSim ass3: Source code cleanup.

parent da8076a2
...@@ -2,3 +2,4 @@ test ...@@ -2,3 +2,4 @@ test
main main
*.sgv *.sgv
*.png *.png
*.data
./main 0 ./main 0
cat report/osc_euler | ./plot.py report/osc_euler.pdf cat osc_euler.data | ./plot.py report/osc_euler.pdf
cat report/osc_rk2 | ./plot.py report/osc_rk2.pdf cat osc_rk2.data | ./plot.py report/osc_rk2.pdf
cat report/osc_rk4 | ./plot.py report/osc_rk4.pdf cat osc_rk4.data | ./plot.py report/osc_rk4.pdf
#rm report/osc_euler report/osc_rk2 report/osc_rk4 rm *.data
...@@ -35,15 +35,15 @@ int main(int argc, char **argv) { ...@@ -35,15 +35,15 @@ int main(int argc, char **argv) {
case 0: case 0:
y0[0] = 10.0; y0[0] = 10.0;
y0[1] = 20.0; y0[1] = 20.0;
logfile = fopen("report/osc_euler", "w"); logfile = fopen("osc_euler.data", "w");
puts("Integrating Euler method..."); puts("Integrating Euler method...");
INTEGRATE(Euler, .0, 100.0, COMPARE_DT, 2, osc); INTEGRATE(Euler, .0, 100.0, COMPARE_DT, 2, osc);
logger_close(); logger_close();
logfile = fopen("report/osc_rk2", "w"); logfile = fopen("osc_rk2.data", "w");
puts("Integrating Runge-Kutta 2 method..."); puts("Integrating Runge-Kutta 2 method...");
INTEGRATE(RungeKutta2, .0, 100.0, COMPARE_DT, 2, osc); INTEGRATE(RungeKutta2, .0, 100.0, COMPARE_DT, 2, osc);
logger_close(); logger_close();
logfile = fopen("report/osc_rk4", "w"); logfile = fopen("osc_rk4.data", "w");
puts("Integrating Runge-Kutta 4 method..."); puts("Integrating Runge-Kutta 4 method...");
INTEGRATE(RungeKutta4, .0, 100.0, COMPARE_DT, 2, osc); INTEGRATE(RungeKutta4, .0, 100.0, COMPARE_DT, 2, osc);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment