Commit 1133f86f authored by kraus's avatar kraus

Merge branch...

Merge branch '494-orbit-threader-throws-an-exception-when-trackback-true-and-traveling-wave-structure-present' into 'OPAL-2.2'

Resolve "Orbit threader throws an exception when TRACKBACK = TRUE and...

See merge request OPAL/src!329
parents ebb89c52 2c83690a
...@@ -61,9 +61,9 @@ RFCavity::RFCavity(const RFCavity &right): ...@@ -61,9 +61,9 @@ RFCavity::RFCavity(const RFCavity &right):
autophaseVeto_m(right.autophaseVeto_m), autophaseVeto_m(right.autophaseVeto_m),
designEnergy_m(right.designEnergy_m), designEnergy_m(right.designEnergy_m),
fieldmap_m(right.fieldmap_m), fieldmap_m(right.fieldmap_m),
length_m(right.length_m),
startField_m(right.startField_m), startField_m(right.startField_m),
endField_m(right.endField_m), endField_m(right.endField_m),
length_m(right.length_m),
type_m(right.type_m), type_m(right.type_m),
rmin_m(right.rmin_m), rmin_m(right.rmin_m),
rmax_m(right.rmax_m), rmax_m(right.rmax_m),
...@@ -97,9 +97,9 @@ RFCavity::RFCavity(const std::string &name): ...@@ -97,9 +97,9 @@ RFCavity::RFCavity(const std::string &name):
autophaseVeto_m(false), autophaseVeto_m(false),
designEnergy_m(-1.0), designEnergy_m(-1.0),
fieldmap_m(nullptr), fieldmap_m(nullptr),
length_m(0.0),
startField_m(0.0), startField_m(0.0),
endField_m(0.0), endField_m(0.0),
length_m(0.0),
type_m(SW), type_m(SW),
rmin_m(0.0), rmin_m(0.0),
rmax_m(0.0), rmax_m(0.0),
...@@ -112,9 +112,6 @@ RFCavity::RFCavity(const std::string &name): ...@@ -112,9 +112,6 @@ RFCavity::RFCavity(const std::string &name):
RNormal_m(nullptr), RNormal_m(nullptr),
VrNormal_m(nullptr), VrNormal_m(nullptr),
DvDr_m(nullptr), DvDr_m(nullptr),
// RNormal_m(std::nullptr_t(NULL)),
// VrNormal_m(std::nullptr_t(NULL)),
// DvDr_m(std::nullptr_t(NULL)),
num_points_m(0) num_points_m(0)
{ {
setElType(isRF); setElType(isRF);
...@@ -122,13 +119,6 @@ RFCavity::RFCavity(const std::string &name): ...@@ -122,13 +119,6 @@ RFCavity::RFCavity(const std::string &name):
RFCavity::~RFCavity() { RFCavity::~RFCavity() {
// FIXME: in deleteFielmak, a map find makes problems
// Fieldmap::deleteFieldmap(filename_m);
//~ if(RNormal_m) {
//~ delete[] RNormal_m;
//~ delete[] VrNormal_m;
//~ delete[] DvDr_m;
//~ }
} }
void RFCavity::accept(BeamlineVisitor &visitor) const { void RFCavity::accept(BeamlineVisitor &visitor) const {
...@@ -252,6 +242,7 @@ bool RFCavity::applyToReferenceParticle(const Vector_t &R, ...@@ -252,6 +242,7 @@ bool RFCavity::applyToReferenceParticle(const Vector_t &R,
void RFCavity::initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField) { void RFCavity::initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField) {
using Physics::two_pi; using Physics::two_pi;
startField_m = endField_m = 0.0;
if (bunch == NULL) { if (bunch == NULL) {
startField = startField_m; startField = startField_m;
endField = endField_m; endField = endField_m;
...@@ -265,29 +256,30 @@ void RFCavity::initialise(PartBunchBase<double, 3> *bunch, double &startField, d ...@@ -265,29 +256,30 @@ void RFCavity::initialise(PartBunchBase<double, 3> *bunch, double &startField, d
RefPartBunch_m = bunch; RefPartBunch_m = bunch;
fieldmap_m = Fieldmap::getFieldmap(filename_m, fast_m); fieldmap_m = Fieldmap::getFieldmap(filename_m, fast_m);
fieldmap_m->getFieldDimensions(startField_m, endField_m, rBegin, rEnd); fieldmap_m->getFieldDimensions(startField_m, endField_m, rBegin, rEnd);
if(endField_m > startField_m) { if (endField_m <= startField_m) {
msg << level2 << getName() << " using file "; throw GeneralClassicException("RFCavity::initialise",
fieldmap_m->getInfo(&msg); "The length of the field map '" + filename_m + "' is zero or negativ");
if(std::abs((frequency_m - fieldmap_m->getFrequency()) / frequency_m) > 0.01) { }
errormsg << "FREQUENCY IN INPUT FILE DIFFERENT THAN IN FIELD MAP '" << filename_m << "';\n"
<< frequency_m / two_pi * 1e-6 << " MHz <> " msg << level2 << getName() << " using file ";
<< fieldmap_m->getFrequency() / two_pi * 1e-6 << " MHz; TAKE ON THE LATTER"; fieldmap_m->getInfo(&msg);
std::string errormsg_str = Fieldmap::typeset_msg(errormsg.str(), "warning"); if(std::abs((frequency_m - fieldmap_m->getFrequency()) / frequency_m) > 0.01) {
ERRORMSG(errormsg_str << "\n" << endl); errormsg << "FREQUENCY IN INPUT FILE DIFFERENT THAN IN FIELD MAP '" << filename_m << "';\n"
if(Ippl::myNode() == 0) { << frequency_m / two_pi * 1e-6 << " MHz <> "
std::ofstream omsg("errormsg.txt", std::ios_base::app); << fieldmap_m->getFrequency() / two_pi * 1e-6 << " MHz; TAKE ON THE LATTER";
omsg << errormsg_str << std::endl; std::string errormsg_str = Fieldmap::typeset_msg(errormsg.str(), "warning");
omsg.close(); ERRORMSG(errormsg_str << "\n" << endl);
} if(Ippl::myNode() == 0) {
frequency_m = fieldmap_m->getFrequency(); std::ofstream omsg("errormsg.txt", std::ios_base::app);
omsg << errormsg_str << std::endl;
omsg.close();
} }
length_m = endField_m - startField_m; frequency_m = fieldmap_m->getFrequency();
endField = startField + length_m;
} else {
endField = startField - 1e-3;
} }
length_m = endField_m - startField_m;
endField = startField + length_m;
} }
// In current version ,this function reads in the cavity voltage profile data from file. // In current version ,this function reads in the cavity voltage profile data from file.
...@@ -783,9 +775,9 @@ pair<double, double> RFCavity::trackOnAxisParticle(const double &p0, ...@@ -783,9 +775,9 @@ pair<double, double> RFCavity::trackOnAxisParticle(const double &p0,
integrator.push(z, p, dt); integrator.push(z, p, dt);
z *= cdt; z *= cdt;
Ef = 0.0;
Bf = 0.0;
if(z(2) >= zbegin && z(2) <= zend) { if(z(2) >= zbegin && z(2) <= zend) {
Ef = 0.0;
Bf = 0.0;
applyToReferenceParticle(z, p, t + 0.5 * dt, Ef, Bf); applyToReferenceParticle(z, p, t + 0.5 * dt, Ef, Bf);
} }
integrator.kick(z, p, Ef, Bf, dt); integrator.kick(z, p, Ef, Bf, dt);
......
...@@ -228,11 +228,13 @@ protected: ...@@ -228,11 +228,13 @@ protected:
bool autophaseVeto_m; bool autophaseVeto_m;
double designEnergy_m; double designEnergy_m;
private:
Fieldmap* fieldmap_m; Fieldmap* fieldmap_m;
double length_m;
double startField_m; /**< starting point of field(m)*/ double startField_m; /**< starting point of field(m)*/
private:
double endField_m; double endField_m;
double length_m;
CavityType type_m; CavityType type_m;
......
This diff is collapsed.
...@@ -66,13 +66,6 @@ public: ...@@ -66,13 +66,6 @@ public:
virtual double getAutoPhaseEstimate(const double & E0, const double & t0, const double & q, const double & m) override; virtual double getAutoPhaseEstimate(const double & E0, const double & t0, const double & q, const double & m) override;
virtual std::pair<double, double> trackOnAxisParticle(const double & p0,
const double & t0,
const double & dt,
const double & q,
const double & mass,
std::ofstream *out = NULL) override;
virtual void addKR(int i, double t, Vector_t &K) override; virtual void addKR(int i, double t, Vector_t &K) override;
virtual void addKT(int i, double t, Vector_t &K) override; virtual void addKT(int i, double t, Vector_t &K) override;
...@@ -107,10 +100,6 @@ public: ...@@ -107,10 +100,6 @@ public:
virtual CoordinateSystemTrafo getEdgeToEnd() const override; virtual CoordinateSystemTrafo getEdgeToEnd() const override;
private: private:
Fieldmap *CoreFieldmap_m;
/* Fieldmap *EntryFringeField_m; */
/* Fieldmap *ExitFringeField_m; */
double scaleCore_m; double scaleCore_m;
double scaleCoreError_m; double scaleCoreError_m;
...@@ -118,7 +107,6 @@ private: ...@@ -118,7 +107,6 @@ private:
double phaseCore2_m; double phaseCore2_m;
double phaseExit_m; double phaseExit_m;
double length_m;
double startCoreField_m; /**< starting point of field(m)*/ double startCoreField_m; /**< starting point of field(m)*/
double startExitField_m; double startExitField_m;
double mappedStartExitField_m; double mappedStartExitField_m;
...@@ -128,11 +116,6 @@ private: ...@@ -128,11 +116,6 @@ private:
double CellLength_m; double CellLength_m;
double Mode_m; double Mode_m;
bool fast_m;
bool autophaseVeto_m;
double designEnergy_m;
inline double getdE(const int & i, inline double getdE(const int & i,
const int & I, const int & I,
const std::vector<double> & t, const std::vector<double> & t,
...@@ -258,4 +241,4 @@ CoordinateSystemTrafo TravelingWave::getEdgeToEnd() const ...@@ -258,4 +241,4 @@ CoordinateSystemTrafo TravelingWave::getEdgeToEnd() const
return ret; return ret;
} }
#endif // CLASSIC_TravelingWave_HH #endif // CLASSIC_TravelingWave_HH
\ No newline at end of file
...@@ -33,11 +33,11 @@ Astra1DDynamic::Astra1DDynamic(std::string aFilename): ...@@ -33,11 +33,11 @@ Astra1DDynamic::Astra1DDynamic(std::string aFilename):
if (file.good()) { if (file.good()) {
bool parsing_passed = true; bool parsing_passed = true;
try { try {
parsing_passed = interpreteLine<std::string, int>(file, parsing_passed = interpretLine<std::string, int>(file,
tmpString, tmpString,
accuracy_m); accuracy_m);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
parsing_passed = interpreteLine<std::string, int, std::string>(file, parsing_passed = interpretLine<std::string, int, std::string>(file,
tmpString, tmpString,
accuracy_m, accuracy_m,
tmpString); tmpString);
...@@ -53,13 +53,13 @@ Astra1DDynamic::Astra1DDynamic(std::string aFilename): ...@@ -53,13 +53,13 @@ Astra1DDynamic::Astra1DDynamic(std::string aFilename):
} }
parsing_passed = parsing_passed && parsing_passed = parsing_passed &&
interpreteLine<double>(file, frequency_m); interpretLine<double>(file, frequency_m);
parsing_passed = parsing_passed && parsing_passed = parsing_passed &&
interpreteLine<double, double>(file, zbegin_m, tmpDouble); interpretLine<double, double>(file, zbegin_m, tmpDouble);
tmpDouble2 = zbegin_m; tmpDouble2 = zbegin_m;
while(!file.eof() && parsing_passed) { while(!file.eof() && parsing_passed) {
parsing_passed = interpreteLine<double, double>(file, zend_m, tmpDouble, false); parsing_passed = interpretLine<double, double>(file, zend_m, tmpDouble, false);
if (zend_m - tmpDouble2 > 1e-10) { if (zend_m - tmpDouble2 > 1e-10) {
tmpDouble2 = zend_m; tmpDouble2 = zend_m;
} else if (parsing_passed) { } else if (parsing_passed) {
...@@ -124,7 +124,7 @@ void Astra1DDynamic::readMap() { ...@@ -124,7 +124,7 @@ void Astra1DDynamic::readMap() {
tmpDouble = zbegin_m - dz; tmpDouble = zbegin_m - dz;
for (int i = 0; i < num_gridpz_m && parsing_passed; /* skip increment of i here */) { for (int i = 0; i < num_gridpz_m && parsing_passed; /* skip increment of i here */) {
parsing_passed = interpreteLine<double, double>(in, zvals[i], RealValues[i]); parsing_passed = interpretLine<double, double>(in, zvals[i], RealValues[i]);
// the sequence of z-position should be strictly increasing // the sequence of z-position should be strictly increasing
// drop sampling points that don't comply to this // drop sampling points that don't comply to this
if (zvals[i] - tmpDouble > 1e-10) { if (zvals[i] - tmpDouble > 1e-10) {
...@@ -274,11 +274,11 @@ void Astra1DDynamic::getOnaxisEz(vector<pair<double, double> > & F) { ...@@ -274,11 +274,11 @@ void Astra1DDynamic::getOnaxisEz(vector<pair<double, double> > & F) {
F.resize(num_gridpz_m); F.resize(num_gridpz_m);
ifstream in(Filename_m.c_str()); ifstream in(Filename_m.c_str());
interpreteLine<std::string, int>(in, tmpString, tmpInt); interpretLine<std::string, int>(in, tmpString, tmpInt);
interpreteLine<double>(in, tmpDouble); interpretLine<double>(in, tmpDouble);
for (int i = 0; i < num_gridpz_m; ++ i) { for (int i = 0; i < num_gridpz_m; ++ i) {
interpreteLine<double, double>(in, F[i].first, F[i].second); interpretLine<double, double>(in, F[i].first, F[i].second);
if (std::abs(F[i].second) > Ez_max) { if (std::abs(F[i].second) > Ez_max) {
Ez_max = std::abs(F[i].second); Ez_max = std::abs(F[i].second);
} }
......
...@@ -141,14 +141,14 @@ void Astra1DDynamic_fast::getOnaxisEz(std::vector<std::pair<double, double> > & ...@@ -141,14 +141,14 @@ void Astra1DDynamic_fast::getOnaxisEz(std::vector<std::pair<double, double> > &
std::string tmpString; std::string tmpString;
std::ifstream in(Filename_m.c_str()); std::ifstream in(Filename_m.c_str());
interpreteLine<std::string, int>(in, tmpString, tmpInt); interpretLine<std::string, int>(in, tmpString, tmpInt);
interpreteLine<double, double, int>(in, tmpDouble, tmpDouble, tmpInt); interpretLine<double, double, int>(in, tmpDouble, tmpDouble, tmpInt);
interpreteLine<double>(in, tmpDouble); interpretLine<double>(in, tmpDouble);
interpreteLine<double, double, int>(in, tmpDouble, tmpDouble, tmpInt); interpretLine<double, double, int>(in, tmpDouble, tmpDouble, tmpInt);
for(int i = 0; i < num_gridpz_m; ++ i) { for(int i = 0; i < num_gridpz_m; ++ i) {
F[i].first = hz_m * i; F[i].first = hz_m * i;
interpreteLine<double>(in, F[i].second); interpretLine<double>(in, F[i].second);
if(fabs(F[i].second) > Ez_max) { if(fabs(F[i].second) > Ez_max) {
Ez_max = fabs(F[i].second); Ez_max = fabs(F[i].second);
} }
...@@ -172,9 +172,9 @@ bool Astra1DDynamic_fast::readFileHeader(std::ifstream &file) { ...@@ -172,9 +172,9 @@ bool Astra1DDynamic_fast::readFileHeader(std::ifstream &file) {
bool passed = true; bool passed = true;
try { try {
passed = interpreteLine<std::string, int>(file, tmpString, tmpInt); passed = interpretLine<std::string, int>(file, tmpString, tmpInt);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
passed = interpreteLine<std::string, int, std::string>(file, tmpString, tmpInt, tmpString); passed = interpretLine<std::string, int, std::string>(file, tmpString, tmpInt, tmpString);
tmpString = Util::toUpper(tmpString); tmpString = Util::toUpper(tmpString);
if (tmpString != "TRUE" && if (tmpString != "TRUE" &&
...@@ -186,7 +186,7 @@ bool Astra1DDynamic_fast::readFileHeader(std::ifstream &file) { ...@@ -186,7 +186,7 @@ bool Astra1DDynamic_fast::readFileHeader(std::ifstream &file) {
normalize_m = (tmpString == "TRUE"); normalize_m = (tmpString == "TRUE");
} }
passed = passed && interpreteLine<double>(file, frequency_m); passed = passed && interpretLine<double>(file, frequency_m);
return passed; return passed;
} }
...@@ -197,12 +197,12 @@ int Astra1DDynamic_fast::stripFileHeader(std::ifstream &file) { ...@@ -197,12 +197,12 @@ int Astra1DDynamic_fast::stripFileHeader(std::ifstream &file) {
int accuracy; int accuracy;
try { try {
interpreteLine<std::string, int>(file, tmpString, accuracy); interpretLine<std::string, int>(file, tmpString, accuracy);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
interpreteLine<std::string, int, std::string>(file, tmpString, accuracy, tmpString); interpretLine<std::string, int, std::string>(file, tmpString, accuracy, tmpString);
} }
interpreteLine<double>(file, tmpDouble); interpretLine<double>(file, tmpDouble);
return accuracy; return accuracy;
} }
\ No newline at end of file
...@@ -31,9 +31,9 @@ Astra1DElectroStatic::Astra1DElectroStatic(std::string aFilename) ...@@ -31,9 +31,9 @@ Astra1DElectroStatic::Astra1DElectroStatic(std::string aFilename)
if(file.good()) { if(file.good()) {
bool parsing_passed = true; bool parsing_passed = true;
try { try {
parsing_passed = interpreteLine<std::string, int>(file, tmpString, accuracy_m); parsing_passed = interpretLine<std::string, int>(file, tmpString, accuracy_m);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
parsing_passed = interpreteLine<std::string, int, std::string>(file, parsing_passed = interpretLine<std::string, int, std::string>(file,
tmpString, tmpString,
accuracy_m, accuracy_m,
tmpString); tmpString);
...@@ -49,11 +49,11 @@ Astra1DElectroStatic::Astra1DElectroStatic(std::string aFilename) ...@@ -49,11 +49,11 @@ Astra1DElectroStatic::Astra1DElectroStatic(std::string aFilename)
} }
parsing_passed = parsing_passed && parsing_passed = parsing_passed &&
interpreteLine<double, double>(file, zbegin_m, tmpDouble); interpretLine<double, double>(file, zbegin_m, tmpDouble);
tmpDouble2 = zbegin_m; tmpDouble2 = zbegin_m;
while(!file.eof() && parsing_passed) { while(!file.eof() && parsing_passed) {
parsing_passed = interpreteLine<double, double>(file, zend_m, tmpDouble, false); parsing_passed = interpretLine<double, double>(file, zend_m, tmpDouble, false);
if(zend_m - tmpDouble2 > 1e-10) { if(zend_m - tmpDouble2 > 1e-10) {
tmpDouble2 = zend_m; tmpDouble2 = zend_m;
} else if(parsing_passed) { } else if(parsing_passed) {
...@@ -113,7 +113,7 @@ void Astra1DElectroStatic::readMap() { ...@@ -113,7 +113,7 @@ void Astra1DElectroStatic::readMap() {
getLine(in, tmpString); getLine(in, tmpString);
for(int i = 0; i < num_gridpz_m && parsing_passed; /* skip increment of i here */) { for(int i = 0; i < num_gridpz_m && parsing_passed; /* skip increment of i here */) {
parsing_passed = interpreteLine<double, double>(in, zvals[i], RealValues[i]); parsing_passed = interpretLine<double, double>(in, zvals[i], RealValues[i]);
// the sequence of z-position should be strictly increasing // the sequence of z-position should be strictly increasing
// drop sampling points that don't comply to this // drop sampling points that don't comply to this
if(zvals[i] - tmpDouble > 1e-10) { if(zvals[i] - tmpDouble > 1e-10) {
......
...@@ -120,9 +120,9 @@ bool Astra1DElectroStatic_fast::readFileHeader(std::ifstream &file) { ...@@ -120,9 +120,9 @@ bool Astra1DElectroStatic_fast::readFileHeader(std::ifstream &file) {
bool passed; bool passed;
try { try {
passed = interpreteLine<std::string, int>(file, tmpString, tmpInt); passed = interpretLine<std::string, int>(file, tmpString, tmpInt);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
passed = interpreteLine<std::string, int, std::string>(file, tmpString, tmpInt, tmpString); passed = interpretLine<std::string, int, std::string>(file, tmpString, tmpInt, tmpString);
tmpString = Util::toUpper(tmpString); tmpString = Util::toUpper(tmpString);
if (tmpString != "TRUE" && if (tmpString != "TRUE" &&
...@@ -142,9 +142,9 @@ int Astra1DElectroStatic_fast::stripFileHeader(std::ifstream &file) { ...@@ -142,9 +142,9 @@ int Astra1DElectroStatic_fast::stripFileHeader(std::ifstream &file) {
int accuracy; int accuracy;
try { try {
interpreteLine<std::string, int>(file, tmpString, accuracy); interpretLine<std::string, int>(file, tmpString, accuracy);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
interpreteLine<std::string, int, std::string>(file, tmpString, accuracy, tmpString); interpretLine<std::string, int, std::string>(file, tmpString, accuracy, tmpString);
} }
return accuracy; return accuracy;
......
...@@ -32,9 +32,9 @@ Astra1DMagnetoStatic::Astra1DMagnetoStatic(std::string aFilename) ...@@ -32,9 +32,9 @@ Astra1DMagnetoStatic::Astra1DMagnetoStatic(std::string aFilename)
if(file.good()) { if(file.good()) {
bool parsing_passed = true; bool parsing_passed = true;
try { try {
parsing_passed = interpreteLine<std::string, int>(file, tmpString, accuracy_m); parsing_passed = interpretLine<std::string, int>(file, tmpString, accuracy_m);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
parsing_passed = interpreteLine<std::string, int, std::string>(file, tmpString, accuracy_m, tmpString); parsing_passed = interpretLine<std::string, int, std::string>(file, tmpString, accuracy_m, tmpString);
tmpString = Util::toUpper(tmpString); tmpString = Util::toUpper(tmpString);
if (tmpString != "TRUE" && if (tmpString != "TRUE" &&
...@@ -46,11 +46,11 @@ Astra1DMagnetoStatic::Astra1DMagnetoStatic(std::string aFilename) ...@@ -46,11 +46,11 @@ Astra1DMagnetoStatic::Astra1DMagnetoStatic(std::string aFilename)
normalize_m = (tmpString == "TRUE"); normalize_m = (tmpString == "TRUE");
} }
parsing_passed = parsing_passed && parsing_passed = parsing_passed &&
interpreteLine<double, double>(file, zbegin_m, tmpDouble); interpretLine<double, double>(file, zbegin_m, tmpDouble);
tmpDouble2 = zbegin_m; tmpDouble2 = zbegin_m;
while(!file.eof() && parsing_passed) { while(!file.eof() && parsing_passed) {
parsing_passed = interpreteLine<double, double>(file, zend_m, tmpDouble, false); parsing_passed = interpretLine<double, double>(file, zend_m, tmpDouble, false);
if(zend_m - tmpDouble2 > 1e-10) { if(zend_m - tmpDouble2 > 1e-10) {
tmpDouble2 = zend_m; tmpDouble2 = zend_m;
} else if(parsing_passed) { } else if(parsing_passed) {
...@@ -109,7 +109,7 @@ void Astra1DMagnetoStatic::readMap() { ...@@ -109,7 +109,7 @@ void Astra1DMagnetoStatic::readMap() {
getLine(in, tmpString); getLine(in, tmpString);
for(int i = 0; i < num_gridpz_m && parsing_passed;/* skip increment on i here */) { for(int i = 0; i < num_gridpz_m && parsing_passed;/* skip increment on i here */) {
parsing_passed = interpreteLine<double, double>(in, zvals[i], RealValues[i]); parsing_passed = interpretLine<double, double>(in, zvals[i], RealValues[i]);
// the sequence of z-position should be strictly increasing // the sequence of z-position should be strictly increasing
// drop sampling points that don't comply to this // drop sampling points that don't comply to this
if(zvals[i] - tmpDouble > 1e-10) { if(zvals[i] - tmpDouble > 1e-10) {
......
...@@ -121,9 +121,9 @@ bool Astra1DMagnetoStatic_fast::readFileHeader(std::ifstream &file) { ...@@ -121,9 +121,9 @@ bool Astra1DMagnetoStatic_fast::readFileHeader(std::ifstream &file) {
bool passed; bool passed;
try { try {
passed = interpreteLine<std::string, int>(file, tmpString, tmpInt); passed = interpretLine<std::string, int>(file, tmpString, tmpInt);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
passed = interpreteLine<std::string, int, std::string>(file, tmpString, tmpInt, tmpString); passed = interpretLine<std::string, int, std::string>(file, tmpString, tmpInt, tmpString);
tmpString = Util::toUpper(tmpString); tmpString = Util::toUpper(tmpString);
if (tmpString != "TRUE" && if (tmpString != "TRUE" &&
...@@ -143,9 +143,9 @@ int Astra1DMagnetoStatic_fast::stripFileHeader(std::ifstream &file) { ...@@ -143,9 +143,9 @@ int Astra1DMagnetoStatic_fast::stripFileHeader(std::ifstream &file) {
int accuracy; int accuracy;
try { try {
interpreteLine<std::string, int>(file, tmpString, accuracy); interpretLine<std::string, int>(file, tmpString, accuracy);
} catch (GeneralClassicException &e) { } catch (GeneralClassicException &e) {
interpreteLine<std::string, int, std::string>(file, tmpString, accuracy, tmpString); interpretLine<std::string, int, std::string>(file, tmpString, accuracy, tmpString);
} }
return accuracy; return accuracy;
......
...@@ -40,11 +40,11 @@ void Astra1D_fast::getOnaxisEz(std::vector<std::pair<double, double> > & F) ...@@ -40,11 +40,11 @@ void Astra1D_fast::getOnaxisEz(std::vector<std::pair<double, double> > & F)
bool Astra1D_fast::determineNumSamplingPoints(std::ifstream &file) { bool Astra1D_fast::determineNumSamplingPoints(std::ifstream &file) {
double tmpDouble, tmpDouble2; double tmpDouble, tmpDouble2;
unsigned int skippedValues = 0; unsigned int skippedValues = 0;
bool passed = interpreteLine<double, double>(file, zbegin_m, tmpDouble); bool passed = interpretLine<double, double>(file, zbegin_m, tmpDouble);
tmpDouble2 = zbegin_m; tmpDouble2 = zbegin_m;
while (!file.eof() && passed) { while (!file.eof() && passed) {
passed = interpreteLine<double, double>(file, zend_m, tmpDouble, false); passed = interpretLine<double, double>(file, zend_m, tmpDouble, false);
if (zend_m - tmpDouble2 > 1e-10) { if (zend_m - tmpDouble2 > 1e-10) {
tmpDouble2 = zend_m; tmpDouble2 = zend_m;
} else if (passed) { } else if (passed) {
...@@ -64,7 +64,7 @@ double Astra1D_fast::readFieldData(std::ifstream &file) { ...@@ -64,7 +64,7 @@ double Astra1D_fast::readFieldData(std::ifstream &file) {
int nsp; int nsp;
for (nsp = 0; nsp < num_gridpz_m; ) { for (nsp = 0; nsp < num_gridpz_m; ) {
interpreteLine<double, double>(file, zvals_m[nsp], onAxisField_m[nsp]); interpretLine<double, double>(file, zvals_m[nsp], onAxisField_m[nsp]);
if(zvals_m[nsp] - tmpDouble > 1e-10) { if(zvals_m[nsp] - tmpDouble > 1e-10) {
if(std::abs(onAxisField_m[nsp]) > maxValue) { if(std::abs(onAxisField_m[nsp]) > maxValue) {
......
...@@ -148,7 +148,7 @@ bool FM1DDynamic::checkFileData(std::ifstream &fieldFile, bool parsingPassed) { ...@@ -148,7 +148,7 @@ bool FM1DDynamic::checkFileData(std::ifstream &fieldFile, bool parsingPassed) {
double tempDouble; double tempDouble;
for(int dataIndex = 0; dataIndex < numberOfGridPoints_m; ++ dataIndex) for(int dataIndex = 0; dataIndex < numberOfGridPoints_m; ++ dataIndex)
parsingPassed = parsingPassed parsingPassed = parsingPassed
&& interpreteLine<double>(fieldFile, tempDouble); && interpretLine<double>(fieldFile, tempDouble);
return parsingPassed && interpreteEOF(fieldFile); return parsingPassed && interpreteEOF(fieldFile);
...@@ -251,7 +251,7 @@ double FM1DDynamic::readFileData(std::ifstream &fieldFile, double fieldData[]) { ...@@ -251,7 +251,7 @@ double FM1DDynamic::readFileData(std::ifstream &fieldFile, double fieldData[]) {
double maxEz = 0.0; double maxEz = 0.0;
for(int dataIndex = 0; dataIndex < numberOfGridPoints_m; ++ dataIndex) { for(int dataIndex = 0; dataIndex < numberOfGridPoints_m; ++ dataIndex) {
interpreteLine<double>(fieldFile, fieldData[numberOfGridPoints_m interpretLine<double>(fieldFile, fieldData[numberOfGridPoints_m
- 1 + dataIndex]); - 1 + dataIndex]);
if(std::abs(fieldData[numberOfGridPoints_m + dataIndex]) > maxEz) if(std::abs(fieldData[numberOfGridPoints_m + dataIndex]) > maxEz)
maxEz = std::abs(fieldData[numberOfGridPoints_m + dataIndex]);