From adb829a0765199e20967aa6b39ddcfc3ab6dac53 Mon Sep 17 00:00:00 2001 From: rulrich <ralf.m.ulrich@kit.edu> Date: Sun, 31 May 2020 13:12:21 +0200 Subject: [PATCH] more conex --- CMakeModules/FindCONEX.cmake | 100 +++++++++++++++++++++++++++++++++ Processes/CONEX/CMakeLists.txt | 70 +++++++++++++++++++++++ Processes/CONEX/CONEX.cc | 5 ++ Processes/CONEX/CONEX.h | 12 ++++ Processes/CONEX/testConex.cc | 30 ++++++++++ 5 files changed, 217 insertions(+) create mode 100644 CMakeModules/FindCONEX.cmake create mode 100644 Processes/CONEX/CMakeLists.txt create mode 100644 Processes/CONEX/CONEX.cc create mode 100644 Processes/CONEX/CONEX.h create mode 100644 Processes/CONEX/testConex.cc diff --git a/CMakeModules/FindCONEX.cmake b/CMakeModules/FindCONEX.cmake new file mode 100644 index 000000000..860009583 --- /dev/null +++ b/CMakeModules/FindCONEX.cmake @@ -0,0 +1,100 @@ +# - find Conex +# +# This module defines +# CONEX_FOUND +# CONEX_PREFIX +# CONEX_INCLUDE_DIR + +FIND_PATH (CONEX_PREFIX + NAMES lib/${CMAKE_SYSTEM_NAME} + PATHS $ENV{CONEXROOT} + DOC "The CONEX root directory" + NO_DEFAULT_PATH +) + +FIND_PATH (CONEX_INCLUDE_DIR + NAMES ConexDynamicInterface.h + PATHS ${CONEX_PREFIX}/src + DOC "The CONEX include directory" +) + +IF (CONEX_INCLUDE_DIR) + SET (CONEX_FOUND TRUE) + ADD_DEFINITIONS (-D_CONEX_PREFIX=\"${CONEX_PREFIX}\" -D_CONEX_SYSTEM=\"${CMAKE_SYSTEM_NAME}\") + IF (NOT Conex_FIND_QUIETLY) + MESSAGE (STATUS "Conex include directory is ${CONEX_INCLUDE_DIR}") + ENDIF () + SET (CMAKE_REQUIRED_INCLUDES ${CONEX_INCLUDE_DIR}) + CHECK_CXX_SOURCE_COMPILES ( + " + #include <conexHEModels.h> + + int + main() + { + EHEModel test = eSibyll23; + if (test == eSibyll23) return 0; + return 0; + } + " + HAS_SIBYLL23 + ) + CHECK_CXX_SOURCE_COMPILES ( + " + #include <conexHEModels.h> + + int + main() + { + EHEModel test = eEposLHC; + if (test == eEposLHC) return 0; + return 0; + } + " + HAS_EPOS_LHC + ) + CHECK_CXX_SOURCE_COMPILES ( + " + #include <ConexDynamicInterface.h> + #include <ConexDynamicInterface.cc> + int + main() + { + ConexDynamicInterface cdi(eSibyll23); + cdi.GetLeadingInteractionsParticleData(); + return 0; + } + " + HAS_LEADINGINTERACTION_INTERFACE + ) + IF (HAS_LEADINGINTERACTION_INTERFACE) + # at least conex2r5.65 + ADD_DEFINITIONS (-D_CONEX2R_VERSION=565) + IF (NOT Conex_FIND_QUIETLY) + MESSAGE (STATUS "Conex has interface to leading interactions. Set _CONEX2R_VERSION=565.") + ENDIF () + ELSEIF (HAS_SIBYLL23) + # at least conex2r5.30 + ADD_DEFINITIONS (-D_CONEX2R_VERSION=530) + IF (NOT Conex_FIND_QUIETLY) + MESSAGE (STATUS "Conex has SIBYLL2.3. Set _CONEX2R_VERSION=530.") + ENDIF () + ELSEIF (HAS_EPOS_LHC) + # at least conex2r4.36 + ADD_DEFINITIONS (-D_CONEX2R_VERSION=436) + IF (NOT Conex_FIND_QUIETLY) + MESSAGE (STATUS "Conex has EPOS-LHC. Set _CONEX2R_VERSION=436.") + ENDIF () + ELSE () + # pre LHC + ADD_DEFINITIONS (-D_CONEX2R_VERSION=300) + IF (NOT Conex_FIND_QUIETLY) + MESSAGE (STATUS "Conex is pre-LHC. Set _CONEX2R_VERSION=300.") + ENDIF () + ENDIF () +ELSE () + SET (CONEX_FOUND FALSE) + IF (Conex_FIND_REQUIRED) + MESSAGE (FATAL_ERROR "Could not find Conex!") + ENDIF () +ENDIF () diff --git a/Processes/CONEX/CMakeLists.txt b/Processes/CONEX/CMakeLists.txt new file mode 100644 index 000000000..2ddb73305 --- /dev/null +++ b/Processes/CONEX/CMakeLists.txt @@ -0,0 +1,70 @@ +set ( + MODEL_SOURCES + #${CONEX_INCLUDE_DIR}/ConexDynamicInterface.cc + CONEX.cc + ) + +set ( + MODEL_HEADERS + #ConexDynamicInterface.h + CONEX.h + ) + +set ( + MODEL_NAMESPACE + corsika/process/conex + ) + +add_library (ProcessConex STATIC ${MODEL_SOURCES}) +CORSIKA_COPY_HEADERS_TO_NAMESPACE (ProcessConex ${MODEL_NAMESPACE} ${MODEL_HEADERS}) + + +set_target_properties ( + ProcessConex + PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION 1 + ) + +# target dependencies on other libraries (also the header onlys) +target_link_libraries ( + ProcessConex + CORSIKAprocesssequence + CORSIKAparticles + CORSIKAutilities + CORSIKAunits + CORSIKAgeometry + CORSIKAenvironment + CORSIKAsetup + CORSIKArandom + CORSIKAconex + ) + +target_include_directories ( + ProcessConex + INTERFACE + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> + $<INSTALL_INTERFACE:include/include> + ) + +install ( + TARGETS ProcessConex + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + + +# -------------------- +# code unit testing + +CORSIKA_ADD_TEST(testConex + SOURCES + testConex.cc + ${MODEL_HEADERS} +) +target_link_libraries ( + testConex + ProcessConex + CORSIKAtesting + ) + diff --git a/Processes/CONEX/CONEX.cc b/Processes/CONEX/CONEX.cc new file mode 100644 index 000000000..6787dbbb6 --- /dev/null +++ b/Processes/CONEX/CONEX.cc @@ -0,0 +1,5 @@ +#include <corsika/process/conex/CONEX.h> + +using namespace corsika::process::CONEX; + +conex::conex() {} diff --git a/Processes/CONEX/CONEX.h b/Processes/CONEX/CONEX.h new file mode 100644 index 000000000..3fee04d66 --- /dev/null +++ b/Processes/CONEX/CONEX.h @@ -0,0 +1,12 @@ +#pragma once + +#include <ConexDynamicInterface.h> + +namespace corsika::process::CONEX { + +class conex{ + public: + conex(); +}; + +} diff --git a/Processes/CONEX/testConex.cc b/Processes/CONEX/testConex.cc new file mode 100644 index 000000000..21dee216d --- /dev/null +++ b/Processes/CONEX/testConex.cc @@ -0,0 +1,30 @@ +/* + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + +#include <corsika/process/conex/CONEX.h> + +#include <corsika/random/RNGManager.h> + +#include <corsika/particles/ParticleProperties.h> + +#include <corsika/geometry/Point.h> +#include <corsika/units/PhysicalUnits.h> + +#include <corsika/utl/CorsikaFenv.h> +#include <catch2/catch.hpp> + +TEST_CASE("CONEX", "[processes]") { + + SECTION("linking conex") { + using std::cout; + using std::endl; + + } +} -- GitLab