IAP GITLAB

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AirShowerPhysics/corsika
  • rulrich/corsika
  • AAAlvesJr/corsika
  • Andre/corsika
  • arrabito/corsika
  • Nikos/corsika
  • olheiser73/corsika
  • AirShowerPhysics/papers/corsika
  • pranav/corsika
9 results
Show changes
Commits on Source (4139)
Showing
with 1060 additions and 365 deletions
---
Language: Cpp
ColumnLimit: 90 # line width, 0: respect programmer's choice
TabWidth: 8
UseTab: Never
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
......@@ -16,7 +21,6 @@ AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
......@@ -36,7 +40,7 @@ BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
# BreakInheritanceListBeforeComma: true
ColumnLimit: 90
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
......@@ -53,6 +57,7 @@ IncludeCategories:
Priority: 2
- Regex: '.*'
Priority: 3
SortIncludes: false
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
......@@ -72,7 +77,6 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
......@@ -84,6 +88,8 @@ SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
# If true, always break after the template<...> of a template declaration.
AlwaysBreakTemplateDeclarations: true
...
*.inl gitlab-language=c++
\ No newline at end of file
*gcov
**/*~
**/*.bak
build/
install/
.vscode/
Framework/Particles/GeneratedParticleProperties.inc
flymd.html
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
variables:
GIT_STRATEGY: $CORSIKA8_GIT_STRATEGY # clone: fresh clone, fetch: update
GIT_SSL_NO_VERIFY: "1"
GIT_DEPTH: "2"
# to re-use clones also in different forks
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_NAME
## Runtime options for sanitizers
# (detect_leaks=0 because leak detection doesn't work in CI, but you can
# try to test with leak detection locally by using detect_leaks=1)
UBSAN_OPTIONS: "print_stacktrace=1"
LSAN_OPTIONS: "log_threads=1"
ASAN_OPTIONS: "detect_leaks=0:detect_stack_use_after_return=1"
# location of AirShowerPhysics/corsika-data
CORSIKA_DATA: "${CI_PROJECT_DIR}/modules/data" # the git submodule
corsika_DIR: "${CI_PROJECT_DIR}/build/install" # for cmake to find corsikaConfig.cmake
# _alternatively_ corsika-data can be downloaded as submodule:
GIT_SUBMODULE_STRATEGY: recursive # none: we get the submodules in before_script,
# normal: get submodules automatically
CTEST_OUTPUT_ON_FAILURE: 1
PIP_PARTICLE_VERSION: "0.25.1"
#
# multi-step pipeline for each commit
#
# Note: "Draft/WIP:" merge request, non-Draft/non-WIP merge requests and "Ready for Code Review" MR are all
# handled explicitly
#
stages:
- quality
- config
- build_test
- build_test_example
- python
- optional
##########################################
########### CODE QUALITY CHECK ###########
##########################################
##########################################################
check-copyrights:
image: corsika/devel:u-22.04
stage: quality
tags:
- corsika
script:
- ./do-copyright.py
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
allow_failure: true
##########################################################
check-clang-format:
image: corsika/devel:clang-8
stage: quality
tags:
- corsika
script:
- ./do-clang-format.py --all
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
allow_failure: true
check-python-quality:
image: corsika/devel:u-22.04
stage: quality
tags:
- corsika
script:
- cd ${CI_PROJECT_DIR}/python # change into the Python directory
- pip3 install --user -e '.[test]' # install the package + test deps
- python3 --version
- python3 -m black -t py37 --check corsika tests
- python3 -m flake8 -v corsika tests
- python3 -m isort --atomic --check-only corsika tests
- python3 -m mypy corsika
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
allow_failure: true
##########################################
################# CONFIG #################
##########################################
##########################################################
# the generic config template job
# job/stage to just prepare cmake
.config:
stage: config
tags:
- corsika
script:
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${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
- if: $CI_COMMIT_BRANCH
artifacts:
when: on_failure
expire_in: 3 days
paths:
- ${CI_PROJECT_DIR}/build/CMakeFiles/CMakeOutput.log
# config for gcc
config-u-22_04:
extends: .config
image: corsika/devel:u-22.04
# config for clang
config-clang-14:
extends: .config
image: corsika/devel:clang-14
##########################################
############### BUILD-TEST ###############
##########################################
##########################################################
# the generic build_test template job
# normal pipeline for each commit
.build_test:
stage: build_test
tags:
- corsika
script:
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${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
rules:
- if: '$CI_MERGE_REQUEST_ID && ($CI_MERGE_REQUEST_TITLE =~ /^Draft:/ || $CI_MERGE_REQUEST_TITLE =~ /^WIP:/)'
allow_failure: false
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 3 days
paths:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
# build_test for gcc
build_test-u-22_04:
extends: .build_test
image: corsika/devel:u-22.04
needs:
- job: config-u-22_04
artifacts: false
# build_test for clang
build_test-clang-14:
extends: .build_test
image: corsika/devel:clang-14
needs:
- job: config-clang-14
artifacts: false
##########################################
########## BUILD-TEST-EXAMPLE ###########
##########################################
##########################################################
# generic example template job
# normal pipeline for each commit
.build_test_example:
stage: build_test_example
tags:
- corsika
script:
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${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
- cmake --install .
- mkdir -p ${CI_PROJECT_DIR}/build/build_examples
- cd ${CI_PROJECT_DIR}/build/build_examples
- 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=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
- export OUTPUT_DIR=${CI_PROJECT_DIR}/build/build_examples/example_outputs/
- export CMD="$EXE --seed 1234 --energy 1e3 -p 2212 --disable-interaction-histograms --compress --filename $OUTPUT_DIR/c8_air_shower_output"
- echo "Running... $CMD"
- $CMD
rules:
- if: '$CI_MERGE_REQUEST_ID && ($CI_MERGE_REQUEST_TITLE =~ /^Draft:/ || $CI_MERGE_REQUEST_TITLE =~ /^WIP:/)'
when: manual
allow_failure: true
- if: $CI_COMMIT_BRANCH
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 2 days
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
paths:
- ${CI_PROJECT_DIR}/build/build_examples/example_outputs/radio_em_shower_outputs #python examples need this
- ${CI_PROJECT_DIR}/build/build_examples/example_outputs/c8_air_shower_output.tar #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
# build_test_example for gcc
build_test_example-u-22_04:
extends: .build_test_example
image: corsika/devel:u-22.04
needs:
- job: config-u-22_04
artifacts: false
# build_test_example for clang
build_test_example-clang-14:
extends: .build_test_example
image: corsika/devel:clang-14
needs:
- job: config-clang-14
artifacts: false
##########################################
################ OPTIONAL ################
##########################################
##########################################################
# generic release template job
# optional release pipeline for each commit
.release:
stage: optional
tags:
- corsika
script:
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${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
- 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
when: manual
allow_failure: true
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 3 days
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
paths:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
# release for gcc
release-full-u-22_04:
extends: .release
image: corsika/devel:u-22.04
needs:
- job: config-u-22_04
artifacts: false
# release for clang
release-full-clang-14:
extends: .release
image: corsika/devel:clang-14
needs:
- job: config-clang-14
artifacts: false
##########################################
################ COVERAGE ################
##########################################
##########################################################
# the coverage generation should either run when manually requested, OR always on the master
coverage:
image: corsika/devel:u-22.04
needs:
- job: config-u-22_04
artifacts: false
stage: optional
tags:
- corsika
script:
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${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
- tar czf coverage-report.tar.gz coverage-report
coverage: '/^.*lines\.+:\s(.*\%)\s/'
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
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 3 month
paths:
- ${CI_PROJECT_DIR}/build/coverage-report.tar.gz
##########################################
################# SANITY #################
##########################################
##########################################################
sanity:
image: corsika/devel:u-22.04
needs:
- job: config-u-22_04
artifacts: false
stage: optional
tags:
- corsika
script:
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${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
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
##########################################
################# Python #################
##########################################
##########################################################
# template for all Python jobs
.python:
stage: python
tags:
- corsika
script:
- cd ${CI_PROJECT_DIR}/python # change into the Python directory
- pip3 install --user -e '.[test]' # install the package + test deps
- python3 --version
- python3 -m mypy corsika
- python3 -m isort --atomic --check-only corsika tests
- python3 -m black -t py37 corsika tests
- python3 -m flake8 corsika tests
- python3 -m pytest --cov=corsika tests
coverage: '/^TOTAL\s*\d+\s*\d+\s*(.*\%)/'
python-tests:
extends: .python
image: corsika/devel:u-22.04
needs:
- job: build_test_example-u-22_04
artifacts: true
artifacts:
when: always
expire_in: 1 month
paths:
- ${CI_PROJECT_DIR}/python/python-test.log
allow_failure: false
python-examples:
stage: python
tags:
- corsika
image: corsika/devel:u-22.04
needs:
- job: build_test_example-u-22_04
artifacts: true
artifacts:
when: always
expire_in: 1 month
paths:
- ${CI_PROJECT_DIR}/python/examples/example_plots
script:
- export EXAMPLE_SHOWER=${CI_PROJECT_DIR}/build/build_examples/example_outputs/c8_air_shower_output.tar
- cd ${CI_PROJECT_DIR}/python
- pip3 install --user -e '.[test,examples]'
- cd ${CI_PROJECT_DIR}/python/examples
- python3 particle_distribution.py --input-dir $EXAMPLE_SHOWER
- python3 shower_profile.py --input-dir $EXAMPLE_SHOWER
- python3 first_interactions.py --input-dir $EXAMPLE_SHOWER
- export EXAMPLE_RADIO_SHOWER_DIR=${CI_PROJECT_DIR}/build/build_examples/example_outputs/radio_em_shower_outputs
- python3 radio_emission.py --input-dir $EXAMPLE_RADIO_SHOWER_DIR
Issues: Closes #....
The code approval procedure is described in the wiki: [Code approval procedure wiki](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
- [ ] The MR is without `WIP/Draft` status
- [ ] Make sure the most recent CI jobs (config, quality, build_test_example) all run fine with no failures
- if "check clang-format" failed: the code contributor has to run `./do-clang-format.py --apply` eventually with the `--all` option
- if "check copyright" failed the code contributor has to run`./do-copyright.py --add=20xy`
- [ ] Make sure also the jobs with MR-label `ready for code review` succeed. This includes the optional jobs, in particular 'coverage', 'release-full-clang-14", "release-full-u-22_04" and make sure no problems occur. You may have to trigger a pipeline manually to check this.
- [ ] Check in the "coverage" job output that the coverage did not decrease. It should always stay, or increase. If it decreased --> ask contributor to add further needed unit tests, and check coverage report.
- On the MR page, open the "Open in Web IDE" tool
- [ ] Check if the provided solution solves the Issue, discuss on gitlab
- [ ] Check that all changes are actually related to the issue
- [ ] There are no debug statements left, not even commented out
- [ ] Check all changes for coding rules and guidelines
- When all above is done:
- **Add MR label "Code Review Finished"**
[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
Everything
\ No newline at end of file
cmake_minimum_required (VERSION 3.4.3)
#
# (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
#
# See file AUTHORS for a list of contributors.
#
# This software is distributed under the terms of the 3-clause BSD license.
# See file LICENSE for a full version of the license.
#
cmake_minimum_required (VERSION 3.9)
#+++++++++++++++++++++++++++++
# project name
# version is: "8.major.minor.patch"
# major: API changes
# minor: no API changes
# patch: bug fix and small improvements
#
set (c8_version 8.0.0.0)
project (
corsika
VERSION 8.0.0
DESCRIPTION "CORSIKA C++ project"
VERSION ${c8_version}
DESCRIPTION "CORSIKA C++ project (alpha status)"
LANGUAGES CXX
)
#+++++++++++++++++++++++++++++
# for pre-defined standard path
#
include (GNUInstallDirs)
#+++++++++++++++++++++++++++++
# prevent in-source builds and give warning message
#
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message (FATAL_ERROR "In-source builds are disabled.
Please create a build-dir and use `cmake <source-dir>` inside it.
NOTE: cmake will now create CMakeCache.txt and CMakeFiles/*.
You must delete them, or cmake will refuse to work.")
endif ()
#++++++++++++++++++++++++++++
# cmake version-specific settings
#
# https://cmake.org/cmake/help/latest/policy/CMP0079.html
if (POLICY CMP0079)
cmake_policy (SET CMP0079 NEW)
endif ()
# Download timestamp for external modules
if (POLICY CMP0135)
cmake_policy (SET CMP0135 OLD)
endif ()
# AUtomatically add extensions to filenames if needed (old behaviour)
if (POLICY CMP0115)
cmake_policy (SET CMP0115 OLD)
endif ()
#+++++++++++++++++++++++++++++
# warn user if system is not UNIX
#
if (NOT UNIX)
message (FATAL_ERROR "| CORSIKA8 > This is an unsupported system.")
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)
# directory for local cmake modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
include (CorsikaUtilities) # a few cmake function
#+++++++++++++++++++++++++++++
# Extra cmake functions for registering and running tests
#
include (corsikaUtilities) # extra cmake functions
#+++++++++++++++++++++++++++++
# Setup hardware and infrastructure dependent defines, and general settings
#
include (corsikaDefines)
# --std=c++14
#+++++++++++++++++++++++++++++
# check if compiler is C++17 compliant
#
include (CheckCXXCompilerFlag)
check_CXX_compiler_flag ("-std=c++17" COMPILER_SUPPORTS_CXX17)
if (NOT COMPILER_SUPPORTS_CXX17)
message (FATAL "| CORSIKA8 > The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
endif ()
# set CXX compile flags and options and warning settings
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_EXTENSIONS OFF)
#+++++++++++++++++++++++++++++
# Compiler and linker flags, settings
#
# enable warnings and disallow non-standard language
# configure the various build types here, too
# FYI: optimizer flags: -O2 would not trade speed for size, neither O2/3 use fast-math
# debug: O0, relwithdebinfo: 02, release: O3, minsizerel: Os (all defaults)
set (CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers")
if (CORSIKA_SCL_CXX)
add_definitions (-D_GLIBCXX_USE_CXX11_ABI=0)
endif()
# clang produces a lot of unecessary warnings without this:
add_compile_options (
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-nonportable-include-path>
)
#+++++++++++++++++++++++++++++
# Setup external dependencies.
#
###
#
# add cnpy temporarily. As long as SaveBoostHistogram does not save to parquet directly
#
add_subdirectory (externals/cnpy)
#+++++++++++++++++++++++++++++
# Coverage
#
# targets and settings needed to generate coverage reports
#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")
set (c8_lcov_download_url "https://github.com/linux-test-project/lcov/releases/download")
set (c8_lcov_version "1.16")
set (c8_lcov_install_dir "${CMAKE_BINARY_DIR}/lcov")
include(ExternalProject)
ExternalProject_Add(lcov
URL ${c8_lcov_download_url}/v${c8_lcov_version}/lcov-${c8_lcov_version}.tar.gz
DOWNLOAD_NO_EXTRACT 0
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND make -C <SOURCE_DIR> install PREFIX=${c8_lcov_install_dir}
)
find_package (Perl REQUIRED)
# compile coverage under -O0 to avoid any optimization, function elimation etc.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage")
# search for local lcov
find_program (c8_lcov_bin lcov)
if (NOT c8_lcov_bin)
set (c8_lcov_bin "${c8_lcov_install_dir}/bin/lcov")
message ("use C8 version of lcov ${c8_lcov_bin}")
endif ()
# search for local genhtml
find_program (c8_genhtml_bin genhtml)
if (NOT c8_genhtml_bin)
set (c8_genhtml_bin "${c8_lcov_install_dir}/bin/genhtml")
message ("use C8 version of genhtml ${c8_genhtml_bin}")
endif ()
set (GCOV gcov CACHE STRING "gcov executable" FORCE)
# collect coverage data
add_custom_command (
OUTPUT raw-coverage.info
COMMAND ${CMAKE_COMMAND} -E echo "Note: you need to run ctest at least once to generate the coverage data"
COMMAND ${c8_lcov_bin} --gcov-tool=${GCOV} --rc lcov_branch_coverage=1
--directory . --capture --output-file raw-coverage.info
)
# remove uninteresting entries
add_custom_command (
OUTPUT coverage.info
COMMAND ${c8_lcov_bin} -q --remove raw-coverage.info "*/usr/*" "/usr/*" --output-file coverage2.info
COMMAND ${c8_lcov_bin} --remove coverage2.info
"*/externals/*" "*/tests/*" "*/sibyll2.3d.cpp" "*/.conan/*"
"*/include/Pythia8/*" "*/install/*"
"${CMAKE_SOURCE_DIR}/modules/*" "${CMAKE_BINARY_DIR}/modules/*"
"*/cxroot/*" "*/.conan2/*" "/boost/*"
--output-file coverage.info
COMMAND ${CMAKE_COMMAND} -E remove coverage2.info
DEPENDS raw-coverage.info
)
# generate html report
add_custom_command (
OUTPUT coverage-report
COMMAND ${c8_genhtml_bin} --branch-coverage --show-details --title "CORSIKA 8 test coverage" --legend --demangle-cpp coverage.info -o coverage-report
DEPENDS coverage.info
)
add_custom_target (coverage DEPENDS coverage-report)
endif ()
#+++++++++++++++++++++++++++++
# CTest config
#
enable_testing ()
set (CTEST_OUTPUT_ON_FAILURE 1)
# unit testing coverage, does not work yet
#include (CodeCoverage)
##set(COVERAGE_LCOV_EXCLUDES 'Documentation/*')
##setup_target_for_coverage(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage)
#SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML (
# NAME corsika_coverage
# EXECUTABLE ctest
# #-j ${PROCESSOR_COUNT}
# # DEPENDENCIES corsika
# )
#add_custom_target (corsika_pre_build)
#add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py")
# dependencies
find_package (Boost 1.40 COMPONENTS program_options REQUIRED)
find_package (Eigen3 REQUIRED)
#find_package (HDF5) # not yet needed
# order of subdirectories
add_subdirectory (ThirdParty)
add_subdirectory (Framework)
add_subdirectory (Stack)
add_subdirectory (Processes)
add_subdirectory (Documentation)
add_subdirectory (Main)
if (${CMAKE_VERSION} VERSION_LESS "3.12.0")
list (APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure")
else (${CMAKE_VERSION} VERSION_LESS "3.12.0")
set (CTEST_OUTPUT_ON_FAILURE 1) # this is for new versions of cmake
endif (${CMAKE_VERSION} VERSION_LESS "3.12.0")
set (CTEST_CUSTOM_COVERAGE_EXCLUDE "./tests/" "./examples/" "./modules/" "test*.(hpp/cpp)$")
# include this test only if NOT run on gitlab-ci; On CI this is a dedicated job:
if (NOT DEFINED ENV{CI})
# add call to ./do-copyright.py to run as unit-test-case
add_test (NAME copyright_notices COMMAND ./do-copyright.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif (NOT DEFINED ENV{CI})
#+++++++++++++++++++++++++++++
# Externals
#
set (Python_ADDITIONAL_VERSIONS 3)
find_package (PythonInterp 3 REQUIRED)
#+++++++++++++++++++++++++++++++
# exporting of CMake targets
#
include (CMakePackageConfigHelpers)
# list of targets that will be INSTALLed and EXPORTed
# Important: all those targets must be individually INSTALLed with "EXPORT CORSIKA8PublicTargets"
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
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<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(Catch2 REQUIRED)
target_link_libraries (
CORSIKA8
INTERFACE
BZip2::BZip2
Boost::filesystem
CLI11::CLI11
Eigen3::Eigen
spdlog::spdlog
yaml-cpp::yaml-cpp
Parquet::parquet_static
PROPOSAL::PROPOSAL
cnpy # for SaveBoostHistogram
)
# "src" is needed, since some headers (namely GeneratedParticleProperties.inc ec.) are produced by python script from e.g. ParticleData.xml
add_subdirectory (src)
add_subdirectory (documentation)
#+++++++++++++++++++++++++++++
# = Add of subdirectories =
#
#+++++++++++++++++++++++++++++
# modules
#
set (CORSIKA_DATA_WITH_TEST ON) # we want to run the corsika-data unit test
add_subdirectory (modules/data) # this is corsika-data (submodule)
add_subdirectory (modules/common)
add_subdirectory (modules/pythia8)
add_subdirectory (modules/sibyll)
add_subdirectory (modules/sophia)
add_subdirectory (modules/qgsjetII)
add_subdirectory (modules/urqmd)
add_subdirectory (modules/conex)
add_subdirectory (modules/epos)
add_subdirectory (modules/tauola)
add_subdirectory (modules/fluka)
#
#+++++++++++++++++++++++++++++++
# standard applications
#
add_subdirectory(applications)
#+++++++++++++++++++++++++++++++
# unit testing
#
add_subdirectory (tests)
#+++++++++++++++++++++++++++++++
# installation
#
install (
TARGETS CORSIKA8
EXPORT CORSIKA8PublicTargets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# header only part, just copy entire directory tree
#
install (DIRECTORY corsika DESTINATION include)
#
# generate cmake config package version (for find_package)
#
write_basic_package_version_file (
${PROJECT_BINARY_DIR}/corsikaConfigVersion.cmake
VERSION ${c8_version}
COMPATIBILITY SameMajorVersion
)
#
# export targets in build tree (for find_package)
#
export (
EXPORT CORSIKA8PublicTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/corsikaTargets.cmake"
NAMESPACE CORSIKA8::
)
#
# export targets in install tree (for find_package)
#
install (
EXPORT CORSIKA8PublicTargets
FILE corsikaTargets.cmake
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)
#
configure_package_config_file (
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/corsikaConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# corsikaDefines
#
configure_package_config_file (
cmake/corsikaDefines.cmake
${PROJECT_BINARY_DIR}/corsikaDefines.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# config for install tree (for find_package)
# overwrite with install locations (if it was build as part of corsika)
#
set (Pythia8_INCDIR ${Pythia8_INCDIR_INSTALL})
set (Pythia8_LIBDIR ${Pythia8_LIBDIR_INSTALL})
configure_package_config_file (
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/corsikaConfig.cmake-install
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# generate "corsika/corsika.hpp" file with cmake-level details and paths
# first for build-tree
#
# the location of the "corsika-data" is of fundamental importance
set (CORSIKA_CMAKE_DATA_DIR ${CMAKE_SOURCE_DIR}/modules/data)
configure_file (
src/corsika.hpp.in
${PROJECT_BINARY_DIR}/corsika/corsika.hpp
)
#
# second also for install-tree
#
set (CORSIKA_CMAKE_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}/corsika/data")
configure_file (
src/corsika.hpp.in
${PROJECT_BINARY_DIR}/corsika.hpp-install
)
#
# installation of cmake and config files
#
install (
FILES
${CMAKE_BINARY_DIR}/corsikaDefines.cmake
${CMAKE_BINARY_DIR}/corsikaConfigVersion.cmake
DESTINATION lib/cmake/corsika
)
#
# install and rename install-level corsikaConfig.cmake
#
install (
FILES
${CMAKE_BINARY_DIR}/corsikaConfig.cmake-install
RENAME corsikaConfig.cmake
DESTINATION lib/cmake/corsika
)
#
# also install-level config.hpp
#
install (FILES
${PROJECT_BINARY_DIR}/corsika.hpp-install
RENAME corsika.hpp
DESTINATION include/corsika
)
#
# examples
#
install (DIRECTORY examples DESTINATION ${CMAKE_INSTALL_DATADIR}/corsika)
#
# data
#
install (DIRECTORY modules/data DESTINATION ${CMAKE_INSTALL_DATADIR}/corsika)
#
# tools
#
add_subdirectory (tools)
#+++++++++++++++++++++++++++++++
#
# final summary output
#
include (FeatureSummary)
feature_summary (WHAT ALL)
#
# takes a list of input files and prepends a path
#
function (CORSIKA_PREPEND_PATH return prefix)
set (listVar "")
foreach (f ${ARGN})
list (APPEND listVar "${prefix}/${f}")
endforeach (f)
set (${return} "${listVar}" PARENT_SCOPE)
endfunction (CORSIKA_PREPEND_PATH)
#
# use: CORSIKA_COPY_HEADERS_TO_NAMESPACE theLib theNamesapce header1.h header2.h ...
#
# creates a dependence of theLib on the presence of all listed header files in the
# build-directory include/theNamespace directory
#
# if needed, create symbolic links from the source files to this build-directory location
#
# any path information from input filenames is stripped, IF path was specified it is used for the link destination, if NOT the link is relative to the CMAKE_CURRENT_SOURCE_DIR
#
function (CORSIKA_COPY_HEADERS_TO_NAMESPACE for_library in_namespace)
set (HEADERS_BUILD "")
foreach (HEADER ${ARGN})
# find eventual path, and handle it specificly
get_filename_component (barename ${HEADER} NAME)
get_filename_component (baredir ${HEADER} DIRECTORY)
# remove path, prepend build-directory destination
list (APPEND HEADERS_BUILD "${PROJECT_BINARY_DIR}/include/${in_namespace}/${barename}")
# define source location, use path if specified, otherwise CMAKE_CURRENT_SOURCE_DIR
set (FROM_DIR ${CMAKE_CURRENT_SOURCE_DIR})
if (NOT "${baredir}" STREQUAL "")
set (FROM_DIR ${baredir})
endif ()
# define command to perform the symbolic linking
add_custom_command (
OUTPUT ${PROJECT_BINARY_DIR}/include/${in_namespace}/${barename}
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/include/${in_namespace}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${FROM_DIR}/${barename} ${PROJECT_BINARY_DIR}/include/${in_namespace}/${barename}
COMMENT "Generate link: ${PROJECT_BINARY_DIR}/include/${in_namespace}/${barename}"
)
endforeach (HEADER)
# main target for this build step, depends on header files in build area
add_custom_target (
${for_library}_BUILD
DEPENDS ${HEADERS_BUILD}
)
# connect the _BUILD target to the main (external) target
add_dependencies (${for_library} ${for_library}_BUILD)
endfunction (CORSIKA_COPY_HEADERS_TO_NAMESPACE)
# Guidelines for code development, structure, formating etc.
The CORSIKA Project very much welcomes contributions. Here we outline
how you can find the right place to contribute, and how to do that.
Connect to https://gitlab.iap.kit.edu and corsika-devel@lists.kit.edu (self-register at https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in touch with the project.
The CORSIKA Project decides on the [contributing guidelines](CONTRIBUTING.md) and can decide to
change/improve them.
# How to contribute
- We organize all development via gitlab `Issues` that may be feature requests,
ideas, discussions, or bugs fix requests.
- New issues can be created, or existing issues
picked up or contributed to.
- Issues are discussed in meetings or via corsika-devel@lists.kit.edu
within the CORSIKA Project.
- Issues are assigned to milestones.
- The work on issues is performed in `branches` that can be best
created directly via the gitlab web interface.
- Proposed code to close one issue (located in a specific git
branch) is reviewed, discussed, and eventually merged
into the master branch via a merge-request (MR) to close the issue.
- all merge request will undergo a code review, and must be approved before merge, in order to ensure high code qualtiy: [Code Approval Procedure](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
## Code formatting
We rely on `clang-format` for code formatting. This has the tremendous
advantage that definitely all code follows the same formatting rules,
and nobody at any point needs to invest time and effort into code
formatting. We provide a script `do-clang-format.sh`, which can be
very useful. But we urge everybody to integrate `clang-format` already
on the level of your source code editor. See [the official
page](https://clang.llvm.org/docs/ClangFormat.html) for information
about `clang-format` and its editor integrations. At least: run
`do-clang-format.sh` prior to any `git add/commit` command. Code with
improper formatting will not be accepted for merging. It will trigger automatic warnings by the continuous integration (CI) system.
The definition of source code format is written down in the file
[.clang-format](.clang-format) and can be changed, if the CORSIKA
Project agrees on it. To see what is possible, check
e.g. [link1](https://clangformat.com/) or
[link2](https://zed0.co.uk/clang-format-configurator/).
## Coding rules, conventions and guidelines
Please read the [Coding wiki page](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Coding-Conventions-and-Guidelines).
## Release versioning scheme
Releases of CORSIKA 8 are thought to be the baseline for larger scale
validation, and full production. The releases are numbered as CORSIKA 8 vx.y.z,
starting with x=1. The x index is updated for new releases that normally contain improved or
enhanced physics performance, and also interface
changes to accomodate improvements. The y and z indices can be updated more
frequently for bug fixes or new features. Changes in z will not
contain interface changes, thus, production code will remain
fully compatible within changes of z. Special releases of CORSIKA might
also have a release name.
# How to become scientific author of the CORSIKA Project
The CORSIKA Project decides on who becomes scientific author. The
following conditions are sufficient, but not all of them are
required all the time:
- responsibility for a particular functionality or software/management part
- have read and follow our [contributing guidelines](CONTRIBUTING.md)
- active in the CORSIKA Project, that means responsive to
discussions and problems in corsika-devel@list.kit.edu or on https//gitlab.iap.kit.edu,
of relevant *Issues*, in (phone) meetings or our Mattermost workspace
- agreement to the [using and collaborating agreement](USING_COLLABORATING.md)
- the members of the CORSIKA Project must agree
add_subdirectory (Doxygen)
add_subdirectory (Examples)
add_executable (helix_example helix_example.cc)
target_link_libraries(helix_example CORSIKAgeometry CORSIKAunits)
install (TARGETS helix_example DESTINATION share/examples)
add_executable (geometry_example geometry_example.cc)
target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits)
install (TARGETS geometry_example DESTINATION share/examples)
add_executable (logger_example logger_example.cc)
target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
install (TARGETS logger_example DESTINATION share/examples)
add_executable (stack_example stack_example.cc)
target_link_libraries (stack_example SuperStupidStack CORSIKAunits CORSIKAlogging)
install (TARGETS stack_example DESTINATION share/examples)
add_executable (staticsequence_example staticsequence_example.cc)
target_link_libraries (staticsequence_example SuperStupidStack CORSIKAprocesssequence CORSIKAunits CORSIKAlogging)
install (TARGETS staticsequence_example DESTINATION share/examples)
#include <corsika/logging/Logger.h>
#include <boost/format.hpp>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
using namespace corsika::logging;
int main() {
{
cout << "writing to \"another.log\"" << endl;
ofstream logfile("another.log");
sink::SinkStream unbuffered_sink(logfile);
sink::BufferedSinkStream sink(logfile, sink::StdBuffer(10000));
Logger<MessageOn, sink::BufferedSinkStream> info("\033[32m", "info", sink);
Logger<MessageOn, sink::BufferedSinkStream> err("\033[31m", "error", sink);
// logger<ostream,messageconst,StdBuffer> info(std::cout, StdBuffer(10000));
/*
Logging& logs = Logging::GetInstance();
logs.AddLogger<>("info", info);
auto& log_1 = logs.GetLogger("info"); // no so useful, since type of log_1 is
std::any
*/
for (int i = 0; i < 100000; ++i) {
LOG(info, "irgendwas", " ", string("and more"), " ",
boost::format("error: %i message: %s. done."), i, "stupido");
LOG(err, "Fehler");
}
}
{
sink::NoSink off;
Logger<MessageOff> info("", "", off);
for (int i = 0; i < 100000; ++i) {
LOG(info, "irgendwas", string("and more"),
boost::format("error: %i message: %s. done."), i, "stupido", "a-number:", 8.99,
"ENDE");
}
}
return 0;
}
#include <corsika/particles/ParticleProperties.h>
#include <corsika/stack/super_stupid/SuperStupidStack.h>
#include <iomanip>
#include <iostream>
using namespace std;
// using namespace corsika::literals;
// using namespace corsika::io;
using namespace corsika::units;
using namespace corsika::stack;
void fill(corsika::stack::super_stupid::SuperStupidStack& s) {
for (int i = 0; i < 11; ++i) {
auto p = s.NewParticle();
p.SetId(corsika::particles::Code::Electron);
p.SetEnergy(1.5_GeV * i);
}
}
void read(corsika::stack::super_stupid::SuperStupidStack& s) {
cout << "found Stack with " << s.GetSize() << " particles. " << endl;
EnergyType Etot;
for (auto p : s) {
Etot += p.GetEnergy();
cout << "particle: " << p.GetId() << " with " << p.GetEnergy() / 1_GeV << " GeV"
<< endl;
}
cout << "Etot=" << Etot << " = " << Etot / 1_GeV << " GeV" << endl;
}
int main() {
corsika::stack::super_stupid::SuperStupidStack s;
fill(s);
read(s);
return 0;
}
#include <array>
#include <iomanip>
#include <iostream>
#include <corsika/process/ProcessSequence.h>
using namespace std;
using namespace corsika::process;
class Process1 : public corsika::process::BaseProcess<Process1> {
public:
Process1() {}
template <typename D>
void DoContinuous(D& d) const {
for (int i = 0; i < 10; ++i) d.p[i] += 1;
}
};
class Process2 : public corsika::process::BaseProcess<Process2> {
public:
Process2() {}
template <typename D>
inline void DoContinuous(D& d) const {
// for (int i=0; i<10; ++i) d.p[i] *= 2;
}
};
class Process3 : public BaseProcess<Process3> {
public:
// Process3(const int v) :fV(v) {}
Process3() {}
template <typename D>
inline void DoContinuous(D& d) const {
// for (int i=0; i<10; ++i) d.p[i] += fV;
}
private:
// int fV;
};
class Process4 : public BaseProcess<Process4> {
public:
// Process4(const int v) : fV(v) {}
Process4() {}
template <typename D>
inline void DoContinuous(D& d) const {
// for (int i=0; i<10; ++i) d.p[i] /= fV;
}
private:
// int fV;
};
class Data {
public:
std::array<double, 10> p{{0.}};
};
void modular() {
Data d0;
Process1 m1;
Process2 m2;
Process3 m3;
Process4 m4;
const auto sequence = m1 + m2 + m3 + m4;
const int n = 100000000;
for (int i = 0; i < n; ++i) { sequence.DoContinuous(d0); }
double s = 0;
for (int i = 0; i < 10; ++i) { s += d0.p[i]; }
cout << scientific << " v=" << s << " n=" << n << endl;
}
int main() {
modular();
return 0;
}
add_subdirectory (Units)
add_subdirectory (Geometry)
add_subdirectory (Particles)
add_subdirectory (Logging)
add_subdirectory (StackInterface)
add_subdirectory (ProcessSequence)
namespace cascade;
template <typename Sequence, typename Trajectory>
void Cascade::Cascade() {
kkk;
kk;
}
template <typename Sequence, typename Trajectory>
void Cascade::Init() {
fStack.Init();
fProcesseList.Init();
}
template <typename Sequence, typename Trajectory>
void Cascade::Run() {
if (!fStack.IsEmpty()) {
if (!fStack.IsEmpty()) {
Particle& p = fStack.GetNextParticle();
Step(p);
}
// do cascade equations, which can put new particles on Stack,
// thus, the double loop
// DoCascadeEquations(); //
}
}
template <typename Sequence, typename Trajectory>
void Cascade::Step(Particle& particle) {
double nextStep = fProcesseList.MinStepLength(particle);
Trajectory trajectory = fProcesseList.Transport(particle, nextStep);
sequence.DoContinuous(particle, trajectory);
sequence.DoDiscrete(particle);
}
#ifndef _include_Cascade_h_
#define _include_Cascade_h_
namespace cascade {
template <typename Processes, typename Trajectory, typename Stack>
class Cascade {
public:
Cascade();
void Init();
void Run();
void Step(Particle& particle);
private:
Stack fStack;
Processes fProcesseList;
};
} // namespace cascade
#endif
namespace cascade;
void Cascade::Step(auto& sequence, Particle& particle) {
double nextStep = sequence.MinStepLength(particle);
Trajectory trajectory = sequence.Transport(particle, nextStep);
sequence.DoContinuous(particle, trajectory);
sequence.DoDiscrete(particle);
}