#include #include #include #include #include using namespace std; /******************* GRF_PDE_1D ******************************************/ /************************************************************************/ /* Creator for pde_1d graph. */ /* pde : pointer to the m_pde_1d to display (do not free!) */ /* file_name : filename prefix */ /************************************************************************/ grf_pde_1d::grf_pde_1d(pde_1d *pde,string file_name) : file_name_(file_name) { nx_ = pde->nx(); xmin_ = pde->xmin(); xmax_ = pde->xmax(); dx_ = pde->dx(); }; /**************************************************************/ /* Ouput a single txt 1D graphic file */ /* name : file descriptor (Energy of fct name) */ /* findex : file index */ /* p : pointer to the data array */ /* vsize : size of data vector (No of fcts) */ /* t : value of t for the snapshot */ /* Output format: */ /* The file should be a .m file. It can be execute by matlab */ /* # t = t */ /* ti Fi */ /* Throw a string on error */ /**************************************************************/ void grf_pde_1d::write_1_grf(const char *name,int findex,double *p, int vsize, double t) { int ix,index; double x; string fname = make_file_name(file_name_+"_"+name,findex,"txt"); ofstream ofs(fname.c_str()); if(!ofs) { throw((string)" Error: Can't open file : "+fname); } ofs <<"# t = "<