Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef XY_FILE_HH
00021 #define XY_FILE_HH
00022 #include <fstream>
00023 #include <iostream>
00024 #include <string>
00025 #include <vector>
00026 using namespace std;
00027
00028 bool read_xy_file(const std::string & filename, std::vector<int> & tab_sizes,
00029 std::vector<double> & tab_mflops, bool quiet = false)
00030 {
00031
00032 std::ifstream input_file (filename.c_str(),std::ios::in);
00033
00034 if (!input_file){
00035 if (!quiet) {
00036 INFOS("!!! Error opening "<<filename);
00037 }
00038 return false;
00039 }
00040
00041 int nb_point=0;
00042 int size=0;
00043 double mflops=0;
00044
00045 while (input_file >> size >> mflops ){
00046 nb_point++;
00047 tab_sizes.push_back(size);
00048 tab_mflops.push_back(mflops);
00049 }
00050 SCRUTE(nb_point);
00051
00052 input_file.close();
00053 return true;
00054 }
00055
00056
00057
00058
00059
00060
00061 using namespace std;
00062
00063 template<class Vector_A, class Vector_B>
00064 void dump_xy_file(const Vector_A & X, const Vector_B & Y, const std::string & filename){
00065
00066 ofstream outfile (filename.c_str(),ios::out) ;
00067 int size=X.size();
00068
00069 for (int i=0;i<size;i++)
00070 outfile << X[i] << " " << Y[i] << endl;
00071
00072 outfile.close();
00073 }
00074
00075 #endif