Skip to content

Commit

Permalink
Merge branch 'master' into 'gcc15gentoo'
Browse files Browse the repository at this point in the history
# Conflicts:
#   .gitlab-ci.yml
#   CMakeLists.txt
#   examples/Pythia6Example/main63.f
Andrii Verbytskyi committed Jan 10, 2025
2 parents b772942 + 7c7f4e5 commit fb87103
Showing 12 changed files with 64 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variables:
DOCKER_DRIVER: overlay2
STANDARDFLAGS: -DHEPMC3_TEST_VALGRIND=ON -DHEPMC3_ENABLE_PROTOBUFIO:BOOL=ON -DHEPMC3_ENABLE_ROOTIO:BOOL=ON -DHEPMC3_BUILD_EXAMPLES:BOOL=ON -DHEPMC3_ENABLE_TEST:BOOL=ON -DHEPMC3_TEST_VALGRIND:BOOL=ON -DHEPMC3_ENABLE_PYTHON:BOOL=ON -DHEPMC3_INSTALL_INTERFACES:BOOL=ON -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DHEPMC3_BUILD_DOCS:BOOL=ON
STANDARDFLAGS: -DHEPMC3_TEST_VALGRIND=ON -DHEPMC3_ENABLE_PROTOBUFIO:BOOL=ON -DHEPMC3_ENABLE_ROOTIO:BOOL=ON -DHEPMC3_BUILD_EXAMPLES:BOOL=ON -DHEPMC3_ENABLE_TEST:BOOL=ON -DHEPMC3_TEST_VALGRIND:BOOL=ON -DHEPMC3_ENABLE_PYTHON:BOOL=ON -DHEPMC3_INSTALL_INTERFACES:BOOL=ON -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DHEPMC3_BUILD_DOCS:BOOL=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
#-DCMAKE_CXX_FLAGS="-Wpedantic -Wall -Wextra"
stages:
- check_if_dockerfile_updated
@@ -349,7 +349,7 @@ Fedora38-GNU:
- job: build_image_Fedora38

Fedora37-LLVM:
variables: { OS: Fedora, FREL: 37, TOOLSET: LLVM, EXTRACMAKEFLAGS: }
variables: { OS: Fedora, FREL: 37, TOOLSET: LLVM, EXTRACMAKEFLAGS: -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF}
extends: .any-cmake
needs:
- job: build_image_Fedora37
@@ -367,7 +367,7 @@ Fedora34-GNU:
- job: build_image_Fedora34

