diff --git a/CMakeLists.txt b/CMakeLists.txt index d44825bcd162ce73d2e18c1e1bdc6c43abed4155..9def1d5e6076f653d6a566d067e25d8daad10f14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,29 +1,35 @@ cmake_minimum_required (VERSION 3.4.3) -project (corsika VERSION 8.0.0 DESCRIPTION "CORSIKA C++ project" LANGUAGES CXX) +project ( + corsika + VERSION 8.0.0 + DESCRIPTION "CORSIKA C++ project" + LANGUAGES CXX + ) # ignore many irrelevant Up-to-date messages during install set (CMAKE_INSTALL_MESSAGE LAZY) # directory for local cmake modules set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) +include (CorsikaUtilities) # a few cmake function # --std=c++14 set (CMAKE_CXX_STANDARD 17) enable_testing () set (CTEST_OUTPUT_ON_FAILURE 1) -# testing coverage -include(CodeCoverage) -#set(COVERAGE_LCOV_EXCLUDES 'Documentation/*') -#setup_target_for_coverage(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage) -SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML( - NAME corsika_coverage - EXECUTABLE ctest - #-j ${PROCESSOR_COUNT} -# DEPENDENCIES corsika - ) - +# unit testing coverage, does not work yet +#include (CodeCoverage) +##set(COVERAGE_LCOV_EXCLUDES 'Documentation/*') +##setup_target_for_coverage(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage) +#SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML ( +# NAME corsika_coverage +# EXECUTABLE ctest +# #-j ${PROCESSOR_COUNT} +# # DEPENDENCIES corsika +# ) + #add_custom_target (corsika_pre_build) #add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py") diff --git a/CMakeModules/CorsikaUtilities.cmake b/CMakeModules/CorsikaUtilities.cmake new file mode 100644 index 0000000000000000000000000000000000000000..c247c631b6de05fb42ae9a4cf0769ae9b6eb9577 --- /dev/null +++ b/CMakeModules/CorsikaUtilities.cmake @@ -0,0 +1,44 @@ + +# +# takes a list of input files and prepends a path +# + +function (CORSIKA_PREPEND_PATH return prefix) + set (listVar "") + foreach (f ${ARGN}) + list (APPEND listVar "${prefix}/${f}") + endforeach (f) + set (${return} "${listVar}" PARENT_SCOPE) +endfunction (CORSIKA_PREPEND_PATH) + + +# +# use: CORSIKA_COPY_HEADERS_TO_NAMESPACE theLib theNamesapce header1.h header2.h ... +# +# creates a dependence of theLib on the presence of all listed header files in the +# build-directory include/theNamespace directory +# +# if needed, create symbolic links from the source files to this build-directory location +# +function (CORSIKA_COPY_HEADERS_TO_NAMESPACE for_library in_namespace) + CORSIKA_PREPEND_PATH (HEADERS_BUILD "${PROJECT_BINARY_DIR}/include/${in_namespace}" ${ARGN}) + foreach (HEADER ${ARGN}) + add_custom_command ( + OUTPUT ${PROJECT_BINARY_DIR}/include/${in_namespace}/${HEADER} + COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/include/${in_namespace} + COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} ${PROJECT_BINARY_DIR}/include/${in_namespace}/${HEADER} + COMMENT "Generate link: ${PROJECT_BINARY_DIR}/include/${in_namespace}/${HEADER}" + # VERBATIM + ) + endforeach (HEADER) + + # main target for this library, depends on header files in build area + add_custom_target ( + ${for_library}_BUILD + DEPENDS ${HEADERS_BUILD} + ) + + add_dependencies (${for_library} ${for_library}_BUILD) + +endfunction (CORSIKA_COPY_HEADERS_TO_NAMESPACE) + diff --git a/Documentation/Examples/geometry_example.cc b/Documentation/Examples/geometry_example.cc index b2c2404922b4f66f4d53749bac90b1094815d1fb..73063442169cf2b67f342edebadfe502cae06ae3 100644 --- a/Documentation/Examples/geometry_example.cc +++ b/Documentation/Examples/geometry_example.cc @@ -1,7 +1,7 @@ -#include <Geometry/Vector.h> -#include <Geometry/Sphere.h> -#include <Geometry/Point.h> -#include <Geometry/CoordinateSystem.h> +#include <fwk/Vector.h> +#include <fwk/Sphere.h> +#include <fwk/Point.h> +#include <fwk/CoordinateSystem.h> #include <Units/PhysicalUnits.h> #include <iostream> @@ -12,6 +12,8 @@ using namespace phys::units; using namespace phys::units::io; // support stream << unit using namespace phys::units::literals; // support unit literals like 5_m; +using namespace fwk; + int main() { // define the root coordinate system diff --git a/Documentation/Examples/helix_example.cc b/Documentation/Examples/helix_example.cc index ae7250b16ffefbcf22dcb20f360ceb14debdad54..46b9f7161d864c00f13855f9b73ca8eed9a70ecf 100644 --- a/Documentation/Examples/helix_example.cc +++ b/Documentation/Examples/helix_example.cc @@ -1,8 +1,8 @@ #include <Units/PhysicalUnits.h> -#include <Geometry/Vector.h> -#include <Geometry/CoordinateSystem.h> -#include <Geometry/Point.h> -#include <Geometry/Helix.h> +#include <fwk/Vector.h> +#include <fwk/CoordinateSystem.h> +#include <fwk/Point.h> +#include <fwk/Helix.h> #include <cstdlib> #include <iostream> #include <array> @@ -15,12 +15,12 @@ int main() { CoordinateSystem root; - Point const r0(root, {0_m, 0_m, 0_m}); + fwk::Point const r0(root, {0_m, 0_m, 0_m}); auto const omegaC = 2 * M_PI * 1_Hz; - Vector<speed_d> vPar(root, {0_m / second, 0_m / second, 10_cm / second}); - Vector<speed_d> vPerp(root, {1_m / second, 0_m / second, 0_m / second}); + fwk::Vector<speed_d> vPar(root, {0_m / second, 0_m / second, 10_cm / second}); + fwk::Vector<speed_d> vPerp(root, {1_m / second, 0_m / second, 0_m / second}); - Helix h(r0, omegaC, vPar, vPerp); + fwk::Helix h(r0, omegaC, vPar, vPerp); auto constexpr t0 = 0_s; auto constexpr t1 = 1_s; diff --git a/Documentation/Examples/logger_example.cc b/Documentation/Examples/logger_example.cc index d8212e6612dc2f45eb73990571d5d4c4125562ce..219358ab25e12468d623d5407e30fcf01bf98fb0 100644 --- a/Documentation/Examples/logger_example.cc +++ b/Documentation/Examples/logger_example.cc @@ -1,4 +1,4 @@ -#include <Logging/Logger.h> +#include <fwk/Logger.h> #include <string> #include <iostream> @@ -14,10 +14,10 @@ main() { cout << "writing to \"another.log\"" << endl; ofstream logfile("another.log"); - logger::sink::SinkStream unbuffered_sink(logfile); - logger::sink::BufferedSinkStream sink(logfile, logger::sink::StdBuffer(10000)); - logger::Logger<logger::MessageOn, logger::sink::BufferedSinkStream> info("\033[32m", "info", sink); - logger::Logger<logger::MessageOn, logger::sink::BufferedSinkStream> err("\033[31m", "error", sink); + fwk::sink::SinkStream unbuffered_sink(logfile); + fwk::sink::BufferedSinkStream sink(logfile, fwk::sink::StdBuffer(10000)); + fwk::Logger<fwk::MessageOn, fwk::sink::BufferedSinkStream> info("\033[32m", "info", sink); + fwk::Logger<fwk::MessageOn, fwk::sink::BufferedSinkStream> err("\033[31m", "error", sink); //logger<ostream,messageconst,StdBuffer> info(std::cout, StdBuffer(10000)); /* @@ -33,8 +33,8 @@ main() } { - logger::sink::NoSink off; - logger::Logger<logger::MessageOff> info("", "", off); + fwk::sink::NoSink off; + fwk::Logger<fwk::MessageOff> info("", "", off); for (int i=0; i<100000; ++i) { LOG(info, "irgendwas", string("and more"), boost::format("error: %i message: %s. done."), i, "stupido", "a-number:", 8.99, "ENDE" ); diff --git a/Documentation/Examples/stack_example.cc b/Documentation/Examples/stack_example.cc index d27467f56999a113442befdb644ee3e8893cda63..c526b5887a886c6061b517abad2eda69e8deb839 100644 --- a/Documentation/Examples/stack_example.cc +++ b/Documentation/Examples/stack_example.cc @@ -1,4 +1,5 @@ #include <ParticleStack/StackOne.h> +//#include <corsika/StackOne.h> #include <iostream> #include <iomanip> diff --git a/Framework/Cascade/Cascade.cc b/Framework/Cascade/Cascade.cc index ffd4607039c933165ade08c624b332f5fddbf9b2..d4e1320a5fa5685064123e6ff635ab50a529b2fe 100644 --- a/Framework/Cascade/Cascade.cc +++ b/Framework/Cascade/Cascade.cc @@ -4,8 +4,9 @@ namespace cascade; template<typename Sequence, typename Trajectory> void -Cascade::Cascade() -{ +Cascade::Cascade() { + kkk; + kk; } diff --git a/Framework/Geometry/BaseVector.h b/Framework/Geometry/BaseVector.h index 02edb6fa8199e0d70a0eea1b326ca6f07b8bd5b3..2ed634df665cc4e2a32d1b038c50867c8c398e48 100644 --- a/Framework/Geometry/BaseVector.h +++ b/Framework/Geometry/BaseVector.h @@ -1,8 +1,10 @@ #ifndef _include_BASEVECTOR_H_ #define _include_BASEVECTOR_H_ -#include <Geometry/QuantityVector.h> -#include <Geometry/CoordinateSystem.h> +#include <fwk/QuantityVector.h> +#include <fwk/CoordinateSystem.h> + +namespace fwk { /*! * Common base class for Vector and Point. Currently it does basically nothing. @@ -22,4 +24,6 @@ public: } }; +} // end namesapce + #endif diff --git a/Framework/Geometry/CMakeLists.txt b/Framework/Geometry/CMakeLists.txt index 16dce73058acacd30e22672ff8eb59acd2b3ab88..61abfdc6294c81d83dbd7fb42ad2c36fd9b37b08 100644 --- a/Framework/Geometry/CMakeLists.txt +++ b/Framework/Geometry/CMakeLists.txt @@ -1,31 +1,68 @@ -set (GEOMETRY_SOURCES CoordinateSystem.cc) -set (GEOMETRY_HEADERS Vector.h Point.h Sphere.h CoordinateSystem.h Helix.h) +set ( + GEOMETRY_SOURCES + CoordinateSystem.cc + ) + +set ( + GEOMETRY_HEADERS + Vector.h + Point.h + Sphere.h + CoordinateSystem.h + Helix.h + BaseVector.h + QuantityVector.h + ) + +set ( + GEOMETRY_NAMESPACE + fwk + ) add_library (CORSIKAgeometry STATIC ${GEOMETRY_SOURCES}) +CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAgeometry ${GEOMETRY_NAMESPACE} ${GEOMETRY_HEADERS}) -set_target_properties (CORSIKAgeometry PROPERTIES VERSION ${PROJECT_VERSION}) -set_target_properties (CORSIKAgeometry PROPERTIES SOVERSION 1) +set_target_properties ( + CORSIKAgeometry + PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION 1 + PUBLIC_HEADER "${GEOMETRY_HEADERS}" + ) -set_target_properties (CORSIKAgeometry PROPERTIES PUBLIC_HEADER "${GEOMETRY_HEADERS}") - -# target dependencies on other libraries (also header only) -target_link_libraries (CORSIKAgeometry CORSIKAunits) +# target dependencies on other libraries (also the header onlys) +target_link_libraries ( + CORSIKAgeometry + CORSIKAunits + ) -target_include_directories (CORSIKAgeometry PRIVATE ${EIGEN3_INCLUDE_DIR}) -target_include_directories (CORSIKAgeometry INTERFACE ${EIGEN3_INCLUDE_DIR}) -target_include_directories (CORSIKAgeometry INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework> - $<INSTALL_INTERFACE:include/Framework> - ) +target_include_directories ( + CORSIKAgeometry + PRIVATE ${EIGEN3_INCLUDE_DIR} + INTERFACE ${EIGEN3_INCLUDE_DIR} + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> + $<INSTALL_INTERFACE:include/include> + ) -install (TARGETS CORSIKAgeometry - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include/Geometry) +install ( + TARGETS CORSIKAgeometry + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include/${GEOMETRY_NAMESPACE} + ) -# code testing +# -------------------- +# code unit testing add_executable (testGeometry testGeometry.cc) -target_link_libraries (testGeometry CORSIKAgeometry CORSIKAunits CORSIKAthirdparty) # for catch2 -add_test (NAME testGeometry COMMAND testGeometry -o report.xml -r junit) + +target_link_libraries ( + testGeometry + CORSIKAgeometry + CORSIKAunits + CORSIKAthirdparty # for catch2 + ) + +add_test (NAME testGeometry COMMAND testGeometry) diff --git a/Framework/Geometry/Helix.h b/Framework/Geometry/Helix.h index 10480c00fca7bec80153c76c52410feb626e3922..1234940b3f16aa1e4345338ab9e36835f2255d89 100644 --- a/Framework/Geometry/Helix.h +++ b/Framework/Geometry/Helix.h @@ -1,12 +1,14 @@ #ifndef _include_HELIX_H_ #define _include_HELIX_H_ -#include <Geometry/Vector.h> -#include <Geometry/Point.h> +#include <fwk/Vector.h> +#include <fwk/Point.h> #include <Units/PhysicalUnits.h> #include <cmath> +namespace fwk { + class Helix // TODO: inherit from to-be-implemented "Trajectory" { using SpeedVec = Vector<Speed::dimension_type>; @@ -38,4 +40,6 @@ public: } }; +} // end namesapce + #endif diff --git a/Framework/Geometry/LineTrajectory.h b/Framework/Geometry/LineTrajectory.h index f9efee6e67d523a5ecaadaadfb40f76fa72acb5f..3313eb8c9de494941693357aee08a468a71d5c8a 100644 --- a/Framework/Geometry/LineTrajectory.h +++ b/Framework/Geometry/LineTrajectory.h @@ -1,10 +1,12 @@ #ifndef _include_LINETRAJECTORY_H #define _include_LINETRAJECTORY_H -#include <Framework/Geometry/Point.h> -#include <Framework/Geometry/Vector.h> +#include <fwk/Point.h> +#include <fwk/Vector.h> #include <Units/PhysicalUnits.h> +namesapce fwk { + class LineTrajectory // TODO: inherit from Trajectory { using SpeedVec = Vector<Speed::dimension_type>; @@ -23,4 +25,6 @@ class LineTrajectory // TODO: inherit from Trajectory } }; +} // end namesapce + #endif diff --git a/Framework/Geometry/Point.h b/Framework/Geometry/Point.h index f5efef09d77a24ee0587fb42f5be1d24150958f9..6607f1bdc71c9a58d79e8f435e0bc7c0b87fa034 100644 --- a/Framework/Geometry/Point.h +++ b/Framework/Geometry/Point.h @@ -1,24 +1,27 @@ #ifndef _include_POINT_H_ #define _include_POINT_H_ -#include <Geometry/BaseVector.h> -#include <Geometry/QuantityVector.h> -#include <Geometry/Vector.h> +#include <fwk/BaseVector.h> +#include <fwk/QuantityVector.h> +#include <fwk/Vector.h> #include <Units/PhysicalUnits.h> -/*! - * A Point represents a point in position space. It is defined by its - * coordinates with respect to some CoordinateSystem. - */ -class Point : public BaseVector<phys::units::length_d> -{ -public: - Point(CoordinateSystem const& pCS, QuantityVector<phys::units::length_d> pQVector) : - BaseVector<phys::units::length_d>(pCS, pQVector) - { - } - Point(CoordinateSystem const& cs, Length x, Length y, Length z) : +namespace fwk { + + /*! + * A Point represents a point in position space. It is defined by its + * coordinates with respect to some CoordinateSystem. + */ + class Point : public BaseVector<phys::units::length_d> + { + public: + Point(CoordinateSystem const& pCS, QuantityVector<phys::units::length_d> pQVector) : + BaseVector<phys::units::length_d>(pCS, pQVector) + { + } + + Point(CoordinateSystem const& cs, Length x, Length y, Length z) : BaseVector<phys::units::length_d>(cs, {x, y, z}) { } @@ -65,4 +68,6 @@ public: } }; +} // end namespace + #endif diff --git a/Framework/Geometry/Sphere.h b/Framework/Geometry/Sphere.h index cc87e1088161c0ea6800bad116c154e23deff015..634ffe31ec1599565110d297cc1ad2bc6910e3e1 100644 --- a/Framework/Geometry/Sphere.h +++ b/Framework/Geometry/Sphere.h @@ -1,9 +1,11 @@ #ifndef _include_SPHERE_H_ #define _include_SPHERE_H_ -#include <Geometry/Point.h> +#include <fwk/Point.h> #include <Units/PhysicalUnits.h> +namespace fwk { + class Sphere { Point center; @@ -23,4 +25,6 @@ public: }; +}// end namespace + #endif diff --git a/Framework/Geometry/Vector.h b/Framework/Geometry/Vector.h index 3c48f9df8d52df91ab95be553d113a619059a766..113d8701813d46e9023a7b0cd127501c9e282c73 100644 --- a/Framework/Geometry/Vector.h +++ b/Framework/Geometry/Vector.h @@ -1,8 +1,8 @@ #ifndef _include_VECTOR_H_ #define _include_VECTOR_H_ -#include <Geometry/BaseVector.h> -#include <Geometry/QuantityVector.h> +#include <fwk/BaseVector.h> +#include <fwk/QuantityVector.h> #include <Units/PhysicalUnits.h> /*! @@ -15,8 +15,10 @@ * part only and invariant under translations. */ -template <typename dim> -class Vector : public BaseVector<dim> +namespace fwk { + + template <typename dim> + class Vector : public BaseVector<dim> { using Quantity = phys::units::quantity<dim, double>; @@ -200,4 +202,6 @@ public: }; +} // end namespace + #endif diff --git a/Framework/Logging/BufferedSink.h b/Framework/Logging/BufferedSink.h index 9934744dc1d069e603ec4f72f4ea25652eb97e4c..86e7db4b32f02cc8f17b537aa19eda4ddeae2ae9 100644 --- a/Framework/Logging/BufferedSink.h +++ b/Framework/Logging/BufferedSink.h @@ -1,7 +1,7 @@ #ifndef _include_BufferedSink_h_ #define _include_BufferedSink_h_ -namespace logger { +namespace fwk { namespace sink { diff --git a/Framework/Logging/CMakeLists.txt b/Framework/Logging/CMakeLists.txt index 581df617b38eb288e0f198d60d2cfa18c1e82a7d..7486c499adc255b6d027d1752b8c53542e4efd6c 100644 --- a/Framework/Logging/CMakeLists.txt +++ b/Framework/Logging/CMakeLists.txt @@ -1,18 +1,55 @@ - add_library (CORSIKAlogging INTERFACE) -target_include_directories (CORSIKAlogging INTERFACE ${PROJECT_SOURCE_DIR}/Framework) +# namespace of library -> location of header files +set ( + CORSIKAlogging_NAMESPACE + fwk + ) + +# header files of this library +set ( + CORSIKAlogging_HEADERS + Logger.h + Sink.h + MessageOn.h + MessageOff.h + NoSink.h + Sink.h + BufferedSink.h + ) + +CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAlogging ${CORSIKAlogging_NAMESPACE} ${CORSIKAlogging_HEADERS}) + +# include directive for upstream code +target_include_directories ( + CORSIKAlogging + INTERFACE + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> + $<INSTALL_INTERFACE:include/> + ) + +# install library +install ( + FILES ${CORSIKAlogging_HEADERS} + DESTINATION include/${CORSIKAlogging_NAMESPACE} + ) -target_include_directories (CORSIKAlogging INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework> - $<INSTALL_INTERFACE:include/Framework> - ) +# ---------------- +# code unit testing +add_executable ( + testLogging + testLogging.cc + ) -install (FILES Logger.h Sink.h MessageOn.h MessageOff.h NoSink.h Sink.h BufferedSink.h - DESTINATION include/Logging) +target_link_libraries ( + testLogging + CORSIKAlogging + CORSIKAthirdparty # for catch2 + ) -# code testing -add_executable (testLogging testLogging.cc) -target_link_libraries (testLogging CORSIKAlogging CORSIKAthirdparty) # for catch2 -add_test (NAME testLogging COMMAND testLogging -o report.xml -r junit) +add_test ( + NAME testLogging + COMMAND testLogging + ) diff --git a/Framework/Logging/Logger.h b/Framework/Logging/Logger.h index b98654d3f224711bf1d3315564f316c63544759e..6b8acd2cc95da21c3fa0ad250b1f7e1e93554ef9 100644 --- a/Framework/Logging/Logger.h +++ b/Framework/Logging/Logger.h @@ -1,3 +1,7 @@ +/** + @File Logger.h + */ + #ifndef _include_logger_h_ #define _include_logger_h_ @@ -8,11 +12,11 @@ #include <boost/format.hpp> -#include <Logging/MessageOn.h> -#include <Logging/MessageOff.h> -#include <Logging/Sink.h> -#include <Logging/NoSink.h> -#include <Logging/BufferedSink.h> +#include <fwk/MessageOn.h> +#include <fwk/MessageOff.h> +#include <fwk/Sink.h> +#include <fwk/NoSink.h> +#include <fwk/BufferedSink.h> using namespace std; @@ -22,7 +26,7 @@ using namespace boost; Everything around logfile generation and text output. */ -namespace logger { +namespace fwk { /** Defines one stream to accept messages, and to wrote those into diff --git a/Framework/Logging/MessageOff.h b/Framework/Logging/MessageOff.h index ef62e2577eedae957767888156bbe04474e71c0b..d54b675b684208dff030f20d06aa37336a731dd8 100644 --- a/Framework/Logging/MessageOff.h +++ b/Framework/Logging/MessageOff.h @@ -1,7 +1,7 @@ #ifndef _include_MessageOff_h_ #define _include_MessageOff_h_ -namespace logger { +namespace fwk { /** Helper class to ignore all arguments to MessagesOn::Message and diff --git a/Framework/Logging/MessageOn.h b/Framework/Logging/MessageOn.h index 43b847448a5b92d3b3c48d5768db874663a9d8a1..d53ec05c8682879de0f081ecf04d2a153453f350 100644 --- a/Framework/Logging/MessageOn.h +++ b/Framework/Logging/MessageOn.h @@ -2,7 +2,7 @@ #define _include_MessageOn_h_ -namespace logger { +namespace fwk { /** Helper class to convert all input arguments of MessageOn::Message diff --git a/Framework/Logging/NoSink.h b/Framework/Logging/NoSink.h index 13e37f3b9a511182f792d81922e7dfba4c62d8ef..c5932499aa893042999da6d0961e0e7c6b4dc486 100644 --- a/Framework/Logging/NoSink.h +++ b/Framework/Logging/NoSink.h @@ -1,7 +1,7 @@ #ifndef _include_NoSink_h_ #define _include_NoSink_h_ -namespace logger { +namespace fwk { namespace sink { diff --git a/Framework/Logging/Sink.h b/Framework/Logging/Sink.h index 6ee615176036f03c74a1deb50493bfdcd6cddd1b..7950f05b9ede6696929beff72149e459b4efd0c1 100644 --- a/Framework/Logging/Sink.h +++ b/Framework/Logging/Sink.h @@ -1,7 +1,7 @@ #ifndef _include_Sink_h_ #define _include_Sink_h_ -namespace logger { +namespace fwk { /** a sink for the logger must implement the two functions diff --git a/Framework/Logging/testLogging.cc b/Framework/Logging/testLogging.cc index 7d2ccb56977a70d1b953e70df4f8a7ca42e5fdd7..f4113483629bf5660c45ca3624886b7964b099f2 100644 --- a/Framework/Logging/testLogging.cc +++ b/Framework/Logging/testLogging.cc @@ -1,7 +1,7 @@ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file #include <catch2/catch.hpp> -#include <Logging/Logger.h> +#include <fwk/Logger.h> TEST_CASE( "Logging", "[Logging]" ) { diff --git a/Framework/ParticleStack/CMakeLists.txt b/Framework/ParticleStack/CMakeLists.txt index 93b5280ec328b02eebe3ad5f10a1c73ed37e6c7c..66534852893a0aa85e45bc4438170a30444ec06f 100644 --- a/Framework/ParticleStack/CMakeLists.txt +++ b/Framework/ParticleStack/CMakeLists.txt @@ -1,5 +1,5 @@ -set (STACK_HEADERS StackOne.h) +set (PUBLIC_HEADER_FILES StackOne.h) add_library (CORSIKAstack INTERFACE) @@ -11,8 +11,22 @@ add_library (CORSIKAstack INTERFACE) #target_link_libraries (CORSIKAstackinterface CORSIKAunits) #target_include_directories (CORSIKAstack PRIVATE ${EIGEN3_INCLUDE_DIR}) -target_include_directories (CORSIKAstack INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework> - $<INSTALL_INTERFACE:include/Framework> - ) +target_include_directories ( + CORSIKAstack + INTERFACE + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> + $<INSTALL_INTERFACE:include> + ) -install (FILES StackOne.h DESTINATION include/Stack) +#add_custom_command ( +# CORSIKAstack +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PUBLIC_HEADER_FILES} ${PROJECT_BINARY_DIR}/include/corsika}) +# ) + +install ( + FILES + StackOne.h + DESTINATION + include/Stack + ) diff --git a/Framework/ParticleStack/StackOne.h b/Framework/ParticleStack/StackOne.h index 0d8ab00680f334bd01bf7f072131ec933b65b33a..e41007a6a97aea7ba0d91402df5cd022372778b0 100644 --- a/Framework/ParticleStack/StackOne.h +++ b/Framework/ParticleStack/StackOne.h @@ -5,6 +5,7 @@ #include <string> #include <StackInterface/Stack.h> +//#include <corsika/Stack.h> namespace stack { @@ -24,8 +25,8 @@ namespace stack { void SetId(const int id) { GetStack().SetId(GetIndex(), id); } void SetEnergy(const double e) { GetStack().SetEnergy(GetIndex(), e); } - int GetId() const { GetStack().GetId(GetIndex()); } - double GetEnergy() const { GetStack().GetEnergy(GetIndex()); } + int GetId() const { return GetStack().GetId(GetIndex()); } + double GetEnergy() const { return GetStack().GetEnergy(GetIndex()); } double GetPDG() const { return 0; } // ConvertToPDG(GetId()); } void SetPDG(double v) { GetStack().SetId(0, 0); } //fIndex, ConvertFromPDG(v)); } diff --git a/Framework/Particles/CMakeLists.txt b/Framework/Particles/CMakeLists.txt index b408a7690153aca39fd0f9453fa940d483068ef1..f4305b5d2c55ea6825e7753008e5911abde154ad 100644 --- a/Framework/Particles/CMakeLists.txt +++ b/Framework/Particles/CMakeLists.txt @@ -1,14 +1,27 @@ -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/Framework/Particles/GeneratedParticleProperties.inc - COMMAND ${PROJECT_SOURCE_DIR}/Framework/Particles/pdxml_reader.py ${PROJECT_SOURCE_DIR}/Framework/Particles/ParticleData.xml ${PROJECT_SOURCE_DIR}/Framework/Particles/ParticleClassNames.xml - DEPENDS pdxml_reader.py ParticleData.xml ParticleClassNames.xml - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/Framework/Particles/ - COMMENT "Read PYTHIA8 particle data and produce C++ source code GeneratedParticleProperties.inc" - VERBATIM) +add_custom_command ( + OUTPUT + ${PROJECT_BINARY_DIR}/Framework/Particles/GeneratedParticleProperties.inc + COMMAND + ${PROJECT_SOURCE_DIR}/Framework/Particles/pdxml_reader.py ${PROJECT_SOURCE_DIR}/Framework/Particles/ParticleData.xml ${PROJECT_SOURCE_DIR}/Framework/Particles/ParticleClassNames.xml + DEPENDS + pdxml_reader.py + ParticleData.xml + ParticleClassNames.xml + WORKING_DIRECTORY + ${PROJECT_BINARY_DIR}/Framework/Particles/ + COMMENT + "Read PYTHIA8 particle data and produce C++ source code GeneratedParticleProperties.inc" + VERBATIM + ) #set (PARTICLES_SOURCES ) -set (PARTICLE_HEADERS Particles.h ${PROJECT_BINARY_DIR}/Framework/Particles/GeneratedParticleProperties.inc) +set ( + PARTICLE_HEADERS + Particles.h + ${PROJECT_BINARY_DIR}/Framework/Particles/GeneratedParticleProperties.inc + ) add_library (CORSIKAparticles INTERFACE) @@ -21,21 +34,50 @@ add_library (CORSIKAparticles INTERFACE) #target_link_libraries (CORSIKAparticles CORSIKAunits) #target_include_directories (CORSIKAparticles PRIVATE ${EIGEN3_INCLUDE_DIR}) -target_include_directories (CORSIKAparticles INTERFACE ${EIGEN3_INCLUDE_DIR}) -target_include_directories (CORSIKAparticles INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework> - $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/Framework> - $<INSTALL_INTERFACE:include/Framework> - ) +target_include_directories ( + CORSIKAparticles + INTERFACE + ${EIGEN3_INCLUDE_DIR} + ) + +target_include_directories ( + CORSIKAparticles + INTERFACE + $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework> + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/Framework> + $<INSTALL_INTERFACE:include/Framework> + ) #install (TARGETS CORSIKAparticles # LIBRARY DESTINATION lib # ARCHIVE DESTINATION lib # PUBLIC_HEADER DESTINATION include/Particles) -install (FILES ${PARTICLE_HEADERS} DESTINATION include/Particles) +install ( + FILES + ${PARTICLE_HEADERS} + DESTINATION + include/Particles + ) # code testing -add_executable (testParticles testParticles.cc ${PROJECT_BINARY_DIR}/Framework/Particles/GeneratedParticleProperties.inc) -target_link_libraries (testParticles CORSIKAparticles CORSIKAunits CORSIKAthirdparty) # for catch2 -add_test (NAME testParticles COMMAND testParticles) +add_executable ( + testParticles + testParticles.cc + ${PROJECT_BINARY_DIR}/Framework/Particles/GeneratedParticleProperties.inc + ) + +target_link_libraries ( + testParticles + CORSIKAparticles + CORSIKAunits + CORSIKAthirdparty # for catch2 + ) + +add_test ( + NAME + testParticles + COMMAND + testParticles + ) diff --git a/Framework/Particles/pdxml_reader.py b/Framework/Particles/pdxml_reader.py index 62d24c7fc3b0bfe7bb93ce2f0050211b774152e5..1394ed4242fd4665f554e6c1c8d85ef14836d4b7 100755 --- a/Framework/Particles/pdxml_reader.py +++ b/Framework/Particles/pdxml_reader.py @@ -203,6 +203,8 @@ def gen_classes(pythia_db): break string += "\n"; + string += "/** @class " + cname + "\n" + string += "*/\n\n" string += "struct " + cname + "{\n" string += " static InternalParticleCode GetType() { return Type; }\n" string += " static quantity<energy_d> GetMass() { return masses[TypeIndex]; }\n" diff --git a/Framework/StackInterface/CMakeLists.txt b/Framework/StackInterface/CMakeLists.txt index f37313a26f26c2595eb43682195a85304f00822e..21e156044e29f420d7e0442c83c60b60b37aeb14 100644 --- a/Framework/StackInterface/CMakeLists.txt +++ b/Framework/StackInterface/CMakeLists.txt @@ -1,10 +1,31 @@ +set ( + PUBLIC_HEADER_FILES + Stack.h + StackIterator.h + ) -add_library (CORSIKAstackinterface INTERFACE) +add_library ( + CORSIKAstackinterface + INTERFACE + ) -target_include_directories (CORSIKAstackinterface INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework> - $<INSTALL_INTERFACE:include/Framework> - ) +target_include_directories ( + CORSIKAstackinterface + INTERFACE + $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> + $<INSTALL_INTERFACE:include> + ) -install (FILES Stack.h StackIterator.h - DESTINATION include/StackInterface) +#add_custom_command ( +# TARGET +# CORSIKAstackinterface +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PUBLIC_HEADER_FILES} ${PROJECT_BINARY_DIR}/include/corsika +# ) +install ( + FILES + ${PUBLIC_HEADER_FILES} + DESTINATION + include/corsika + ) diff --git a/Framework/StackInterface/Stack.h b/Framework/StackInterface/Stack.h index 9b9065d7e0b0933710cf3baf28361b6f0109a546..9412286bf85fc9558308e01d117124c181bbba7b 100644 --- a/Framework/StackInterface/Stack.h +++ b/Framework/StackInterface/Stack.h @@ -2,6 +2,7 @@ #define _include_Stack_h__ #include <StackInterface/StackIterator.h> // to help application programmres +//#include <corsika/StackIterator.h> // to help application programmres /** All classes around management of particles on a stack.