IAP GITLAB

Skip to content
Snippets Groups Projects
Commit cd627541 authored by ralfulrich's avatar ralfulrich
Browse files

all my started development

parent 68680043
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ project (corsika VERSION 8.0.0 DESCRIPTION "CORSIKA C++ project") ...@@ -11,6 +11,7 @@ project (corsika VERSION 8.0.0 DESCRIPTION "CORSIKA C++ project")
find_package (Boost 1.40 COMPONENTS program_options REQUIRED) find_package (Boost 1.40 COMPONENTS program_options REQUIRED)
find_package (Eigen3 3.3 REQUIRED) find_package (Eigen3 3.3 REQUIRED)
find_package (HDF5)
add_subdirectory (Documentation) add_subdirectory (Documentation)
add_subdirectory (Framework) add_subdirectory (Framework)
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
using namespace phys::units;
int main() int main()
{ {
using namespace phys::units; using namespace phys::units;
...@@ -25,7 +27,7 @@ int main() ...@@ -25,7 +27,7 @@ int main()
CoordinateSystem cs2 = root.translate({0_m, 0_m, 1_m}); CoordinateSystem cs2 = root.translate({0_m, 0_m, 1_m});
Point const p2(cs2, {0_m, 0_m, 0_m}); Point const p2(cs2, {0_m, 0_m, 0_m});
auto const diff = p2 - p1; Vector<length_d> const diff = p2 - p1;
auto const norm = diff.squaredNorm(); auto const norm = diff.squaredNorm();
std::cout << "p2-p1 components: " << diff.getComponents() << std::endl; std::cout << "p2-p1 components: " << diff.getComponents() << std::endl;
......
...@@ -15,6 +15,7 @@ Cascade::Process() ...@@ -15,6 +15,7 @@ Cascade::Process()
} }
template<typename Trajectory>
void void
Cascade::Step(auto& sequence, Particle& particle) Cascade::Step(auto& sequence, Particle& particle)
{ {
......
...@@ -17,21 +17,24 @@ namespace stack { ...@@ -17,21 +17,24 @@ namespace stack {
template<typename _Stack> template<typename _Stack>
class ParticleReadOne : public StackIteratorInfo<_Stack, ParticleReadOne<_Stack> > class ParticleReadOne : public StackIteratorInfo<_Stack, ParticleReadOne<_Stack> >
{ {
using StackIteratorInfo<_Stack, ParticleReadOne>::Index; using StackIteratorInfo<_Stack, ParticleReadOne>::GetIndex;
using StackIteratorInfo<_Stack, ParticleReadOne>::Stack; using StackIteratorInfo<_Stack, ParticleReadOne>::GetStack;
public: public:
void SetId(const int id) { Stack().SetId(Index(), id); } void SetId(const int id) { GetStack().SetId(GetIndex(), id); }
void SetEnergy(const double e) { Stack().SetEnergy(Index(), e); } void SetEnergy(const double e) { GetStack().SetEnergy(GetIndex(), e); }
int GetId() const { Stack().GetId(Index()); } int GetId() const { GetStack().GetId(GetIndex()); }
double GetEnergy() const { Stack().GetEnergy(Index()); } double GetEnergy() const { GetStack().GetEnergy(GetIndex()); }
double GetPDG() const { return 0; } // ConvertToPDG(GetId()); } double GetPDG() const { return 0; } // ConvertToPDG(GetId()); }
void SetPDG(double v) { Stack().SetId(0, 0); } //fIndex, ConvertFromPDG(v)); } void SetPDG(double v) { GetStack().SetId(0, 0); } //fIndex, ConvertFromPDG(v)); }
}; };
/** /**
Memory implementation of the most simple particle stack object. Memory implementation of the most simple particle stack object.
*/ */
...@@ -40,6 +43,7 @@ namespace stack { ...@@ -40,6 +43,7 @@ namespace stack {
{ {
private: private:
/// the actual memory to store particle data /// the actual memory to store particle data
std::vector<int> fId; std::vector<int> fId;
std::vector<double> fData; std::vector<double> fData;
......
...@@ -48,7 +48,7 @@ namespace processes { ...@@ -48,7 +48,7 @@ namespace processes {
{ } { }
template<typename D> template<typename D>
inline void DoContinuous(D& d) const { A.DoContinuous(d); B.DoContinuous(d); } inline void DoContinuous(D& d) const { A.DoContinuous(d); B.DoContinuous(d); } // add trajectory
template<typename D> template<typename D>
inline double MinStepLength(D& d) const { return min(A.MinStepLength(d), B.MinStepLength(d)); } inline double MinStepLength(D& d) const { return min(A.MinStepLength(d), B.MinStepLength(d)); }
......
...@@ -19,12 +19,8 @@ namespace stack { ...@@ -19,12 +19,8 @@ namespace stack {
This allows to write code like This allows to write code like
\verbatim \verbatim
for (auto p : theStack) { p.SetEnergy(newEnergy); } for (auto& p : theStack) { p.SetEnergy(newEnergy); }
\endverbatim \endverbatim
It might be interesting to investigate whether auto or auto& is
better in the loop here...
*/ */
template<typename Stack, typename Particle> template<typename Stack, typename Particle>
...@@ -71,7 +67,7 @@ namespace stack { ...@@ -71,7 +67,7 @@ namespace stack {
Internal helper class for StackIterator. Document better... Internal helper class for StackIterator. Document better...
*/ */
template<class _Stack, class Particle> template<typename _Stack, typename Particle>
class StackIteratorInfo { class StackIteratorInfo {
friend Particle; friend Particle;
...@@ -79,9 +75,9 @@ namespace stack { ...@@ -79,9 +75,9 @@ namespace stack {
StackIteratorInfo() {} StackIteratorInfo() {}
protected: protected:
inline _Stack& Stack() { return static_cast<StackIterator<_Stack, Particle>*>(this)->GetStack(); } inline _Stack& GetStack() { return static_cast<StackIterator<_Stack, Particle>*>(this)->GetStack(); }
inline int Index() const { return static_cast<const StackIterator<_Stack, Particle>*>(this)->GetIndex(); } inline int GetIndex() const { return static_cast<const StackIterator<_Stack, Particle>*>(this)->GetIndex(); }
inline const _Stack& Stack() const { return static_cast<const StackIterator<_Stack, Particle>*>(this)->GetStack(); } inline const _Stack& GetStack() const { return static_cast<const StackIterator<_Stack, Particle>*>(this)->GetStack(); }
}; };
} // end namespace stack } // end namespace stack
......
...@@ -6,16 +6,20 @@ ...@@ -6,16 +6,20 @@
#include <Units/PhysicalConstants.h> #include <Units/PhysicalConstants.h>
// define _XeV literals /**
/file PhysicalUnits
Define _XeV literals, alowing 10_GeV in the code.
//namespace corsika { */
namespace phys {
namespace units { namespace phys {
namespace literals { namespace units {
QUANTITY_DEFINE_SCALING_LITERALS(eV, energy_d, magnitude(eV) ) namespace literals {
} QUANTITY_DEFINE_SCALING_LITERALS(eV, energy_d, magnitude(eV) )
} }
} }
//} }
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment