IAP GITLAB

Commit 35b66632 authored by Ralf Ulrich's avatar Ralf Ulrich

simplified modules area

rename framweork/sequence int framework/process

remove all dynamic build files from main corsika directory, move into src

re-added main/shower

fixed wrong file locations

Update corsika.hpp. Re-defining the version macros.

Update corsika.hpp

Update CONTRIBUTING.md

Update MAINTAINERS.md
Deleted FIXME.md

Deleted AUTHORS

Update COLLABORATION_AGREEMENT.md

Update .clang-format

Update .gitlab-ci.yml

added packages: proposal, conex, cnpy, spdlog, lcov, corsika-data

prevent in-source builds

fotran language

flags, sections

build types

fixed stack_example

rename directories

corsika8 interface target

fixed few compilation, dependency issues in new system

clang error

simpler cmake files, using functions, re-introduce run_examples target

clang format

copyright notices

fixed CI script, clang-format

simplify ctest output

better interfaces for urqmd and qgsjII, conex

updated conex, data cmake integration

build system cmake updates

also updated corsika.hpp

added earth radius

moved static_pow from corsika::units::si::detail to corsika::units

updated units::si namespaces throughout the project

No python jobs

removed a lot of stray using namespaces and corsika::units::si in entire codebase

[refactory-2020] stack implementations: updated

[refactory-2020] stack implementations: updated

[refactory-2020] stack implementations

[refactory-2020] stack implementations: !290 headers

