From 9b0227fd260cb1b0064677e712a07c3029373fd4 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 31 Jan 2019 08:57:20 +0100 Subject: [PATCH] the nuclear stack extension with unit test and all needed adaptions --- Documentation/Examples/stack_example.cc | 2 +- Environment/Environment.h | 22 +++ Environment/FlatAtmosphere/FlatAtmosphere.h | 22 +++ Environment/HomogeneousMedium.h | 22 +++ Environment/IMediumModel.h | 22 +++ Environment/NuclearComposition.h | 22 +++ Environment/VolumeTreeNode.h | 22 +++ Environment/testEnvironment.cc | 22 +++ Framework/Cascade/Cascade.h | 22 +++ Framework/Cascade/Step.cc | 22 +++ Framework/Cascade/testCascade.cc | 22 +++ Framework/Geometry/BaseTrajectory.h | 11 ++ Framework/Geometry/BaseVector.h | 11 ++ Framework/Geometry/CoordinateSystem.cc | 11 ++ Framework/Geometry/CoordinateSystem.h | 22 +++ Framework/Geometry/FourVector.h | 11 ++ Framework/Geometry/Helix.h | 11 ++ Framework/Geometry/Line.h | 11 ++ Framework/Geometry/Point.h | 22 +++ Framework/Geometry/QuantityVector.h | 22 +++ Framework/Geometry/RootCoordinateSystem.h | 11 ++ Framework/Geometry/Sphere.h | 11 ++ Framework/Geometry/Trajectory.h | 11 ++ Framework/Geometry/Vector.h | 22 +++ Framework/Geometry/Volume.h | 11 ++ Framework/Geometry/testFourVector.cc | 11 ++ Framework/Geometry/testGeometry.cc | 22 +++ Framework/Particles/NuclearData.xml | 3 + Framework/Particles/ParticleData.xml | 2 +- Framework/Particles/ParticleProperties.cc | 11 ++ Framework/Particles/pdxml_reader.py | 2 +- Framework/Particles/testParticles.cc | 2 + Framework/ProcessSequence/BaseProcess.h | 22 +++ Framework/ProcessSequence/ContinuousProcess.h | 22 +++ Framework/ProcessSequence/DecayProcess.h | 22 +++ Framework/ProcessSequence/DiscreteProcess.h | 22 +++ .../ProcessSequence/InteractionProcess.h | 22 +++ Framework/ProcessSequence/ProcessReturn.h | 22 +++ Framework/ProcessSequence/ProcessSequence.h | 22 +++ Framework/ProcessSequence/ProcessSignature.h | 22 +++ .../ProcessSequence/testProcessSequence.cc | 22 +++ Framework/Random/ExponentialDistribution.h | 22 +++ Framework/Random/RNGManager.cc | 22 +++ Framework/Random/RNGManager.h | 22 +++ Framework/Random/UniformRealDistribution.h | 22 +++ Framework/Random/testRandom.cc | 22 +++ Framework/StackInterface/ParticleBase.h | 32 +++- Framework/StackInterface/Stack.h | 58 ++++++-- .../StackInterface/StackIteratorInterface.h | 27 +++- .../StackInterface/testStackInterface.cc | 8 +- Framework/Units/testUnits.cc | 22 +++ Framework/Utilities/Bit.h | 22 +++ Framework/Utilities/COMBoost.cc | 22 +++ Framework/Utilities/COMBoost.h | 22 +++ Framework/Utilities/CorsikaFenv.h | 22 +++ Framework/Utilities/CorsikaFenvDefault.cc | 22 +++ Framework/Utilities/CorsikaFenvFallback.cc | 22 +++ Framework/Utilities/CorsikaFenvOSX.cc | 22 +++ Framework/Utilities/Singleton.h | 22 +++ Framework/Utilities/testCOMBoost.cc | 22 +++ Framework/Utilities/testCorsikaFenv.cc | 22 +++ Framework/Utilities/try_feenableexcept.cc | 22 +++ Main/Environment.h | 11 ++ Main/Stack.h | 11 ++ Main/shower.cc | 11 ++ .../HadronicElasticModel.cc | 11 ++ .../HadronicElasticModel.h | 11 ++ Processes/NullModel/NullModel.cc | 11 ++ Processes/NullModel/NullModel.h | 11 ++ Processes/NullModel/testNullModel.cc | 11 ++ Processes/Sibyll/SibStack.h | 26 ++-- Processes/StackInspector/StackInspector.cc | 11 ++ Processes/StackInspector/StackInspector.h | 11 ++ .../StackInspector/testStackInspector.cc | 11 ++ Processes/TrackWriter/TrackWriter.cc | 11 ++ Processes/TrackWriter/TrackWriter.h | 11 ++ Processes/TrackingLine/TrackingLine.h | 11 ++ Processes/TrackingLine/testTrackingLine.cc | 11 ++ Setup/SetupEnvironment.h | 11 ++ Setup/SetupLogger.h | 11 ++ Setup/SetupStack.h | 11 ++ Setup/SetupTrajectory.h | 11 ++ Stack/CMakeLists.txt | 1 + Stack/DummyStack/DummyStack.h | 22 +++ Stack/DummyStack/SuperStupidStack.h | 108 -------------- .../NuclearStackExtension.h | 139 ++++++++++++------ .../testNuclearStackExtension.cc | 57 +++++-- Stack/SuperStupidStack/SuperStupidStack.h | 44 ++---- .../SuperStupidStack/testSuperStupidStack.cc | 22 +++ do-copyright.py | 2 + 90 files changed, 1562 insertions(+), 238 deletions(-) delete mode 100644 Stack/DummyStack/SuperStupidStack.h diff --git a/Documentation/Examples/stack_example.cc b/Documentation/Examples/stack_example.cc index 6f6dd0382..3d28e5566 100644 --- a/Documentation/Examples/stack_example.cc +++ b/Documentation/Examples/stack_example.cc @@ -21,6 +21,7 @@ using namespace corsika::units::si; using namespace corsika::stack; +using namespace corsika; using namespace std; void fill(corsika::stack::super_stupid::SuperStupidStack& s) { @@ -44,7 +45,6 @@ void read(corsika::stack::super_stupid::SuperStupidStack& s) { assert(p.GetPID() == corsika::particles::Code::Electron); assert(p.GetEnergy() == 1.5_GeV * (i++)); } - // assert(total_energy == 82.5_GeV); } int main() { diff --git a/Environment/Environment.h b/Environment/Environment.h index 97931aeff..611da5d16 100644 --- a/Environment/Environment.h +++ b/Environment/Environment.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Environment/FlatAtmosphere/FlatAtmosphere.h b/Environment/FlatAtmosphere/FlatAtmosphere.h index 6839def48..efc579a82 100644 --- a/Environment/FlatAtmosphere/FlatAtmosphere.h +++ b/Environment/FlatAtmosphere/FlatAtmosphere.h @@ -8,3 +8,25 @@ * 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. + */ diff --git a/Environment/HomogeneousMedium.h b/Environment/HomogeneousMedium.h index e42631400..9691dce33 100644 --- a/Environment/HomogeneousMedium.h +++ b/Environment/HomogeneousMedium.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Environment/IMediumModel.h b/Environment/IMediumModel.h index 84832eef0..8779ac451 100644 --- a/Environment/IMediumModel.h +++ b/Environment/IMediumModel.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Environment/NuclearComposition.h b/Environment/NuclearComposition.h index 40bf93ed4..0efb49bb9 100644 --- a/Environment/NuclearComposition.h +++ b/Environment/NuclearComposition.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Environment/VolumeTreeNode.h b/Environment/VolumeTreeNode.h index 3331c41bf..60a3d9560 100644 --- a/Environment/VolumeTreeNode.h +++ b/Environment/VolumeTreeNode.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Environment/testEnvironment.cc b/Environment/testEnvironment.cc index 585681867..f58492025 100644 --- a/Environment/testEnvironment.cc +++ b/Environment/testEnvironment.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index 3adaac2bc..8c9ea2e1b 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Cascade/Step.cc b/Framework/Cascade/Step.cc index ba29d2341..25c775031 100644 --- a/Framework/Cascade/Step.cc +++ b/Framework/Cascade/Step.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Cascade/testCascade.cc b/Framework/Cascade/testCascade.cc index 7abf985ad..960bd7315 100644 --- a/Framework/Cascade/testCascade.cc +++ b/Framework/Cascade/testCascade.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Geometry/BaseTrajectory.h b/Framework/Geometry/BaseTrajectory.h index 8d13f97a3..6e62d87c2 100644 --- a/Framework/Geometry/BaseTrajectory.h +++ b/Framework/Geometry/BaseTrajectory.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/BaseVector.h b/Framework/Geometry/BaseVector.h index c41d8edf2..4f4c723e0 100644 --- a/Framework/Geometry/BaseVector.h +++ b/Framework/Geometry/BaseVector.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/CoordinateSystem.cc b/Framework/Geometry/CoordinateSystem.cc index 35e294167..f42b13a66 100644 --- a/Framework/Geometry/CoordinateSystem.cc +++ b/Framework/Geometry/CoordinateSystem.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/CoordinateSystem.h b/Framework/Geometry/CoordinateSystem.h index aaf226f38..9790225d9 100644 --- a/Framework/Geometry/CoordinateSystem.h +++ b/Framework/Geometry/CoordinateSystem.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Geometry/FourVector.h b/Framework/Geometry/FourVector.h index 0a917a153..d9e792d9c 100644 --- a/Framework/Geometry/FourVector.h +++ b/Framework/Geometry/FourVector.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/Helix.h b/Framework/Geometry/Helix.h index caf2c34d0..5875f6738 100644 --- a/Framework/Geometry/Helix.h +++ b/Framework/Geometry/Helix.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/Line.h b/Framework/Geometry/Line.h index ce795d8d9..f6730d5eb 100644 --- a/Framework/Geometry/Line.h +++ b/Framework/Geometry/Line.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/Point.h b/Framework/Geometry/Point.h index f05bd31d1..053d9605f 100644 --- a/Framework/Geometry/Point.h +++ b/Framework/Geometry/Point.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Geometry/QuantityVector.h b/Framework/Geometry/QuantityVector.h index dafef96b6..2c65a90f0 100644 --- a/Framework/Geometry/QuantityVector.h +++ b/Framework/Geometry/QuantityVector.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Geometry/RootCoordinateSystem.h b/Framework/Geometry/RootCoordinateSystem.h index 0e641b3a3..34091bcf4 100644 --- a/Framework/Geometry/RootCoordinateSystem.h +++ b/Framework/Geometry/RootCoordinateSystem.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/Sphere.h b/Framework/Geometry/Sphere.h index 5a38820a3..436008dc1 100644 --- a/Framework/Geometry/Sphere.h +++ b/Framework/Geometry/Sphere.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/Trajectory.h b/Framework/Geometry/Trajectory.h index 5be99e363..168121f03 100644 --- a/Framework/Geometry/Trajectory.h +++ b/Framework/Geometry/Trajectory.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/Vector.h b/Framework/Geometry/Vector.h index 5ac1f118b..01b75835d 100644 --- a/Framework/Geometry/Vector.h +++ b/Framework/Geometry/Vector.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Geometry/Volume.h b/Framework/Geometry/Volume.h index c6c953d95..c4fd7e814 100644 --- a/Framework/Geometry/Volume.h +++ b/Framework/Geometry/Volume.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/testFourVector.cc b/Framework/Geometry/testFourVector.cc index a4063f0ef..fe7378885 100644 --- a/Framework/Geometry/testFourVector.cc +++ b/Framework/Geometry/testFourVector.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Geometry/testGeometry.cc b/Framework/Geometry/testGeometry.cc index 0a6dbbdec..03d10b4f3 100644 --- a/Framework/Geometry/testGeometry.cc +++ b/Framework/Geometry/testGeometry.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Particles/NuclearData.xml b/Framework/Particles/NuclearData.xml index 930a3565a..1a92b0d5a 100644 --- a/Framework/Particles/NuclearData.xml +++ b/Framework/Particles/NuclearData.xml @@ -1,5 +1,8 @@ <chapter name="Nuclear Data"> +<particle id="1000000000" name="nucleus" A="0" Z="0" > +</particle> + <particle id="1000010010" name="hydrogen" A="1" Z="1" > </particle> diff --git a/Framework/Particles/ParticleData.xml b/Framework/Particles/ParticleData.xml index 16e7878ab..6c8c3d0a0 100644 --- a/Framework/Particles/ParticleData.xml +++ b/Framework/Particles/ParticleData.xml @@ -4,7 +4,7 @@ <particle id="0" name="void" spinType="0" chargeType="0" colType="0" m0="0.00000"> </particle> - + <!-- <particle id="1" name="d" antiName="dbar" spinType="2" chargeType="-1" colType="1" m0="0.33000"> diff --git a/Framework/Particles/ParticleProperties.cc b/Framework/Particles/ParticleProperties.cc index 7df29e065..f26513a48 100644 --- a/Framework/Particles/ParticleProperties.cc +++ b/Framework/Particles/ParticleProperties.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Framework/Particles/pdxml_reader.py b/Framework/Particles/pdxml_reader.py index 2e463a0e1..99544cf50 100755 --- a/Framework/Particles/pdxml_reader.py +++ b/Framework/Particles/pdxml_reader.py @@ -251,7 +251,7 @@ def read_nuclei_db(filename, particle_db, classnames): } return particle_db - + diff --git a/Framework/Particles/testParticles.cc b/Framework/Particles/testParticles.cc index 30cbbca86..1ca8b2188 100644 --- a/Framework/Particles/testParticles.cc +++ b/Framework/Particles/testParticles.cc @@ -45,6 +45,8 @@ TEST_CASE("ParticleProperties", "[Particles]") { SECTION("Names") { REQUIRE(Electron::GetName() == "e-"); REQUIRE(PiMinus::GetName() == "pi-"); + REQUIRE(Nucleus::GetName() == "nucleus"); + REQUIRE(Iron::GetName() == "iron"); } SECTION("PDG") { diff --git a/Framework/ProcessSequence/BaseProcess.h b/Framework/ProcessSequence/BaseProcess.h index 8b4014478..1ed474b34 100644 --- a/Framework/ProcessSequence/BaseProcess.h +++ b/Framework/ProcessSequence/BaseProcess.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/ProcessSequence/ContinuousProcess.h b/Framework/ProcessSequence/ContinuousProcess.h index 9a3424a35..a449bc490 100644 --- a/Framework/ProcessSequence/ContinuousProcess.h +++ b/Framework/ProcessSequence/ContinuousProcess.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/ProcessSequence/DecayProcess.h b/Framework/ProcessSequence/DecayProcess.h index 82be572d6..96199a3a7 100644 --- a/Framework/ProcessSequence/DecayProcess.h +++ b/Framework/ProcessSequence/DecayProcess.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/ProcessSequence/DiscreteProcess.h b/Framework/ProcessSequence/DiscreteProcess.h index 40b544530..c03e4b41b 100644 --- a/Framework/ProcessSequence/DiscreteProcess.h +++ b/Framework/ProcessSequence/DiscreteProcess.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/ProcessSequence/InteractionProcess.h b/Framework/ProcessSequence/InteractionProcess.h index 964727553..27883b256 100644 --- a/Framework/ProcessSequence/InteractionProcess.h +++ b/Framework/ProcessSequence/InteractionProcess.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/ProcessSequence/ProcessReturn.h b/Framework/ProcessSequence/ProcessReturn.h index 94a69406a..566b5f6d8 100644 --- a/Framework/ProcessSequence/ProcessReturn.h +++ b/Framework/ProcessSequence/ProcessReturn.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/ProcessSequence/ProcessSequence.h b/Framework/ProcessSequence/ProcessSequence.h index 4d4d3fbfd..7bff1dabd 100644 --- a/Framework/ProcessSequence/ProcessSequence.h +++ b/Framework/ProcessSequence/ProcessSequence.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/ProcessSequence/ProcessSignature.h b/Framework/ProcessSequence/ProcessSignature.h index 38503b87b..31d371391 100644 --- a/Framework/ProcessSequence/ProcessSignature.h +++ b/Framework/ProcessSequence/ProcessSignature.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/ProcessSequence/testProcessSequence.cc b/Framework/ProcessSequence/testProcessSequence.cc index 8fd46418a..77f500054 100644 --- a/Framework/ProcessSequence/testProcessSequence.cc +++ b/Framework/ProcessSequence/testProcessSequence.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Random/ExponentialDistribution.h b/Framework/Random/ExponentialDistribution.h index dc17b2099..347d40482 100644 --- a/Framework/Random/ExponentialDistribution.h +++ b/Framework/Random/ExponentialDistribution.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Random/RNGManager.cc b/Framework/Random/RNGManager.cc index c02f7a432..c88694b24 100644 --- a/Framework/Random/RNGManager.cc +++ b/Framework/Random/RNGManager.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Random/RNGManager.h b/Framework/Random/RNGManager.h index 9637b4b82..12e19189b 100644 --- a/Framework/Random/RNGManager.h +++ b/Framework/Random/RNGManager.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Random/UniformRealDistribution.h b/Framework/Random/UniformRealDistribution.h index 1328377dc..e73fbeb1e 100644 --- a/Framework/Random/UniformRealDistribution.h +++ b/Framework/Random/UniformRealDistribution.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Random/testRandom.cc b/Framework/Random/testRandom.cc index c362d393f..4fcc1c64c 100644 --- a/Framework/Random/testRandom.cc +++ b/Framework/Random/testRandom.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/StackInterface/ParticleBase.h b/Framework/StackInterface/ParticleBase.h index 5bf2ece2b..e148f1389 100644 --- a/Framework/StackInterface/ParticleBase.h +++ b/Framework/StackInterface/ParticleBase.h @@ -22,6 +22,23 @@ namespace corsika::stack { The base class to define the readout of particle properties from a particle stack. Every stack must implement this readout via the ParticleBase class. + + The StackIterator template argument is derived from StackIteratorInterface, which is of type + <code> + template <typename StackData, template <typename> typename ParticleInterface> + class StackIteratorInterface : public ParticleInterface<StackIteratorInterface<StackData, ParticleInterface>> + </code> + + where StackData must refer to a Stack type, and ParticleInterface<StackIteratorInterface> is the corresponding particle readout class. + + Thus, StackIteratorInterface is a CRTP class, injecting the full StackIteratorInterface machinery into the ParticleInterface (aka ParticleBase) type! + + The declartion of a StackIteratorInterface type simultaneously declares the corresponding ParticleInterface type. + + Furthermore, the operator* of the StackIteratorInterface returns a + static_cast to the ParticleInterface type, allowing a direct + readout of the particle data from the iterator. + */ template <typename StackIterator> @@ -31,6 +48,7 @@ namespace corsika::stack { ParticleBase() = default; private: + /* // those copy constructors and assigments should never be implemented ParticleBase(ParticleBase&) = delete; ParticleBase operator=(ParticleBase&) = delete; @@ -38,10 +56,11 @@ namespace corsika::stack { ParticleBase operator=(ParticleBase&&) = delete; ParticleBase(const ParticleBase&) = delete; ParticleBase operator=(const ParticleBase&) = delete; - + */ public: - /** delete this particle on the stack. The corresponding iterator - * will be invalidated by this operation + /** + * Delete this particle on the stack. The corresponding iterator + * will be invalidated by this operation */ void Delete() { GetIterator().GetStack().Delete(GetIterator()); } @@ -55,7 +74,7 @@ namespace corsika::stack { return GetStack().AddSecondary(GetIterator(), args...); } - // protected: // todo should [MAY]be proteced, but don't now how to 'friend Stack' + // protected: // todo should [MAY]be proteced, but don't now how to 'friend Stack' // Function to provide CRTP access to inheriting class (type) /** * return the corresponding StackIterator for this particle @@ -66,7 +85,8 @@ namespace corsika::stack { } protected: - /** @name Access to underlying stack data + /** + @name Access to underlying stack data @{ */ auto& GetStackData() { return GetIterator().GetStackData(); } @@ -78,7 +98,7 @@ namespace corsika::stack { /** * return the index number of the underlying iterator object */ - int GetIndex() const { return GetIterator().GetIndex(); } + unsigned int GetIndex() const { return GetIterator().GetIndex(); } }; } // namespace corsika::stack diff --git a/Framework/StackInterface/Stack.h b/Framework/StackInterface/Stack.h index bc9aa2e5c..7f42bbc56 100644 --- a/Framework/StackInterface/Stack.h +++ b/Framework/StackInterface/Stack.h @@ -27,36 +27,67 @@ namespace corsika::stack { ParticleInterface, which is one of the essential template parameters for the Stack. - Important: ParticleInterface must inherit from ParticleBase ! + <b>Important:</b> ParticleInterface must inherit from ParticleBase ! */ template <typename> class ParticleInterface; // forward decl - /** - Interface definition of a Stack object. The Stack implements the + /** + The Stack class provides (and connects) the main particle data storage machinery. + + The StackData type is the user-provided bare data storage + object. This can be of any complexity, from a simple struct + (fortran common block), to a combination of different and + distributed data sources. + + The user-provided ParticleInterface template type is the base + class type of the StackIteratorInterface class (CRTP) and must + provide all functions to read single particle data from the + StackData, given an 'unsigned int' index. + + The Stack implements the std-type begin/end function to allow integration in normal for - loops etc. + loops, ranges, etc. */ template <typename StackData, template <typename> typename ParticleInterface> class Stack : public StackData { public: - typedef Stack<StackData, ParticleInterface> StackType; - typedef StackIteratorInterface<StackData, ParticleInterface> StackIterator; - typedef ConstStackIteratorInterface<StackData, ParticleInterface> ConstStackIterator; - // typedef const StackIterator ConstStackIterator; + typedef StackData StackImpl; ///< this is the type of the user-provided data structure + template<typename SI> using PIType = ParticleInterface<SI>; + //typedef ParticleInterface<StackIteratorInterface> StackParticleInterface; ///< this is the type of the user-provided ParticleInterface + //typedef Stack<StackData, ParticleInterface> StackType; + + /** + * Via the StackIteratorInterface and ConstStackIteratorInterface + * specialization, the type of the StackIterator + * template class is declared for a particular stack data + * object. Using CRTP, this also determines the type of + * ParticleInterface template class simultaneously. + */ + typedef StackIteratorInterface<StackData, ParticleInterface> + StackIterator; + typedef ConstStackIteratorInterface<StackData, + ParticleInterface> ConstStackIterator; + /** + * this is the full type of the declared ParticleInterface: typedef typename + */ typedef typename StackIterator::ParticleInterfaceType ParticleType; + friend class StackIteratorInterface<StackData, ParticleInterface>; friend class ConstStackIteratorInterface<StackData, ParticleInterface>; + protected: + using StackData::Copy; + using StackData::Swap; + public: using StackData::GetCapacity; using StackData::GetSize; using StackData::Clear; - using StackData::Copy; using StackData::DecrementSize; using StackData::IncrementSize; @@ -88,9 +119,12 @@ namespace corsika::stack { IncrementSize(); return StackIterator(*this, GetSize() - 1, parent, v...); } - void Copy(StackIterator& a, StackIterator& b) { Copy(a.GetIndex(), b.GetIndex()); } + void Swap(StackIterator a, StackIterator b) { Swap(a.GetIndex(), b.GetIndex()); } + void Swap(ConstStackIterator a, ConstStackIterator b) { Swap(a.GetIndex(), b.GetIndex()); } + void Copy(StackIterator a, StackIterator b) { Copy(a.GetIndex(), b.GetIndex()); } + void Copy(ConstStackIterator a, StackIterator b) { Copy(a.GetIndex(), b.GetIndex()); } /// delete this particle - void Delete(StackIterator& p) { + void Delete(StackIterator p) { if (GetSize() == 0) { /*error*/ throw std::runtime_error("Stack, cannot delete entry since size is zero"); } @@ -98,7 +132,7 @@ namespace corsika::stack { DeleteLast(); // p.SetInvalid(); } - void Delete(ParticleType& p) { Delete(p.GetIterator()); } + void Delete(ParticleType p) { Delete(p.GetIterator()); } /// delete last particle on stack by decrementing stack size void DeleteLast() { DecrementSize(); } /// check if there are no further particles on stack diff --git a/Framework/StackInterface/StackIteratorInterface.h b/Framework/StackInterface/StackIteratorInterface.h index ad00c6c09..effdd876a 100644 --- a/Framework/StackInterface/StackIteratorInterface.h +++ b/Framework/StackInterface/StackIteratorInterface.h @@ -51,11 +51,13 @@ namespace corsika::stack { class StackIteratorInterface : public ParticleInterface<StackIteratorInterface<StackData, ParticleInterface>> { + public: typedef Stack<StackData, ParticleInterface> StackType; /*typedef typename std::conditional<std::is_const<StackData>::value, const Stack<const StackData, ParticleInterface>&, Stack<StackData, ParticleInterface>&>::type StackType;*/ + typedef ParticleInterface<StackIteratorInterface<StackData, ParticleInterface>> ParticleInterfaceType; @@ -63,7 +65,7 @@ namespace corsika::stack { friend class ParticleBase<StackIteratorInterface>; // for access to GetStackData private: - int fIndex = 0; + unsigned int fIndex = 0; StackType* fData = 0; // info: Particles and StackIterators become invalid when parent // Stack is copied or deleted! @@ -75,7 +77,7 @@ namespace corsika::stack { @param data reference to the stack [rw] @param index index on stack */ - StackIteratorInterface(StackType& data, const int index) + StackIteratorInterface(StackType& data, const unsigned int index) : fIndex(index) , fData(&data) {} @@ -87,7 +89,7 @@ namespace corsika::stack { ParticleInterfaceType::SetParticleData(...) function */ template <typename... Args> - StackIteratorInterface(StackType& data, const int index, const Args... args) + StackIteratorInterface(StackType& data, const unsigned int index, const Args... args) : fIndex(index) , fData(&data) { (**this).SetParticleData(args...); @@ -104,7 +106,7 @@ namespace corsika::stack { ParticleInterfaceType::SetParticleData(...) function */ template <typename... Args> - StackIteratorInterface(StackType& data, const int index, + StackIteratorInterface(StackType& data, const unsigned int index, StackIteratorInterface& parent, const Args... args) : fIndex(index) , fData(&data) { @@ -124,6 +126,9 @@ namespace corsika::stack { ++fIndex; return tmp; } + StackIteratorInterface operator+(int delta) { + return StackIteratorInterface(*fData, fIndex+delta); + } bool operator==(const StackIteratorInterface& rhs) { return fIndex == rhs.fIndex; } bool operator!=(const StackIteratorInterface& rhs) { return fIndex != rhs.fIndex; } /// Convert to value type @@ -141,7 +146,7 @@ namespace corsika::stack { */ ///@{ /// Get current particle index - inline int GetIndex() const { return fIndex; } + inline unsigned int GetIndex() const { return fIndex; } /// Get current particle Stack object inline StackType& GetStack() { return *fData; } /// Get current particle const Stack object @@ -153,6 +158,8 @@ namespace corsika::stack { ///@} }; // end class StackIterator + + /** @class ConstStackIteratorInterface @@ -164,6 +171,7 @@ namespace corsika::stack { : public ParticleInterface< ConstStackIteratorInterface<StackData, ParticleInterface>> { + public: typedef Stack<StackData, ParticleInterface> StackType; typedef ParticleInterface<ConstStackIteratorInterface<StackData, ParticleInterface>> ParticleInterfaceType; @@ -172,7 +180,7 @@ namespace corsika::stack { friend class ParticleBase<ConstStackIteratorInterface>; // for access to GetStackData private: - int fIndex = 0; + unsigned int fIndex = 0; const StackType* fData = 0; // info: Particles and StackIterators become invalid when // parent Stack is copied or deleted! @@ -180,7 +188,7 @@ namespace corsika::stack { ConstStackIteratorInterface() = delete; public: - ConstStackIteratorInterface(const StackType& data, const int index) + ConstStackIteratorInterface(const StackType& data, const unsigned int index) : fIndex(index) , fData(&data) {} @@ -210,6 +218,9 @@ namespace corsika::stack { ++fIndex; return tmp; } + ConstStackIteratorInterface operator+(int delta) { + return ConstStackIteratorInterface(*fData, fIndex+delta); + } bool operator==(const ConstStackIteratorInterface& rhs) { return fIndex == rhs.fIndex; } @@ -227,7 +238,7 @@ namespace corsika::stack { Only the const versions for read-only access */ ///@{ - inline int GetIndex() const { return fIndex; } + inline unsigned int GetIndex() const { return fIndex; } inline const StackType& GetStack() const { return *fData; } inline const StackData& GetStackData() const { return fData->GetStackData(); } ///@} diff --git a/Framework/StackInterface/testStackInterface.cc b/Framework/StackInterface/testStackInterface.cc index cde5a76e2..3a5e945c4 100644 --- a/Framework/StackInterface/testStackInterface.cc +++ b/Framework/StackInterface/testStackInterface.cc @@ -29,8 +29,8 @@ public: // these functions are needed for the Stack interface void Init() {} void Clear() { fData.clear(); } - int GetSize() const { return fData.size(); } - int GetCapacity() const { return fData.size(); } + unsigned int GetSize() const { return fData.size(); } + unsigned int GetCapacity() const { return fData.size(); } void Copy(const int i1, const int i2) { fData[i2] = fData[i1]; } void Swap(const int i1, const int i2) { double tmp0 = fData[i1]; @@ -97,8 +97,8 @@ TEST_CASE("Stack", "[Stack]") { s.Init(); s.Clear(); s.IncrementSize(); - s.Copy(0, 0); - s.Swap(0, 0); + s.Copy(s.cbegin(), s.begin()); + s.Swap(s.begin(), s.begin()); s.GetCapacity(); REQUIRE(s.GetSize() == 1); s.DecrementSize(); diff --git a/Framework/Units/testUnits.cc b/Framework/Units/testUnits.cc index e8f389a05..406da9fe9 100644 --- a/Framework/Units/testUnits.cc +++ b/Framework/Units/testUnits.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/Bit.h b/Framework/Utilities/Bit.h index 7306e76d8..741d6ca3c 100644 --- a/Framework/Utilities/Bit.h +++ b/Framework/Utilities/Bit.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/COMBoost.cc b/Framework/Utilities/COMBoost.cc index 5d8b00857..62990bc2d 100644 --- a/Framework/Utilities/COMBoost.cc +++ b/Framework/Utilities/COMBoost.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/COMBoost.h b/Framework/Utilities/COMBoost.h index eebc8358a..5f300e2ff 100644 --- a/Framework/Utilities/COMBoost.h +++ b/Framework/Utilities/COMBoost.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/CorsikaFenv.h b/Framework/Utilities/CorsikaFenv.h index e7df59534..dd35268b3 100644 --- a/Framework/Utilities/CorsikaFenv.h +++ b/Framework/Utilities/CorsikaFenv.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/CorsikaFenvDefault.cc b/Framework/Utilities/CorsikaFenvDefault.cc index f1bb7732b..c6c90ca2f 100644 --- a/Framework/Utilities/CorsikaFenvDefault.cc +++ b/Framework/Utilities/CorsikaFenvDefault.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/CorsikaFenvFallback.cc b/Framework/Utilities/CorsikaFenvFallback.cc index ed71c5b6c..9d03760c8 100644 --- a/Framework/Utilities/CorsikaFenvFallback.cc +++ b/Framework/Utilities/CorsikaFenvFallback.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/CorsikaFenvOSX.cc b/Framework/Utilities/CorsikaFenvOSX.cc index 4495ebd1e..f0cf4eb54 100644 --- a/Framework/Utilities/CorsikaFenvOSX.cc +++ b/Framework/Utilities/CorsikaFenvOSX.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/Singleton.h b/Framework/Utilities/Singleton.h index 3780cc99a..25563940c 100644 --- a/Framework/Utilities/Singleton.h +++ b/Framework/Utilities/Singleton.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/testCOMBoost.cc b/Framework/Utilities/testCOMBoost.cc index 501db8643..b7d917f85 100644 --- a/Framework/Utilities/testCOMBoost.cc +++ b/Framework/Utilities/testCOMBoost.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/testCorsikaFenv.cc b/Framework/Utilities/testCorsikaFenv.cc index eb4885b9a..c8ae63ca5 100644 --- a/Framework/Utilities/testCorsikaFenv.cc +++ b/Framework/Utilities/testCorsikaFenv.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Framework/Utilities/try_feenableexcept.cc b/Framework/Utilities/try_feenableexcept.cc index 9ca52262c..2b77a898d 100644 --- a/Framework/Utilities/try_feenableexcept.cc +++ b/Framework/Utilities/try_feenableexcept.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Main/Environment.h b/Main/Environment.h index 6839def48..6e64a7418 100644 --- a/Main/Environment.h +++ b/Main/Environment.h @@ -8,3 +8,14 @@ * 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. + */ diff --git a/Main/Stack.h b/Main/Stack.h index 6839def48..6e64a7418 100644 --- a/Main/Stack.h +++ b/Main/Stack.h @@ -8,3 +8,14 @@ * 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. + */ diff --git a/Main/shower.cc b/Main/shower.cc index 5ca8d4ab2..9e9cbb1db 100644 --- a/Main/shower.cc +++ b/Main/shower.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/HadronicElasticModel/HadronicElasticModel.cc b/Processes/HadronicElasticModel/HadronicElasticModel.cc index 943195b68..9d85ac5e6 100644 --- a/Processes/HadronicElasticModel/HadronicElasticModel.cc +++ b/Processes/HadronicElasticModel/HadronicElasticModel.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/HadronicElasticModel/HadronicElasticModel.h b/Processes/HadronicElasticModel/HadronicElasticModel.h index 8ddc55fa0..0ef645faf 100644 --- a/Processes/HadronicElasticModel/HadronicElasticModel.h +++ b/Processes/HadronicElasticModel/HadronicElasticModel.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/NullModel/NullModel.cc b/Processes/NullModel/NullModel.cc index 09956e7c7..f08d79f67 100644 --- a/Processes/NullModel/NullModel.cc +++ b/Processes/NullModel/NullModel.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/NullModel/NullModel.h b/Processes/NullModel/NullModel.h index 6222e290f..09e78db15 100644 --- a/Processes/NullModel/NullModel.h +++ b/Processes/NullModel/NullModel.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/NullModel/testNullModel.cc b/Processes/NullModel/testNullModel.cc index 6bf7d99da..d68329d16 100644 --- a/Processes/NullModel/testNullModel.cc +++ b/Processes/NullModel/testNullModel.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/Sibyll/SibStack.h b/Processes/Sibyll/SibStack.h index 11a5bb2bf..dd563d90f 100644 --- a/Processes/Sibyll/SibStack.h +++ b/Processes/Sibyll/SibStack.h @@ -29,34 +29,34 @@ namespace corsika::process::sibyll { void Init(); void Clear() { s_plist_.np = 0; } - int GetSize() const { return s_plist_.np; } - int GetCapacity() const { return 8000; } + unsigned int GetSize() const { return s_plist_.np; } + unsigned int GetCapacity() const { return 8000; } - void SetId(const int i, const int v) { s_plist_.llist[i] = v; } - void SetEnergy(const int i, const corsika::units::si::HEPEnergyType v) { + void SetId(const unsigned int i, const int v) { s_plist_.llist[i] = v; } + void SetEnergy(const unsigned int i, const corsika::units::si::HEPEnergyType v) { using namespace corsika::units::si; s_plist_.p[3][i] = v / 1_GeV; } - void SetMass(const int i, const corsika::units::si::HEPMassType v) { + void SetMass(const unsigned int i, const corsika::units::si::HEPMassType v) { using namespace corsika::units::si; s_plist_.p[4][i] = v / 1_GeV; } - void SetMomentum(const int i, const MomentumVector& v) { + void SetMomentum(const unsigned int i, const MomentumVector& v) { using namespace corsika::units::si; auto tmp = v.GetComponents(); for (int idx = 0; idx < 3; ++idx) s_plist_.p[idx][i] = tmp[idx] / 1_GeV; } - int GetId(const int i) const { return s_plist_.llist[i]; } + int GetId(const unsigned int i) const { return s_plist_.llist[i]; } corsika::units::si::HEPEnergyType GetEnergy(const int i) const { using namespace corsika::units::si; return s_plist_.p[3][i] * 1_GeV; } - corsika::units::si::HEPEnergyType GetMass(const int i) const { + corsika::units::si::HEPEnergyType GetMass(const unsigned int i) const { using namespace corsika::units::si; return s_plist_.p[4][i] * 1_GeV; } - MomentumVector GetMomentum(const int i) const { + MomentumVector GetMomentum(const unsigned int i) const { using corsika::geometry::CoordinateSystem; using corsika::geometry::QuantityVector; using corsika::geometry::RootCoordinateSystem; @@ -69,15 +69,15 @@ namespace corsika::process::sibyll { return v1; } - void Copy(const int i1, const int i2) { + void Copy(const unsigned int i1, const unsigned int i2) { s_plist_.llist[i2] = s_plist_.llist[i1]; - for (int i=0; i<5; ++i) + for (unsigned int i=0; i<5; ++i) s_plist_.p[i][i2] = s_plist_.p[i][i1]; } - void Swap(const int i1, const int i2) { + void Swap(const unsigned int i1, const unsigned int i2) { std::swap(s_plist_.llist[i1], s_plist_.llist[i2]); - for (int i=0; i<5; ++i) + for (unsigned int i=0; i<5; ++i) std::swap(s_plist_.p[i][i1], s_plist_.p[i][i2]); } diff --git a/Processes/StackInspector/StackInspector.cc b/Processes/StackInspector/StackInspector.cc index 312fe40ec..fa592342b 100644 --- a/Processes/StackInspector/StackInspector.cc +++ b/Processes/StackInspector/StackInspector.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/StackInspector/StackInspector.h b/Processes/StackInspector/StackInspector.h index 8bb2ca45c..98f6c0e21 100644 --- a/Processes/StackInspector/StackInspector.h +++ b/Processes/StackInspector/StackInspector.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/StackInspector/testStackInspector.cc b/Processes/StackInspector/testStackInspector.cc index 784be88f9..68937e34b 100644 --- a/Processes/StackInspector/testStackInspector.cc +++ b/Processes/StackInspector/testStackInspector.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/TrackWriter/TrackWriter.cc b/Processes/TrackWriter/TrackWriter.cc index 65dec50ca..781acf0b4 100644 --- a/Processes/TrackWriter/TrackWriter.cc +++ b/Processes/TrackWriter/TrackWriter.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/TrackWriter/TrackWriter.h b/Processes/TrackWriter/TrackWriter.h index c61d2a6c8..aa81bccec 100644 --- a/Processes/TrackWriter/TrackWriter.h +++ b/Processes/TrackWriter/TrackWriter.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/TrackingLine/TrackingLine.h b/Processes/TrackingLine/TrackingLine.h index b82981476..df3f51453 100644 --- a/Processes/TrackingLine/TrackingLine.h +++ b/Processes/TrackingLine/TrackingLine.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Processes/TrackingLine/testTrackingLine.cc b/Processes/TrackingLine/testTrackingLine.cc index 7dde7aec2..ff8761cb3 100644 --- a/Processes/TrackingLine/testTrackingLine.cc +++ b/Processes/TrackingLine/testTrackingLine.cc @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Setup/SetupEnvironment.h b/Setup/SetupEnvironment.h index 08780b73b..d7d01b9ae 100644 --- a/Setup/SetupEnvironment.h +++ b/Setup/SetupEnvironment.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Setup/SetupLogger.h b/Setup/SetupLogger.h index 76148050f..591244b46 100644 --- a/Setup/SetupLogger.h +++ b/Setup/SetupLogger.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Setup/SetupStack.h b/Setup/SetupStack.h index 0ab05fffb..b39a7ed62 100644 --- a/Setup/SetupStack.h +++ b/Setup/SetupStack.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Setup/SetupTrajectory.h b/Setup/SetupTrajectory.h index 0e93b3e44..a00c1d548 100644 --- a/Setup/SetupTrajectory.h +++ b/Setup/SetupTrajectory.h @@ -1,4 +1,15 @@ +/* + * (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 * diff --git a/Stack/CMakeLists.txt b/Stack/CMakeLists.txt index 4cf17a616..a9645130b 100644 --- a/Stack/CMakeLists.txt +++ b/Stack/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory (DummyStack) add_subdirectory (SuperStupidStack) +add_subdirectory (NuclearStackExtension) diff --git a/Stack/DummyStack/DummyStack.h b/Stack/DummyStack/DummyStack.h index adcf494a5..54b490529 100644 --- a/Stack/DummyStack/DummyStack.h +++ b/Stack/DummyStack/DummyStack.h @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/Stack/DummyStack/SuperStupidStack.h b/Stack/DummyStack/SuperStupidStack.h deleted file mode 100644 index 3abbb3139..000000000 --- a/Stack/DummyStack/SuperStupidStack.h +++ /dev/null @@ -1,108 +0,0 @@ - -/* - * (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_superstupidstack_h_ -#define _include_superstupidstack_h_ - -#include <corsika/particles/ParticleProperties.h> -#include <corsika/stack/Stack.h> -#include <corsika/units/PhysicalUnits.h> - -#include <string> -#include <vector> - -namespace corsika::stack { - - namespace super_stupid { - - using corsika::particles::Code; - using corsika::units::si::EnergyType; - using corsika::units::si::operator""_GeV; // literals; - - /** - * Example of a particle object on the stack. - */ - - template <typename _Stack> - class ParticleRead : public StackIteratorInfo<_Stack, ParticleRead<_Stack> > { - - using StackIteratorInfo<_Stack, ParticleRead>::GetIndex; - using StackIteratorInfo<_Stack, ParticleRead>::GetStack; - - public: - void SetId(const Code id) { GetStack().SetId(GetIndex(), id); } - void SetEnergy(const EnergyType& e) { GetStack().SetEnergy(GetIndex(), e); } - - Code GetId() const { return GetStack().GetId(GetIndex()); } - const EnergyType& GetEnergy() const { return GetStack().GetEnergy(GetIndex()); } - }; - - /** - * - * Memory implementation of the most simple (stupid) particle stack object. - */ - - class SuperStupidStackImpl { - - public: - void Init() {} - - void Clear() { - fDataE.clear(); - fDataId.clear(); - } - - int GetSize() const { return fDataId.size(); } - int GetCapacity() const { return fDataId.size(); } - - void SetId(const int i, const Code id) { fDataId[i] = id; } - void SetEnergy(const int i, const EnergyType& e) { fDataE[i] = e; } - - const Code GetId(const int i) const { return fDataId[i]; } - const EnergyType& GetEnergy(const int i) const { return fDataE[i]; } - - /** - * Function to copy particle at location i2 in stack to i1 - */ - void Copy(const int i1, const int i2) { - fDataE[i2] = fDataE[i1]; - fDataId[i2] = fDataId[i1]; - } - - protected: - void IncrementSize() { - fDataE.push_back(0_GeV); - fDataId.push_back(Code::unknown); - } - void DecrementSize() { - if (fDataE.size() > 0) { - fDataE.pop_back(); - fDataId.pop_back(); - } - } - - private: - /// the actual memory to store particle data - - std::vector<Code> fDataId; - std::vector<EnergyType> fDataE; - - }; // end class SuperStupidStackImpl - - typedef StackIterator<SuperStupidStackImpl, ParticleRead<SuperStupidStackImpl> > - Particle; - typedef Stack<SuperStupidStackImpl, Particle> SuperStupidStack; - - } // namespace super_stupid - -} // namespace corsika::stack - -#endif diff --git a/Stack/NuclearStackExtension/NuclearStackExtension.h b/Stack/NuclearStackExtension/NuclearStackExtension.h index 1d5955fd4..581104e71 100644 --- a/Stack/NuclearStackExtension/NuclearStackExtension.h +++ b/Stack/NuclearStackExtension/NuclearStackExtension.h @@ -14,28 +14,40 @@ #include <corsika/stack/super_stupid/SuperStupidStack.h> +#include <corsika/particles/ParticleProperties.h> +#include <corsika/stack/Stack.h> +#include <corsika/units/PhysicalUnits.h> + +#include <corsika/geometry/Point.h> +#include <corsika/geometry/Vector.h> + +#include <algorithm> #include <vector> namespace corsika::stack { namespace nuclear_extension { - using corsika::stack::super_stupid::MomentumVector; - - template <typename StackIteratorInterface> - class ParticleInterface - : public corsika::stack::super_stupid::ParticleInterface<StackIteratorInterface> { + typedef corsika::geometry::Vector<corsika::units::si::hepmomentum_d> MomentumVector; + + /** + * Define ParticleInterface for NuclearStackExtension Stack derived from ParticleInterface of Inner stack class + */ + template<template <typename> typename InnerParticleInterface, typename StackIteratorInterface> + class NuclearParticleInterface : public InnerParticleInterface<StackIteratorInterface> { + public: + //template<typename > + using ExtendedParticleInterface = NuclearParticleInterface<InnerParticleInterface, StackIteratorInterface>; + protected: - // using corsika::stack::ParticleBase<StackIteratorInterface>::GetStack; - //using corsika::stack::super_stupid::ParticleInterface<StackIteratorInterface>::GetStackData; - using corsika::stack::ParticleBase<StackIteratorInterface>::GetStackData; - using corsika::stack::ParticleBase<StackIteratorInterface>::GetIndex; + using InnerParticleInterface<StackIteratorInterface>::GetStackData; + using InnerParticleInterface<StackIteratorInterface>::GetIndex; public: void SetParticleData(const corsika::particles::Code vDataPID, const corsika::units::si::HEPEnergyType vDataE, - const corsika::stack::super_stupid::MomentumVector& vMomentum, + const MomentumVector& vMomentum, const corsika::geometry::Point& vPosition, const corsika::units::si::TimeType vTime, const int vA = 0, @@ -46,23 +58,29 @@ namespace corsika::stack { err << "NuclearStackExtension: no A and Z specified for new Nucleus!"; throw std::runtime_error(err.str()); } - SetNuclearRef(corsika::stack::ParticleBase<StackIteratorInterface>::GetStackData().GetNucleusNextRef()); // store this nucleus data ref + //SetNuclearRef(corsika::stack::ParticleBase<StackIteratorInterface>::GetStackData().GetNucleusNextRef()); // store this nucleus data ref + SetNuclearRef(GetStackData().GetNucleusNextRef()); // store this nucleus data ref SetNuclearA(vA); SetNuclearZ(vZ); } else { SetNuclearRef(-1); // this is not a nucleus } - corsika::stack::super_stupid::ParticleInterface<StackIteratorInterface>::SetParticleData(vDataPID, - vDataE, - vMomentum, - vPosition, - vTime); + //corsika::stack::super_stupid::NuclearParticleInterface<StackIteratorInterface>:: + InnerParticleInterface<StackIteratorInterface>:: + //InnerParticleInterface:: + SetParticleData(vDataPID, + vDataE, + vMomentum, + vPosition, + vTime); } - void SetParticleData(ParticleInterface<StackIteratorInterface>& parent, + // void SetParticleData(NuclearParticleInterface<StackIteratorInterface>& parent, + void SetParticleData(InnerParticleInterface<StackIteratorInterface>& parent, + //void SetParticleData(InnerParticleInterface& parent, const corsika::particles::Code vDataPID, const corsika::units::si::HEPEnergyType vDataE, - const corsika::stack::super_stupid::MomentumVector& vMomentum, + const MomentumVector& vMomentum, const corsika::geometry::Point& vPosition, const corsika::units::si::TimeType vTime, const int vA = 0, @@ -100,33 +118,32 @@ namespace corsika::stack { /** * Memory implementation of the most simple (stupid) particle stack object. */ - - class NuclearStackExtensionImpl - : public corsika::stack::super_stupid::SuperStupidStackImpl { + template<typename InnerStackImpl> + class NuclearStackExtensionImpl : public InnerStackImpl { public: - void Init() { corsika::stack::super_stupid::SuperStupidStackImpl::Init(); } + void Init() { InnerStackImpl::Init(); } void Clear() { - corsika::stack::super_stupid::SuperStupidStackImpl::Clear(); + InnerStackImpl::Clear(); fNuclearRef.clear(); fNuclearA.clear(); fNuclearZ.clear(); } - int GetSize() const { return fNuclearRef.size(); } - int GetCapacity() const { return fNuclearRef.size(); } + unsigned int GetSize() const { return fNuclearRef.size(); } + unsigned int GetCapacity() const { return fNuclearRef.size(); } - void SetNuclearA(const int i, const int vA) { fNuclearA[GetNucleusRef(i)] = vA; } - void SetNuclearZ(const int i, const int vZ) { fNuclearZ[GetNucleusRef(i)] = vZ; } - void SetNuclearRef(const int i, const int v) { fNuclearRef[i] = v; } + void SetNuclearA(const unsigned int i, const int vA) { fNuclearA[GetNucleusRef(i)] = vA; } + void SetNuclearZ(const unsigned int i, const int vZ) { fNuclearZ[GetNucleusRef(i)] = vZ; } + void SetNuclearRef(const unsigned int i, const int v) { fNuclearRef[i] = v; } - int GetNuclearA(const int i) const { return fNuclearA[GetNucleusRef(i)]; } - int GetNuclearZ(const int i) const { return fNuclearZ[GetNucleusRef(i)]; } + int GetNuclearA(const unsigned int i) const { return fNuclearA[GetNucleusRef(i)]; } + int GetNuclearZ(const unsigned int i) const { return fNuclearZ[GetNucleusRef(i)]; } // this function will create new storage for Nuclear Properties, and return the reference to it int GetNucleusNextRef() { fNuclearA.push_back(0); fNuclearZ.push_back(0); return fNuclearA.size()-1; } - int GetNucleusRef(const int i) const { + int GetNucleusRef(const unsigned int i) const { if (fNuclearRef[i]>=0) return fNuclearRef[i]; std::ostringstream err; @@ -137,8 +154,13 @@ namespace corsika::stack { /** * Function to copy particle at location i1 in stack to i2 */ - void Copy(const int i1, const int i2) { - corsika::stack::super_stupid::SuperStupidStackImpl::Copy(i1, i2); + void Copy(const unsigned int i1, const unsigned int i2) { + if (i1>=GetSize() || i2>=GetSize()) { + std::ostringstream err; + err << "NuclearStackExtension: trying to access data beyond size of stack!"; + throw std::runtime_error(err.str()); + } + InnerStackImpl::Copy(i1, i2); const int ref1 = fNuclearRef[i1]; const int ref2 = fNuclearRef[i2]; if (ref2<0) { @@ -157,8 +179,8 @@ namespace corsika::stack { fNuclearZ[ref2] = fNuclearZ[ref1]; } else { // i2 is overwritten with non-nucleus i1 - fNuclearA.erase(fNuclearA.begin() + ref2); - fNuclearZ.erase(fNuclearZ.begin() + ref2); + fNuclearA.erase(fNuclearA.cbegin() + ref2); + fNuclearZ.erase(fNuclearZ.cbegin() + ref2); const int n = fNuclearRef.size(); for (int i=0; i<n; ++i) { if (fNuclearRef[i]>=ref2) { @@ -172,8 +194,13 @@ namespace corsika::stack { /** * Function to copy particle at location i2 in stack to i1 */ - void Swap(const int i1, const int i2) { - corsika::stack::super_stupid::SuperStupidStackImpl::Swap(i1, i2); + void Swap(const unsigned int i1, const unsigned int i2) { + if (i1>=GetSize() || i2>=GetSize()) { + std::ostringstream err; + err << "NuclearStackExtension: trying to access data beyond size of stack!"; + throw std::runtime_error(err.str()); + } + InnerStackImpl::Swap(i1, i2); const int ref1 = fNuclearRef[i1]; const int ref2 = fNuclearRef[i2]; if (ref2<0) { @@ -196,12 +223,12 @@ namespace corsika::stack { protected: void IncrementSize() { - corsika::stack::super_stupid::SuperStupidStackImpl::IncrementSize(); + InnerStackImpl::IncrementSize(); fNuclearRef.push_back(-1); } void DecrementSize() { - corsika::stack::super_stupid::SuperStupidStackImpl::DecrementSize(); + InnerStackImpl::DecrementSize(); if (fNuclearRef.size() > 0) { const int ref = fNuclearRef.back(); fNuclearRef.pop_back(); @@ -225,10 +252,40 @@ namespace corsika::stack { std::vector<int> fNuclearA; std::vector<int> fNuclearZ; - }; // end class SuperStupidStackImpl + }; // end class NuclearStackExtensionImpl - typedef Stack<NuclearStackExtensionImpl, ParticleInterface> NuclearStackExtension; + // template<typename StackIteratorInterface> + // using NuclearParticleInterfaceType<StackIteratorInterface> = NuclearParticleInterface< ,StackIteratorInterface> + + // works, but requires stupd _PI class + //template<typename SS> using TEST = NuclearParticleInterface<corsika::stack::super_stupid::SuperStupidStack::PIType, SS>; + template <typename InnerStack, template<typename>typename _PI> + using NuclearStackExtension = Stack<NuclearStackExtensionImpl<typename InnerStack::StackImpl>, _PI>; + + // ---- + + + // I'm dont't manage to do this properly....... + /* + template<typename TT, typename SS> using TESTi = typename NuclearParticleInterface<TT::template PIType, SS>::ExtendedParticleInterface; + template<typename TT, typename SS> using TEST1 = TESTi<TT, SS>; + template<typename SS> using TEST2 = TEST1<typename corsika::stack::super_stupid::SuperStupidStack, SS>; + + using NuclearStackExtension = Stack<NuclearStackExtensionImpl<typename InnerStack::StackImpl>, TEST2>; + */ + /* + // .... this should be fixed .... + + template <typename InnerStack, typename SS=StackIteratorInterface> + //using NuclearStackExtension = Stack<NuclearStackExtensionImpl<typename InnerStack::StackImpl>, NuclearParticleInterface<typename InnerStack::template PIType, StackIteratorInterface>::ExtendedParticleInterface>; + using NuclearStackExtension = Stack<NuclearStackExtensionImpl<typename InnerStack::StackImpl>, TEST1<typename corsika::stack::super_stupid::SuperStupidStack, SS> >; + + //template <typename InnerStack> + // using NuclearStackExtension = Stack<NuclearStackExtensionImpl<typename InnerStack::StackImpl>, TEST<typename corsika::stack::super_stupid::SuperStupidStack::PIType>>; + //using NuclearStackExtension = Stack<NuclearStackExtensionImpl<typename InnerStack::StackImpl>, TEST>; + */ + } // namespace nuclear_extension } // namespace corsika::stack diff --git a/Stack/NuclearStackExtension/testNuclearStackExtension.cc b/Stack/NuclearStackExtension/testNuclearStackExtension.cc index f8fac4bd9..ef0c22dbd 100644 --- a/Stack/NuclearStackExtension/testNuclearStackExtension.cc +++ b/Stack/NuclearStackExtension/testNuclearStackExtension.cc @@ -9,10 +9,14 @@ * the license. */ -#include <corsika/geometry/RootCoordinateSystem.h> #include <corsika/stack/nuclear_extension/NuclearStackExtension.h> +#include <corsika/stack/super_stupid/SuperStupidStack.h> +#include <corsika/geometry/RootCoordinateSystem.h> #include <corsika/units/PhysicalUnits.h> +#include <boost/type_index.hpp> +using boost::typeindex::type_id_with_cvr; + using namespace corsika::geometry; using namespace corsika::units::si; @@ -23,6 +27,13 @@ using namespace corsika::units::si; using namespace corsika; using namespace corsika::stack::nuclear_extension; +// this is an auxiliary help typedef, which I don't know how to put +// into NuclearStackExtension.h where it belongs... +template<typename StackIter> using ExtendedParticleInterfaceType = + corsika::stack::nuclear_extension::NuclearParticleInterface<corsika::stack::super_stupid::SuperStupidStack::PIType, StackIter>; + +using ExtStack = NuclearStackExtension<corsika::stack::super_stupid::SuperStupidStack, ExtendedParticleInterfaceType>; + #include <iostream> using namespace std; @@ -31,8 +42,11 @@ TEST_CASE("NuclearStackExtension", "[stack]") { geometry::CoordinateSystem& dummyCS = geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); + // cout << "ParticleType=" << type_id_with_cvr<ParticleType>().pretty_name() << endl; + + SECTION("write non nucleus") { - NuclearStackExtension s; + NuclearStackExtension<corsika::stack::super_stupid::SuperStupidStack, ExtendedParticleInterfaceType> s; s.AddParticle(particles::Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s); @@ -40,7 +54,7 @@ TEST_CASE("NuclearStackExtension", "[stack]") { } SECTION("write nucleus") { - NuclearStackExtension s; + NuclearStackExtension<corsika::stack::super_stupid::SuperStupidStack, ExtendedParticleInterfaceType> s; s.AddParticle(particles::Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 10); @@ -48,14 +62,14 @@ TEST_CASE("NuclearStackExtension", "[stack]") { } SECTION("write invalid nucleus") { - NuclearStackExtension s; + ExtStack s; REQUIRE_THROWS(s.AddParticle(particles::Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 0, 0)); } SECTION("read non nucleus") { - NuclearStackExtension s; + ExtStack s; s.AddParticle(particles::Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s); @@ -66,7 +80,7 @@ TEST_CASE("NuclearStackExtension", "[stack]") { } SECTION("read nucleus") { - NuclearStackExtension s; + ExtStack s; s.AddParticle(particles::Code::Nucleus, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 9); @@ -79,7 +93,7 @@ TEST_CASE("NuclearStackExtension", "[stack]") { } SECTION("read invalid nucleus") { - NuclearStackExtension s; + ExtStack s; s.AddParticle(particles::Code::Electron, 1.5_GeV, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s); @@ -91,7 +105,7 @@ TEST_CASE("NuclearStackExtension", "[stack]") { SECTION("stack fill and cleanup") { - NuclearStackExtension s; + ExtStack s; // add 99 particles, each 10th particle is a nucleus with A=i and Z=A/2! for (int i = 0; i < 99; ++i) { if ((i+1)%10 == 0) { @@ -105,17 +119,15 @@ TEST_CASE("NuclearStackExtension", "[stack]") { } } - REQUIRE(s.GetSize() == 99); - + REQUIRE(s.GetSize() == 99); for (int i = 0; i < 99; ++i) s.GetNextParticle().Delete(); - REQUIRE(s.GetSize() == 0); } SECTION("stack operations") { - NuclearStackExtension s; + ExtStack s; // add 99 particles, each 10th particle is a nucleus with A=i and Z=A/2! for (int i = 0; i < 99; ++i) { if ((i+1)%10 == 0) { @@ -131,7 +143,7 @@ TEST_CASE("NuclearStackExtension", "[stack]") { // copy { - s.Copy(s.begin()+9, s.begin()+10); + s.Copy(s.begin()+9, s.begin()+10); // nuclei to non-nuclei const auto& p9 = s.cbegin() + 9; const auto& p10 = s.cbegin() + 10; @@ -147,7 +159,22 @@ TEST_CASE("NuclearStackExtension", "[stack]") { REQUIRE(p10.GetNuclearA() == 9); REQUIRE(p10.GetNuclearZ() == 9/2); } - + + // copy + { + s.Copy(s.begin()+93, s.begin()+9); // non-nuclei to nuclei + const auto& p93 = s.cbegin() + 93; + const auto& p9 = s.cbegin() + 9; + + REQUIRE(p9.GetPID() == particles::Code::Electron); + REQUIRE(p9.GetEnergy() == 93*1.5_GeV); + REQUIRE(p9.GetTime() == 100_s); + + REQUIRE(p93.GetPID() == particles::Code::Electron); + REQUIRE(p93.GetEnergy() == 93*1.5_GeV); + REQUIRE(p93.GetTime() == 100_s); + } + // swap { s.Swap(s.begin()+11, s.begin()+10); @@ -167,7 +194,7 @@ TEST_CASE("NuclearStackExtension", "[stack]") { // swap two nuclei { - s.Copy(s.begin()+29, s.begin()+59); + s.Swap(s.begin()+29, s.begin()+59); const auto& p29 = s.cbegin() + 29; const auto& p59 = s.cbegin() + 59; diff --git a/Stack/SuperStupidStack/SuperStupidStack.h b/Stack/SuperStupidStack/SuperStupidStack.h index c3d4e6336..b4c8c858c 100644 --- a/Stack/SuperStupidStack/SuperStupidStack.h +++ b/Stack/SuperStupidStack/SuperStupidStack.h @@ -23,8 +23,6 @@ #include <algorithm> #include <vector> -using namespace corsika; - namespace corsika::stack { namespace super_stupid { @@ -38,20 +36,12 @@ namespace corsika::stack { template <typename StackIteratorInterface> class ParticleInterface : public ParticleBase<StackIteratorInterface> { + protected: using corsika::stack::ParticleBase<StackIteratorInterface>::GetStack; using corsika::stack::ParticleBase<StackIteratorInterface>::GetStackData; using corsika::stack::ParticleBase<StackIteratorInterface>::GetIndex; public: - /// the factory function, this is how to create a new particle: - /*void AddSecondary(const corsika::particles::Code vDataPID, - const corsika::units::si::HEPEnergyType vDataE, - const MomentumVector& vMomentum, - const corsika::geometry::Point& vPosition, - const corsika::units::si::TimeType vTime) { - GetStack().AddParticle(vDataPID, vDataE, vMomentum, vPosition, vTime); - }*/ - // void SetParticleData(const corsika::particles::Code vDataPID, const corsika::units::si::HEPEnergyType vDataE, const MomentumVector& vMomentum, @@ -117,7 +107,6 @@ namespace corsika::stack { }; /** - * * Memory implementation of the most simple (stupid) particle stack object. */ @@ -134,29 +123,29 @@ namespace corsika::stack { fTime.clear(); } - int GetSize() const { return fDataPID.size(); } - int GetCapacity() const { return fDataPID.size(); } + unsigned int GetSize() const { return fDataPID.size(); } + unsigned int GetCapacity() const { return fDataPID.size(); } - void SetPID(const int i, const corsika::particles::Code id) { fDataPID[i] = id; } - void SetEnergy(const int i, const corsika::units::si::HEPEnergyType e) { + void SetPID(const unsigned int i, const corsika::particles::Code id) { fDataPID[i] = id; } + void SetEnergy(const unsigned int i, const corsika::units::si::HEPEnergyType e) { fDataE[i] = e; } - void SetMomentum(const int i, const MomentumVector& v) { fMomentum[i] = v; } - void SetPosition(const int i, const corsika::geometry::Point& v) { + void SetMomentum(const unsigned int i, const MomentumVector& v) { fMomentum[i] = v; } + void SetPosition(const unsigned int i, const corsika::geometry::Point& v) { fPosition[i] = v; } - void SetTime(const int i, const corsika::units::si::TimeType& v) { fTime[i] = v; } + void SetTime(const unsigned int i, const corsika::units::si::TimeType& v) { fTime[i] = v; } - corsika::particles::Code GetPID(const int i) const { return fDataPID[i]; } - corsika::units::si::HEPEnergyType GetEnergy(const int i) const { return fDataE[i]; } - MomentumVector GetMomentum(const int i) const { return fMomentum[i]; } - corsika::geometry::Point GetPosition(const int i) const { return fPosition[i]; } - corsika::units::si::TimeType GetTime(const int i) const { return fTime[i]; } + corsika::particles::Code GetPID(const unsigned int i) const { return fDataPID[i]; } + corsika::units::si::HEPEnergyType GetEnergy(const unsigned int i) const { return fDataE[i]; } + MomentumVector GetMomentum(const unsigned int i) const { return fMomentum[i]; } + corsika::geometry::Point GetPosition(const unsigned int i) const { return fPosition[i]; } + corsika::units::si::TimeType GetTime(const unsigned int i) const { return fTime[i]; } /** * Function to copy particle at location i2 in stack to i1 */ - void Copy(const int i1, const int i2) { + void Copy(const unsigned int i1, const unsigned int i2) { fDataPID[i2] = fDataPID[i1]; fDataE[i2] = fDataE[i1]; fMomentum[i2] = fMomentum[i1]; @@ -167,7 +156,7 @@ namespace corsika::stack { /** * Function to copy particle at location i2 in stack to i1 */ - void Swap(const int i1, const int i2) { + void Swap(const unsigned int i1, const unsigned int i2) { std::swap(fDataPID[i2], fDataPID[i1]); std::swap(fDataE[i2], fDataE[i1]); std::swap(fMomentum[i2], fMomentum[i1]); @@ -181,7 +170,6 @@ namespace corsika::stack { using corsika::particles::Code; fDataPID.push_back(Code::Unknown); fDataE.push_back(0 * corsika::units::si::electronvolt); - //#TODO this here makes no sense: see issue #48 geometry::CoordinateSystem& dummyCS = geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); fMomentum.push_back(MomentumVector( @@ -216,7 +204,7 @@ namespace corsika::stack { }; // end class SuperStupidStackImpl typedef Stack<SuperStupidStackImpl, ParticleInterface> SuperStupidStack; - + } // namespace super_stupid } // namespace corsika::stack diff --git a/Stack/SuperStupidStack/testSuperStupidStack.cc b/Stack/SuperStupidStack/testSuperStupidStack.cc index 0e3628b46..c213abd59 100644 --- a/Stack/SuperStupidStack/testSuperStupidStack.cc +++ b/Stack/SuperStupidStack/testSuperStupidStack.cc @@ -1,4 +1,26 @@ +/* + * (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 * diff --git a/do-copyright.py b/do-copyright.py index 10f60e389..f54d85f06 100755 --- a/do-copyright.py +++ b/do-copyright.py @@ -84,6 +84,8 @@ def next_file(x, dir_name, files): return for check in files : filename, file_extension = os.path.splitext(check) + if '#' in check or '~' in check: + return for check2 in excludeFiles : if check2 in check: return -- GitLab