Fedora34-LLVM:
variables: { OS: Fedora, FREL: 34, TOOLSET: LLVM, EXTRACMAKEFLAGS: }
variables: { OS: Fedora, FREL: 34, TOOLSET: LLVM, EXTRACMAKEFLAGS: -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF}
extends: .any-cmake
needs:
- job: build_image_Fedora34
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -186,8 +186,8 @@ set(PGI_CXX_FLAGS_TO_CHECK "-Wc,--pending_instantiations=0;-noswitcherror;--diag
set(NVHPC_CXX_FLAGS_TO_CHECK "-Wc,--pending_instantiations=0;-noswitcherror;--diag_suppress=code_is_unreachable;--diag_suppress=offset_in_non_POD_nonstandard;--diag_suppress=set_but_not_used")
set(Intel_CXX_FLAGS_TO_CHECK "-diag-disable=2196")
set(IntelLLVM_CXX_FLAGS_TO_CHECK "-diag-disable=2196;-Wno-unused-command-line-argument")
set(GNU_CXX_FLAGS_TO_CHECK "-Wlto-type-mismatch;-Werror=lto-type-mismatch;-Wzero-as-null-pointer-constant;-Wold-style-cast;-Wno-strict-aliasing;-Wno-unused-command-line-argument;-Wno-gnu-zero-variadic-macro-arguments;-Wno-deprecated-declarations")
set(Clang_CXX_FLAGS_TO_CHECK "-Wlto-type-mismatch;-Werror=lto-type-mismatch;-Wzero-as-null-pointer-constant;-Wold-style-cast;-Wno-strict-aliasing;-Wno-unused-command-line-argument;-Wno-gnu-zero-variadic-macro-arguments;-Wno-deprecated-declarations")
set(GNU_CXX_FLAGS_TO_CHECK "-Wlto-type-mismatch;-Werror=lto-type-mismatch;-Wno-old-style-cast;-Wno-strict-aliasing;-Wno-unused-command-line-argument;-Wno-gnu-zero-variadic-macro-arguments;-Wno-deprecated-declarations")
set(Clang_CXX_FLAGS_TO_CHECK "-Wlto-type-mismatch;-Werror=lto-type-mismatch;-Wno-old-style-cast;-Wno-strict-aliasing;-Wno-unused-command-line-argument;-Wno-gnu-zero-variadic-macro-arguments;-Wno-deprecated-declarations")
set(AppleClang_CXX_FLAGS_TO_CHECK "-Wno-strict-aliasing;-Wno-unused-command-line-argument;-Wno-gnu-zero-variadic-macro-arguments;-Wno-deprecated-declarations")
set(XL_CXX_FLAGS_TO_CHECK "-qsuppress=1500-030")
foreach(fl ${${CMAKE_CXX_COMPILER_ID}_CXX_FLAGS_TO_CHECK})
7 changes: 7 additions & 0 deletions examples/BasicExamples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@
#------------------
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
#
if (${CMAKE_VERSION} VERSION_GREATER "3.8")
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
endif()

#---Add executables------------------------------------------------------------
add_executable(basic_tree.exe ${CMAKE_CURRENT_SOURCE_DIR}/basic_tree.cc)
@@ -21,6 +25,9 @@ else()
if (USE_INSTALLED_HEPMC3)
install(TARGETS hepevt_wrapper_example.exe DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if (NOT "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_CXX_COMPILER_ID}")
set_target_properties(hepevt_wrapper_example.exe PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
endif()
else()
message(STATUS "HepMC3: No Fortran compiler - dissabling HepEvt example.")
endif()
12 changes: 1 addition & 11 deletions examples/BasicExamples/hepevt_wrapper_example_main.cc
Original file line number Diff line number Diff line change
@@ -15,16 +15,6 @@
* is needed to use this wrapper.
*/


/* These two define statements can be used to change HEPEVT definition.
They must be defined before including HepMC/HEPEVT_Wrapper.h
For this test, if these values were to be changed, the same changes
must be included in FORTRAN code
NOTE: default is NMXHEP=10000 and double precision */

//#define HEPMC3_HEPEVT_NMXHEP 4000
//#define HEPMC3_HEPEVT_PRECISION float
#include "HepMC3/HEPEVT_Wrapper.h"

#include <iostream>
@@ -39,7 +29,7 @@ using namespace HepMC3;
#endif
extern "C" void FC_SIMPLE_TAU_HEPEVT_EVENT(); //!< Forward declaration of function defined in hepevt_wrapper_example_fortran.f
extern "C" void FC_PHODMP(); //!< Forward declaration of function defined in hepevt_wrapper_example_fortran.f
extern "C" struct HEPEVT hepevt_; //!< Forward declaration of fortran block pointer
extern "C" struct HEPEVT_Templated_Simple<10000,double> hepevt_; //!< Forward declaration of fortran block pointer


/** @brief Add single particle to HEPEVT event */
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ if (CMAKE_Fortran_COMPILER)
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
message(STATUS "HepMC3 examples: Fortran compiler found, Pythia6 example enabled. Fortran_COMPILER_NAME=${Fortran_COMPILER_NAME} CMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}")
set(${CMAKE_Fortran_COMPILER_ID}_Fortran_FLAGS_TO_CHECK "")
set( GNU_Fortran_FLAGS_TO_CHECK "-fno-automatic -fno-backslash;-ffixed-line-length-132;-std=legacy")
set( GNU_Fortran_FLAGS_TO_CHECK "-Wno-unused-label;-Wno-conversion;-Wno-unused-parameter;-Wno-maybe-uninitialized;-Wno-unused-dummy-argument;-Wno-integer-division;-Wno-compare-reals;-Wno-function-elimination;-Wno-tabs;-Wno-unused-variable;-Wno-do-subscript;-fno-automatic;-fno-backslash;-ffixed-line-length-132;-std=legacy")
set( IntelLLVM_Fortran_FLAGS_TO_CHECK "-extend-source:132;-noauto;-extend-source 132;-diag-disable 8291;-diag-disable 7784")
set( Intel_Fortran_FLAGS_TO_CHECK "/noauto;/extend-source:132;-noauto;-extend-source 132;-diag-disable 8291;-diag-disable 7784")
set( PGI_Fortran_FLAGS_TO_CHECK "-Mpreprocess;-Mextend;-Mnosave;-Mnofree;-noswitcherror")
3 changes: 3 additions & 0 deletions examples/Pythia6Example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -16,6 +16,9 @@ if ( (USE_INSTALLED_HEPMC3 AND HEPMC3_INTERFACES_DIR) OR (NOT USE_INSTALLED_HEP
target_compile_definitions(pythia6_example.exe PRIVATE PYTHIA6HEPEVTSIZE=4000)
set_target_properties(pythia6_example.exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/outputs/${CMAKE_INSTALL_BINDIR})
set_target_properties(pythia6_example.exe PROPERTIES LINKER_LANGUAGE Fortran)
if (NOT "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_CXX_COMPILER_ID}")
set_target_properties(pythia6_example.exe PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
endif()
if (USE_INSTALLED_HEPMC3)
install(TARGETS pythia6_example.exe DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
16 changes: 10 additions & 6 deletions examples/Pythia6Example/main63.f
Original file line number Diff line number Diff line change
@@ -142,13 +142,17 @@ PROGRAM MAIN
& 1.0E9*XSEC(0,3),
& 1.0E9*XSEC(0,3)/sqrt(1.0*NGEN(0,3)),
& NGEN(0,3),0)
PDF1=1
PDF2=1
C int hepmc3_set_pdf_info_(const int & position, const int& parton_id1, const int& parton_id2, const double& x1, const double& x2, const double& scale_in, const double& xf1, const double& xf2, const int& pdf_id1, const int& pdf_id2)
C HEPMC3STATUS=hepmc3_set_pdf_info(OUTID(ICA),
C & MSTI(15),MSTI(16),PARI(33),PARI(34),PARI(23),
C & MSTP(51),MSTP(52),PDF1,PDF2)
C int hepmc3_set_pdf_info_(const int & position,
C const int& parton_id1, const int& parton_id2,
C const double& x1, const double& x2, const double& scale_in,
C const double& xf1, const double& xf2,
C const int& pdf_id1, const int& pdf_id2)
C...The values below are not always meaningful
HEPMC3STATUS=hepmc3_set_pdf_info(OUTID(ICA),
& MSTI(15),MSTI(16),
& PARI(33),PARI(34),PARI(23),
& 1.0D0, 1.0D0,
& MSTP(52),MSTP(52))
HEPMC3STATUS=hepmc3_set_attribute_int(OUTID(ICA),-1,
& 'mpi'//char(0))
HEPMC3STATUS=hepmc3_set_attribute_int(OUTID(ICA),MSUB(1),
4 changes: 4 additions & 0 deletions examples/SearchExample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@
#------------------
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
#
if (${CMAKE_VERSION} VERSION_GREATER "3.8")
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
endif()

#---Add executables------------------------------------------------------------
add_executable(search_example.exe ${CMAKE_CURRENT_SOURCE_DIR}/src/search_example.cc)
4 changes: 2 additions & 2 deletions examples/ViewerExample/src/HepMC3ViewerFrame.cc
Original file line number Diff line number Diff line change
@@ -24,10 +24,10 @@ static char* create_image_from_dot(char* m_buffer)
unsigned int length;

if (!g)
return NULL;
return nullptr;
err = gvRenderData(gvc, g, "png", &data, &length);
if (err)
return NULL;
return nullptr;
data = static_cast<char*>(realloc(data, length + 1));
gvFreeLayout(gvc, g);
agclose(g);
12 changes: 6 additions & 6 deletions include/HepMC3/Attribute.h
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ class Attribute {
public:
/** @brief Default constructor */
//Note: m_event should be set to nullptr in case event is deleted!
Attribute():m_is_parsed(true) { m_event=nullptr; }
Attribute():m_is_parsed(true) { m_event = nullptr; }

/** @brief Virtual destructor */
virtual ~Attribute() {}
@@ -63,7 +63,7 @@ class Attribute {
* @note There should be no need for user class to ever use this constructor
*/
//Note: m_event should be set to nullptr n case event is deleted!
explicit Attribute(const std::string &st):m_is_parsed(false),m_string(st) { m_event=nullptr; }
explicit Attribute(const std::string &st):m_is_parsed(false),m_string(st) { m_event = nullptr; }

/** @brief GenEvent is a friend */
friend class GenEvent;
@@ -487,7 +487,7 @@ class LongDoubleAttribute : public Attribute {

/** @brief Implementation of Attribute::from_string */
bool from_string(const std::string &att) override {
m_val = strtold( att.c_str(),NULL);
m_val = strtold( att.c_str(), nullptr);
set_is_parsed(true);
return true;
}
@@ -536,7 +536,7 @@ class UIntAttribute : public Attribute {

/** @brief Implementation of Attribute::from_string */
bool from_string(const std::string &att) override {
m_val = strtoul(att.c_str(), NULL, 0);
m_val = strtoul(att.c_str(), nullptr, 0);
set_is_parsed(true);
return true;
}
@@ -581,7 +581,7 @@ class ULongAttribute : public Attribute {

/** @brief Implementation of Attribute::from_string */
bool from_string(const std::string &att) override {
m_val = strtoul(att.c_str(), NULL, 0);
m_val = strtoul(att.c_str(), nullptr, 0);
set_is_parsed(true);
return true;
}
@@ -625,7 +625,7 @@ class ULongLongAttribute : public Attribute {

/** @brief Implementation of Attribute::from_string */
bool from_string(const std::string &att) override {
m_val = strtoull(att.c_str(), NULL, 0);
m_val = strtoull(att.c_str(), nullptr, 0);
set_is_parsed(true);
return true;
}
20 changes: 20 additions & 0 deletions include/HepMC3/HEPEVT_Helpers.h
Original file line number Diff line number Diff line change
@@ -48,6 +48,26 @@ struct HEPEVT_Templated
momentum_type vhep [max_particles][4]; //!< Time-space position: x, y, z, t
};

/** @struct HEPEVT_Templated
* @brief C structure representing Fortran common block HEPEVT
* T. Sjöstrand et al., "A proposed standard event record",
* in `Z physics at LEP 1', eds. G. Altarelli, R. Kleiss and C. Verzegnassi,
* Geneva, Switzerland, September 4-5, 1989, CERN 89-08 (Geneva, 1989), Vol. 3, p. 327
* Disk representation is given by Fortran WRITE/READ format.
*/
template <int max_particles, typename momentum_type = double>
struct HEPEVT_Templated_Simple
{
int nevhep; //!< Event number
int nhep; //!< Number of entries in the event
int isthep[max_particles]; //!< Status code
int idhep [max_particles]; //!< PDG ID
int jmohep[max_particles*2]; //!< Position of 1st and 2nd (or last!) mother
int jdahep[max_particles*2]; //!< Position of 1nd and 2nd (or last!) daughter
momentum_type phep [max_particles*5]; //!< Momentum: px, py, pz, e, m
momentum_type vhep [max_particles*4]; //!< Time-space position: x, y, z, t
};

/** @struct HEPEVT_Pointers
* @brief C structure representing Fortran common block HEPEVT
* T. Sjöstrand et al., "A proposed standard event record",
6 changes: 5 additions & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,7 +2,11 @@
#Should be fixed
cmake_minimum_required(VERSION 3.5.0)
if(${CMAKE_VERSION} VERSION_LESS "3.14.00")
SET_PROPERTY (GLOBAL PROPERTY CMAKE_ROLE "PROJECT")
SET_PROPERTY (GLOBAL PROPERTY CMAKE_ROLE "PROJECT")
endif()
if (${CMAKE_VERSION} VERSION_GREATER "3.8")
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
endif()
set(CMAKE_VERBOSE_MAKEFILE ON)

0 comments on commit fb87103

Please sign in to comment.