[refactory-2020] stack implementations: !290 headers
parent 7afc4547
......@@ -11,7 +11,7 @@ variables:
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}/Data" # the git submodule
CORSIKA_DATA: "${CI_PROJECT_DIR}/modules/data" # the git submodule
# _alternatively_ corsika-data can be downloaded as submodule:
GIT_SUBMODULE_STRATEGY: normal # none: we get the submodules in before_script,
# normal: get submodules automatically
......@@ -29,7 +29,6 @@ stages:
- build
- test
- build_test
- python
- example
- build_test_example
- install
......@@ -272,8 +271,6 @@ build_test-clang-8:
# normal pipeline for each commit
.example:
stage: example
before_script:
- apt-get -qq update && apt-get -qq install -y gdb
tags:
- corsika
script:
......@@ -328,8 +325,6 @@ example-clang-8:
stage: build_test_example
tags:
- corsika
before_script:
- apt-get -qq update && apt-get -qq install -y gdb
script:
- cd build
- cmake --build . -- -j4
......@@ -438,8 +433,6 @@ install-clang-8:
stage: optional
tags:
- corsika
before_script:
- apt-get -qq update && apt-get -qq install -y gdb
script:
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release
......@@ -604,36 +597,3 @@ sanity:
key: "${CI_COMMIT_REF_SLUG}-gcc"
##########################################################
# template for all Python jobs
.python:
stage: python
tags:
- corsika
script:
- cd ${CI_PROJECT_DIR}/Python # change into the Python directory
- pip install --user -e '.[test]' # install the package + test deps
- make all 2&>1 | tee python-test.log # this runs all of the Python tests
- echo "finished" >> python-test.log # create even an empty file...
- cd ${CI_PROJECT_DIR} # reset the directory
artifacts:
when: always
expire_in: 1 year
paths:
- ${CI_PROJECT_DIR}/Python/python-test.log
allow_failure: true
# we now configure the jobs for the three
# supported Python versions
python-3.6:
extends: .python
image: python:3.6
python-3.7:
extends: .python
image: python:3.7
python-3.8:
extends: .python
image: python:3.8
[submodule "Data"]
path = Data
[submodule "modules/data"]
path = modules/data
url = ../../AirShowerPhysics/corsika-data
branch = master
[submodule "ThirdParty/spdlog"]
path = ThirdParty/spdlog
shallow = true
[submodule "externals/spdlog"]
path = externals/spdlog
url = https://github.com/gabime/spdlog.git
shallow = true
[submodule "Processes/Proposal/PROPOSAL"]
path = Processes/Proposal/PROPOSAL
shallow = true
[submodule "modules/proposal"]
path = modules/proposal
url = https://github.com/tudo-astroparticlephysics/PROPOSAL.git
shallow = true
branch = restructure_parametrization
shallow = true
[submodule "modules/conex"]
path = modules/conex
url = ../../AirShowerPhysics/cxroot
branch = master
shallow = true
This diff is collapsed.
......@@ -23,12 +23,13 @@ liability and licensing question are only handled by the adopted
software license.
## The software license of the CORSIKA project
The license adopted for the CORSIKA project is the explicit copyleft
license GPLv3, as copied in full in the file
[LICENSE](LICENSE). Each source file of the CORSIKA project contains a
short statement of the copyright and this license. Each binary or
source code release of CORSIKA contains the file LICENSE. The
code, documentation and content in the folder [ThirdParty](ThirdParty)
code, documentation and content in the folder [externals](externals)
is not integral part of the CORSIKA project and can be based on, or
include, other licenses, which must be compatible with GPLv3. Check the
content of this folder for details and additional license information. It depends on the configuration of
......
......@@ -8,7 +8,7 @@ change/improve them.
# How to contribute
- We organize all development via `Issues` that may be feature requests,
- 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.
......@@ -19,7 +19,7 @@ change/improve them.
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 to close the issue.
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.ikp.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
......@@ -32,9 +32,9 @@ 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 integration. At least: run
`do-clang-format.sh` prior to any `git add` command. Code with
improper formatting will not be accepted for merging.
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
......@@ -43,138 +43,36 @@ e.g. [link1](https://clangformat.com/) or
[link2](https://zed0.co.uk/clang-format-configurator/).
## Naming conventions
While `clang-format` does the structural formatting, we still need to agree on naming conventions:
- Classes and structs start with capital letters ```LikeThis```
- Class member variables start non-captial and have a trailing "_" ```likeThis_```
- Class member functions start with small letters ```LikeThis::doSomething(...)``` or ```LikeThis::do_something(...)```
- Any class setter begins with "set_" ```LikeThis::set_something(...)```
- Any class getter is named accoring to its property: ```LikeThis::something()```
- Logical getters may start with ```is_``` or ```has_```
- enums should be ```enum class```
- Named variables start with small letter ```likeThis```
- types in template definitions start with "T" ```TLikeThis```
- use names that explain and document the code, thus for example
```
TimeType TimeOfIntersection(Line const& line, Plane const& plane) {
auto const line_direction = line.GetDirection();
auto const plane_normal = plane.GetNormal();
return plane_normal.dot(plane.GetCenter()-line.GetPosition()) / plane_normal.dot(line_direction);
}
```
and not
```
TimeType TimeOfIntersection(Line const& l, Plane const& p) {
auto const d = p.GetCenter() - l.GetR0();
auto const v = l.GetV0();
auto const n = p.GetNormal();
auto const c = n.dot(v);
return n.dot(d) / c;
}
```
This actually is suffient to document the code, no further comments should be added in such cases. Only if further clarification is needed.
- We use namespaces to avoid clashes and to structure code
- *Everything* is part of one of those namespaces:
- ```corsika::framework```, ```corsika::physics```, or ```corsika::process```
- All classes and objects are encapsulated into suited sub-namespaces,
thus corsika, corsikaes, corsika::units, etc.
- Namespace names do not use capital letters.
- Every header file is copied during build and install into
"include/corsika/[namespace]" which also means, each header file
can only provide definitions for a _single_ namespace. It is one
main purpose of namespaces to structure the location of header
files.
- Each header file uses an include protection that includes at
least the namespace name, and header file name, thus, `#ifndef
__include_geometry_Point_h__` or `#ifndef __geometry_Point_h__`,
or similar are acceptable.
- Header files should always be included with `<..>`, thus,
`#include <corsika/framework/geometry/Point.hpp>` since the build system
will always provide the correct include directives (and files
anyway cannot be found in file-system paths, which generally do
not follow the namespace naming conventions outlined
here).
- Header files are named after the main class (or object) they
define. This also means each header file name starts with a
capital letter.
## Coding rules
- Warnings should be fixed, when they appear on the system(s) currently used by the CI, by altering the code unless the warning originates from third-party code and cannot be fixed. In that case, the warning should be locally silenced with appropriate pragmas or by locally turning off warnings for that translation unit.
- All unit tests must succeed on the specified systems/configurations on gitlab-ci. If tests fail, code is not merged.
- The unit test code coverage should not decrease due to a new merge request.
- We use C++17 features wherever useful and helpful.
- On any major error or malfunction we throw an exception. This is needed and required for complex physics and shower debugging.
- We never catch exceptions for error handling, there might be very few special exceptions from this. We need to discuss such cases.
- Everything that should not change should be ```const```
- Everything that does not need to be visible to the outside of a class/struct should be `private` or `protected`
- We prefer the use of references, wherever useful
- There cannot be any raw pointer in the interface of any class or object
exposed to outside users, there might be (technical) raw pointers for very special cases
inside of classes.
- (member)functions that do something (are not just getters/setters), model actions or transformations, and should therefore be verbs. Classes are nouns.
- When you contribute new code, or extend existing code, at the same time provide unit-tests for all functionality.
- When you contribute new physics algorithms, in addition you also need to provide a validation module (this is still TBD what exactly this means)
- Code must be documented with `doxygen` commands extensively -> MAKE THIS INVESTMENT OF YOUR TIME EARLY, IT REALLY HELPS
- There should not be any useless comments in code, in particular absolutely avoid to commit commented-out debug remnants
- Add sufficient and meaningful comments to the code (only in English)
## CMAKE formatting
- command are lower cases, e.g. ```set (...)```
- variables upper case, e.g. ```set (VAR1 Text)```
Since cmake itself lacks structure almost entirely:
- put a space between command and start of parenthesis, e.g. ```command (...)```
- add two spaces for logical indent
```
if (condition)
do something
endif (condition)
```
- break long lines to start with new keyword in new line (indented)
```
install (
FILES ${CORSIKAstackinterface_HEADERS}
DESTINATION include/${CORSIKAstackinterface_NAMESPACE}
)
```
- add plenty of comments to all cmake code
- use expressive variables and functions
## Coding rules, conventions and guidelines
Please read the [Coding wiki page](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/-/wikis/Coding-Conventions-and-Guidelines).
## Release versioning scheme
Releases of CORSIKA are thought to be the baseline for larger scale
testing, and full production. The releases are numbered as x.y.z,
starting with x=8 form the gitlab c++ version. X will only be
incremented for major design or physics changes. The y index is
updated for new official releases that normally contain improved or
enhanced physics performance, and may also contain normal interface
Releases of CORSIKA 8 are thought to be the baseline for larger scale
validation, and full production. The releases are numbered as x.y.z,
starting with x=8, which will not be changed for CORSIKA 8. The y index is
updated for new releases that normally contain improved or
enhanced physics performance, and also interface
changes to accomodate improvements. The z index can be updated more
frequently for bug fixes or new features. Changes in z will not
contain (major) interface changes, thus, production code will remain
fully compatible within changes of z. Special releases of CORSIKA can
also have a tag name from git, e.g. as in the "milestone1" release.
contain interface changes, thus, production code will remain
fully compatible within changes of z. Special releases of CORSIKA will
also have a release names.
# How to become scientific author of the CORSIKA Project
The CORSIKA Project decides on who becomes scientific author. The
following conditions are clearly sufficient, but not all of them are
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 these [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.ikp.kit.edu,
of relevant *Issues*,
or in (phone) meetings
- agreement to the [COLLABORATION_AGREEMENT](COLLABORATION_AGREEMENT.md) is strictly required
- the members of the CORSIKA Project panel agree
of relevant *Issues*, or in (phone) meetings
- agreement to the [COLLABORATION_AGREEMENT](COLLABORATION_AGREEMENT.md)
- the members of the CORSIKA Project must agree
This diff is collapsed.
Maintainers of the CORSIKA8 project are collaborators actively taking
care of code contributions, quality control, development, and related
discussions.
General:
General and infrastructure:
- Ralf Ulrich <ralf.ulrich@kit.edu>, KIT
- Maximilian Reininghaus <maximilian.reininghaus@kit.edu>, KIT
- Hans Dembinski <hdembins@mpi-hd.mpg.de>, Dortmund
- Antonio Augusto Alves Junior <antonio.junior@kit.edu>, KIT
High performance, GPU:
- Dominik Baack <dominik.baack@tu-dortmund.de>, Dortmund
- Antonio Augusto Alves Junior <antonio.junior@kit.edu>, KIT
- Luisa Arrabito <arrabito@in2p3.fr>, Montpellier
Electromagnetic models, and infrastructure:
Electromagnetic models:
- Jean-Marco Alameddine <jean-marco.alameddine@udo.edu>, Dortmund
- Jan Soedingrekso <jan.soedingrekso@tu-dortmund.de>, Dortmund
- Maximilian Sackel <maximilian.sackel@udo.edu>, Dortmund
Hadron models and infrastructure:
Hadron models:
- Felix Riehn <friehn@lip.pt>, Santiago/Lisbon
- Anatoli Fedynitch <anatoli.fedynitch@icecube.wisc.edu> ICRR Tokyo
......
......@@ -8,92 +8,6 @@
# the license.
#
#################################################
#
# 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)
#################################################
#
# use: CORSIKA_ADD_FILES_ABSOLUTE varname
#
# add list of filenames with absolute paths (pointing to CMAKE_SOURCE_DIR) to ${varname} in PARAENT_SCOPE
#
macro (CORSIKA_ADD_FILES_ABSOLUTE varname)
file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
foreach (_src ${ARGN})
if (_relPath)
list (APPEND "${varname}" "${CMAKE_SOURCE_DIR}/${_relPath}/${_src}")
else()
list (APPEND "${varname}" "${CMAKE_SOURCE_DIR}/${_src}")
endif()
endforeach()
if (_relPath)
# propagate SRCS to parent directory
set ("${varname}" "${${varname}}" PARENT_SCOPE)
endif()
endmacro(CORSIKA_ADD_FILES_ABSOLUTE)
#################################################
#
# central macro to register unit tests in cmake
......@@ -143,6 +57,7 @@ function (CORSIKA_ADD_TEST)
endif ()
add_executable (${name} ${sources})
target_link_libraries (${name} CORSIKA8 Catch2)
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/)
......@@ -157,7 +72,7 @@ endfunction (CORSIKA_ADD_TEST)
#################################################
#
# central macro to register an exmaple in cmake
# central macro to register an examples in cmake
#
# Examples can be globally executed by 'make run_examples'
#
......@@ -165,56 +80,37 @@ endfunction (CORSIKA_ADD_TEST)
# Pass the name of the test.cc file as the first
# argument, without the ".cc" extention.
#
# Example: CORSIKA_ADD_EXAMPLE (testSomething)
# Example: CORSIKA_REGISTER_EXAMPLE (doSomething)
#
# This generates target testSomething from file testSomething.cc.
#
# 2) Customize sources:
# If 1) doesn't work, use the SOURCES keyword to explicitly
# specify the sources.
# The TARGET doSomething must already exists,
# i.e. typically via add_executable (doSomething src.cc).
#
# Example: CORSIKA_ADD_EXAMPLE (testSomething
# SOURCES source1.cc source2.cc someheader.h
# RUN_OPTION "extra command line options"
# RUN_IN_GDB)
# )
#
# In all cases, you can further customize the target with
# target_link_libraries(testSomething ...) and so on.
#
function (CORSIKA_ADD_EXAMPLE)
cmake_parse_arguments (PARSE_ARGV 1 C8_ADD_EXAMPLE "RUN_IN_GDB" "" "SOURCES;RUN_OPTIONS")
function (CORSIKA_REGISTER_EXAMPLE)
cmake_parse_arguments (PARSE_ARGV 1 C8_EXAMPLE "" "" "RUN_OPTIONS")
set (name ${ARGV0})
if (NOT C8_ADD_EXAMPLE_SOURCES)
set (sources ${name}.cc)
else ()
set (sources ${C8_ADD_EXAMPLE_SOURCES})
endif ()
if (NOT C8_ADD_EXAMPLE_RUN_OPTIONS)
if (NOT C8_EXAMPLE_RUN_OPTIONS)
set (run_options "")
else ()
set (run_options ${C8_ADD_EXAMPLE_RUN_OPTIONS})
set (run_options ${C8_EXAMPLE_RUN_OPTIONS})
endif ()
add_executable (${name} ${sources})
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}/example_outputs/)
if (TARGET run_examples)
else ()
add_custom_target (run_examples)
endif ()
add_dependencies (run_examples ${name})
if (C8_ADD_EXAMPLE_RUN_IN_GDB)
# convert cmake list into real string:
string (REPLACE ";" " " run_options_str "${run_options}")
# run the command in gdb and study backtrace a bit
set (CMD gdb -q --batch -ex "run ${run_options_str}" -ex bt -ex "info locals" -ex "up" -ex "info locals" -ex "up" -ex "info locals" -ex "up" -ex "info locals" -ex quit "${CMAKE_CURRENT_BINARY_DIR}/${name}")
else (C8_ADD_EXAMPLE_RUN_IN_GDB)
# just run the command as-is
set (CMD ${CMAKE_CURRENT_BINARY_DIR}/${name} ${run_options})
endif (C8_ADD_EXAMPLE_RUN_IN_GDB)
# just run the command as-is
set (CMD ${CMAKE_CURRENT_BINARY_DIR}/${name} ${run_options})
add_custom_command (TARGET run_examples
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo ""
......@@ -223,4 +119,4 @@ function (CORSIKA_ADD_EXAMPLE)
COMMAND ${CMD} VERBATIM
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/example_outputs)
install (TARGETS ${name} DESTINATION share/examples)
endfunction (CORSIKA_ADD_EXAMPLE)