diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index 5b156d2..3ef4f79 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -10,12 +10,12 @@ ExternalProject_Add( INSTALL_COMMAND "" PREFIX "external" ) -ExternalProject_Get_Property(json_hpp install_dir) +ExternalProject_Get_Property(json_hpp download_dir) foreach(entry ${CATIMA_APPS}) add_executable(${entry} ${entry}.cpp) target_link_libraries(${entry} catima) - target_include_directories(${entry} PRIVATE ${install_dir}) + target_include_directories(${entry} PRIVATE ${download_dir}) endforeach(entry in ${CATIMA_APPS}) install (TARGETS ${CATIMA_APPS} RUNTIME DESTINATION bin) diff --git a/catima.cpp b/catima.cpp index 931f66c..7ebe337 100644 --- a/catima.cpp +++ b/catima.cpp @@ -149,7 +149,6 @@ double energy_straggling_from_E(Projectile &p, double T, double Tout,const Mater } double energy_out(double T, double thickness, const Interpolator &range_spline){ - constexpr double epsilon = 1E-5; int counter = 0; double range; double dedx; @@ -162,13 +161,14 @@ double energy_out(double T, double thickness, const Interpolator &range_spline){ e = T - (thickness*dedx); while(1){ r = range - range_spline(e) - thickness; - if(fabs(r)100){printf("too many iterations finding Eout");return -1;} + assert(counter<=100); + if(counter>100)return -1; } return -1; } diff --git a/constants.h b/constants.h index 6032f92..6125471 100644 --- a/constants.h +++ b/constants.h @@ -11,6 +11,7 @@ constexpr double logEmax = 7.0; // log of max energy constexpr int max_datapoints = 500; // how many datapoints between logEmin and logEmax constexpr int max_storage_data = 60; // number of datapoints which can be stored in cache constexpr double numeric_epsilon = 10*std::numeric_limits::epsilon(); +constexpr double Eout_epsilon = 1e-5; // constexpr double thin_target_limit = 1 - 1e-3; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 745bd70..7d89935 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,17 +1,19 @@ -add_definitions(-Dlest_FEATURE_COLOURISE=1) +find_package(doctest REQUIRED) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tests) set(CATIMA_TESTS test_calculations test_generated test_storage test_structures test_dedx_range test_abundances) foreach(entry ${CATIMA_TESTS}) add_executable(${entry} ${entry}.cpp) - target_link_libraries(${entry} catima) + target_link_libraries(${entry} PRIVATE catima) + target_compile_features(${entry} PRIVATE cxx_std_17) add_test(${entry} ${PROJECT_BINARY_DIR}/tests/${entry}) endforeach(entry in ${CATIMA_TESTS}) if(REACTIONS) add_executable(test_reaction test_reaction.cpp) target_link_libraries(test_reaction catima) + target_compile_features(test_reaction PRIVATE cxx_std_17) add_test(test_reaction ${PROJECT_BINARY_DIR}/tests/test_reaction) endif(REACTIONS) @@ -20,4 +22,5 @@ MESSAGE( STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} ) foreach(entry ${C_TESTS}) add_executable(${entry} ${entry}.c) target_link_libraries(${entry} catima) + target_compile_features(${entry} PRIVATE cxx_std_17) endforeach(entry in ${C_TESTS})