From 8419555f93e55f78bf199b607a41d443ff7d3089 Mon Sep 17 00:00:00 2001 From: hrocho Date: Tue, 8 Oct 2019 20:25:30 +0200 Subject: [PATCH] skip var removed from Config --- catima.cpp | 2 +- config.h | 22 ---------------------- cwrapper.cpp | 1 - cwrapper.h | 22 ++++++++++------------ pymodule/pycatima.cpp | 9 --------- 5 files changed, 11 insertions(+), 45 deletions(-) diff --git a/catima.cpp b/catima.cpp index 5c9ea13..07913e1 100644 --- a/catima.cpp +++ b/catima.cpp @@ -254,7 +254,7 @@ Result calculate(Projectile &p, const Material &t, const Config &c){ spline_type angular_variance_spline = get_angular_variance_spline(data); res.sigma_a = sqrt(angular_variance_spline(T) - angular_variance_spline(res.Eout)); #endif - if( !(c.skip&skip_tof) && t.thickness()>0){ + if( t.thickness()>0){ //auto tofdata = calculate_tof(p,t,c); //Interpolator tof_spline(energy_table.values, tofdata.data(), energy_table.num,interpolation_t::linear); //res.tof = tof_spline(res.Ein) - tof_spline(res.Eout); diff --git a/config.h b/config.h index 4b4c99b..5e0256a 100644 --- a/config.h +++ b/config.h @@ -19,17 +19,6 @@ namespace catima{ atima14 = 7 }; - /** - * enum to select which calculation to skip - */ - enum skip_calculation:unsigned char{ - skip_none = 0, - skip_tof = 1, - skip_sigma_a = 2, - skip_sigma_r = 4, - skip_reactions = 128 - }; - /** * enum to select which dEdx correction to skip */ @@ -58,11 +47,6 @@ namespace catima{ /** * structure to store calculation configuration - * each group of options are grouped and enum are suppose to use - * see catima::z_eff_type, catima::skip_calculation, catima::corrections - * - * check catima::z_effective() - * */ struct Config{ #ifndef GLOBAL @@ -71,12 +55,6 @@ namespace catima{ unsigned char z_effective=z_eff_type::atima14; #endif - #ifdef REACTIONS - unsigned char skip=skip_none; - #else - unsigned char skip=skip_calculation::skip_reactions; - #endif - unsigned char corrections = 0; unsigned char calculation = 1; }; diff --git a/cwrapper.cpp b/cwrapper.cpp index 2733401..2c93a15 100644 --- a/cwrapper.cpp +++ b/cwrapper.cpp @@ -7,7 +7,6 @@ extern "C" { CatimaResult catima_calculate(double pa, int pz, double T, double ta, double tz, double thickness, double density){ catima::default_config.z_effective = catima_defaults.z_effective; - catima::default_config.skip = catima_defaults.skip; catima::Material mat; catima::Projectile p(pa,pz); if(tz>200){ diff --git a/cwrapper.h b/cwrapper.h index 4a2b3fc..90ae782 100644 --- a/cwrapper.h +++ b/cwrapper.h @@ -15,28 +15,26 @@ struct CatimaResult{ double sigma_E; double sigma_a; double sigma_r; - double tof; + double tof; }; enum z_eff_type { none = 0, - atima = 1 - }; - - enum skip_calculation{ - skip_none = 0, - skip_tof = 1, - skip_sigma_a = 2, - skip_sigma_r = 4 + pierce_blann = 1, + anthony_landorf = 2, + hubert = 3, + winger = 4, + schiwietz = 5, + global = 6, + atima14 = 7 }; struct CatimaConfig { char z_effective; - char skip; }; -struct CatimaConfig catima_defaults = {none,skip_none}; +struct CatimaConfig catima_defaults = {none}; typedef struct CatimaResult CatimaResult; @@ -49,4 +47,4 @@ double catima_energy_straggling_from_E(double pa, int pz, double Tin, double Tou } #endif -#endif \ No newline at end of file +#endif diff --git a/pymodule/pycatima.cpp b/pymodule/pycatima.cpp index c6adda1..11bf21e 100644 --- a/pymodule/pycatima.cpp +++ b/pymodule/pycatima.cpp @@ -213,13 +213,6 @@ PYBIND11_MODULE(pycatima,m){ .value("global", z_eff_type::global) .value("atima14", z_eff_type::atima14); - py::enum_(m,"skip_calculation") - .value("skip_none", skip_calculation::skip_none) - .value("skip_tof", skip_calculation::skip_tof) - .value("skip_sigma_a", skip_calculation::skip_sigma_a) - .value("skip_sigma_r", skip_calculation::skip_sigma_r) - .value("skip_reactions", skip_calculation::skip_reactions); - py::enum_(m,"corrections") .value("no_barkas", corrections::no_barkas) .value("no_lindhard", corrections::no_lindhard) @@ -264,13 +257,11 @@ PYBIND11_MODULE(pycatima,m){ .def_readwrite("z_effective", &Config::z_effective) .def_readwrite("corrections", &Config::corrections) .def_readwrite("calculation", &Config::calculation) - .def_readwrite("skip", &Config::skip) .def("get",[](const Config &r){ py::dict d; d["z_effective"] = r.z_effective; d["corrections"] = r.corrections; d["calculation"] = r.calculation; - d["skip"] = r.skip; return d; }) .def("__str__",[](const Config &r){