diff --git a/.gitignore b/.gitignore index 2c27e924a22be89752baa8ac014618a843f06268..d817555586cbdb3a4c1b914f01ca946062447125 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,15 @@ flymd.md Testing tags Environment/GeneratedMediaProperties.inc +CMakeUserPresets.json +corsika/framework/core/GeneratedParticleClasses.inc +corsika/framework/core/GeneratedParticleProperties.inc +corsika/framework/core/particle_db.pkl +corsika/media/GeneratedMediaProperties.inc +corsika/modules/epos/Generated.inc +corsika/modules/fluka/Generated.inc +corsika/modules/qgsjetII/Generated.inc +corsika/modules/sibyll/Generated.inc +corsika/modules/sophia/Generated.inc +conan_cmake/ +corsika-cmake.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c0591c65b111f8151f629932a4d68df86abd80ae..7bf86f03fb0d762f48174d710b757637e7fde617 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -102,10 +102,11 @@ check-python-quality: tags: - corsika script: + - pip3 install conan --upgrade --user - mkdir -p ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build - - ${CI_PROJECT_DIR}/conan-install.sh - - cmake .. -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 + - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d + - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8" rules: - if: $CI_MERGE_REQUEST_ID - if: $CI_COMMIT_TAG @@ -141,10 +142,11 @@ config-clang-14: tags: - corsika script: + - pip3 install conan --upgrade --user - mkdir -p ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build - - ${CI_PROJECT_DIR}/conan-install.sh - - cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 + - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d + - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8" - cmake --build . -- -j4 - set -o pipefail - ctest -j4 @@ -163,6 +165,7 @@ config-clang-14: junit: - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml + # build_test for gcc build_test-u-22_04: extends: .build_test @@ -194,10 +197,11 @@ build_test-clang-14: tags: - corsika script: + - pip3 install conan --upgrade --user - mkdir -p ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build - - ${CI_PROJECT_DIR}/conan-install.sh - - cmake .. -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 + - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d + - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8" - cmake --build . -- VERBOSE=1 -j4 - set -o pipefail - ctest -j4 @@ -205,7 +209,8 @@ build_test-clang-14: - mkdir -p ${CI_PROJECT_DIR}/build/build_examples - cd ${CI_PROJECT_DIR}/build/build_examples - export corsika_DIR=${CI_PROJECT_DIR}/build/install - - cmake -DCMAKE_BUILD_TYPE=Debug ../install/share/corsika/examples + - export corsika_CONAN_DEPENDENCIES=${CI_PROJECT_DIR}/build/install/lib/cmake/dependencies + - cmake -DCMAKE_TOOLCHAIN_FILE=${corsika_CONAN_DEPENDENCIES}/conan_toolchain.cmake -DCMAKE_PREFIX_PATH=${corsika_CONAN_DEPENDENCIES} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug ../install/share/corsika/examples - cmake --build . -- -j2 - cmake --build . --target run_examples -- -j2 - export EXE=${CI_PROJECT_DIR}/build/install/bin/c8_air_shower # Run the example scripts @@ -233,7 +238,7 @@ build_test-clang-14: - ${CI_PROJECT_DIR}/build/build_examples/example_outputs/c8_air_shower_output #python examples need this - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml - ${CI_PROJECT_DIR}/build/CMakeCache.txt #python tests need this - - ${CI_PROJECT_DIR}/build/bin #python tests need this + - ${CI_PROJECT_DIR}/build #/bin #python tests need this # build_test_example for gcc build_test_example-u-22_04: @@ -267,19 +272,22 @@ build_test_example-clang-14: tags: - corsika script: + - pip3 install conan --upgrade --user - mkdir -p ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build - - ${CI_PROJECT_DIR}/conan-install.sh - - cmake .. -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DCMAKE_BUILD_TYPE=Release -DUSE_Pythia8_C8=C8 + - ${CI_PROJECT_DIR}/conan-install.sh -s .. -r + - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8" - cmake --build . -- -j4 - set -o pipefail - ctest -j4 - cmake --install . - mkdir -p ${CI_PROJECT_DIR}/build/build_examples - cd ${CI_PROJECT_DIR}/build/build_examples - - cmake -DCMAKE_BUILD_TYPE=Release ${CI_PROJECT_DIR}/build/install/share/corsika/examples - - cmake --build . -- VERBOSE=1 -j2 - - cmake --build . --target run_examples -- -j2 + - export corsika_DIR=${CI_PROJECT_DIR}/build/install + - export corsika_CONAN_DEPENDENCIES=${CI_PROJECT_DIR}/build/install/lib/cmake/dependencies + - cmake -DCMAKE_TOOLCHAIN_FILE=${corsika_CONAN_DEPENDENCIES}/conan_toolchain.cmake -DCMAKE_PREFIX_PATH=${corsika_CONAN_DEPENDENCIES} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release ../install/share/corsika/examples + - cmake --build . -- VERBOSE=1 -j4 + - cmake --build . --target run_examples -- -j4 rules: - if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for Code Review/' # run on merge requests, if label 'Ready for Code Review' is set - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH @@ -300,6 +308,7 @@ build_test_example-clang-14: paths: - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml + # release for gcc release-full-u-22_04: extends: .release @@ -335,10 +344,11 @@ coverage: tags: - corsika script: + - pip3 install conan --upgrade --user - mkdir -p ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build - - ${CI_PROJECT_DIR}/conan-install.sh - - cmake .. -DCMAKE_BUILD_TYPE=Coverage -DUSE_Pythia8_C8=C8 + - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d + - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCOVERAGE_BUILD=True -DUSE_Pythia8_C8=C8" - cmake --build . -- -j4 - ctest -j4 - cmake --build . --target coverage @@ -378,10 +388,11 @@ sanity: tags: - corsika script: + - pip3 install conan --upgrade --user - mkdir -p ${CI_PROJECT_DIR}/build - cd ${CI_PROJECT_DIR}/build - - ${CI_PROJECT_DIR}/conan-install.sh - - cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8 + - ${CI_PROJECT_DIR}/conan-install.sh -s .. -d + - ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DWITH_CORSIKA_SANITIZERS_ENABLED=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8" - cmake --build . -- -j4 rules: - if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for Code Review/' # run on merge requests, if label 'Ready for Code Review' is set diff --git a/.gitmodules b/.gitmodules index 5abc7c480624b6b7a5a5f88b29be25d3713945a2..62dc61c1d98043956bf1f4639262afd93de92398 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +1,10 @@ [submodule "modules/data"] path = modules/data url = ../../AirShowerPhysics/corsika-data.git + branch = master shallow = true [submodule "modules/conex"] path = modules/conex/cxroot url = ../../AirShowerPhysics/cxroot.git + branch = master shallow = true diff --git a/CMakeLists.txt b/CMakeLists.txt index 301b18dc25840e065081e1a1b21e5fe073736978..d689c3417f3aa16435034afb152d818b1e4c5c24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,13 @@ endif () # cmake path dir, and cmake config # set (CORSIKA8_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake") + set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH}) + +if(DEFINED CONAN_CMAKE_DIR) + list(APPEND CMAKE_MODULE_PATH "${CONAN_CMAKE_DIR}") +endif(DEFINED CONAN_CMAKE_DIR) + set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be done with `make VERBOSE=1` # ignore many irrelevant Up-to-date messages during install set (CMAKE_INSTALL_MESSAGE LAZY) @@ -111,8 +117,7 @@ add_compile_options ( # Setup external dependencies. # ### -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) + # # add cnpy temporarily. As long as SaveBoostHistogram does not save to parquet directly @@ -123,7 +128,15 @@ add_subdirectory (externals/cnpy) # Coverage # # targets and settings needed to generate coverage reports -if (CMAKE_BUILD_TYPE STREQUAL Coverage) +#if (CMAKE_BUILD_TYPE STREQUAL Coverage) + +SET(COVERAGE_BUILD OFF CACHE BOOL "Activate coverage build") + +if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug")) + + + message(INFO "\n|==========> COVERAGE TARGET ACTIVATED.\n") + find_package (Perl REQUIRED) # compile coverage under -O0 to avoid any optimization, function elimation etc. @@ -173,6 +186,7 @@ if (CMAKE_BUILD_TYPE STREQUAL Coverage) DEPENDS coverage.info ) add_custom_target (coverage DEPENDS coverage-report) + endif () #+++++++++++++++++++++++++++++ @@ -211,13 +225,14 @@ set (public_CORSIKA8_targets CORSIKA8) # CORSIKA8 # add_library (CORSIKA8 INTERFACE) + set_target_properties ( CORSIKA8 PROPERTIES INTERFACE_CORSIKA8_MAJOR_VERSION 0 COMPATIBLE_INTERFACE_STRING CORSIKA8_MAJOR_VERSION ) -# + target_include_directories ( CORSIKA8 INTERFACE @@ -225,17 +240,31 @@ target_include_directories ( $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}> $<INSTALL_INTERFACE:include> ) + # since CORSIKA8 is a header only library we must specify all link dependencies here: + +find_package(Boost COMPONENTS filesystem REQUIRED) +find_package(CLI11 REQUIRED) +find_package(Eigen3 REQUIRED) +find_package(spdlog REQUIRED) +find_package(yaml-cpp REQUIRED) +find_package(Arrow REQUIRED) +find_package(PROPOSAL REQUIRED) +find_package(BZip2 REQUIRED) +find_package(Catch2 REQUIRED) + target_link_libraries ( CORSIKA8 INTERFACE - CONAN_PKG::proposal - CONAN_PKG::eigen - CONAN_PKG::spdlog - CONAN_PKG::boost - CONAN_PKG::yaml-cpp - CONAN_PKG::arrow - CONAN_PKG::cli11 + ZLIB::ZLIB + BZip2::BZip2 + Boost::filesystem + CLI11::CLI11 + Eigen3::Eigen + spdlog::spdlog + yaml-cpp::yaml-cpp + Parquet::parquet_static + PROPOSAL::PROPOSAL cnpy # for SaveBoostHistogram ) @@ -312,6 +341,12 @@ install ( NAMESPACE CORSIKA8:: DESTINATION lib/cmake/corsika ) + if(DEFINED CONAN_CMAKE_DIR) + install ( + DIRECTORY conan_cmake/ + DESTINATION lib/cmake/dependencies + ) + endif(DEFINED CONAN_CMAKE_DIR) # # config for build tree (for find_package) # @@ -362,8 +397,6 @@ configure_file ( # install ( FILES - ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake - ${CMAKE_BINARY_DIR}/conaninfo.txt ${CMAKE_BINARY_DIR}/corsikaDefines.cmake ${CMAKE_BINARY_DIR}/corsikaConfigVersion.cmake DESTINATION lib/cmake/corsika diff --git a/README.md b/README.md index 76dd332112e43694ccbf1398f150bc5625634e93..f05a327d9b49ff535351d3fb9020b7dc45fb624b 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ CORSIKA 8 is tested regularly at least on `gcc11.0.0` and `clang-14.0.0`. You will also need: - Python 3 (supported versions are Python >= 3.6), with pip -- conan (via pip) +- conan (via pip, with version higher than 2.0) - cmake > 3.4 - git - g++, gfortran, binutils, make @@ -96,7 +96,7 @@ manage our dependencies. Currently, version 1.57.0 or higher is required. **Note**: if you are NOT using a virtual environment, you may want to use the `pip install --user` flag. ``` shell -pip install conan~=1.57.0 +pip install conan ``` ### Compiling @@ -109,8 +109,9 @@ git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git # Or for https: git clone --recursive git@gitlab.iap.kit.edu:AirShowerPhysics/corsika.git mkdir corsika-build cd corsika-build -../corsika/conan-install.sh -cmake ../corsika -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=../corsika-install +../corsika/conan-install.sh --source-directory ../corsika --release-with-debug +# conan-install.sh takes required options from command line to install dependencies for 'Debug', 'Release' and 'RelWithDebInfo' builds. +../corsika/corsika-cmake.sh -c "-DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=../corsika-install" make -j4 #The number should match the number of available cores on your machine make install ``` @@ -155,8 +156,9 @@ git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git sudo docker run -v $PWD:/corsika -it corsika/devel:clang-8 /bin/bash mkdir build cd build -../corsika/conan-install.sh -cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install +../corsika/conan-install.sh --source-directory ../corsika --release-with-debug +# conan-install.sh takes required options from command line to install dependencies for 'Debug', 'Release' and 'RelWithDebInfo' builds. +../corsika/corsika-cmake.sh -c "-DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=../corsika-install" make -j4 #The number should match the number of available cores on your machine make install ``` diff --git a/cmake/corsikaConfig.cmake.in b/cmake/corsikaConfig.cmake.in index 03c2a194eeb77a276947f704d94dd6b256e4dd7b..d8e0bb894beeef04788075dd88a5f94d26829765 100644 --- a/cmake/corsikaConfig.cmake.in +++ b/cmake/corsikaConfig.cmake.in @@ -30,12 +30,6 @@ set (CMAKE_CXX_EXTENSIONS @CMAKE_CXX_EXTENSIONS@) set (COMPILE_OPTIONS @COMPILE_OPTIONS@) set (CMAKE_VERBOSE_MAKEFILE @CMAKE_VERBOSE_MAKEFILE@) -#+++++++++++++++++++++++++++++ -# Setup external dependencies via conan -# -include (${CMAKE_CURRENT_LIST_DIR}/conanbuildinfo.cmake) -conan_basic_setup (TARGETS) - #+++++++++++++++++++++++++++++ # Import Pythia8 # since we always import pythia (ExternalProject_Add) we have to diff --git a/cmake/corsikaUtilities.cmake b/cmake/corsikaUtilities.cmake index cf8f1ef681a13f6545b613966f9f47f576e5d918..d9fd9f2e8b18f819920a25de5b03fbc4f424ef05 100644 --- a/cmake/corsikaUtilities.cmake +++ b/cmake/corsikaUtilities.cmake @@ -55,9 +55,10 @@ function (CORSIKA_ADD_TEST) else () set(sanitize ${C8_ADD_TEST_SANITIZE}) endif () - + + find_package(Catch2 REQUIRED) add_executable (${name} ${sources}) - target_link_libraries (${name} CORSIKA8 CONAN_PKG::catch2 CorsikaTestingCommon) + target_link_libraries (${name} CORSIKA8 Catch2::Catch2WithMain CorsikaTestingCommon) target_compile_options (${name} PRIVATE -g) # do not skip asserts target_include_directories (${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_outputs/) diff --git a/conan-install.sh b/conan-install.sh index 4298c1d0ebd8967ade8d8d0ebd79d17fe3e32253..5331b1096324edae2f0270ea094e276265457140 100755 --- a/conan-install.sh +++ b/conan-install.sh @@ -1,35 +1,245 @@ -#! /bin/sh +#!/bin/bash -DIR=$(readlink -f $(dirname $0)) -if [ $# -eq 0 ]; then - # no arguments passed, target is current working dir - target_dir="$PWD" -elif [ $# -eq 1 ]; then - # target is provided directory - target_dir="$1" -else - echo "usage: conan-install.sh [directory]" >&2 +function show_usage(){ + printf "\n\nUsage:" + printf "$0 options [parameters]\n" + printf "\n" + printf "Options:\n" + printf "\n -s or --source-directory:\n Corsika 8 download directory, which contains the 'conanfile.py' recipe. Default is the current directory." + printf "\n -d or --debug:\n Specify 'Debug' as build type for the installed dependences. This should be matched when building CORSIKA 8." + printf "\n -r or --release:\n Specify 'Release' as build type for the installed dependences. This should be matched when building CORSIKA 8." + printf "\n -rd or --release-with-debug:\n Specify 'RelWithDebInfo' as build type for the installed dependences. This should be matched when building CORSIKA 8." + printf "\n\nExample: ./conan-install.sh --source-directory /some_path/corsika --debug" + printf "\n -h or --help:\n Prints this message.\n" + +exit 0 +} + +echo "|---------------------------------------------------|" +echo "|-----------------[ CORSIKA 8 ]---------------------|" +echo "|-----[ CONAN2 DEPENDENCIES INSTALL SCRIPT ]------- |" +echo "|---------------------------------------------------|" +echo "|-------------------- BEGIN ------------------------| " + +echo " " + +SOURCE=${BASH_SOURCE[0]} +while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) + SOURCE=$(readlink "$SOURCE") + [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done + +SCRIPT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) + +BUILD_TYPE="RelWithDebInfo" +CORSIKA_DIR=${CURRENT_DIR} +CORSIKA_DIR_INFORMED=${CURRENT_DIR} +CONAN2_OUTPUT_FOLDER_NAME="conan_cmake" + +printf "[ conan-install | info > This script is located at the directory: ${SCRIPT_DIR}\n" + + + +if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]];then + show_usage +fi + +while [ ! -z "$1" ]; do + case "$1" in + --source-directory|-s) + shift + CORSIKA_DIR=$(readlink -e ${1}) + CORSIKA_DIR_INFORMED=${1} + ;; + --debug|-d) + #shift + BUILD_TYPE="Debug" + ;; + --release|-r) + #shift + BUILD_TYPE="Release" + ;; + --release-with-debug|-rd) + #shift + BUILD_TYPE="RelWithDebInfo" + ;; + --help|-h) + #shift + show_usage + ;; + *) + show_usage + ;; + esac +if [ $# -gt 0 ]; then +shift +fi +done + +if [[ ${#CORSIKA_DIR} -eq 0 ]]; then + printf "[ conan-install | warning > Output folder for cmake scripts generated by conan2 not found.\n" + printf "[ conan-install | warning > Directory '${CORSIKA_DIR_INFORMED}' does not exist.\n" exit 1 fi -echo "using `conan --version`" -if ! conan profile show corsika8 >/dev/null 2>/dev/null; then - conan profile new --detect corsika8 - conan profile update settings.compiler.cppstd=17 corsika8 - if [ "$(uname)" = "Linux" ]; then - conan profile update settings.compiler.libcxx=libstdc++11 corsika8 - fi +if [ -d "${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}" ]; then + printf "[ conan-install | info > Output folder for cmake scripts generated by conan2 is: ${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}\n" +else + printf "[ conan-install | warning > Output folder for cmake scripts generated by conan2 not found.\n" + printf "[ conan-install | warning > Creating directory ${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}.\n" + mkdir -p "${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}" fi -mkdir -p "$target_dir" || exit 2 -cd "$target_dir" || exit 3 +if [ -f "${CORSIKA_DIR}/conanfile.py" ]; then + printf "[ conan-install | info > conan2 recipe: ${CORSIKA_DIR}/conanfile.py\n" +else + printf "[ conan-install | warning > conan2 recipe not found.\n" + printf "[ conan-install | warning > File '${CORSIKA_DIR}/conanfile.py' does not exist.\n" + exit 1 +fi + +# Conan2 variabes +CONAN2_HOME=$(readlink -e `conan config home`) +CONAN2_PROFILE_NAME="corsika8" +printf "[ conan-install | info > conan2 home: ${CONAN2_HOME}\n" + +# Conan2 commands +CONAN2_DEFAULT_PROFILE_COMMAND="conan profile detect --force" +CONAN2_PROFILE_COMMAND="conan profile detect --name ${CONAN2_PROFILE_NAME} --force" +CONAN2_INSTALL_COMMAND="conan install ${CORSIKA_DIR} --output-folder=${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME} --build=missing --settings=build_type=${BUILD_TYPE} --profile=${CONAN2_PROFILE_NAME}" +CONAN2_SHOW_PROFLE_COMMAND="conan profile show -pr ${CONAN2_PROFILE_NAME}" + +printf "[ conan-install | info > Creating default profile...\n\n" +eval $CONAN2_DEFAULT_PROFILE_COMMAND +if [ ! $? -eq 0 ]; then + printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${CONAN2_DEFAULT_PROFILE_COMMAND}.\n" + exit 126 +fi + +printf "[ conan-install | info > Creating '${CONAN2_PROFILE_NAME}' profile...\n\n" +eval $CONAN2_PROFILE_COMMAND +if [ ! $? -eq 0 ]; then + printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${CONAN2_PROFILE_COMMAND}.\n" + exit 126 +fi + +printf "\n\n[ conan-install | info > Editing '${CONAN2_PROFILE_NAME}' profile\n" +#========== cppstd setting ============ +STD_NUMBER=`grep -n -m 1 "compiler.cppstd=" ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME} | cut -d: -f1` +SED_STD_COMMAND="sed -i '${STD_NUMBER}s/.*/compiler.cppstd=gnu17/' ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME}" +eval $SED_STD_COMMAND +if [ ! $? -eq 0 ]; then + printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${SED_STD_COMMAND}\n" + exit 126 +fi -if [ "${CI_JOB_ID}" ]; then - # Temporary fix for the CI which has a broken arrow install - conan remove -f arrow +#========== libcxx setting ============ +CXX_NUMBER=`grep -n -m 1 "compiler.libcxx=" ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME} | cut -d: -f1` +SED_CXX_COMMAND="sed -i '${CXX_NUMBER}s/.*/compiler.libcxx=libstdc++11/' ${CONAN2_HOME}/profiles/${CONAN2_PROFILE_NAME}" + +eval $SED_CXX_COMMAND +if [ ! $? -eq 0 ]; then + printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${SED_CXX_COMMAND}\n" + exit 126 +fi + +eval $CONAN2_SHOW_PROFLE_COMMAND +if [ ! $? -eq 0 ]; then + printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${CONAN2_SHOW_PROFLE_COMMAND}\n" + exit 126 +fi + +printf "[ conan-install | info > ${CONAN2_INSTALL_COMMAND}\n" + +eval ${CONAN2_INSTALL_COMMAND} +if [ ! $? -eq 0 ]; then + printf "[ conan-install | error > Exit code 126 (Command invoked cannot execute):\n ${CONAN2_INSTALL_COMMAND}\n" + exit 126 +fi + +CORSIKA_CMAKE_SCRIPT="#!/bin/bash + + +function show_usage(){ + printf \"\n\nUsage:\" + printf \"\$0 options [parameters]\n\" + printf \"\n\" + printf \"Options:\n\" + printf \"\n -c or --cmake-flags:\n Additional flags and settings to cmake base command. Default is empty string.\" + printf \"\n\nExample: ./corsika-cmake.sh --cmake-flags '-DUSE_Pythia8_C8=C8' \" + printf \"\n\nNote: the source directory (the one containing CMakeLists.txt), CMAKE_BUILD_TYPE, CMAKE_POLICY_DEFAULT_CMP0091 and CMAKE_TOOLCHAIN_FILE are already set. Do not repeat them.\" + printf \"\n -h or --help:\n Prints this message.\n\" + +exit 0 +} + +echo \"|---------------------------------------------------|\" +echo \"|-----------------[ CORSIKA 8 ]---------------------|\" +echo \"|----------[ CMAKE CONFIGURATION SCRIPT ]---------- |\" +echo \"|---------------------------------------------------|\" +echo \"|-------------------- BEGIN ------------------------|\" + +CMAKE_BASE_SETTINGS=\"cmake -S ${CORSIKA_DIR} -D CONAN_CMAKE_DIR=${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME} -D CMAKE_TOOLCHAIN_FILE=${CORSIKA_DIR}/${CONAN2_OUTPUT_FOLDER_NAME}/conan_toolchain.cmake -D CMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=${BUILD_TYPE}\" +CMAKE_ADDITIONAL_SETTINGS=\"\" + +if [[ \"\$1\" == \"--help\" ]] || [[ \"\$1\" == \"-h\" ]];then + show_usage fi -conan install -pr corsika8 --build=missing "${DIR}" + +while [ ! -z \"\$1\" ]; do + case \"\$1\" in + --cmake-flags|-c) + shift + CMAKE_ADDITIONAL_SETTINGS=\${1} + ;; + --help|-h) + #shift + show_usage + ;; + *) + show_usage + ;; + esac +if [ \$# -gt 0 ]; then +shift +fi +done + +printf \"[corsika-cmake | info > Issuing CMake command :\n\" +printf '[corsika-cmake | info > \e[1;36m%s\e[0m\n\n\n' \"\${CMAKE_BASE_SETTINGS} \${CMAKE_ADDITIONAL_SETTINGS}\" + +eval \"\${CMAKE_BASE_SETTINGS} \${CMAKE_ADDITIONAL_SETTINGS}\" + +if [ ! \$? -eq 0 ]; then + printf \"[ corsika | error > Project configuration (CMake) failed. \n\" + exit 1 +fi + +echo \"|---------------------------------------------------|\" +echo \"|-----------------[ CORSIKA 8 ]---------------------|\" +echo \"|----------[ CMAKE CONFIGURATION SCRIPT ]---------- |\" +echo \"|---------------------------------------------------|\" +echo \"|-------------------- END --------------------------|\" +" + +printf "%s" "${CORSIKA_CMAKE_SCRIPT}" > ${SCRIPT_DIR}/corsika-cmake.sh +chmod +x ${SCRIPT_DIR}/corsika-cmake.sh + +printf "\n\n[ conan-install | info > Copy and paste the commands below in the corsika-build directory:\n\n" +printf '\e[1;36m%s\e[0m\n' "> ${SCRIPT_DIR}/corsika-cmake.sh " +printf '\e[1;36m%s\e[0m\n' "> make -j8" + +echo " " +echo "|---------------------------------------------------|" +echo "|-----------------[ CORSIKA 8 ]---------------------|" +echo "|-----[ CONAN2 DEPENDENCIES INSTALL SCRIPT ]------- |" +echo "|---------------------------------------------------|" +echo "|-------------------- END --------------------------| " +echo " " + +exit 0 diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000000000000000000000000000000000000..1a1f5d83fe795b00e8f1e0d8e561a899ebc9171e --- /dev/null +++ b/conanfile.py @@ -0,0 +1,77 @@ +from conan import ConanFile +from conan.tools.cmake import cmake_layout,CMakeToolchain, CMakeDeps + +class Pkg(ConanFile): + generators = "CMakeDeps", #"CMakeToolchain", + settings = "os", "arch", "compiler", "build_type" + default_options = { + 'readline*:shared': 'True', + 'arrow*:shared': 'False', + 'arrow*:parquet': 'True', + 'arrow*:fPIC': 'False', + 'arrow*:with_re2': 'True', + 'arrow*:with_protobuf': 'False', + 'arrow*:with_openssl': 'False', + 'arrow*:with_gflags': 'False', + 'arrow*:with_glog': 'False', + 'arrow*:with_grpc': 'False', + 'arrow*:with_utf8proc': 'False', + 'arrow*:with_zstd': 'False', + 'arrow*:with_bz2': 'False', + 'arrow*:with_thrift': 'True', + 'arrow*:with_boost': 'True', + 'boost*:without_container': 'True', + 'boost*:without_context': 'True', + 'boost*:without_contract': 'True', + 'boost*:without_coroutine': 'True', + 'boost*:without_date_time': 'True', + 'boost*:without_fiber': 'True', + 'boost*:without_filesystem': 'False', + 'boost*:without_graph': 'True', + 'boost*:without_graph_parallel': 'True', + 'boost*:without_iostreams': 'False', + 'boost*:without_json': 'True', + 'boost*:without_locale': 'True', + 'boost*:without_log': 'True', + 'boost*:without_math': 'False', + 'boost*:without_mpi': 'True', + 'boost*:without_nowide': 'True', + 'boost*:without_program_options': 'True', + 'boost*:without_python': 'True', + 'boost*:without_serialization': 'False', + 'boost*:without_stacktrace': 'True', + 'boost*:without_system': 'False', + 'boost*:without_test': 'True', + 'boost*:without_thread': 'True', + 'boost*:without_timer': 'True', + 'boost*:without_type_erasure': 'True', + 'boost*:without_wave': 'True' +} + + def configure(self): + self.options['arrow'].with_boost = True + self.options['arrow'].parquet = True + self.options['arrow'].with_thrift = True + + def requirements(self): + self.requires("spdlog/1.14.1", force=True) + self.requires("catch2/3.6.0") + self.requires("bzip2/1.0.8") + self.requires("boost/1.85.0", force=True) + self.requires("eigen/3.4.0") + self.requires("zlib/1.3.1") + self.requires("yaml-cpp/0.8.0") + self.requires("cli11/1.9.1") + self.requires("arrow/16.1.0") + self.requires("proposal/7.6.2") + + def build_requirements(self): + self.tool_requires("readline/8.0") + self.tool_requires("bison/[>1.0]") + + def generate(self): + tc = CMakeToolchain(self) + tc.absolute_paths = True + tc.generate() + + diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index b2bcdd82698b11502a653da6c6f84eeef1adce16..0000000000000000000000000000000000000000 --- a/conanfile.txt +++ /dev/null @@ -1,61 +0,0 @@ -[requires] -spdlog/1.9.2 -catch2/2.13.8 -eigen/3.3.8 -boost/1.78.0 -zlib/1.2.13 -proposal/7.6.2 -yaml-cpp/0.7.0 -arrow/10.0.0 -cli11/1.9.1 - -[build_requires] -readline/8.0 # this is only needed to fix a missing dependency in "bison" which is pulled-in by arrow -bison/[>1.0] # needed for arrow, and we HAVE to compile it - -[generators] -cmake - -[options] -readline:shared=True -arrow:shared=False -arrow:parquet=True -arrow:fPIC=False -arrow:with_boost=True -arrow:with_re2=True -arrow:with_protobuf=False -arrow:with_openssl=False -arrow:with_gflags=False -arrow:with_glog=False -arrow:with_grpc=False -arrow:with_utf8proc=False -arrow:with_zstd=False -arrow:with_bz2=False -arrow:with_thrift=True - -boost:without_container=True -boost:without_context=True -boost:without_contract=True -boost:without_coroutine=True -boost:without_date_time=True -boost:without_fiber=True -boost:without_filesystem=False -boost:without_graph=True -boost:without_graph_parallel=True -boost:without_iostreams=False -boost:without_json=True -boost:without_locale=True -boost:without_log=True -boost:without_math=False -boost:without_mpi=True -boost:without_nowide=True -boost:without_program_options=True -boost:without_python=True -boost:without_serialization=False -boost:without_stacktrace=True -boost:without_system=False -boost:without_test=False -boost:without_thread=True -boost:without_timer=True -boost:without_type_erasure=True -boost:without_wave=True diff --git a/corsika/detail/framework/core/SpdlogSpecializations.inl b/corsika/detail/framework/core/SpdlogSpecializations.inl new file mode 100644 index 0000000000000000000000000000000000000000..5be155144f490a0b08c7477a17b77fe31505d25e --- /dev/null +++ b/corsika/detail/framework/core/SpdlogSpecializations.inl @@ -0,0 +1,91 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + +#pragma once + +#include <fmt/format.h> +#include <corsika/framework/core/ParticleProperties.hpp> +#include <boost/filesystem/path.hpp> +#include <corsika/framework/core/PhysicalUnits.hpp> +#include <Eigen/Dense> + +//----------------------------------- +// STD +//----------------------------------- +namespace std { + + auto inline format_as(std::_Put_time<char> const& arg) { + std::ostringstream os; + os << arg; + return os.str(); + } + +} // namespace std + +//----------------------------------- +// CORSIKA +//----------------------------------- +namespace corsika { + + // formatters for particle codes declared on ParticleProperties.hpp + auto inline format_as(Code code) { return fmt::underlying(code); } + auto inline format_as(PDGCode code) { return fmt::underlying(code); } + + template <typename Type> + auto inline format_as(Type const& arg) { + std::ostringstream os; + os << arg; + return os.str(); + } + +} // namespace corsika + +//----------------------------------- +// boost::filesystem +//----------------------------------- +namespace boost::filesystem { + + auto inline format_as(path const& fname) { return fname.string().c_str(); } + +} // namespace boost::filesystem + +//----------------------------------- +// phys::units +//----------------------------------- +namespace phys::units { + + template <typename Dimensions> + auto inline format_as(phys::units::quantity<Dimensions> const& arg) { + + return io::to_string(arg); + } + +} // namespace phys::units + +//---------------------------------- +// Eigen +//---------------------------------- +namespace Eigen { + + template <typename Scalar, int M, int N> + auto inline format_as(Matrix<Scalar, M, N> const& arg) { + + std::ostringstream os; + os << arg; + return os.str(); + } + + template <typename Matrix1, typename Matrix2> + auto inline format_as(Product<Matrix1, Matrix2> const& arg) { + + std::ostringstream os; + os << arg; + return os.str(); + } + +} // namespace Eigen diff --git a/corsika/framework/core/Logging.hpp b/corsika/framework/core/Logging.hpp index dd58cc538a1a70a1e3909f994de74e815c32fcab..d67be36218c377edc64da478ac1e40fd255d54a5 100644 --- a/corsika/framework/core/Logging.hpp +++ b/corsika/framework/core/Logging.hpp @@ -22,23 +22,31 @@ // use the coarse system clock. This is *much* faster // but introduces a timestamp error of O(10 ms) which is fine for us. +#ifndef SPDLOG_CLOCK_COARSE #define SPDLOG_CLOCK_COARSE - +#endif // do not create a default logger (we provide our own "corsika" logger) +#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER #define SPDLOG_DISABLE_DEFAULT_LOGGER - +#endif // use __PRETTY_FUNCTION__ instead of __FUNCTION__ where // printing function names in trace statements. This is much // nicer than __FUNCTION__ under GCC/clang. +#ifndef SPDLOG_FUNCTION #define SPDLOG_FUNCTION __PRETTY_FUNCTION__ +#endif // if this is a Debug build, include debug messages in objects #ifdef _C8_DEBUG_ // trace is the highest level of logging (ALL messages will be printed) +#ifndef SPDLOG_ACTIVE_LEVEL #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE +#endif #else // otherwise, remove everything but "error" and worse messages +#ifndef SPDLOG_ACTIVE_LEVEL #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG #endif +#endif #include <spdlog/fmt/ostr.h> // will output whenerver a streaming operator is found #include <spdlog/sinks/stdout_color_sinks.h> @@ -149,3 +157,4 @@ namespace corsika { } // namespace corsika #include <corsika/detail/framework/core/Logging.inl> +#include <corsika/detail/framework/core/SpdlogSpecializations.inl> diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp index a07e93d55b9b95034e67ba8d5ecbe7c2af293c7f..c6f81f59fe725b40bb5da4e88bef5b5fd0064756 100644 --- a/corsika/framework/core/ParticleProperties.hpp +++ b/corsika/framework/core/ParticleProperties.hpp @@ -82,15 +82,14 @@ namespace corsika { * * The Code enum is the actual place to define CORSIKA 8 particle codes. */ - enum class Code : int32_t; + enum class Code : std::int32_t; /** * @enum PDGCode * * Specifically for PDG ids. */ - enum class PDGCode : int32_t; - + enum class PDGCode : std::int32_t; /** * Internal integer type for enum Code. */ diff --git a/corsika/modules/PROPOSAL.hpp b/corsika/modules/PROPOSAL.hpp index 81066911f66f9979f3ebfed7999d0cb07cd6b2ee..2556b847d1f7b91eea79b21a420a54a86e191b50 100644 --- a/corsika/modules/PROPOSAL.hpp +++ b/corsika/modules/PROPOSAL.hpp @@ -10,6 +10,7 @@ #include <corsika/modules/proposal/InteractionModel.hpp> #include <corsika/modules/proposal/ContinuousProcess.hpp> +#include <fmt/format.h> namespace corsika::proposal { @@ -25,3 +26,13 @@ namespace corsika::proposal { thr) {} }; } // namespace corsika::proposal + +//---------------------------------- +// SPDLOG PROPOSAL +//---------------------------------- + +namespace PROPOSAL { + + auto format_as(InteractionType code) { return fmt::underlying(code); } + +} // namespace PROPOSAL diff --git a/corsika/modules/sophia/SophiaStack.hpp b/corsika/modules/sophia/SophiaStack.hpp index 7b3a9235f58706400877fe7fa527215bb428cda7..100c75964d05ef30c36f8a088c013b5b6220bf14 100644 --- a/corsika/modules/sophia/SophiaStack.hpp +++ b/corsika/modules/sophia/SophiaStack.hpp @@ -13,6 +13,7 @@ #include <corsika/framework/geometry/Vector.hpp> #include <corsika/framework/stack/Stack.hpp> #include <corsika/modules/sophia/ParticleConversion.hpp> +#include <fmt/format.h> #include <sophia.hpp> @@ -123,4 +124,6 @@ namespace corsika::sophia { typedef corsika::Stack<SophiaStackData, ParticleInterface> SophiaStack; + auto inline format_as(SophiaCode code) { return fmt::underlying(code); } + } // namespace corsika::sophia diff --git a/corsika/modules/tauola/Decay.hpp b/corsika/modules/tauola/Decay.hpp index eda4f74aa7f96679f2c5a308669e3b9056b38bb2..bc46b3524233f287931e70406a252db989a37fe5 100644 --- a/corsika/modules/tauola/Decay.hpp +++ b/corsika/modules/tauola/Decay.hpp @@ -20,6 +20,8 @@ namespace corsika::tauola { */ enum class Helicity { LeftHanded, Unpolarized, RightHanded }; + auto inline format_as(Helicity code) { return fmt::underlying(code); } + /** * An interface to TAUOLA to simulate tau lepton decays. * diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 614bfb9bc25ab1a8b4ecf1308f362e3fdbe5af7c..e7acbc55fa385eea308e7068efefcf3726fc04ca 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -9,34 +9,46 @@ find_package (corsika CONFIG REQUIRED) # this is only for CORSIKA_REGISTER_EXAMPLE include ("${CMAKE_CURRENT_SOURCE_DIR}/corsikaExamples.cmake") +find_package(Catch2) +find_package(yaml-cpp) +find_package(CLI11) +find_package(Arrow) +find_package(PROPOSAL) +find_package(Boost) +find_package(ZLIB) +find_package(BZip2) +find_package(Eigen3) +find_package(spdlog) + +set(CONANDEPS Catch2::Catch2WithMain yaml-cpp::yaml-cpp CLI11::CLI11 arrow::arrow PROPOSAL::PROPOSAL boost::boost ZLIB::ZLIB BZip2::BZip2 Eigen3::Eigen spdlog::spdlog ) ################### ## cascade_examples ################### add_executable (em_shower cascade_examples/em_shower.cpp) -target_link_libraries (em_shower CORSIKA8::CORSIKA8) +target_link_libraries (em_shower CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (em_shower RUN_OPTIONS 100 8472) if (WITH_FLUKA) add_executable (mars cascade_examples/mars.cpp) - target_link_libraries (mars CORSIKA8::CORSIKA8) + target_link_libraries (mars CORSIKA8::CORSIKA8 ${CONANDEPS}) message("FLUKA found, will make 'mars' example") else() message("FLUKA not found, will not make 'mars' example") endif() add_executable (mc_conex cascade_examples/mc_conex.cpp) -target_link_libraries (mc_conex CORSIKA8::CORSIKA8) +target_link_libraries (mc_conex CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (mc_conex RUN_OPTIONS 4 2 10000.) add_executable (radio_em_shower cascade_examples/radio_em_shower.cpp) -target_link_libraries (radio_em_shower CORSIKA8::CORSIKA8) +target_link_libraries (radio_em_shower CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (radio_em_shower RUN_OPTIONS 10 1121673489) if (WITH_FLUKA) add_executable (water cascade_examples/water.cpp) - target_link_libraries (water CORSIKA8::CORSIKA8) + target_link_libraries (water CORSIKA8::CORSIKA8 ${CONANDEPS}) message("FLUKA found, will make 'water' example") else() message("FLUKA not found, will not make 'water' example") @@ -48,30 +60,30 @@ endif() ##################### add_executable (boundary_crossing framework_examples/boundary_crossing.cpp) -target_link_libraries (boundary_crossing CORSIKA8::CORSIKA8) +target_link_libraries (boundary_crossing CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (boundary_crossing) add_executable (environment framework_examples/environment.cpp) -target_link_libraries (environment CORSIKA8::CORSIKA8) +target_link_libraries (environment CORSIKA8::CORSIKA8 ${CONANDEPS}) add_executable (geometry framework_examples/geometry.cpp) -target_link_libraries (geometry CORSIKA8::CORSIKA8) +target_link_libraries (geometry CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (geometry) add_executable (helix_trajectory framework_examples/helix_trajectory.cpp) -target_link_libraries (helix_trajectory CORSIKA8::CORSIKA8) +target_link_libraries (helix_trajectory CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (helix_trajectory) add_executable (known_particles framework_examples/known_particles.cpp) -target_link_libraries (known_particles CORSIKA8::CORSIKA8) +target_link_libraries (known_particles CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (known_particles) add_executable (stack framework_examples/stack.cpp) -target_link_libraries (stack CORSIKA8::CORSIKA8) +target_link_libraries (stack CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (stack) add_executable (static_sequence framework_examples/static_sequence.cpp) -target_link_libraries (static_sequence CORSIKA8::CORSIKA8) +target_link_libraries (static_sequence CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (static_sequence) @@ -80,17 +92,17 @@ CORSIKA_REGISTER_EXAMPLE (static_sequence) ################### add_executable (stopping_power physics_examples/stopping_power.cpp) -target_link_libraries (stopping_power CORSIKA8::CORSIKA8) +target_link_libraries (stopping_power CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (stopping_power) add_executable (synchrotron_clover_leaf physics_examples/synchrotron_clover_leaf.cpp) -target_link_libraries (synchrotron_clover_leaf CORSIKA8::CORSIKA8) +target_link_libraries (synchrotron_clover_leaf CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (synchrotron_clover_leaf) add_executable (synchrotron_test_C8tracking physics_examples/synchrotron_test_C8tracking.cpp) -target_link_libraries (synchrotron_test_C8tracking CORSIKA8::CORSIKA8) +target_link_libraries (synchrotron_test_C8tracking CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (synchrotron_test_C8tracking) add_executable (synchrotron_test_manual_tracking physics_examples/synchrotron_test_manual_tracking.cpp) -target_link_libraries (synchrotron_test_manual_tracking CORSIKA8::CORSIKA8) +target_link_libraries (synchrotron_test_manual_tracking CORSIKA8::CORSIKA8 ${CONANDEPS}) CORSIKA_REGISTER_EXAMPLE (synchrotron_test_manual_tracking) diff --git a/examples/corsikaExamples.cmake b/examples/corsikaExamples.cmake index 398863c5c72e99f7e46b5ef142d56a534b7dc67f..8acf3ee739f9081ac5fdc95234f6883afd60b2b6 100644 --- a/examples/corsikaExamples.cmake +++ b/examples/corsikaExamples.cmake @@ -38,7 +38,7 @@ function (CORSIKA_REGISTER_EXAMPLE) endif () add_dependencies (run_examples ${name}) # just run the command as-is - set (CMD ${CMAKE_CURRENT_BINARY_DIR}/bin/${name} ${run_options}) + set (CMD ${CMAKE_CURRENT_BINARY_DIR}/${name} ${run_options}) add_custom_command (TARGET run_examples POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo "" diff --git a/externals/cnpy/CMakeLists.txt b/externals/cnpy/CMakeLists.txt index 6e60f74d79ee4a641f398a37c9f108e5c487e0e9..bf1cba9a9d6ef2f5ee548a305eafcf7c4a29f1ed 100644 --- a/externals/cnpy/CMakeLists.txt +++ b/externals/cnpy/CMakeLists.txt @@ -9,12 +9,12 @@ set ( ) add_library (cnpy STATIC ${CNPY_SOURCES}) - +find_package(ZLIB REQUIRED) # target dependencies on other libraries (also the header onlys) target_link_libraries ( cnpy PUBLIC - CONAN_PKG::zlib + ZLIB::ZLIB ) target_include_directories ( diff --git a/modules/conex/cxroot b/modules/conex/cxroot index 20589c2dac8d39ef07d0f1b46eaa3696c82f82a3..ab5f63b4ea3347f96d82a999c908af2b6475845e 160000 --- a/modules/conex/cxroot +++ b/modules/conex/cxroot @@ -1 +1 @@ -Subproject commit 20589c2dac8d39ef07d0f1b46eaa3696c82f82a3 +Subproject commit ab5f63b4ea3347f96d82a999c908af2b6475845e diff --git a/modules/data b/modules/data index 81eab5761247ecd4caa99983688e8ec86b82cf5e..252a0fe2368cbbd47206f9459a7e5a3657aacbf7 160000 --- a/modules/data +++ b/modules/data @@ -1 +1 @@ -Subproject commit 81eab5761247ecd4caa99983688e8ec86b82cf5e +Subproject commit 252a0fe2368cbbd47206f9459a7e5a3657aacbf7 diff --git a/python/tests/io/test_library.py b/python/tests/io/test_library.py index c0e0c9bebed58bcf380df460e6d691e2b11a7104..7a9b4be36a38d8a19b567c5c6f1624c07f386a5a 100644 --- a/python/tests/io/test_library.py +++ b/python/tests/io/test_library.py @@ -18,7 +18,7 @@ from corsika.io import Library from .. import build_directory -bindir = op.join(build_directory, "bin") +bindir = op.join(build_directory, "tests/output") def generate_data() -> str: diff --git a/src/framework/core/CMakeLists.txt b/src/framework/core/CMakeLists.txt index 4faa8829e543b17d6905b8dbcd4c957bfff4761f..c6e4473b72471c73de99e82e1a75a88bed9b869b 100644 --- a/src/framework/core/CMakeLists.txt +++ b/src/framework/core/CMakeLists.txt @@ -1,5 +1,6 @@ set (input_dir ${PROJECT_SOURCE_DIR}/src/framework/core) set (output_dir ${PROJECT_BINARY_DIR}/corsika/framework/core) +set (destination_dir ${PROJECT_SOURCE_DIR}/corsika/framework/core ) file (MAKE_DIRECTORY ${output_dir}) @@ -27,16 +28,18 @@ set_source_files_properties ( PROPERTIES GENERATED TRUE ) -add_custom_target (GenParticlesHeaders +add_custom_command( + OUTPUT ${destination_dir}/GeneratedParticleProperties.inc + ${destination_dir}/GeneratedParticleClasses.inc + COMMAND ${CMAKE_COMMAND} -E copy ${output_dir}/GeneratedParticleProperties.inc ${destination_dir}/GeneratedParticleProperties.inc + COMMAND ${CMAKE_COMMAND} -E copy ${output_dir}/GeneratedParticleClasses.inc ${destination_dir}/GeneratedParticleClasses.inc DEPENDS ${output_dir}/GeneratedParticleProperties.inc ${output_dir}/GeneratedParticleClasses.inc ${output_dir}/particle_db.pkl - ) -add_dependencies (CORSIKA8 GenParticlesHeaders) +) -install ( - FILES - ${output_dir}/GeneratedParticleProperties.inc - ${output_dir}/GeneratedParticleClasses.inc - DESTINATION include/corsika/framework/core +add_custom_target (GenParticlesHeaders + DEPENDS ${destination_dir}/GeneratedParticleProperties.inc + ${destination_dir}/GeneratedParticleClasses.inc ) +add_dependencies (CORSIKA8 GenParticlesHeaders) diff --git a/src/framework/core/code_generator.py b/src/framework/core/code_generator.py index f76976a5bb866200bd2908b26e692f53d4dab84c..b4e9db132788504e4f5363dc857105c49fb8bf67 100755 --- a/src/framework/core/code_generator.py +++ b/src/framework/core/code_generator.py @@ -513,6 +513,8 @@ def inc_start(): string = ('// generated by framework/core/code_generator.py\n' '// MANUAL EDITS ON OWN RISK. THEY WILL BE OVERWRITTEN. \n' '\n' + '#pragma once' + '\n' 'namespace corsika {\n' '/** @ingroup Particles \n' ' @{ \n' diff --git a/src/modules/epos/CMakeLists.txt b/src/modules/epos/CMakeLists.txt index c34857ddd0c7ae17104befc001f58408bf369c10..16f2c82b46a42a941ec9181e170c3f2aa0ee4e9b 100644 --- a/src/modules/epos/CMakeLists.txt +++ b/src/modules/epos/CMakeLists.txt @@ -1,5 +1,6 @@ set (input_dir ${PROJECT_SOURCE_DIR}/src/modules/epos) set (output_dir ${PROJECT_BINARY_DIR}/corsika/modules/epos) +set (destination_dir ${PROJECT_SOURCE_DIR}/corsika/modules/epos ) file (MAKE_DIRECTORY ${output_dir}) @@ -16,11 +17,12 @@ add_custom_command ( COMMENT "Generate conversion tables for particle codes EPOS <-> CORSIKA" VERBATIM ) + + add_custom_command( + OUTPUT ${destination_dir}/Generated.inc + COMMAND ${CMAKE_COMMAND} -E copy ${output_dir}/Generated.inc ${destination_dir}/Generated.inc + DEPENDS ${output_dir}/Generated.inc +) -add_custom_target (SourceDirLinkEpos DEPENDS ${output_dir}/Generated.inc) +add_custom_target (SourceDirLinkEpos DEPENDS ${destination_dir}/Generated.inc) add_dependencies (CORSIKA8 SourceDirLinkEpos) - -install ( - FILES ${output_dir}/Generated.inc - DESTINATION include/corsika/modules/epos - ) diff --git a/src/modules/fluka/CMakeLists.txt b/src/modules/fluka/CMakeLists.txt index 2d2d26b447c277b20da5760a7236cab69c334f5e..aafdda71cefaafe9888f8ac9945331c1910aa360 100644 --- a/src/modules/fluka/CMakeLists.txt +++ b/src/modules/fluka/CMakeLists.txt @@ -1,5 +1,6 @@ set (input_dir ${PROJECT_SOURCE_DIR}/src/modules/fluka) set (output_dir ${PROJECT_BINARY_DIR}/corsika/modules/fluka) +set (destination_dir ${PROJECT_SOURCE_DIR}/corsika/modules/fluka ) file (MAKE_DIRECTORY ${output_dir}) @@ -17,10 +18,11 @@ add_custom_command ( VERBATIM ) -add_custom_target (SourceDirLinkFLUKA DEPENDS ${output_dir}/Generated.inc) -add_dependencies (CORSIKA8 SourceDirLinkFLUKA) - -install ( - FILES ${output_dir}/Generated.inc - DESTINATION include/corsika/modules/fluka + add_custom_command( + OUTPUT ${destination_dir}/Generated.inc + COMMAND ${CMAKE_COMMAND} -E copy ${output_dir}/Generated.inc ${destination_dir}/Generated.inc + DEPENDS ${output_dir}/Generated.inc ) + +add_custom_target (SourceDirLinkFLUKA DEPENDS ${destination_dir}/Generated.inc) +add_dependencies (CORSIKA8 SourceDirLinkFLUKA) diff --git a/src/modules/qgsjetII/CMakeLists.txt b/src/modules/qgsjetII/CMakeLists.txt index d347593299e7bbafea500a5c4e809e4a2d0a1653..eab00a52d7785b57e40ceb93abbdb8015dc3ff2b 100644 --- a/src/modules/qgsjetII/CMakeLists.txt +++ b/src/modules/qgsjetII/CMakeLists.txt @@ -1,5 +1,7 @@ set (input_dir ${PROJECT_SOURCE_DIR}/src/modules/qgsjetII) set (output_dir ${PROJECT_BINARY_DIR}/corsika/modules/qgsjetII) +set (destination_dir ${PROJECT_SOURCE_DIR}/corsika/modules/qgsjetII ) + file (MAKE_DIRECTORY ${output_dir}) @@ -23,10 +25,11 @@ set_source_files_properties ( PROPERTIES GENERATED TRUE ) -add_custom_target (SourceDirLinkQgs DEPENDS ${output_dir}/Generated.inc) -add_dependencies (CORSIKA8 SourceDirLinkQgs) + add_custom_command( + OUTPUT ${destination_dir}/Generated.inc + COMMAND ${CMAKE_COMMAND} -E copy ${output_dir}/Generated.inc ${destination_dir}/Generated.inc + DEPENDS ${output_dir}/Generated.inc +) -install ( - FILES ${output_dir}/Generated.inc - DESTINATION include/corsika/modules/qgsjetII - ) +add_custom_target (SourceDirLinkQgs DEPENDS ${destination_dir}/Generated.inc) +add_dependencies (CORSIKA8 SourceDirLinkQgs) diff --git a/src/modules/sibyll/CMakeLists.txt b/src/modules/sibyll/CMakeLists.txt index 1ae19d37aa342d848f0e6f8756074361c6bfae0a..2b7f23595b08d4df8a7f6b7b06727eb311a6499c 100644 --- a/src/modules/sibyll/CMakeLists.txt +++ b/src/modules/sibyll/CMakeLists.txt @@ -1,5 +1,7 @@ set (input_dir ${PROJECT_SOURCE_DIR}/src/modules/sibyll) set (output_dir ${PROJECT_BINARY_DIR}/corsika/modules/sibyll) +set (destination_dir ${PROJECT_SOURCE_DIR}/corsika/modules/sibyll ) + file (MAKE_DIRECTORY ${output_dir}) @@ -23,10 +25,11 @@ set_source_files_properties ( PROPERTIES GENERATED TRUE ) -add_custom_target (SourceDirLinkSib DEPENDS ${output_dir}/Generated.inc) -add_dependencies (CORSIKA8 SourceDirLinkSib) +add_custom_command( + OUTPUT ${destination_dir}/Generated.inc + COMMAND ${CMAKE_COMMAND} -E copy ${output_dir}/Generated.inc ${destination_dir}/Generated.inc + DEPENDS ${output_dir}/Generated.inc +) -install ( - FILES ${output_dir}/Generated.inc - DESTINATION include/corsika/modules/sibyll - ) +add_custom_target (SourceDirLinkSib DEPENDS ${destination_dir}/Generated.inc) +add_dependencies (CORSIKA8 SourceDirLinkSib) diff --git a/src/modules/sophia/CMakeLists.txt b/src/modules/sophia/CMakeLists.txt index 9f5da49e86eb67261d606ba2d066e872964c916c..e57b3b7f0322a9e8c00691aacee4e7c3e7288cad 100644 --- a/src/modules/sophia/CMakeLists.txt +++ b/src/modules/sophia/CMakeLists.txt @@ -1,5 +1,7 @@ set (input_dir ${PROJECT_SOURCE_DIR}/src/modules/sophia) set (output_dir ${PROJECT_BINARY_DIR}/corsika/modules/sophia) +set (destination_dir ${PROJECT_SOURCE_DIR}/corsika/modules/sophia ) + file (MAKE_DIRECTORY ${output_dir}) @@ -23,10 +25,12 @@ set_source_files_properties ( PROPERTIES GENERATED TRUE ) -add_custom_target (SourceDirLinkSoph DEPENDS ${output_dir}/Generated.inc) -add_dependencies (CORSIKA8 SourceDirLinkSoph) +add_custom_command( + OUTPUT ${destination_dir}/Generated.inc + COMMAND ${CMAKE_COMMAND} -E copy ${output_dir}/Generated.inc ${destination_dir}/Generated.inc + DEPENDS ${output_dir}/Generated.inc +) -install ( - FILES ${output_dir}/Generated.inc - DESTINATION include/corsika/modules/sophia - ) + +add_custom_target (SourceDirLinkSoph DEPENDS ${destination_dir}/Generated.inc) +add_dependencies (CORSIKA8 SourceDirLinkSoph) diff --git a/tests/common/PhysicalUnitsCatch2.hpp b/tests/common/PhysicalUnitsCatch2.hpp index 3fdc58bfeb8ddb4845bbf3b760aacb9e2fef6422..70c8bafeb97ac2eeb467c3f714dfc292c6d6db12 100644 --- a/tests/common/PhysicalUnitsCatch2.hpp +++ b/tests/common/PhysicalUnitsCatch2.hpp @@ -10,7 +10,9 @@ #include <corsika/framework/core/PhysicalUnits.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> + +using Catch::Approx; namespace corsika::testing { @@ -22,7 +24,7 @@ namespace corsika::testing { * `CHECK(v.normalize().norm() == Approx(1),margin(0)) ` * **/ - inline bool operator==(DimensionlessType const a, Catch::Detail::Approx const& b) { + inline bool operator==(DimensionlessType const a, Approx const& b) { return a.magnitude() == b; } diff --git a/tests/framework/TestMain.cpp b/tests/framework/TestMain.cpp index 51532584b8e03b35d79301543ac8f80b598ba544..7aec5694577d79834fb8350f7cea321f18ce5d96 100644 --- a/tests/framework/TestMain.cpp +++ b/tests/framework/TestMain.cpp @@ -8,4 +8,4 @@ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one // cpp file -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> diff --git a/tests/framework/testCOMBoost.cpp b/tests/framework/testCOMBoost.cpp index f9542e3942c61d8430f567048e25d3f8bfd6b54a..27461645384d5aa2a428517ff411dca967acb475 100644 --- a/tests/framework/testCOMBoost.cpp +++ b/tests/framework/testCOMBoost.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/FourVector.hpp> @@ -16,6 +16,7 @@ #include <corsika/framework/utility/COMBoost.hpp> using namespace corsika; +using Catch::Approx; double constexpr absMargin = 1e-6; diff --git a/tests/framework/testCascade.cpp b/tests/framework/testCascade.cpp index 63da8381b2f93dcdf426580d202f7c3a8482e61d..5cf836c6dfec9ed5f136cd6274be267d98ac2f4f 100644 --- a/tests/framework/testCascade.cpp +++ b/tests/framework/testCascade.cpp @@ -30,12 +30,13 @@ #include <SetupTestTrajectory.hpp> #include <corsika/setup/SetupTrajectory.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; #include <limits> using namespace std; +using Catch::Approx; /** * testCascade implements an e.m. Heitler model with energy splitting diff --git a/tests/framework/testClassTimer.cpp b/tests/framework/testClassTimer.cpp index b88d2fc97a0f2c99e5100268e168b6134598ca63..70a44b7c0f46fa34304ed143f7e9a4ca93e16d8b 100644 --- a/tests/framework/testClassTimer.cpp +++ b/tests/framework/testClassTimer.cpp @@ -9,13 +9,14 @@ #include <corsika/framework/analytics/ClassTimer.hpp> #include <corsika/framework/core/Logging.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <chrono> #include <iostream> #include <thread> using namespace corsika; +using Catch::Approx; class _foo2 { public: diff --git a/tests/framework/testCombinedStack.cpp b/tests/framework/testCombinedStack.cpp index 7e86bd88b2beb540328e192969b4a6a878fed57d..7b151f188ce84fa6dcd40aa4478ac2b96252b8fe 100644 --- a/tests/framework/testCombinedStack.cpp +++ b/tests/framework/testCombinedStack.cpp @@ -19,7 +19,8 @@ #include <iomanip> #include <vector> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> +using Catch::Approx; using namespace corsika; using namespace std; diff --git a/tests/framework/testCorsikaFenv.cpp b/tests/framework/testCorsikaFenv.cpp index 030d33dfac78b92464b677b489f7f62b8fb6fa4c..d05a17514775f5bea907a76aee5322818a87ff8f 100644 --- a/tests/framework/testCorsikaFenv.cpp +++ b/tests/framework/testCorsikaFenv.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/utility/CorsikaFenv.hpp> #include <cmath> diff --git a/tests/framework/testDynamicInteractionProcess.cpp b/tests/framework/testDynamicInteractionProcess.cpp index 7c68e341babab575ce04bcf8975c09e455d5ef8f..25068565992139c108361e44dc4798eb25427c76 100644 --- a/tests/framework/testDynamicInteractionProcess.cpp +++ b/tests/framework/testDynamicInteractionProcess.cpp @@ -11,9 +11,10 @@ #include <corsika/framework/geometry/FourVector.hpp> #include <corsika/framework/geometry/CoordinateSystem.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; struct DummyStack { using stack_view_type = int&; diff --git a/tests/framework/testEnergyMomentum.cpp b/tests/framework/testEnergyMomentum.cpp index efef1a9f860566f361a664e5bfd21114b625e730..54551eaa406c3e87844a0c40d8f77622cfe2e8b8 100644 --- a/tests/framework/testEnergyMomentum.cpp +++ b/tests/framework/testEnergyMomentum.cpp @@ -6,12 +6,13 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/EnergyMomentumOperations.hpp> using namespace corsika; +using Catch::Approx; TEST_CASE("EnergyMomentumOperations") { diff --git a/tests/framework/testFourVector.cpp b/tests/framework/testFourVector.cpp index 489d6261b17d6c68f85a01dae591992cbbba6a90..0bccd4ec4b361dbe8946a0581f1d645f3e36ff3d 100644 --- a/tests/framework/testFourVector.cpp +++ b/tests/framework/testFourVector.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/CoordinateSystem.hpp> @@ -17,6 +17,7 @@ #include <cmath> using namespace corsika; +using Catch::Approx; TEST_CASE("four vectors") { diff --git a/tests/framework/testFunctionTimer.cpp b/tests/framework/testFunctionTimer.cpp index 1328ea7badbc86f13809197a06ca773593381137..7dff91fb6e2c4a0d70e25f44e43132467d19fbdf 100644 --- a/tests/framework/testFunctionTimer.cpp +++ b/tests/framework/testFunctionTimer.cpp @@ -9,7 +9,7 @@ #include <corsika/framework/analytics/FunctionTimer.hpp> #include <corsika/framework/core/Logging.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <chrono> #include <thread> diff --git a/tests/framework/testGeometry.cpp b/tests/framework/testGeometry.cpp index fcd29c001598f89fb1a90878fc294cdc7c44bd72..512d4eb23dc1f1bab081bb49f75240b36f4b308c 100644 --- a/tests/framework/testGeometry.cpp +++ b/tests/framework/testGeometry.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <cmath> #include <corsika/framework/core/PhysicalUnits.hpp> @@ -28,6 +28,7 @@ using namespace corsika; using namespace corsika::testing; +using Catch::Approx; double constexpr absMargin = 1.0e-8; diff --git a/tests/framework/testHelix.cpp b/tests/framework/testHelix.cpp index 042e4212f122bb538c86e9c78317fb86259b3ba8..fa16c83239b5bf66fd48cdf8c57caa4c5a1c6341 100644 --- a/tests/framework/testHelix.cpp +++ b/tests/framework/testHelix.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/geometry/Helix.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> @@ -16,6 +16,7 @@ #include <corsika/framework/geometry/RootCoordinateSystem.hpp> using namespace corsika; +using Catch::Approx; double constexpr absMargin = 1.0e-8; diff --git a/tests/framework/testInteractionCounter.cpp b/tests/framework/testInteractionCounter.cpp index 50c2397c9e2dd831401f60be0ad99bc6a89b7712..7d74d81c492b657b63465705db9736687201d80f 100644 --- a/tests/framework/testInteractionCounter.cpp +++ b/tests/framework/testInteractionCounter.cpp @@ -12,7 +12,7 @@ #include <corsika/framework/geometry/Vector.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <numeric> #include <algorithm> diff --git a/tests/framework/testInteractionLengthModifier.cpp b/tests/framework/testInteractionLengthModifier.cpp index 5d8ee70ed26ec29ff53c540cc2533e4b6b556668..d22c43b02c31f41a5f87b63c209a7f9acd86d3a7 100644 --- a/tests/framework/testInteractionLengthModifier.cpp +++ b/tests/framework/testInteractionLengthModifier.cpp @@ -9,7 +9,7 @@ #include <corsika/framework/process/InteractionLengthModifier.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; diff --git a/tests/framework/testLogging.cpp b/tests/framework/testLogging.cpp index 5b4fc2233fbb5a480d25e8ab12145b6f5887ab20..f22dcfd65e8aba048955e5965f1d1bbcaeece8d9 100644 --- a/tests/framework/testLogging.cpp +++ b/tests/framework/testLogging.cpp @@ -8,7 +8,7 @@ #include <corsika/framework/core/Logging.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; diff --git a/tests/framework/testNullModel.cpp b/tests/framework/testNullModel.cpp index 872fc34dbbeb685db1806c74c93f4709443db545..fdcd8894dd239b7d0aab93650ab754ca6df3e433 100644 --- a/tests/framework/testNullModel.cpp +++ b/tests/framework/testNullModel.cpp @@ -9,7 +9,7 @@ #include <corsika/framework/process/NullModel.hpp> #include <corsika/framework/core/Logging.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; diff --git a/tests/framework/testParticles.cpp b/tests/framework/testParticles.cpp index 52648ba7120aabb8705bc679323f8322b96ac64c..33710cd6457f9f17bc70250608bb2141e47a1994 100644 --- a/tests/framework/testParticles.cpp +++ b/tests/framework/testParticles.cpp @@ -10,9 +10,10 @@ #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/Logging.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; TEST_CASE("ParticleProperties", "[Particles]") { diff --git a/tests/framework/testProcessSequence.cpp b/tests/framework/testProcessSequence.cpp index a7f23a329e5c42e0a0407f249b679c86f814274a..59486c6c2693e5b5765cba0409144fcf1feda358 100644 --- a/tests/framework/testProcessSequence.cpp +++ b/tests/framework/testProcessSequence.cpp @@ -7,10 +7,10 @@ */ #define CORSIKA_UNIT_TESTING +#include <corsika/framework/process/ContinuousProcessStepLength.hpp> #include <corsika/framework/process/ProcessSequence.hpp> -#include <corsika/framework/process/SwitchProcessSequence.hpp> #include <corsika/framework/process/ProcessTraits.hpp> -#include <corsika/framework/process/ContinuousProcessStepLength.hpp> +#include <corsika/framework/process/SwitchProcessSequence.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/Step.hpp> @@ -19,7 +19,7 @@ #include <corsika/media/NuclearComposition.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <array> #include <iomanip> @@ -35,6 +35,7 @@ using namespace corsika; using namespace std; +using Catch::Approx; struct DummyRNG { static constexpr int max() { return 10; } @@ -81,8 +82,8 @@ struct DummyTrajectory { } }; -// since there is no stack, there is also no view. This is a simplistic dummy object -// sufficient here. +// since there is no stack, there is also no view. This is a simplistic dummy +// object sufficient here. struct DummyView { DummyView(DummyData& p) : p_(p) {} @@ -630,8 +631,8 @@ TEST_CASE("SwitchProcessSequence", "ProcessSequence") { auto sequence1 = make_sequence(Process1(0), cp2, Decay1(0), sec1, Boundary1(1.0)); // 10 mb - auto sequence2 = - make_sequence(cp3, Process2(0), Boundary1(-1.0), Decay2(0), sec2); // 20 mb + auto sequence2 = make_sequence(cp3, Process2(0), Boundary1(-1.0), Decay2(0), + sec2); // 20 mb auto sequence3 = make_sequence(cp1, Process3(0), // 30 mb SwitchProcessSequence(select1, sequence1, sequence2)); @@ -775,8 +776,8 @@ TEST_CASE("SwitchProcessSequence", "ProcessSequence") { CHECK(checkCont == 0); CHECK(checkSec == 0); - // now check sequence3, which contains a SwitchProcessSequence that contains two - // longer sequences in each branch. + // now check sequence3, which contains a SwitchProcessSequence that contains + // two longer sequences in each branch. { // check that large "select" value will correctly ignore the call cx_select = 1e5_mb; @@ -820,8 +821,8 @@ TEST_CASE("SwitchProcessSequence", "ProcessSequence") { CHECK(checkInteract == 1); // 2^1 } - // now check sequence3, which contains a SwitchProcessSequence that contains just two - // bare InteractionProcess-es in each branch. + // now check sequence3, which contains a SwitchProcessSequence that contains + // just two bare InteractionProcess-es in each branch. { // check that large "select" value will correctly ignore the call cx_select = 1e5_mb; @@ -889,8 +890,8 @@ TEST_CASE("SwitchProcessSequence", "ProcessSequence") { DummyTrajectory track; Step step(particle, track); - particle.data_[0] = - 100; // data positive, selects particular branch on SwitchProcessSequence + particle.data_[0] = 100; // data positive, selects particular branch on + // SwitchProcessSequence cp1.setStep(10_m); cp2.setStep(15_m); @@ -909,8 +910,8 @@ TEST_CASE("SwitchProcessSequence", "ProcessSequence") { CORSIKA_LOG_INFO("step1, l={}, i={}", LengthType(step1), ContinuousProcessIndex(step1).getIndex()); - particle.data_[0] = - 100; // data positive, selects particular branch on SwitchProcessSequence + particle.data_[0] = 100; // data positive, selects particular branch on + // SwitchProcessSequence cp1.setStep(50_m); cp2.setStep(15_m); @@ -930,8 +931,8 @@ TEST_CASE("SwitchProcessSequence", "ProcessSequence") { ContinuousProcessIndex(step2).getIndex(), boost::typeindex::type_id<decltype(sequence3)>().pretty_name()); - particle.data_[0] = - -100; // data positive, selects particular branch on SwitchProcessSequence + particle.data_[0] = -100; // data positive, selects particular branch on + // SwitchProcessSequence cp1.setStep(11_m); cp2.setStep(15_m); @@ -951,8 +952,8 @@ TEST_CASE("SwitchProcessSequence", "ProcessSequence") { ContinuousProcessIndex(step3).getIndex(), boost::typeindex::type_id<decltype(sequence3)>().pretty_name()); - particle.data_[0] = - -100; // data positive, selects particular branch on SwitchProcessSequence + particle.data_[0] = -100; // data positive, selects particular branch on + // SwitchProcessSequence cp1.setStep(11_m); cp2.setStep(15_m); @@ -979,15 +980,15 @@ TEST_CASE("SwitchProcessSequence", "ProcessSequence") { DummyNode node_from(1); DummyNode node_to(2); - particle.data_[0] = - 100; // data positive, selects particular branch on SwitchProcessSequence + particle.data_[0] = 100; // data positive, selects particular branch on + // SwitchProcessSequence sequence4.doBoundaryCrossing(particle, node_from, node_to); CHECK(particle.data_[0] == 97); // 100 - 2*1 - 1*1 - particle.data_[0] = - -100; // data positive, selects particular branch on SwitchProcessSequence + particle.data_[0] = -100; // data positive, selects particular branch on + // SwitchProcessSequence sequence4.doBoundaryCrossing(particle, node_from, node_to); CHECK(particle.data_[0] == -101); // -100 - 2*1 + 1*1 @@ -1102,8 +1103,8 @@ TEST_CASE("SelectInteractionZeroCrossSection", "ProcessSequence") { auto retValue = sequence.selectInteraction(view, projectileP4, noComposition, rng, 0_mb); - CHECK(!isInteracted(retValue)); // cross section of process sequence is zero, no process - // should cause an interaction + CHECK(!isInteracted(retValue)); // cross section of process sequence is zero, + // no process should cause an interaction } TEST_CASE("SwitchProcessSequence Indexing", "ProcessSequence") { diff --git a/tests/framework/testRandom.cpp b/tests/framework/testRandom.cpp index 26363a914b21b457eb6b2629c24025f659f5547f..18811b91d002dc99994d4ea9ac40ef903f0b9393 100644 --- a/tests/framework/testRandom.cpp +++ b/tests/framework/testRandom.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/random/ExponentialDistribution.hpp> @@ -17,6 +17,7 @@ #include <random> using namespace corsika; +using Catch::Approx; SCENARIO("random-number streams can be registered and retrieved") { GIVEN("a RNGManager") { diff --git a/tests/framework/testSaveBoostHistogram.cpp b/tests/framework/testSaveBoostHistogram.cpp index ca772e11c971542783b28521724daaca08e2ee76..81137879075d28dd178c964106d3d5c97d30b588 100644 --- a/tests/framework/testSaveBoostHistogram.cpp +++ b/tests/framework/testSaveBoostHistogram.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/utility/SaveBoostHistogram.hpp> #include <corsika/framework/core/Logging.hpp> diff --git a/tests/framework/testSecondaryView.cpp b/tests/framework/testSecondaryView.cpp index 9ca07a13d1e567398456207874cbd47093902956..191d5209968e31db2c2c60d4f4420ebfbd9d2d57 100644 --- a/tests/framework/testSecondaryView.cpp +++ b/tests/framework/testSecondaryView.cpp @@ -18,7 +18,7 @@ #include <iomanip> #include <vector> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; using namespace std; diff --git a/tests/framework/testSolver.cpp b/tests/framework/testSolver.cpp index 197061b813ce2b7fdee427e9a450d6291f1a7785..5eee9a867247af8fd2e1a339bac93ab7eabe4a9b 100644 --- a/tests/framework/testSolver.cpp +++ b/tests/framework/testSolver.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <cmath> #include <vector> @@ -21,6 +21,7 @@ using namespace corsika; using namespace std; +using Catch::Approx; double pol4(long double x, long double a, long double b, long double c, long double d, long double e) { diff --git a/tests/framework/testStackInterface.cpp b/tests/framework/testStackInterface.cpp index 6b6c26ea3fc741cb9ab6f62692bb0ac9ee092b4d..4c8a7fd81c0601c7ffde97905053a84470af71d2 100644 --- a/tests/framework/testStackInterface.cpp +++ b/tests/framework/testStackInterface.cpp @@ -17,7 +17,7 @@ #include <tuple> #include <vector> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; using namespace std; diff --git a/tests/framework/testUnits.cpp b/tests/framework/testUnits.cpp index 2938f4bb671ca9caf5843c54428b40d9e9a0ce62..1e1be41a415063ea30462e253ceae804148b74c6 100644 --- a/tests/framework/testUnits.cpp +++ b/tests/framework/testUnits.cpp @@ -12,9 +12,10 @@ #include <array> #include <sstream> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; TEST_CASE("PhysicalUnits", "[Units]") { diff --git a/tests/media/CMakeLists.txt b/tests/media/CMakeLists.txt index 5a8442123f68b8ad25cab177b4befdccc9ae9312..108ae81441ebfba367abe69631949f566e06c397 100644 --- a/tests/media/CMakeLists.txt +++ b/tests/media/CMakeLists.txt @@ -10,8 +10,8 @@ set (test_media_sources ) CORSIKA_ADD_TEST (testMedia SOURCES ${test_media_sources}) - -target_link_libraries (testMedia CONAN_PKG::boost) # for math/quadrature/gauss_kronrod.hpp +find_package(Boost) +target_link_libraries (testMedia Boost::boost) # for math/quadrature/gauss_kronrod.hpp target_compile_definitions ( testMedia diff --git a/tests/media/TestMain.cpp b/tests/media/TestMain.cpp index 51532584b8e03b35d79301543ac8f80b598ba544..7aec5694577d79834fb8350f7cea321f18ce5d96 100644 --- a/tests/media/TestMain.cpp +++ b/tests/media/TestMain.cpp @@ -8,4 +8,4 @@ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one // cpp file -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> diff --git a/tests/media/testCORSIKA7Atmospheres.cpp b/tests/media/testCORSIKA7Atmospheres.cpp index 55b2081675c0385912fa4a4725fd6986929595c4..e0c21fa85088278b067f16f6b436fe9a1ac1b77b 100644 --- a/tests/media/testCORSIKA7Atmospheres.cpp +++ b/tests/media/testCORSIKA7Atmospheres.cpp @@ -12,9 +12,10 @@ #include <corsika/media/CORSIKA7Atmospheres.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; TEST_CASE("CORSIKA7Atmospheres") { @@ -35,4 +36,4 @@ TEST_CASE("CORSIKA7Atmospheres") { CHECK(universe->getContainingNode(p)->getModelProperties().getMassDensity(p) / 1_g * static_pow<3>(1_cm) == Approx(1222.6562 / 994186.38)); -} \ No newline at end of file +} diff --git a/tests/media/testEnvironment.cpp b/tests/media/testEnvironment.cpp index 77b4eb794321e0400f35a45545674506b66b1c1f..35754340cefee63d32a8f444c8f926fa49c89bbf 100644 --- a/tests/media/testEnvironment.cpp +++ b/tests/media/testEnvironment.cpp @@ -33,9 +33,10 @@ #include <SetupTestTrajectory.hpp> #include <corsika/setup/SetupTrajectory.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; CoordinateSystemPtr const& gCS = get_root_CoordinateSystem(); diff --git a/tests/media/testMagneticField.cpp b/tests/media/testMagneticField.cpp index a5dd38e49b16ec0b6a75665608eabfbc0185d09c..944d51fb247c084651f7c5bbf969d2673637c584 100644 --- a/tests/media/testMagneticField.cpp +++ b/tests/media/testMagneticField.cpp @@ -16,9 +16,10 @@ #include <corsika/media/IMagneticFieldModel.hpp> #include <corsika/media/GeomagneticModel.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; const std::string refDataDir = std::string(REFDATADIR); // from cmake diff --git a/tests/media/testMedium.cpp b/tests/media/testMedium.cpp index 2cbf6a7bb4ab55962ff8970cace93aacde7ac007..04772702a932e1569239965fc8d674cff3e9d840 100644 --- a/tests/media/testMedium.cpp +++ b/tests/media/testMedium.cpp @@ -18,12 +18,13 @@ #include <corsika/media/MediumPropertyModel.hpp> #include <corsika/media/MediumProperties.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <SetupTestTrajectory.hpp> #include <corsika/setup/SetupTrajectory.hpp> using namespace corsika; +using Catch::Approx; TEST_CASE("MediumProperties") { diff --git a/tests/media/testNuclearComposition.cpp b/tests/media/testNuclearComposition.cpp index acf9c8e2fb9171a495f76081ec47df1b36a602ef..b85a85d9833d1746dcca7614b249f0451bcb889d 100644 --- a/tests/media/testNuclearComposition.cpp +++ b/tests/media/testNuclearComposition.cpp @@ -11,9 +11,10 @@ #include <corsika/framework/core/Logging.hpp> #include <corsika/media/NuclearComposition.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; struct DummyRNG { double v_; diff --git a/tests/media/testRefractiveIndex.cpp b/tests/media/testRefractiveIndex.cpp index 65e2c749d960be164be9f1c1ca85a6830e414381..245a17e710d7074020148d7aec8eb447a5ba9d84 100644 --- a/tests/media/testRefractiveIndex.cpp +++ b/tests/media/testRefractiveIndex.cpp @@ -26,9 +26,11 @@ #include <SetupTestTrajectory.hpp> #include <corsika/setup/SetupTrajectory.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; + template <typename TInterface> using MyExtraEnv = ExponentialRefractiveIndex<MediumPropertyModel<UniformMagneticField<TInterface>>>; @@ -291,4 +293,4 @@ TEST_CASE("GladstoneDaleRefractiveIndex w/ 5-layered atmosphere") { CHECK(rIndex1 - n0 == Approx(-0.0002591034)); CHECK(rIndex2 - n0 == Approx(0)); -} \ No newline at end of file +} diff --git a/tests/media/testShowerAxis.cpp b/tests/media/testShowerAxis.cpp index d8285e322749d9269e0f8ff7b37bd9c4a733bce0..947c04e7c586f303c57ea8c8a7e66c82d8cd4736 100644 --- a/tests/media/testShowerAxis.cpp +++ b/tests/media/testShowerAxis.cpp @@ -18,10 +18,11 @@ #include <corsika/framework/core/ParticleProperties.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> // using namespace using namespace corsika; +using Catch::Approx; const auto density = 1_kg / (1_m * 1_m * 1_m); diff --git a/tests/modules/TestMain.cpp b/tests/modules/TestMain.cpp index 51532584b8e03b35d79301543ac8f80b598ba544..7aec5694577d79834fb8350f7cea321f18ce5d96 100644 --- a/tests/modules/TestMain.cpp +++ b/tests/modules/TestMain.cpp @@ -8,4 +8,4 @@ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one // cpp file -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> diff --git a/tests/modules/testCONEX.cpp b/tests/modules/testCONEX.cpp index 256cea0f01a53e0181c81f0fba81a9254e7645b2..296700bccab695a83b56be716dfbcc08417d14e0 100644 --- a/tests/modules/testCONEX.cpp +++ b/tests/modules/testCONEX.cpp @@ -28,9 +28,10 @@ #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/utility/CorsikaFenv.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/modules/testEMThinning.cpp b/tests/modules/testEMThinning.cpp index 9b23d0c129d94fcce3c63873b7af8254ffe6eae5..9f33a100cac19904d7e781c5ab7ca1ed6f970957 100644 --- a/tests/modules/testEMThinning.cpp +++ b/tests/modules/testEMThinning.cpp @@ -17,13 +17,14 @@ #include <SetupTestTrajectory.hpp> #include <SetupTestEnvironment.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/stats.hpp> #include <boost/accumulators/statistics/mean.hpp> using namespace corsika; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/modules/testEpos.cpp b/tests/modules/testEpos.cpp index b78f8a9f9f85aae2caa7f714616ad9336939cc78..4b984bbca8fd5485c27d9b1ca034d70697df38fd 100644 --- a/tests/modules/testEpos.cpp +++ b/tests/modules/testEpos.cpp @@ -15,11 +15,12 @@ #include <SetupTestEnvironment.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <tuple> using namespace corsika; using namespace corsika::epos; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/modules/testExecTime.cpp b/tests/modules/testExecTime.cpp index 4ebc03342914dc28e9137e7fd96dde010e8ac544..6cab0d8dcfaca6c1575471be0552622210357f55 100644 --- a/tests/modules/testExecTime.cpp +++ b/tests/modules/testExecTime.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/modules/ExecTime.hpp> diff --git a/tests/modules/testFluka.cpp b/tests/modules/testFluka.cpp index a52340d43c6bfecd8911be07048898b90876a201..2b379fc69c6f8c128364886c9e11f6ff0e234ee7 100644 --- a/tests/modules/testFluka.cpp +++ b/tests/modules/testFluka.cpp @@ -18,7 +18,7 @@ #include <corsika/media/IMediumModel.hpp> #include <corsika/media/HomogeneousMedium.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <fstream> #include <iomanip> diff --git a/tests/modules/testNullModel.cpp b/tests/modules/testNullModel.cpp index 658ec03d13ed50c010ed75fa1f7abb34383fc36a..19de1fb937efcc5988886248aed2f49316f038b1 100644 --- a/tests/modules/testNullModel.cpp +++ b/tests/modules/testNullModel.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/process/NullModel.hpp> diff --git a/tests/modules/testObservationPlane.cpp b/tests/modules/testObservationPlane.cpp index 5ffe5acad8252bf0c9e65e80157a9e49dfe242af..8eb9d4830bd7bc03ca3699bde91362c54870307a 100644 --- a/tests/modules/testObservationPlane.cpp +++ b/tests/modules/testObservationPlane.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/modules/ObservationPlane.hpp> @@ -23,6 +23,7 @@ #include <corsika/setup/SetupTrajectory.hpp> using namespace corsika; +using Catch::Approx; TEST_CASE("ObservationPlane", "interface") { diff --git a/tests/modules/testObservationVolume.cpp b/tests/modules/testObservationVolume.cpp index 17344f86003a7a338ba01cd043e2799b8bd8bfff..ef8b25e9ede00972f882b599916af30b794e6a2f 100644 --- a/tests/modules/testObservationVolume.cpp +++ b/tests/modules/testObservationVolume.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/modules/ObservationVolume.hpp> #include <corsika/framework/geometry/Point.hpp> @@ -24,6 +24,8 @@ #include <corsika/setup/SetupTrajectory.hpp> using namespace corsika; +using Catch::Approx; + // some geometries such as box do not support curved track yet. using Tracking = tracking_line::Tracking; @@ -96,4 +98,4 @@ TEST_CASE("ObservationVolume", "interface") { auto const cfg = obs.getConfig(); CHECK(cfg["type"]); } -} \ No newline at end of file +} diff --git a/tests/modules/testOnShellCheck.cpp b/tests/modules/testOnShellCheck.cpp index 341fc3c88ab0ad4fa5c7b16efa70aaa0a48095ce..a4c0c5c0e38451d673ab372d14d04158c6077ea7 100644 --- a/tests/modules/testOnShellCheck.cpp +++ b/tests/modules/testOnShellCheck.cpp @@ -18,7 +18,7 @@ #include <corsika/setup/SetupStack.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; diff --git a/tests/modules/testParticleCut.cpp b/tests/modules/testParticleCut.cpp index 1f97f5a274f50ae158199d26c54cb47545dda71c..cf61644fdfeac29431cce81cb848d45f397c542a 100644 --- a/tests/modules/testParticleCut.cpp +++ b/tests/modules/testParticleCut.cpp @@ -21,7 +21,7 @@ #include <SetupTestEnvironment.hpp> #include <corsika/setup/SetupTrajectory.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; diff --git a/tests/modules/testProposal.cpp b/tests/modules/testProposal.cpp index 7d59b9be8c844e0f05955faecda35536a828c181..7a5be72de289a9c928e4df5da4d7a7d3100fbae7 100644 --- a/tests/modules/testProposal.cpp +++ b/tests/modules/testProposal.cpp @@ -10,7 +10,7 @@ #include <SetupTestEnvironment.hpp> #include <SetupTestStack.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <tuple> #include "corsika/framework/core/PhysicalUnits.hpp" diff --git a/tests/modules/testPythia8.cpp b/tests/modules/testPythia8.cpp index 78f3e82316461c1126dde433162ca3863900820a..5bc59f46afb6106a720e30bc16ec5a7d5a872a92 100644 --- a/tests/modules/testPythia8.cpp +++ b/tests/modules/testPythia8.cpp @@ -16,9 +16,10 @@ #include <SetupTestEnvironment.hpp> #include <SetupTestStack.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/modules/testQGSJetII.cpp b/tests/modules/testQGSJetII.cpp index 580aaa8cfb19d4745e3c69bcbca7fffb2883e018..c5a10c68f26aff019cee004d414fa51c2cfac906 100644 --- a/tests/modules/testQGSJetII.cpp +++ b/tests/modules/testQGSJetII.cpp @@ -15,12 +15,13 @@ #include <SetupTestEnvironment.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <string> #include <cstdlib> using namespace corsika; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/modules/testRadio.cpp b/tests/modules/testRadio.cpp index bb3937aff344f844a881aa875687dc1a5a4b1a18..3d44b3db23a2129535755ce9025c48db993dd186 100644 --- a/tests/modules/testRadio.cpp +++ b/tests/modules/testRadio.cpp @@ -5,7 +5,7 @@ * Licence version 3 (GPL Version 3). See file LICENSE for a full version of * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/modules/radio/RadioProcess.hpp> #include <corsika/modules/radio/ZHS.hpp> @@ -55,6 +55,7 @@ #include <corsika/output/OutputManager.hpp> using namespace corsika; +using Catch::Approx; double constexpr absMargin = 1.0e-7; diff --git a/tests/modules/testRandom.cpp b/tests/modules/testRandom.cpp index c307cbeea08bb209961ce6089a2e1b975def780a..59043ad76206d6d4dc4c7258f76c458e923f8f93 100644 --- a/tests/modules/testRandom.cpp +++ b/tests/modules/testRandom.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #ifdef WITH_FLUKA #include <corsika/modules/FLUKA.hpp> #endif @@ -18,6 +18,8 @@ #include <corsika/modules/Sophia.hpp> #include <corsika/modules/UrQMD.hpp> +using Catch::Approx; + static std::size_t first{}; void dummy_rng_func(double* dest, std::size_t N) { double constexpr factor = 1.e-6; diff --git a/tests/modules/testSibyll.cpp b/tests/modules/testSibyll.cpp index 9132308af21a40374e5e981d8af06df9c91fffee..41a3c88ba3ccf15cf39b5ebae5c3fc440379294b 100644 --- a/tests/modules/testSibyll.cpp +++ b/tests/modules/testSibyll.cpp @@ -16,11 +16,12 @@ #include <corsika/framework/utility/COMBoost.hpp> #include <SetupTestEnvironment.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <tuple> using namespace corsika; using namespace corsika::sibyll; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/modules/testSophia.cpp b/tests/modules/testSophia.cpp index a9495a727b9ad9167caface641f7fe402d05c88f..449810e53e2979081d12090ead202db22a81dbf5 100644 --- a/tests/modules/testSophia.cpp +++ b/tests/modules/testSophia.cpp @@ -17,11 +17,12 @@ #include <corsika/framework/utility/COMBoost.hpp> #include <SetupTestEnvironment.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <tuple> using namespace corsika; using namespace corsika::sophia; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/modules/testStackInspector.cpp b/tests/modules/testStackInspector.cpp index f76eab9a93f7177ee20cfc4bf6b531e153aba0e1..6acbf12040d3b2dbdb7777a4a4394c28691214df 100644 --- a/tests/modules/testStackInspector.cpp +++ b/tests/modules/testStackInspector.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/modules/StackInspector.hpp> diff --git a/tests/modules/testTAUOLA.cpp b/tests/modules/testTAUOLA.cpp index 8101a422f377885c48431d5bd09f8ecb47b74562..19f9684909f31812e9f0f08d1d78e65728dbc90f 100644 --- a/tests/modules/testTAUOLA.cpp +++ b/tests/modules/testTAUOLA.cpp @@ -9,7 +9,7 @@ #include <corsika/modules/TAUOLA.hpp> #include <SetupTestEnvironment.hpp> #include <SetupTestStack.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/histogram.hpp> #include <boost/format.hpp> @@ -24,6 +24,7 @@ using namespace corsika::tauola; using namespace corsika; using namespace boost::histogram; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; @@ -631,4 +632,4 @@ TEST_CASE("TAUOLA", "modules") { CHECK(decay.isDecayHandled(Code::KStarPlus)); CHECK(decay.isDecayHandled(Code::KStarMinus)); } -} \ No newline at end of file +} diff --git a/tests/modules/testTracking.cpp b/tests/modules/testTracking.cpp index b66d160dc7b6ed4660320dbdb3e7a538d60e895e..98dcc4868750a6da7d59f23bbac9821d627701a6 100644 --- a/tests/modules/testTracking.cpp +++ b/tests/modules/testTracking.cpp @@ -18,11 +18,12 @@ #include <SetupTestStack.hpp> #include <SetupTestTrajectory.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/type_index.hpp> using namespace corsika; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/modules/testUrQMD.cpp b/tests/modules/testUrQMD.cpp index fbdf5fceb508e67ced8c02cffdd76577c0661d25..2eb92ae4858de5c8b3ff9f4512828df0ea94c6c6 100644 --- a/tests/modules/testUrQMD.cpp +++ b/tests/modules/testUrQMD.cpp @@ -27,10 +27,11 @@ #include <tuple> #include <utility> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; using namespace corsika::urqmd; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/output/TestMain.cpp b/tests/output/TestMain.cpp index 51532584b8e03b35d79301543ac8f80b598ba544..7aec5694577d79834fb8350f7cea321f18ce5d96 100644 --- a/tests/output/TestMain.cpp +++ b/tests/output/TestMain.cpp @@ -8,4 +8,4 @@ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one // cpp file -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> diff --git a/tests/output/testDummyOutputManager.cpp b/tests/output/testDummyOutputManager.cpp index cc571832f601c1e9814ca25e1de9d4db152d1afc..afacb993da07e4fd25f9c9d76558ba5bd1aa22af 100644 --- a/tests/output/testDummyOutputManager.cpp +++ b/tests/output/testDummyOutputManager.cpp @@ -6,12 +6,13 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/output/DummyOutputManager.hpp> #include <corsika/framework/core/Logging.hpp> using namespace corsika; +using Catch::Approx; class DummyOutput {}; diff --git a/tests/output/testInteractionWriter.cpp b/tests/output/testInteractionWriter.cpp index d9a45e41883643dbf8a841a609dd137f43be022d..dd515cfd4041c40088eb5ba241978197441ae739 100644 --- a/tests/output/testInteractionWriter.cpp +++ b/tests/output/testInteractionWriter.cpp @@ -8,7 +8,7 @@ #include <boost/filesystem.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/modules/writers/InteractionWriter.hpp> @@ -26,6 +26,7 @@ #include <SetupTestTrajectory.hpp> using namespace corsika; +using Catch::Approx; using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; using DummyEnvironment = Environment<DummyEnvironmentInterface>; diff --git a/tests/output/testOutputManager.cpp b/tests/output/testOutputManager.cpp index 9df88ea27b70a14f0411261f4e215fe66164e6e7..b9e9e3fd09267b5c8f68be9f3fd9fa6738fb2254 100644 --- a/tests/output/testOutputManager.cpp +++ b/tests/output/testOutputManager.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/filesystem.hpp> @@ -16,6 +16,7 @@ #include <corsika/output/NoOutput.hpp> using namespace corsika; +using Catch::Approx; struct DummyNoOutput : public NoOutput { void check() { diff --git a/tests/output/testParquetStreamer.cpp b/tests/output/testParquetStreamer.cpp index 13ade23599eafbb8403dad9d55a595c4aea220d4..5d1a9c677184a58e674aded5ee1fc12c62dbf235 100644 --- a/tests/output/testParquetStreamer.cpp +++ b/tests/output/testParquetStreamer.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/filesystem.hpp> @@ -14,6 +14,7 @@ #include <corsika/framework/core/Logging.hpp> using namespace corsika; +using Catch::Approx; TEST_CASE("ParquetStreamer") { @@ -53,4 +54,4 @@ TEST_CASE("ParquetStreamer") { CHECK_FALSE(test.isInit()); CHECK(boost::filesystem::exists("./parquet_test.parquet")); } -} \ No newline at end of file +} diff --git a/tests/output/testWritePrimary.cpp b/tests/output/testWritePrimary.cpp index 66211692359ca85b19db332c345a2a554ac9b2f4..ddfd0d1b809a1e72f3af011bcbac84402096e794 100644 --- a/tests/output/testWritePrimary.cpp +++ b/tests/output/testWritePrimary.cpp @@ -7,7 +7,7 @@ */ #include <boost/filesystem.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <corsika/framework/core/Logging.hpp> #include <corsika/media/Environment.hpp> @@ -15,6 +15,7 @@ #include <corsika/setup/SetupTrajectory.hpp> using namespace corsika; +using Catch::Approx; auto setupWritePrimaryEnv() { // Set up all of the background diff --git a/tests/output/testWriterEnergyLoss.cpp b/tests/output/testWriterEnergyLoss.cpp index 811a5284d22f6987dde25caf0f94ff000798fc5a..29f2cf7d5cffeb00531c2c573fd3d449f4b5ca6a 100644 --- a/tests/output/testWriterEnergyLoss.cpp +++ b/tests/output/testWriterEnergyLoss.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/filesystem.hpp> @@ -23,6 +23,7 @@ #include <corsika/framework/core/Logging.hpp> using namespace corsika; +using Catch::Approx; const auto density = 1_kg / (1_m * 1_m * 1_m); diff --git a/tests/output/testWriterLongitudinal.cpp b/tests/output/testWriterLongitudinal.cpp index ef796bda060fd697da175834e3f9312a96ed1698..d1a295e5568ca3409b45c8c92b995727adcb2090 100644 --- a/tests/output/testWriterLongitudinal.cpp +++ b/tests/output/testWriterLongitudinal.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/filesystem.hpp> @@ -26,6 +26,7 @@ #include <string> using namespace corsika; +using Catch::Approx; const auto density = 1_kg / (1_m * 1_m * 1_m); diff --git a/tests/output/testWriterObservationPlane.cpp b/tests/output/testWriterObservationPlane.cpp index ff054358388245d8159ad01c88ac3c122a1c769c..457e214631405f69caabea9131906afb7bb36d5f 100644 --- a/tests/output/testWriterObservationPlane.cpp +++ b/tests/output/testWriterObservationPlane.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/filesystem.hpp> @@ -16,6 +16,7 @@ #include <corsika/framework/geometry/QuantityVector.hpp> using namespace corsika; +using Catch::Approx; struct TestWriterPlane : public ParticleWriterParquet { diff --git a/tests/output/testWriterOff.cpp b/tests/output/testWriterOff.cpp index 9d71be652f317bfbadf44cf0e8f3b97f8d6fa2b5..0a8166c3948e55926754b76f28fbec3b30792cd8 100644 --- a/tests/output/testWriterOff.cpp +++ b/tests/output/testWriterOff.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/filesystem.hpp> @@ -15,6 +15,7 @@ #include <corsika/framework/core/Logging.hpp> using namespace corsika; +using Catch::Approx; /* class TestEnergyLoss : public corsika::EnergyLossWriter<> { diff --git a/tests/output/testWriterTracks.cpp b/tests/output/testWriterTracks.cpp index 79414c206b068850e45cfa73f614e55426fadf53..16f35d7afc0ef1e477340d02c539180bc8ceee53 100644 --- a/tests/output/testWriterTracks.cpp +++ b/tests/output/testWriterTracks.cpp @@ -6,7 +6,7 @@ * the license. */ -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <boost/filesystem.hpp> @@ -16,6 +16,7 @@ #include <SetupTestEnvironment.hpp> using namespace corsika; +using Catch::Approx; struct TestWriterTrack : public TrackWriterParquet { diff --git a/tests/stack/TestMain.cpp b/tests/stack/TestMain.cpp index 51532584b8e03b35d79301543ac8f80b598ba544..7aec5694577d79834fb8350f7cea321f18ce5d96 100644 --- a/tests/stack/TestMain.cpp +++ b/tests/stack/TestMain.cpp @@ -8,4 +8,4 @@ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one // cpp file -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> diff --git a/tests/stack/testDummyStack.cpp b/tests/stack/testDummyStack.cpp index 333517d450d0b89b4886a4c63f6f035dec17eb5e..aa9bc2d5ae0e63b36ecaa3779d3828903a7aee59 100644 --- a/tests/stack/testDummyStack.cpp +++ b/tests/stack/testDummyStack.cpp @@ -10,7 +10,7 @@ using namespace corsika; -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <tuple> diff --git a/tests/stack/testGeometryNodeStackExtension.cpp b/tests/stack/testGeometryNodeStackExtension.cpp index 2bc2e1160836ba85a39b1d93d7916c8459f93af5..40c6d7c57ade1afff3cebba126a27a2b85ff7ebe 100644 --- a/tests/stack/testGeometryNodeStackExtension.cpp +++ b/tests/stack/testGeometryNodeStackExtension.cpp @@ -12,7 +12,7 @@ using namespace corsika; -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <iostream> using namespace std; diff --git a/tests/stack/testHistoryStack.cpp b/tests/stack/testHistoryStack.cpp index 4542db2ebf1dfe218b8566a04987696aff0b194a..64f2f16c2535a9caf0fa9da15356c1158c147980 100644 --- a/tests/stack/testHistoryStack.cpp +++ b/tests/stack/testHistoryStack.cpp @@ -10,7 +10,7 @@ #include <corsika/stack/DummyStack.hpp> #include <corsika/stack/history/HistoryStackExtension.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; diff --git a/tests/stack/testHistoryView.cpp b/tests/stack/testHistoryView.cpp index 4b898560a775e8c0cd651c81b8cc6a14861ad85e..ae296d3edbbf0d2d5566fa32d8a7829490bb5703 100644 --- a/tests/stack/testHistoryView.cpp +++ b/tests/stack/testHistoryView.cpp @@ -14,7 +14,7 @@ #include <corsika/framework/stack/CombinedStack.hpp> #include <corsika/framework/core/Logging.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; diff --git a/tests/stack/testVectorStack.cpp b/tests/stack/testVectorStack.cpp index 74d7d6f76c33e112fd576ac5427707300d53dff0..19a85e685811d8a50906f27f5932100606f7cc76 100644 --- a/tests/stack/testVectorStack.cpp +++ b/tests/stack/testVectorStack.cpp @@ -12,10 +12,11 @@ #include <corsika/stack/VectorStack.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> using namespace corsika; using namespace std; +using Catch::Approx; TEST_CASE("VectorStack", "stack") { @@ -187,4 +188,4 @@ TEST_CASE("VectorStack", "stack") { CHECK(p3.getPosition().getY(dummyCS) / 1_m == Approx(1)); CHECK(p3.getPosition().getZ(dummyCS) / 1_m == Approx(1)); } -} \ No newline at end of file +} diff --git a/tests/stack/testWeightStackExtension.cpp b/tests/stack/testWeightStackExtension.cpp index aa3471a821715a7ec9367a776f94c031c8f1d3d9..bf6a496f96c039ef330515b9770cd5e40d62d313 100644 --- a/tests/stack/testWeightStackExtension.cpp +++ b/tests/stack/testWeightStackExtension.cpp @@ -12,10 +12,11 @@ using namespace corsika; -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <iostream> using namespace std; +using Catch::Approx; // the Weight stack: template <typename TStackIter>