Commit e0aaa07b authored by adelmann's avatar adelmann 🎗
Browse files

avoid one sum over Q and at the same time closing #163, need to fix Util::getChargeString

parent c763c81f
......@@ -742,13 +742,13 @@ double PartBunchBase<T, Dim>::getBinGamma(int bin) {
template <class T, unsigned Dim>
void PartBunchBase<T, Dim>::setBinCharge(int bin, double q) {
this->Q = where(eq(this->Bin, bin), q, 0.0);
this->Q = this->qi_m; // where(eq(this->Bin, bin), q, 0.0);
}
template <class T, unsigned Dim>
void PartBunchBase<T, Dim>::setBinCharge(int bin) {
this->Q = where(eq(this->Bin, bin), this->Q, 0.0);
this->Q = this->qi_m; // where(eq(this->Bin, bin), this->qi_m, 0.0);
}
......@@ -2150,6 +2150,7 @@ void PartBunchBase<T, Dim>::correctEnergy(double avrgp_m) {
template <class T, unsigned Dim>
Inform &PartBunchBase<T, Dim>::print(Inform &os) {
if(getTotalNum() != 0) { // to suppress Nan's
Inform::FmtFlags_t ff = os.flags();
......@@ -2167,8 +2168,8 @@ Inform &PartBunchBase<T, Dim>::print(Inform &os) {
os << level1 << "\n";
os << "* ************** B U N C H ********************************************************* \n";
os << "* NP = " << getTotalNum() << "\n";
os << "* Qtot = " << std::setw(17) << Util::getChargeString(abs(sum(Q))) << " "
<< "Qi = " << std::setw(17) << Util::getChargeString(std::abs(qi_m)) << "\n";
os << "* Qtot = " << std::setw(17) << getTotalNum() * std::abs(qi_m) * 1.0e9 << " [nC] "
<< "Qi = " << std::setw(17) << std::abs(qi_m) * 1.0e9 << " [nC]\n";
os << "* Ekin = " << std::setw(17) << Util::getEnergyString(eKin_m) << " "
<< "dEkin = " << std::setw(17) << Util::getEnergyString(dE_m) << "\n";
os << "* rmax = " << Util::getLengthString(rmax_m, 5) << "\n";
......@@ -2182,7 +2183,8 @@ Inform &PartBunchBase<T, Dim>::print(Inform &os) {
os << "* hr = " << Util::getLengthString(get_hr(), 5) << "\n";
os << "* dh = " << std::setw(13) << std::setprecision(5) << dh_m * 100 << " [%]\n";
os << "* t = " << std::setw(17) << Util::getTimeString(getT()) << " "
<< "dT = " << std::setw(17) << Util::getTimeString(getdT()) << "\n";
// << "dT = " << std::setw(17) << Util::getTimeString(getdT()) << "\n";
<< "dT = " << std::setw(17) << Util::getTimeString(this->dt[0]) << "\n";
os << "* spos = " << std::setw(17) << Util::getLengthString(pathLength) << "\n";
os << "* ********************************************************************************** " << endl;
os.flags(ff);
......
  • kraus @kraus

    mentioned in commit bc7f68f0

    ·

    mentioned in commit bc7f68f0

    Toggle commit list
  • The problem wasn't Util::getChargeString but a missing std:: in front of abs().

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment