Commit b8c94978 authored by kraus's avatar kraus
Browse files

fixing clang warnings (which include also two bugs!)

parent c1de6ea6
......@@ -66,8 +66,8 @@ Collimator::Collimator():
nHolesX_m(0),
nHolesY_m(0),
pitch_m(0.0),
sphys_m(NULL),
lossDs_m(nullptr)
lossDs_m(nullptr),
sphys_m(NULL)
{}
......@@ -105,8 +105,8 @@ Collimator::Collimator(const Collimator &right):
nHolesX_m(right.nHolesX_m),
nHolesY_m(right.nHolesY_m),
pitch_m(right.pitch_m),
sphys_m(NULL),
lossDs_m(nullptr)
lossDs_m(nullptr),
sphys_m(NULL)
{
setGeom();
}
......@@ -146,8 +146,8 @@ Collimator::Collimator(const std::string &name):
nHolesX_m(0),
nHolesY_m(0),
pitch_m(0.0),
sphys_m(NULL),
lossDs_m(nullptr)
lossDs_m(nullptr),
sphys_m(NULL)
{}
......
......@@ -213,7 +213,7 @@ bool Probe::checkProbe(PartBunch &bunch, const int turnnumber, const double t,
double r_end = sqrt(xend_m * xend_m + yend_m * yend_m);
double r1 = sqrt(rmax(0) * rmax(0) + rmax(1) * rmax(1));
double r2 = sqrt(rmin(0) * rmin(0) + rmin(1) * rmin(1));
if( r1 > r_start - 10.0 && r2 < r_end + 10.0 ){
size_t tempnum = bunch.getLocalNum();
int pflag = 0;
......@@ -260,17 +260,17 @@ bool Probe::checkProbe(PartBunch &bunch, const int turnnumber, const double t,
if (k1 == 0.0)
tangle = 1.0e12;
else
tangle = abs(1/k1);
tangle = std::abs(1/k1);
}else if (bunch.P[i](0) == 0.0 ){
k2 = -A_m/B_m;
if (k2 == 0.0)
tangle = 1.0e12;
else
tangle = abs(1/k2);
tangle = std::abs(1/k2);
}else {
k1 = bunch.P[i](1)/bunch.P[i](0);
k2 = -A_m/B_m;
tangle = abs(( k1-k2 )/(1 + k1*k2));
tangle = std::abs(( k1-k2 )/(1 + k1*k2));
}
double dist2 = dist1 * sqrt( 1+1/tangle/tangle );
double dt = dist2/(sqrt(1.0-1.0/(1.0 + dot(bunch.P[i], bunch.P[i]))) * Physics::c)*1.0e9;
......@@ -313,4 +313,3 @@ const std::string &Probe::getType() const {
static const std::string type("Probe");
return type;
}
......@@ -1158,7 +1158,7 @@ bool RBend::InMagnetCentralRegion(Vector_t R, double &deltaX, double &angle) {
bool RBend::InMagnetEntranceRegion(Vector_t R, double &deltaX) {
if(std::abs(R(0) <= aperture_m / 2.0)) {
if(std::abs(R(0)) <= aperture_m / 2.0) {
Vector_t RTransformed(0.0, R(1), 0.0);
RTransformed(0) = (R(0) - xOriginEngeEntry_m) * cosEntranceAngle_m
......
......@@ -1127,7 +1127,7 @@ bool SBend::InMagnetCentralRegion(Vector_t R, double &deltaX, double &angle) {
bool SBend::InMagnetEntranceRegion(Vector_t R, double &deltaX) {
if(std::abs(R(0) <= aperture_m / 2.0)) {
if(std::abs(R(0)) <= aperture_m / 2.0) {
Vector_t RTransformed(0.0, R(1), 0.0);
RTransformed(0) = (R(0) - xOriginEngeEntry_m) * cosEntranceAngle_m
......
......@@ -15,8 +15,7 @@ CSRIGFWakeFunction::CSRIGFWakeFunction(const std::string &name, ElementBase *ele
lineDensity_m(),
dlineDensitydz_m(),
bendRadius_m(0.0),
totalBendAngle_m(0.0),
NBin_m(N)
totalBendAngle_m(0.0)
{ }
void CSRIGFWakeFunction::apply(PartBunch &bunch) {
......
......@@ -25,16 +25,16 @@ private:
void calculateGreenFunction(PartBunch &bunch, double meshSpacing);
double calcPsi(const double &psiInitial, const double &x, const double &Ds) const;
LineDensity lineDensity_m;
std::vector<Filter *> filters_m;
LineDensity lineDensity_m;
LineDensity dlineDensitydz_m;
// Longitudinal CSR field.
std::vector<double> Ez_m;
// Chi used to calculate the Green's function
std::vector<double> Chi_m;
// Green's function
std::vector<double> Grn_m;
......@@ -58,8 +58,6 @@ private:
double totalBendAngle_m;
unsigned int NBin_m;
};
#endif //CSRIGFWAKEFUNCTION_HH
......@@ -17,8 +17,7 @@ CSRWakeFunction::CSRWakeFunction(const std::string &name, ElementBase *element,
dlineDensitydz_m(),
d2lineDensitydz2_m(),
bendRadius_m(0.0),
totalBendAngle_m(0.0),
NBin_m(N)
totalBendAngle_m(0.0)
{ }
void CSRWakeFunction::apply(PartBunch &bunch) {
......
......@@ -53,8 +53,6 @@ private:
double totalBendAngle_m;
unsigned int NBin_m;
};
#endif //CSRWAKEFUNCTION_HH
......@@ -74,7 +74,6 @@ private:
double I_m;
double n_m;
unsigned matToBunchStat_m;
unsigned bunchToMatStat_m;
unsigned stoppedPartStat_m;
unsigned redifusedStat_m;
......@@ -85,11 +84,6 @@ private:
double Emax_m;
double Emin_m;
double Kmax_m;
double Kmin_m;
double Emean_m;
public:
double dT_m;
int N_m;
......
......@@ -358,7 +358,7 @@ void BeamBeam3D::synchroBeamCollision(PartBunch &bunch) const {
double sepx = part.x() + part.px() * s - slice->xstar;
double sepy = part.y() + part.py() * s - slice->ystar;
double bbfx, bbfy, bbgx, bbgy;
double bbfx = 0, bbfy = 0, bbgx = 0, bbgy = 0;
if(std::abs(sx - sy) < 1.0e-6 * std::abs(sx + sy)) {
double x = sepx * sepx + sepy * sepy;
......
......@@ -80,7 +80,6 @@ ParallelTTracker::ParallelTTracker(const Beamline &beamline,
Tracker(beamline, reference, revBeam, revTrack),
itsBunch(NULL),
itsDataSink_m(NULL),
specifiedNPart_m(N),
bgf_m(NULL),
itsOpalBeamline_m(),
lineDensity_m(),
......@@ -103,6 +102,7 @@ recpGamma_m(1.0),
rescale_coeff_m(1.0),
dtTrack_m(0.0),
surfaceEmissionStop_m(-1),
specifiedNPart_m(N),
minStepforReBin_m(-1),
minBinEmitted_m(std::numeric_limits<size_t>::max()),
repartFreq_m(-1),
......@@ -138,7 +138,6 @@ ParallelTTracker::ParallelTTracker(const Beamline &beamline,
size_t N):
Tracker(beamline, reference, revBeam, revTrack),
itsBunch(&bunch),
specifiedNPart_m(N),
itsDataSink_m(&ds),
bgf_m(NULL),
itsOpalBeamline_m(),
......@@ -160,6 +159,7 @@ recpGamma_m(1.0),
rescale_coeff_m(1.0),
dtTrack_m(0.0),
surfaceEmissionStop_m(-1),
specifiedNPart_m(N),
minStepforReBin_m(-1),
minBinEmitted_m(std::numeric_limits<size_t>::max()),
repartFreq_m(-1),
......@@ -200,7 +200,6 @@ ParallelTTracker::ParallelTTracker(const Beamline &beamline,
Amr* amrptr_in):
Tracker(beamline, reference, revBeam, revTrack),
itsBunch(&bunch),
specifiedNPart_m(N),
itsDataSink_m(&ds),
bgf_m(NULL),
itsOpalBeamline_m(),
......@@ -222,6 +221,7 @@ recpGamma_m(1.0),
rescale_coeff_m(1.0),
dtTrack_m(0.0),
surfaceEmissionStop_m(-1),
specifiedNPart_m(N),
minStepforReBin_m(-1),
minBinEmitted_m(std::numeric_limits<size_t>::max()),
repartFreq_m(-1),
......
......@@ -93,7 +93,7 @@ void EnvelopeBunch::calcBeamParameters() {
Inform msg("calcBeamParameters");
IpplTimings::startTimer(statParamTimer_m);
double ex, ey, nex, ney, b0, bRms, bMax, bMin, g0, dgdt, gInc;
double RxRms, RyRms, Px, PxRms, PxMax, PxMin, Py, PyRms, PyMax, PyMin;
double RxRms = 0.0, RyRms = 0.0, Px = 0.0, PxRms = 0.0, PxMax = 0.0, PxMin = 0.0, Py = 0.0, PyRms = 0.0, PyMax = 0.0, PyMin = 0.0;
double Pz, PzMax, PzMin, PzRms;
double x0Rms, y0Rms, zRms, zMax, zMin, I0, IRms, IMax, IMin;
......@@ -625,7 +625,7 @@ void EnvelopeBunch::setBinnedLShape(EnvelopeBunchShape shape, double z0, double
reduce(gz0, gz0, OpAddAssign());
reduce(gzN, gzN, OpAddAssign());
double hbin_m = (gzN - gz0) / nebin_m;
hbin_m = (gzN - gz0) / nebin_m;
// initialize all bins with an empty vector
for(int i = 0; i < nebin_m; i++) {
......@@ -1568,4 +1568,3 @@ Inform &EnvelopeBunch::slprint(Inform &os) {
}
return os;
}
......@@ -198,6 +198,7 @@ Distribution::Distribution():
cathodeFermiEnergy_m(0.0),
cathodeTemp_m(0.0),
emitEnergyUpperLimit_m(0.0),
avrgpz_m(0.0),
inputMoUnits_m(InputMomentumUnitsT::NONE),
sigmaTRise_m(0.0),
sigmaTFall_m(0.0),
......@@ -220,8 +221,7 @@ Distribution::Distribution():
paraFNVYZe_m(0.0),
secondaryFlag_m(0),
ppVw_m(0.0),
vVThermal_m(0.0),
avrgpz_m(0.0) {
vVThermal_m(0.0) {
SetAttributes();
......@@ -280,6 +280,7 @@ Distribution::Distribution(const std::string &name, Distribution *parent):
pyWrite_m(parent->pyWrite_m),
tOrZWrite_m(parent->tOrZWrite_m),
pzWrite_m(parent->pzWrite_m),
avrgpz_m(parent->avrgpz_m),
inputMoUnits_m(parent->inputMoUnits_m),
sigmaTRise_m(parent->sigmaTRise_m),
sigmaTFall_m(parent->sigmaTFall_m),
......@@ -312,8 +313,7 @@ Distribution::Distribution(const std::string &name, Distribution *parent):
tFall_m(parent->tFall_m),
sigmaRise_m(parent->sigmaRise_m),
sigmaFall_m(parent->sigmaFall_m),
cutoff_m(parent->cutoff_m),
avrgpz_m(parent->avrgpz_m){
cutoff_m(parent->cutoff_m){
}
Distribution::~Distribution() {
......
#ifndef OPAL_LASERPROFILE_HH
#define OPAL_LaserProfile_HH
#define OPAL_LASERPROFILE_HH
// ------------------------------------------------------------------------
// $RCSfile: LaserProfile.h,v $
// ------------------------------------------------------------------------
......@@ -47,14 +47,11 @@ public:
void GetProfileMax(unsigned short int *profileMax_m, unsigned short int *image);
private:
double X, Y;
//unsigned short int profileMax_m;
hsize_t sizeX_m, sizeY_m;
gsl_histogram2d *hist2d_m;
const gsl_rng_type *rngT_m;
gsl_rng *r_m;
gsl_histogram2d_pdf *pdf_m;
};
#endif
......@@ -110,7 +110,6 @@ FFTBoxPoissonSolver::FFTBoxPoissonSolver(PartBunch &beam, std::string greensFunc
layout_m(&beam.getFieldLayout()),
mesh2_m(0),
layout2_m(0),
itsBunch_m(&beam),
greensFunction_m(greensFunction) {
int i;
domain_m = layout_m->getDomain();
......
......@@ -100,8 +100,6 @@ private:
Vector_t hr_m;
Vektor<int, 3> nr_m;
PartBunch *itsBunch_m;
std::string greensFunction_m;
double a_m; // the box size
......
......@@ -200,7 +200,6 @@ FFTPoissonSolver::FFTPoissonSolver(PartBunch &beam, std::string greensFunction):
layout3_m(nullptr),
mesh4_m(nullptr),
layout4_m(nullptr),
itsBunch_m(&beam),
greensFunction_m(greensFunction) {
int i;
domain_m = layout_m->getDomain();
......
......@@ -136,8 +136,6 @@ private:
BConds<double, 3, Mesh_t, Center_t> bc_m;
BConds<Vector_t, 3, Mesh_t, Center_t> vbc_m;
PartBunch *itsBunch_m;
std::string greensFunction_m;
bool bcz_m;
......
......@@ -34,8 +34,8 @@ class LossDataSink {
void save();
void addParticle(const Vector_t x, const Vector_t p, const size_t id);
void addParticle(const Vector_t x, const Vector_t p, const size_t id, const double time, const size_t turn);
void addParticle(const Vector_t x, const Vector_t p, const size_t id, const double time, const size_t turn);
private:
......@@ -50,12 +50,12 @@ private:
os_m.open(fn_m.c_str(), std::ios::app);
}
}
void close() {
if(Ippl::myNode() == 0)
os_m.close();
}
void writeHeaderASCII() {
if(Ippl::myNode() == 0) {
if (time_m.size() != 0)
......@@ -86,13 +86,11 @@ private:
// used to write out the data
std::ofstream os_m;
std::string element_m;
bool h5hut_mode_m;
bool hdf5FileIsOpen_m;
/// %Pointer to H5 file for particle data.
h5_file_t *H5file_m;
......@@ -106,11 +104,8 @@ private:
std::vector<double> px_m;
std::vector<double> py_m;
std::vector<double> pz_m;
std::vector<size_t> turn_m;
std::vector<double> time_m;
};
#endif
......@@ -652,14 +652,14 @@ double Survey::getPhi(const Survey::Row &row, int, int) const {
double Survey::getTheta(const Survey::Row &row, int, int) const {
const Rotation3D &rot = row.getMap().getRotation();
double arg = abs(rot(0, 2)) + abs(rot(2, 2));
double arg = std::abs(rot(0, 2)) + std::abs(rot(2, 2));
return (arg > 1.0e-10) ? atan2(rot(0, 2), rot(2, 2)) : 0.0;
}
double Survey::getPsi(const Survey::Row &row, int, int) const {
const Rotation3D &rot = row.getMap().getRotation();
double arg = abs(rot(1, 0)) + abs(rot(1, 1));
double arg = std::abs(rot(1, 0)) + std::abs(rot(1, 1));
return (arg > 1.0e-10) ? atan2(rot(1, 0), rot(1, 1)) : 0.0;
}
......
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