00001
00040 #ifndef __OUTPUT_TO_GNUPLOT__
00041 #define __OUTPUT_TO_GNUPLOT__
00042
00043 #include <fstream>
00044 #include <iostream>
00045
00046 #include "function_2D_types.h"
00047
00048 #include "msg_stream.h"
00049
00050
00051 namespace Function_2D{
00052
00055 template <typename Function>
00056 void output_to_GNUPLOT(const char* file_name,
00057 const Function& f,
00058 const real_type x_begin = -16,
00059 const real_type x_end = 16,
00060 const real_type x_step = 1,
00061 const real_type y_begin = -16,
00062 const real_type y_end = 16,
00063 const real_type y_step = 1);
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 template <typename Function>
00083 void output_to_GNUPLOT(const char* file_name,
00084 const Function& f,
00085 const real_type x_begin,
00086 const real_type x_end,
00087 const real_type x_step,
00088 const real_type y_begin,
00089 const real_type y_end,
00090 const real_type y_step){
00091
00092 using namespace std;
00093
00094 ofstream out(file_name);
00095
00096 for(real_type x=x_begin;x<=x_end;x+=x_step){
00097 for(real_type y=y_begin;y<=y_end;y+=y_step){
00098 out<<x<<' '<<y<<' '<<f(x,y)<<'\n';
00099 }
00100 out<<'\n';
00101 }
00102
00103 out.flush();
00104 out.close();
00105 }
00106
00107 }
00108
00109 #endif