IAP GITLAB

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

added FourVector with tests

parent ddb41a9c
No related branches found
No related tags found
1 merge request!54Resolve "Adding FourVectors"
Pipeline #199 failed
...@@ -17,7 +17,7 @@ set ( ...@@ -17,7 +17,7 @@ set (
BaseVector.h BaseVector.h
QuantityVector.h QuantityVector.h
Trajectory.h Trajectory.h
# BaseTrajectory.h FourVector.h
) )
set ( set (
...@@ -57,16 +57,22 @@ install ( ...@@ -57,16 +57,22 @@ install (
PUBLIC_HEADER DESTINATION include/${GEOMETRY_NAMESPACE} PUBLIC_HEADER DESTINATION include/${GEOMETRY_NAMESPACE}
) )
# -------------------- # --------------------
# code unit testing # code unit testing
add_executable (testGeometry testGeometry.cc) add_executable (testGeometry testGeometry.cc)
target_link_libraries ( target_link_libraries (
testGeometry testGeometry
CORSIKAgeometry CORSIKAgeometry
CORSIKAunits CORSIKAunits
CORSIKAthirdparty # for catch2 CORSIKAthirdparty # for catch2
) )
CORSIKA_ADD_TEST(testGeometry) CORSIKA_ADD_TEST(testGeometry)
add_executable (testFourVector testFourVector.cc)
target_link_libraries (
testFourVector
CORSIKAgeometry
CORSIKAunits
CORSIKAthirdparty # for catch2
)
CORSIKA_ADD_TEST(testFourVector)
...@@ -29,8 +29,7 @@ namespace corsika::geometry { ...@@ -29,8 +29,7 @@ namespace corsika::geometry {
template <typename dim> template <typename dim>
class QuantityVector { class QuantityVector {
protected: public:
// todo: check if we need to move "quantity" into namespace corsika::units
using Quantity = phys::units::quantity<dim, double>; //< the phys::units::quantity using Quantity = phys::units::quantity<dim, double>; //< the phys::units::quantity
// corresponding to the dimension // corresponding to the dimension
......
...@@ -31,6 +31,7 @@ namespace corsika::geometry { ...@@ -31,6 +31,7 @@ namespace corsika::geometry {
template <typename dim> template <typename dim>
class Vector : public BaseVector<dim> { class Vector : public BaseVector<dim> {
public:
using Quantity = phys::units::quantity<dim, double>; using Quantity = phys::units::quantity<dim, double>;
public: public:
......
...@@ -259,39 +259,6 @@ namespace corsika::process { ...@@ -259,39 +259,6 @@ namespace corsika::process {
return ProcessSequence<P1, P2>(A.GetRef(), B.GetRef()); return ProcessSequence<P1, P2>(A.GetRef(), B.GetRef());
} }
/* #define OPSEQ(C1, C2) \ */
/* template < \ */
/* typename P1, typename P2, \ */
/* typename std::enable_if<is_process<typename std::decay<P1>::type>::value &&
* \ */
/* is_process<typename
* std::decay<P2>::type>::value>::type...> \ */
/* inline auto operator+(P1&& A, P2&& B)->ProcessSequence<P1, P2> { \ */
/* return ProcessSequence<P1, P2>(A.GetRef(), B.GetRef()); \ */
/* } */
/* /\*template <typename T1, typename T2> \ */
/* inline ProcessSequence<T1, T2> operator%(C1<T1>& A, C2<T2>& B) { \ */
/* return ProcessSequence<T1, T2>(A.GetRef(), B.GetRef()); \ */
/* }*\/ */
/* OPSEQ(BaseProcess, BaseProcess) */
/* OPSEQ(BaseProcess, InteractionProcess) */
/* OPSEQ(BaseProcess, ContinuousProcess) */
/* OPSEQ(BaseProcess, DecayProcess) */
/* OPSEQ(ContinuousProcess, BaseProcess) */
/* OPSEQ(ContinuousProcess, InteractionProcess) */
/* OPSEQ(ContinuousProcess, ContinuousProcess) */
/* OPSEQ(ContinuousProcess, DecayProcess) */
/* OPSEQ(InteractionProcess, BaseProcess) */
/* OPSEQ(InteractionProcess, InteractionProcess) */
/* OPSEQ(InteractionProcess, ContinuousProcess) */
/* OPSEQ(InteractionProcess, DecayProcess) */
/* OPSEQ(DecayProcess, BaseProcess) */
/* OPSEQ(DecayProcess, InteractionProcess) */
/* OPSEQ(DecayProcess, ContinuousProcess) */
/* OPSEQ(DecayProcess, DecayProcess) */
/// marker to identify objectas ProcessSequence /// marker to identify objectas ProcessSequence
template <typename A, typename B> template <typename A, typename B>
struct is_process_sequence<corsika::process::ProcessSequence<A, B> > { struct is_process_sequence<corsika::process::ProcessSequence<A, B> > {
......
...@@ -79,20 +79,35 @@ namespace corsika::units::si { ...@@ -79,20 +79,35 @@ namespace corsika::units::si {
/** /**
* @file PhysicalUnits * @file PhysicalUnits
* *
* Define _XeV literals, alowing 10_GeV in the code.
* Define _barn literal
*/ */
namespace phys { namespace phys {
namespace units { namespace units {
namespace literals { namespace literals {
/**
* Define new _XeV literals, alowing 10_GeV in the code.
* Define new _barn literal
*/
QUANTITY_DEFINE_SCALING_LITERALS(eV, hepenergy_d, 1) QUANTITY_DEFINE_SCALING_LITERALS(eV, hepenergy_d, 1)
QUANTITY_DEFINE_SCALING_LITERALS(barn, corsika::units::si::sigma_d, QUANTITY_DEFINE_SCALING_LITERALS(barn, corsika::units::si::sigma_d,
magnitude(corsika::units::constants::barn)) magnitude(corsika::units::constants::barn))
// QUANTITY_DEFINE_SCALING_LITERALS(Ns, corsika::units::si::momentum_d, /**
// magnitude(1_m * 1_kg / 1_s)) * add additional literals missing in the original library:
*
*/
QUANTITY_DEFINE_SCALING_LITERALS(gram, mass_d, 1e-3)
  • Owner

    What's the reason for that? We already have

    QUANTITY_DEFINE_SCALING_LITERALS(g, mass_d, 1e-3)

    in phys/units/quantity.hpp. And the literals should only contain the abbreviation, in this case g.

  • Owner

    Yes, this is wrong. Thanks for spotting.

  • Please register or sign in to reply
/*
QUANTITY_DEFINE_LITERALS(meter, length_d)
QUANTITY_DEFINE_LITERALS(second, time_interval_d)
QUANTITY_DEFINE_LITERALS(ampere, electric_current_d)
QUANTITY_DEFINE_LITERALS(Kelvin, thermodynamic_temperature_d)
*/
} // namespace literals } // namespace literals
} // namespace units } // namespace units
......
...@@ -438,7 +438,7 @@ namespace phys { ...@@ -438,7 +438,7 @@ namespace phys {
typedef dimensions<0, 0, 0, 0, 1, 0, 0, 0> thermodynamic_temperature_d; typedef dimensions<0, 0, 0, 0, 1, 0, 0, 0> thermodynamic_temperature_d;
typedef dimensions<0, 0, 0, 0, 0, 1, 0, 0> amount_of_substance_d; typedef dimensions<0, 0, 0, 0, 0, 1, 0, 0> amount_of_substance_d;
typedef dimensions<0, 0, 0, 0, 0, 0, 1, 0> luminous_intensity_d; typedef dimensions<0, 0, 0, 0, 0, 0, 1, 0> luminous_intensity_d;
typedef dimensions<0, 0, 0, 0, 0, 0, 0, 1> hepenergy_d; typedef dimensions<0, 0, 0, 0, 0, 0, 0, 1> hepenergy_d; // this is not an SI unit !
// Addition operators // Addition operators
......
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