1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-26 12:08:52 -05:00

Merge pull request #73 from hrosiak/u4

minor
This commit is contained in:
Andrej Prochazka 2019-11-25 14:19:18 +01:00 committed by GitHub
commit 12ea17aa12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View File

@ -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)

View File

@ -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)<epsilon)return e;
if(fabs(r)<Eout_epsilon)return e;
double step = -r*dedx;
e = e-step;
if(e<Ezero)return 0.0;
dedx = 1.0/range_spline.derivative(e);
counter++;
if(counter>100){printf("too many iterations finding Eout");return -1;}
assert(counter<=100);
if(counter>100)return -1;
}
return -1;
}

View File

@ -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<double>::epsilon();
constexpr double Eout_epsilon = 1e-5; //
constexpr double thin_target_limit = 1 - 1e-3;

View File

@ -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})