C1dInvGaConf.cpp
Go to the documentation of this file.00001 #include <fstream>
00002 #include <algorithm>
00003 #include <CFatalException.h>
00004 #include "C1dInvGaConf.h"
00005 using namespace std;
00006 void C1dInvGaConf::GetData(string filename)
00007 {
00008 ifstream infile;
00009 infile.open(filename.c_str());
00010 infile.peek();
00011 if (!infile)
00012 throw CFatalException("No Configurationfile found !");
00013 GetData(infile);infile.close();
00014 }
00015
00016 void C1dInvGaConf::GetData(std::ifstream &instream)
00017 {
00018 C1dInvGaConfLexer lexer(instream);
00019 C1dInvGaConfParser parser(lexer);
00020 parser.configfile();
00021 verbose= parser.verbose;
00022 usevrefmodel= parser.usevrefmodel;
00023 vrefmodel= parser.vrefmodel;
00024 mtfitexponent= parser.mtfitexponent;
00025 recfitexponent= parser.recfitexponent;
00026 surffitexponent= parser.surffitexponent;
00027 popsize= parser.popsize;
00028 inittemp= parser.inittemp;
00029 coolingratio= parser.coolingratio;
00030 generations= parser.generations;
00031 mutationprob= parser.mutationprob;
00032 crossoverprob= parser.crossoverprob;
00033 poisson= parser.poisson;
00034 threads= parser.threads;
00035 starttime= parser.starttime;
00036 endtime= parser.endtime;
00037 tensorerror= parser.tensorerror;
00038 reserror= parser.reserror;
00039 phaseerror= parser.phaseerror;
00040 surferror= parser.surferror;
00041 recinfofile= parser.recinfofile;
00042 recmethod= parser.recmethod;
00043 normrec= parser.normrec;
00044 gatype= parser.gatype;
00045 outputbase= parser.outputbase;
00046 mode= parser.mode;
00047 mtfit= parser.mtfit;
00048 mtinputdata= parser.mtinputdata;
00049 dispdata= parser.dispdata;
00050 annealinggeneration= parser.annealinggeneration;
00051 elitist= parser.elitist;
00052 thickbase.assign(parser.thickbase.size(),0);
00053 copy(parser.thickbase.begin(),parser.thickbase.end(),thickbase.begin());
00054 thickstep.assign(parser.thickstep.size(),0);
00055 copy(parser.thickstep.begin(),parser.thickstep.end(),thickstep.begin());
00056 thicksizes.assign(parser.thicksizes.size(),0);
00057 copy(parser.thicksizes.begin(),parser.thicksizes.end(),thicksizes.begin());
00058 resbase.assign(parser.resbase.size(),0);
00059 copy(parser.resbase.begin(),parser.resbase.end(),resbase.begin());
00060 resstep.assign(parser.resstep.size(),0);
00061 copy(parser.resstep.begin(),parser.resstep.end(),resstep.begin());
00062 ressizes.assign(parser.ressizes.size(),0);
00063 copy(parser.ressizes.begin(),parser.ressizes.end(),ressizes.begin());
00064 svelbase.assign(parser.svelbase.size(),0);
00065 copy(parser.svelbase.begin(),parser.svelbase.end(),svelbase.begin());
00066 svelstep.assign(parser.svelstep.size(),0);
00067 copy(parser.svelstep.begin(),parser.svelstep.end(),svelstep.begin());
00068 svelsizes.assign(parser.svelsizes.size(),0);
00069 copy(parser.svelsizes.begin(),parser.svelsizes.end(),svelsizes.begin());
00070 weights.assign(parser.weights.size(),0);
00071 copy(parser.weights.begin(),parser.weights.end(),weights.begin());
00072 }
00073
00074 void C1dInvGaConf::WriteData(string filename)
00075 {
00076 ofstream confout(filename.c_str());
00077 WriteData(confout);}
00078
00079 void C1dInvGaConf::WriteData(std::ofstream &outstream)
00080 {
00081 outstream << "verbose" << "=" ;
00082 outstream << (verbose ? "true" : "false") << endl;
00083 outstream << "usevrefmodel" << "=" ;
00084 outstream << (usevrefmodel ? "true" : "false") << endl;
00085 outstream << "vrefmodel" << "=" ;
00086 outstream << vrefmodel << endl;
00087 outstream << "mtfitexponent" << "=" ;
00088 outstream << mtfitexponent << endl;
00089 outstream << "recfitexponent" << "=" ;
00090 outstream << recfitexponent << endl;
00091 outstream << "surffitexponent" << "=" ;
00092 outstream << surffitexponent << endl;
00093 outstream << "popsize" << "=" ;
00094 outstream << popsize << endl;
00095 outstream << "inittemp" << "=" ;
00096 outstream << inittemp << endl;
00097 outstream << "coolingratio" << "=" ;
00098 outstream << coolingratio << endl;
00099 outstream << "generations" << "=" ;
00100 outstream << generations << endl;
00101 outstream << "mutationprob" << "=" ;
00102 outstream << mutationprob << endl;
00103 outstream << "crossoverprob" << "=" ;
00104 outstream << crossoverprob << endl;
00105 outstream << "poisson" << "=" ;
00106 outstream << poisson << endl;
00107 outstream << "threads" << "=" ;
00108 outstream << threads << endl;
00109 outstream << "starttime" << "=" ;
00110 outstream << starttime << endl;
00111 outstream << "endtime" << "=" ;
00112 outstream << endtime << endl;
00113 outstream << "tensorerror" << "=" ;
00114 outstream << tensorerror << endl;
00115 outstream << "reserror" << "=" ;
00116 outstream << reserror << endl;
00117 outstream << "phaseerror" << "=" ;
00118 outstream << phaseerror << endl;
00119 outstream << "surferror" << "=" ;
00120 outstream << surferror << endl;
00121 outstream << "recinfofile" << "=" ;
00122 outstream << recinfofile << endl;
00123 outstream << "recmethod" << "=" ;
00124 outstream << recmethod << endl;
00125 outstream << "normrec" << "=" ;
00126 outstream << (normrec ? "true" : "false") << endl;
00127 outstream << "gatype" << "=" ;
00128 outstream << gatype << endl;
00129 outstream << "outputbase" << "=" ;
00130 outstream << outputbase << endl;
00131 outstream << "mode" << "=" ;
00132 outstream << mode << endl;
00133 outstream << "mtfit" << "=" ;
00134 outstream << mtfit << endl;
00135 outstream << "mtinputdata" << "=" ;
00136 outstream << mtinputdata << endl;
00137 outstream << "dispdata" << "=" ;
00138 outstream << dispdata << endl;
00139 outstream << "annealinggeneration" << "=" ;
00140 outstream << annealinggeneration << endl;
00141 outstream << "elitist" << "=" ;
00142 outstream << (elitist ? "true" : "false") << endl;
00143 outstream << "thickbase" << "=" ;
00144 for (size_t i = 0; i < thickbase.size(); ++i)
00145 outstream << thickbase.at(i) << " ";
00146 outstream << endl;
00147
00148 outstream << "thickstep" << "=" ;
00149 for (size_t i = 0; i < thickstep.size(); ++i)
00150 outstream << thickstep.at(i) << " ";
00151 outstream << endl;
00152
00153 outstream << "thicksizes" << "=" ;
00154 for (size_t i = 0; i < thicksizes.size(); ++i)
00155 outstream << thicksizes.at(i) << " ";
00156 outstream << endl;
00157
00158 outstream << "resbase" << "=" ;
00159 for (size_t i = 0; i < resbase.size(); ++i)
00160 outstream << resbase.at(i) << " ";
00161 outstream << endl;
00162
00163 outstream << "resstep" << "=" ;
00164 for (size_t i = 0; i < resstep.size(); ++i)
00165 outstream << resstep.at(i) << " ";
00166 outstream << endl;
00167
00168 outstream << "ressizes" << "=" ;
00169 for (size_t i = 0; i < ressizes.size(); ++i)
00170 outstream << ressizes.at(i) << " ";
00171 outstream << endl;
00172
00173 outstream << "svelbase" << "=" ;
00174 for (size_t i = 0; i < svelbase.size(); ++i)
00175 outstream << svelbase.at(i) << " ";
00176 outstream << endl;
00177
00178 outstream << "svelstep" << "=" ;
00179 for (size_t i = 0; i < svelstep.size(); ++i)
00180 outstream << svelstep.at(i) << " ";
00181 outstream << endl;
00182
00183 outstream << "svelsizes" << "=" ;
00184 for (size_t i = 0; i < svelsizes.size(); ++i)
00185 outstream << svelsizes.at(i) << " ";
00186 outstream << endl;
00187
00188 outstream << "weights" << "=" ;
00189 for (size_t i = 0; i < weights.size(); ++i)
00190 outstream << weights.at(i) << " ";
00191 outstream << endl;
00192
00193 }
00194