From 94cc227db03b7fc22b2bf953517adfb6dd8d0398 Mon Sep 17 00:00:00 2001 From: hrocho Date: Tue, 9 Oct 2018 11:54:11 +0200 Subject: [PATCH] minor warnings --- CMakeLists.txt | 2 +- bin/catima_calculator.cpp | 5 +++-- calculations.cpp | 7 ++++--- catima.cpp | 5 ----- spline.cpp | 2 -- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d3ee38..06b831d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(warnings "-Wall -Wextra -Werror") + set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror -Wno-sign-compare -Wno-unused-parameter") endif() if(APPLE) diff --git a/bin/catima_calculator.cpp b/bin/catima_calculator.cpp index 18f098c..ec27df6 100644 --- a/bin/catima_calculator.cpp +++ b/bin/catima_calculator.cpp @@ -67,14 +67,15 @@ int main( int argc, char * argv[] ) if(e.count("min")>0 && e.count("max")>0 && (e.count("num")>0 || e.count("step")>0)){ double emin = e["min"].get(); double emax = e["max"].get(); - int num; + int num=0; if(e.count("step")){ num = 1+(emax-emin)/e["step"].get(); } if(e.count("num")){ num = e["num"].get(); } - energies = linspace_vector(emin,emax,num); + if(num>2) + energies = linspace_vector(emin,emax,num); } } } diff --git a/calculations.cpp b/calculations.cpp index 52869c5..8092072 100644 --- a/calculations.cpp +++ b/calculations.cpp @@ -456,7 +456,7 @@ double sezi_dedx_e(const Projectile &p, const Target &t){ return se; } else{ // heavy ion - double h1,h2,h3,h4; + double h1,h4; double a,q,b; double l1,l0,l; double YRmin = 0.130; // YRmin = VR / ZP**0.67 <= 0.13 OR VR <= 1.0 @@ -817,8 +817,10 @@ double z_eff_Schiwietz(double pz, double beta, double tz){ } double z_eff_atima14(double pz, double T, double tz){ + double qmean = 0.0; + #ifdef GLOBAL double qpb; - double qhigh,qwinger,qglobal,qmean=0; + double qhigh,qwinger,qglobal; double c1 = 1.4; double c2 = 0.28; double c3 = 0.04; @@ -826,7 +828,6 @@ double z_eff_atima14(double pz, double T, double tz){ double gamma = gamma_from_T(T); double emax, emin; qpb = z_eff_Pierce_Blann(pz,beta); - #ifdef GLOBAL if(T>30.0 && T<1500.0 && pz>28){ qglobal = z_eff_global(pz,T,tz); diff --git a/catima.cpp b/catima.cpp index 73b08a8..987f7d5 100644 --- a/catima.cpp +++ b/catima.cpp @@ -29,7 +29,6 @@ bool operator==(const Config &a, const Config&b){ double dedx(Projectile &p, double T, const Material &mat, const Config &c){ double sum = 0; - double w=0; if(T<=0)return 0.0; sum += dedx_n(p,mat); @@ -108,7 +107,6 @@ std::vector dedx_from_range(Projectile &p, const std::vector &T, } double range_straggling(Projectile &p, double T, const Material &t, const Config &c){ - double r=0; auto data = _storage.Get(p,t,c); Interpolator range_straggling_spline(energy_table.values,data.range_straggling.data(),energy_table.num); return sqrt(range_straggling_spline(T)); @@ -133,7 +131,6 @@ double da2de(Projectile &p, double T, const Material &t, const Config &c){ } double angular_straggling_from_E(Projectile &p, double T, double Tout, const Material &t, const Config &c){ - double r=0; auto data = _storage.Get(p,t,c); Interpolator angular_straggling_spline(energy_table.values,data.angular_variance.data(),energy_table.num); return sqrt(angular_straggling_spline(T) - angular_straggling_spline(Tout)); @@ -151,7 +148,6 @@ double energy_straggling_from_E(Projectile &p, double T, double Tout,const Mater double energy_out(double T, double thickness, Interpolator &range_spline){ constexpr double epsilon = 1E-5; int counter = 0; - double lo=0,hi=T; double range; double dedx; double e,r; @@ -381,7 +377,6 @@ DataPoint calculate_DataPoint(Projectile p, const Material &t, const Config &c){ dp.range.resize(max_datapoints); dp.range_straggling.resize(max_datapoints); dp.angular_variance.resize(max_datapoints); - double dedxval; auto fdedx = [&](double x)->double{ return 1.0/dedx(p,x,t,c); }; diff --git a/spline.cpp b/spline.cpp index 5e3330b..9ec79ba 100644 --- a/spline.cpp +++ b/spline.cpp @@ -54,8 +54,6 @@ std::vector band_matrix::trig_solve(const std::vector& b) const assert( this->dim()==(int)b.size() ); std::vector x(this->dim()); std::vector g(this->dim()); - int j_stop; - double sum; assert(d[0]!=0.0); x[0] = b[0]/d[0];