CLevanisoConf.cpp
Go to the documentation of this file.00001 #include <fstream>
00002 #include <algorithm>
00003 #include <CFatalException.h>
00004 #include "CLevanisoConf.h"
00005 using namespace std;
00006 void CLevanisoConf::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 CLevanisoConf::GetData(std::ifstream &instream)
00017 {
00018 CLevanisoConfLexer lexer(instream);
00019 CLevanisoConfParser parser(lexer);
00020 parser.configfile();
00021 maxiter= parser.maxiter;
00022 mode= parser.mode;
00023 mtfit= parser.mtfit;
00024 mtinputdata= parser.mtinputdata;
00025 ptensordata= parser.ptensordata;
00026 tensorerror= parser.tensorerror;
00027 phaseerror= parser.phaseerror;
00028 reserror= parser.reserror;
00029 minres.assign(parser.minres.size(),0);
00030 copy(parser.minres.begin(),parser.minres.end(),minres.begin());
00031 maxres.assign(parser.maxres.size(),0);
00032 copy(parser.maxres.begin(),parser.maxres.end(),maxres.begin());
00033 startres.assign(parser.startres.size(),0);
00034 copy(parser.startres.begin(),parser.startres.end(),startres.begin());
00035 minthick.assign(parser.minthick.size(),0);
00036 copy(parser.minthick.begin(),parser.minthick.end(),minthick.begin());
00037 maxthick.assign(parser.maxthick.size(),0);
00038 copy(parser.maxthick.begin(),parser.maxthick.end(),maxthick.begin());
00039 startthick.assign(parser.startthick.size(),0);
00040 copy(parser.startthick.begin(),parser.startthick.end(),startthick.begin());
00041 minaniso.assign(parser.minaniso.size(),0);
00042 copy(parser.minaniso.begin(),parser.minaniso.end(),minaniso.begin());
00043 maxaniso.assign(parser.maxaniso.size(),0);
00044 copy(parser.maxaniso.begin(),parser.maxaniso.end(),maxaniso.begin());
00045 startaniso.assign(parser.startaniso.size(),0);
00046 copy(parser.startaniso.begin(),parser.startaniso.end(),startaniso.begin());
00047 minstrike.assign(parser.minstrike.size(),0);
00048 copy(parser.minstrike.begin(),parser.minstrike.end(),minstrike.begin());
00049 maxstrike.assign(parser.maxstrike.size(),0);
00050 copy(parser.maxstrike.begin(),parser.maxstrike.end(),maxstrike.begin());
00051 startstrike.assign(parser.startstrike.size(),0);
00052 copy(parser.startstrike.begin(),parser.startstrike.end(),startstrike.begin());
00053 weights.assign(parser.weights.size(),0);
00054 copy(parser.weights.begin(),parser.weights.end(),weights.begin());
00055 }
00056
00057 void CLevanisoConf::WriteData(string filename)
00058 {
00059 ofstream confout(filename.c_str());
00060 WriteData(confout);}
00061
00062 void CLevanisoConf::WriteData(std::ofstream &outstream)
00063 {
00064 outstream << "maxiter" << "=" ;
00065 outstream << maxiter << endl;
00066 outstream << "mode" << "=" ;
00067 outstream << mode << endl;
00068 outstream << "mtfit" << "=" ;
00069 outstream << mtfit << endl;
00070 outstream << "mtinputdata" << "=" ;
00071 outstream << mtinputdata << endl;
00072 outstream << "ptensordata" << "=" ;
00073 outstream << ptensordata << endl;
00074 outstream << "tensorerror" << "=" ;
00075 outstream << tensorerror << endl;
00076 outstream << "phaseerror" << "=" ;
00077 outstream << phaseerror << endl;
00078 outstream << "reserror" << "=" ;
00079 outstream << reserror << endl;
00080 outstream << "minres" << "=" ;
00081 for (size_t i = 0; i < minres.size(); ++i)
00082 outstream << minres.at(i) << " ";
00083 outstream << endl;
00084
00085 outstream << "maxres" << "=" ;
00086 for (size_t i = 0; i < maxres.size(); ++i)
00087 outstream << maxres.at(i) << " ";
00088 outstream << endl;
00089
00090 outstream << "startres" << "=" ;
00091 for (size_t i = 0; i < startres.size(); ++i)
00092 outstream << startres.at(i) << " ";
00093 outstream << endl;
00094
00095 outstream << "minthick" << "=" ;
00096 for (size_t i = 0; i < minthick.size(); ++i)
00097 outstream << minthick.at(i) << " ";
00098 outstream << endl;
00099
00100 outstream << "maxthick" << "=" ;
00101 for (size_t i = 0; i < maxthick.size(); ++i)
00102 outstream << maxthick.at(i) << " ";
00103 outstream << endl;
00104
00105 outstream << "startthick" << "=" ;
00106 for (size_t i = 0; i < startthick.size(); ++i)
00107 outstream << startthick.at(i) << " ";
00108 outstream << endl;
00109
00110 outstream << "minaniso" << "=" ;
00111 for (size_t i = 0; i < minaniso.size(); ++i)
00112 outstream << minaniso.at(i) << " ";
00113 outstream << endl;
00114
00115 outstream << "maxaniso" << "=" ;
00116 for (size_t i = 0; i < maxaniso.size(); ++i)
00117 outstream << maxaniso.at(i) << " ";
00118 outstream << endl;
00119
00120 outstream << "startaniso" << "=" ;
00121 for (size_t i = 0; i < startaniso.size(); ++i)
00122 outstream << startaniso.at(i) << " ";
00123 outstream << endl;
00124
00125 outstream << "minstrike" << "=" ;
00126 for (size_t i = 0; i < minstrike.size(); ++i)
00127 outstream << minstrike.at(i) << " ";
00128 outstream << endl;
00129
00130 outstream << "maxstrike" << "=" ;
00131 for (size_t i = 0; i < maxstrike.size(); ++i)
00132 outstream << maxstrike.at(i) << " ";
00133 outstream << endl;
00134
00135 outstream << "startstrike" << "=" ;
00136 for (size_t i = 0; i < startstrike.size(); ++i)
00137 outstream << startstrike.at(i) << " ";
00138 outstream << endl;
00139
00140 outstream << "weights" << "=" ;
00141 for (size_t i = 0; i < weights.size(); ++i)
00142 outstream << weights.at(i) << " ";
00143 outstream << endl;
00144
00145 }
00146