IAP GITLAB

Skip to content
Snippets Groups Projects
Commit e602d722 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

Merge branch 'master' of gitlab.ikp.kit.edu:AirShowerPhysics/corsika

parents 829e0de6 c8d72192
No related branches found
No related tags found
No related merge requests found
Showing
with 413 additions and 24 deletions
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
/** /**
@file Particles.h @file Particles.h
Interface to particle properties Interface to particle properties
*/ */
#ifndef _include_ParticleProperties_h_ #ifndef _include_corsika_particles_ParticleProperties_h_
#define _include_ParticleProperties_h_ #define _include_corsika_particles_ParticleProperties_h_
#include <array> #include <array>
#include <cstdint> #include <cstdint>
...@@ -24,6 +35,7 @@ ...@@ -24,6 +35,7 @@
*/ */
namespace corsika::particles { namespace corsika::particles {
enum class Code : int16_t; enum class Code : int16_t;
using PDGCodeType = int16_t; using PDGCodeType = int16_t;
...@@ -34,7 +46,7 @@ namespace corsika::particles { ...@@ -34,7 +46,7 @@ namespace corsika::particles {
corsika::units::si::ElectricChargeType constexpr GetElectricCharge(Code const); corsika::units::si::ElectricChargeType constexpr GetElectricCharge(Code const);
corsika::units::si::MassType constexpr GetMass(Code const); corsika::units::si::MassType constexpr GetMass(Code const);
PDGCodeType constexpr GetPDG(Code const); PDGCodeType constexpr GetPDG(Code const);
std::string const& GetName(Code const); constexpr std::string const& GetName(Code const);
#include <corsika/particles/GeneratedParticleProperties.inc> #include <corsika/particles/GeneratedParticleProperties.inc>
...@@ -60,15 +72,13 @@ namespace corsika::particles { ...@@ -60,15 +72,13 @@ namespace corsika::particles {
return GetElectricChargeNumber(p) * (corsika::units::si::constants::e / 3.); return GetElectricChargeNumber(p) * (corsika::units::si::constants::e / 3.);
} }
std::string const& GetName(Code const p) { constexpr std::string const& GetName(Code const p) {
return names[static_cast<CodeIntType const>(p)]; return names[static_cast<CodeIntType const>(p)];
} }
namespace io { namespace io {
std::ostream& operator<<(std::ostream& stream, Code const p) { std::ostream& operator<<(std::ostream& stream, Code const p);
return stream << GetName(p);
}
} // namespace io } // namespace io
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <corsika/particles/ParticleProperties.h> #include <corsika/particles/ParticleProperties.h>
#include <corsika/units/PhysicalUnits.h> #include <corsika/units/PhysicalUnits.h>
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#ifndef _include_ProcessReturn_h_ #ifndef _include_ProcessReturn_h_
#define _include_ProcessReturn_h_ #define _include_ProcessReturn_h_
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#ifndef _include_ProcessSequence_h_ #ifndef _include_ProcessSequence_h_
#define _include_ProcessSequence_h_ #define _include_ProcessSequence_h_
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one
// cpp file // cpp file
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <corsika/random/RNGManager.h> #include <corsika/random/RNGManager.h>
void corsika::random::RNGManager::RegisterRandomStream(std::string const& pStreamName) { void corsika::random::RNGManager::RegisterRandomStream(std::string const& pStreamName) {
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#ifndef _include_RNGManager_h_ #ifndef _include_RNGManager_h_
#define _include_RNGManager_h_ #define _include_RNGManager_h_
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one
// cpp file // cpp file
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
......
add_library (CORSIKAstack INTERFACE)
target_include_directories (CORSIKAstack INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework>
$<INSTALL_INTERFACE:include/Framework>
)
install (FILES Stack.h StackIterator.h
DESTINATION include/Stack)
...@@ -31,9 +31,7 @@ install ( ...@@ -31,9 +31,7 @@ install (
include/${CORSIKAstackinterface_NAMESPACE} include/${CORSIKAstackinterface_NAMESPACE}
) )
#code testing
# code testing
add_executable (testStackInterface testStackInterface.cc) add_executable (testStackInterface testStackInterface.cc)
target_link_libraries (testStackInterface CORSIKAstackinterface CORSIKAthirdparty) # for catch2
add_test(NAME testStackInterface COMMAND testStackInterface) add_test(NAME testStackInterface COMMAND testStackInterface)
target_link_libraries (testStackInterface CORSIKAstackinterface CORSIKAthirdparty) # for catch2
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#ifndef _include_particleBase_h_ #ifndef _include_particleBase_h_
#define _include_particleBase_h_ #define _include_particleBase_h_
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#ifndef _include_Stack_h__ #ifndef _include_Stack_h__
#define _include_Stack_h__ #define _include_Stack_h__
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#ifndef _include_StackIterator_h__ #ifndef _include_StackIterator_h__
#define _include_StackIterator_h__ #define _include_StackIterator_h__
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <corsika/stack/Stack.h> #include <corsika/stack/Stack.h>
#include <iomanip> #include <iomanip>
......
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one
// cpp file // cpp file
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
...@@ -16,7 +27,7 @@ TEST_CASE("PhysicalUnits", "[Units]") { ...@@ -16,7 +27,7 @@ TEST_CASE("PhysicalUnits", "[Units]") {
} }
SECTION("Constructors") { SECTION("Constructors") {
auto E1 = 10_GeV; [[maybe_unused]] auto E1 = 10_GeV;
REQUIRE(E1 == 10_GeV); REQUIRE(E1 == 10_GeV);
LengthType l1 = 10_nm; LengthType l1 = 10_nm;
...@@ -25,11 +36,11 @@ TEST_CASE("PhysicalUnits", "[Units]") { ...@@ -25,11 +36,11 @@ TEST_CASE("PhysicalUnits", "[Units]") {
LengthType arr0[5]; LengthType arr0[5];
arr0[0] = 5_m; arr0[0] = 5_m;
LengthType arr1[2] = {{1_mm}, {2_cm}}; [[maybe_unused]] LengthType arr1[2] = {{1_mm}, {2_cm}};
std::array<EnergyType, 4> arr2; // empty array std::array<EnergyType, 4> arr2; // empty array
std::array<EnergyType, 4> arr3 = {1_GeV, 1_eV, 5_MeV}; [[maybe_unused]] std::array<EnergyType, 4> arr3 = {1_GeV, 1_eV, 5_MeV};
} }
SECTION("Powers in literal units") { SECTION("Powers in literal units") {
......
# Guidelines for code development, structure, formating etc.
The CORSIKA Project very much welcomes contributions. Here we outlined
how you can find the right place to contribute, and how to do that.
Connect to http://gitlab.ikp.kit.edu and corsika-devel@lists.kit.edu
or corsika-project@lists.kit.edu to get in touch with the project.
The CORSIKA Project decides on the [GUIDELINES](GUIDELINES.md), and can
change them.
# How to contribute
- We organize all development via `Issues` that may be feature requests,
ideas, or bugs fix requests.
- New issues can be created, or existing issues
picked up.
- 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 and eventually discussed, and finally merged
into the master branch to close the issue.
## 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 integration.
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/).
## Naming conventions
While `clang-format` does the structural formatting, we still need to agree on naming conventions:
- Classes and structs start with capital letters
- Class member variables start with "f"
- Any static variable has a "g" prefix. A static member variable starts with "fg"
- Class member functions start with capital letters
- Any class getter begins with "Get", and setter with "Set"
- enums should be "enum class", and start with a capital "E", enum entries start with "e"
- We use namespaces to avoid clashes and to structure code
- *Everything* is part of the corsika namespace
- All classes and objects are encapsulated into suited sub-namespaces,
thus corsika::geometry, corsika::processes, 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 `#ifnedf __geometry_Point_h__`,
or similar are acceptable.
- Header files should always be included with `<..>`, thus,
`#include <corsika/geometry/Point.h>` since the build system
will always provide the correct include directives (and files
anyway cannot be found in file-system paths that typically 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
- Code may not introduce any compiler errors, or warnings
- All unit tests must succeed at all times
- We use C++17 concepts 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 pointer in the interface of any class or object
exposed to outside users, there might be pointers for very special cases
inside of classes.
- When you contribute new code, or extend existing code, at the same time provide unit-tests for all functionality.
- Code must be documented with `doxygen` commands
## 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 changes to accomodate improvements. The z index can be updated frequently for
bug fixes or new features. Changes in z will not contain interface changes, thus, code will remain fully compatible.
Special releases of CORSIKA can also have a tag name from git, e.g. as in the "milestone1" release.
# 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
required all the time:
- responsibility for a particular functionality or part
- follows these [GUIDELINES](GUIDELINES.md)
- agrees to the [COLLABORATION_AGREEMENT](COLLABORATION_AGREEMENT.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
- the members of the CORSIKA Project panel agree
These guidelines are copied from: http://www.montecarlonet.org/
---------------------------------------------------------------
MCNET GUIDELINES
for Event Generator Authors and Users
PREAMBLE
This generator has been developed as part of an academic research
project and is the result of many years of work by the authors.
Proper academic recognition is a requirement for its continued
development.
The components of the program have been developed to work together
as a coherent physics framework. We believe that the creation of
separately maintained forks or piecewise distribution of individual
parts would diminish their scientific value.
The authors are convinced that software development in a scientific
context requires full availability of all source code, to further
progress and to allow local modifications to meet the specific
requirements of the individual user.
Therefore we have decided to release this program under the GNU
General Public License (GPL) version 2 (with the option to instead
follow the terms and conditions of any later version of GPL). This
ensures that the source code will be available to you and grants you
the freedom to use and modify the program. You can redistribute your
modified versions as long as you retain the GPL and respect existing
copyright notices (see the file 'COPYING' for details).
By using the GPL, we entrust you with considerable freedom and expect
you to use it wisely, since the GPL does not address the issues in
the first two paragraphs. To remedy this shortcoming, we have
formulated the following guidelines relevant for the distribution
and usage of event generator software in an academic setting.
GUIDELINES
1) The integrity of the program should be respected.
-------------------------------------------------
1.1) Suspected bugs and proposed fixes should be reported back to the
original authors to be considered for inclusion in the standard
distribution. No independently developed and maintained forks
should be created as long as the original authors actively work on
the program.
1.2) The program should normally be redistributed in its entirety.
When there are special reasons, an agreement should be sought with
the original authors to redistribute only specific parts. This
should be arranged such that the redistributed parts remain
updated in step with the standard distribution.
1.3) Any changes in the code must be clearly marked in the source
(reason, author, date) and documented. If any modified version is
redistributed it should be stated at the point of distribution
(download link) that it has been modified and why.
1.4) If a significant part of the code is used by another program,
this should be clearly specified in that program's documentation and
stated at its point of distribution.
1.5) Copyright information and references may not be removed.
Copyright-related program messages may not be altered and must be
printed even if only a part of the program is used. Adding further
messages specifying any modifications is encouraged.
2) The program and its physics should be properly cited when used for
academic publications
------------------------------------------------------------------
2.1) The main software reference as designated by the program authors
should always be cited.
2.2) In addition, the original literature on which the program is based
should be cited to the extent that it is of relevance for a study,
applying the same threshold criteria as for other literature.
2.3) When several programs are combined, they should all be mentioned,
commensurate with their importance for the physics study at hand.
2.4) To make published results reproducible, the exact versions of the
codes that were used and any relevant program and parameter
modifications should be spelled out.
POSTSCRIPT
The copyright license of the software is the GPL v2 alone, therefore
the above guidelines are not legally binding. However, we reserve the
right to criticize offenders. The guidelines should always be combined
with common sense, for interpretation and for issues not covered.
Enquiries regarding the guidelines and related issues are encouraged
and should be directed to the authors of the program.
Please note that the program, including all its code and documentation,
is intended for academic use and is delivered "as is" to be used at
your own risk, without any guarantees.
----------------------------------------------------------------------
These guidelines were edited by Nils Lavesson and David Grellscheid
for the MCnet collaboration, which has approved and agreed to respect
them. MCnet is a Marie Curie Research Training Network funded under
Framework Programme 6 contract MRTN-CT-2006-035606.
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
/**
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <utl/Stack.h> #include <utl/Stack.h>
int main(int argc, char** argv) { return 0; } int main(int argc, char** argv) { return 0; }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment