Added logger_open().

parent a391a1ef
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
void logger_open(const char* filename);
void logger(double t, int N, double *y); void logger(double t, int N, double *y);
void logger_close(); void logger_close();
......
...@@ -33,15 +33,15 @@ int main(int argc, char **argv) { ...@@ -33,15 +33,15 @@ int main(int argc, char **argv) {
switch( atoi(argv[1]) ) { switch( atoi(argv[1]) ) {
case 0: case 0:
logfile = fopen("report/osc_euler", "w"); logger_open("report/osc_euler");
puts("Integrating Euler method..."); puts("Integrating Euler method...");
INTEGRATE(Euler, .0, 40.0, COMPARE_DT, 2, osc); INTEGRATE(Euler, .0, 40.0, COMPARE_DT, 2, osc);
logger_close(); logger_close();
logfile = fopen("report/osc_rk2", "w"); logger_open("report/osc_rk2");
puts("Integrating Runge-Kutta 2 method..."); puts("Integrating Runge-Kutta 2 method...");
INTEGRATE(RungeKutta2, .0, 40.0, COMPARE_DT, 2, osc); INTEGRATE(RungeKutta2, .0, 40.0, COMPARE_DT, 2, osc);
logger_close(); logger_close();
logfile = fopen("report/osc_rk4", "w"); logger_open("report/osc_rk4");
puts("Integrating Runge-Kutta 4 method..."); puts("Integrating Runge-Kutta 4 method...");
INTEGRATE(RungeKutta4, .0, 40.0, COMPARE_DT, 2, osc); INTEGRATE(RungeKutta4, .0, 40.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