Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
718d665
removed workflows for this complete seperate branch
JanNiklasB Apr 3, 2026
efb8c8b
Merge remote-tracking branch 'origin/CPP23CRPropa' into CRRW_CRPropa
JanNiklasB Apr 4, 2026
cee805c
replaced AssocVector..h with unordered_map
JanNiklasB Apr 4, 2026
17bfae7
replaced Clock with chrono
JanNiklasB Apr 4, 2026
63e1a05
Replaced Referenced class with shared_ptr
JanNiklasB Apr 5, 2026
50e27cb
wrapped bare new calls in shared_ptr
JanNiklasB Apr 5, 2026
7de1e3a
reworked memory in tests
JanNiklasB Apr 5, 2026
7075b4f
replaced pointer with ref_ptr
JanNiklasB Apr 5, 2026
fed3880
bugfix
JanNiklasB Apr 5, 2026
6fff4e0
added virtual destructors for base classes
JanNiklasB Apr 5, 2026
9871af2
added overloads for raw pointer to every function
JanNiklasB Apr 6, 2026
52e2b2a
added operator== to ref_ptr
JanNiklasB Apr 6, 2026
d248a39
bugfix
JanNiklasB Apr 6, 2026
a0c3da6
removed _ptr from ref_ptr
JanNiklasB Apr 7, 2026
7c6f7eb
reverted tests and fixed tabs
JanNiklasB Apr 7, 2026
0bdfe9b
changed occurences of stack pointer to references
JanNiklasB Apr 7, 2026
30e7021
added _raw_ptr only for stack pointer reference
JanNiklasB Apr 7, 2026
9cb2cad
small bugfix, still encountering double frees
JanNiklasB Apr 7, 2026
a670578
added get_shared functions and changed 0 to NULL
JanNiklasB Apr 7, 2026
1a69f4e
added clone tests
JanNiklasB Apr 7, 2026
841c9cf
removed .get() functions where they don't belong
JanNiklasB Apr 7, 2026
118840c
fixed emission call behaviour
JanNiklasB Apr 7, 2026
6fd8e84
reimplemented workflows
JanNiklasB Apr 7, 2026
61bf8b5
fixed wrong indents
JanNiklasB Apr 7, 2026
4f5d0bb
removed raw pointer overloads
JanNiklasB Apr 7, 2026
fbc9ed7
added --output-on-failure to ctests
JanNiklasB Apr 7, 2026
bd67452
switched operator== to operator T*
JanNiklasB Apr 7, 2026
4c16b51
added shared_ptr to some classes, most derived still missing
JanNiklasB Apr 7, 2026
f50b43b
attempted fix for Vector3 python issue
JanNiklasB Apr 9, 2026
dfa4c92
Merge remote-tracking branch 'origin/master' into ReferencedClassRemoval
JanNiklasB Apr 17, 2026
345d55a
Merge remote-tracking branch 'MASTER/master' into ReferencedClassRemoval
JanNiklasB May 7, 2026
9508933
changed <> back to ""
JanNiklasB May 7, 2026
d965f5a
reversed other changed that were not needed
JanNiklasB May 7, 2026
fd21a47
Attempt to fix "will be initialized after" warnings
JanNiklasB May 11, 2026
8beacb3
reverted back workflows
JanNiklasB May 11, 2026
74a35dc
Resolved issue encountered in the ubuntu workflows
JanNiklasB May 11, 2026
a6b10a0
Added weights to calculation of avg energy
JanNiklasB May 12, 2026
c49f021
Merge remote-tracking branch 'CRPropa/CRPropa3/master' into Reference…
JanNiklasB May 26, 2026
39927d2
Merge remote-tracking branch 'CRPropa3/master' into ReferencedClassRe…
JanNiklasB Jun 22, 2026
1b6880f
Merge remote-tracking branch 'GDMarco/PositionDependentPhotonFieldOpt…
JanNiklasB Jun 22, 2026
cc61f33
changed `operator =` argument to `nullptr_t`
JanNiklasB Jun 22, 2026
44b314e
added instructions for plugin compability with older CRPropa Versions
JanNiklasB Jun 22, 2026
99849b2
replaced Version.h by configurable Version.h.in to define new CRPROPA…
JanNiklasB Jun 22, 2026
273a0d4
included crprop/Version.h in module so user have immidiate acces to i…
JanNiklasB Jun 24, 2026
622295a
Merge remote-tracking branch 'CRPropa3/master' into ReferencedClassRe…
JanNiklasB Jul 13, 2026
fa3bd7c
updated plugin to now removed `Referenced` class
JanNiklasB Jul 13, 2026
d03144c
Added changes to CHANGELOG.md
JanNiklasB Jul 13, 2026
8f2694e
reverted unintended changes
JanNiklasB Jul 13, 2026
ca30769
reversed meaningless changes in tests and corrected error in CMakeLis…
JanNiklasB Jul 13, 2026
e85204c
added venv install to old-crpropa tests
JanNiklasB Jul 13, 2026
bf8157c
fix not working tests by activating python venv in every step
JanNiklasB Jul 13, 2026
a95e7ca
fixed plugin not finding crpropa in venv and _crpropa.so not finding …
JanNiklasB Jul 13, 2026
1825f3d
fixing plugin tests (#5)
JanNiklasB Jul 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
243 changes: 232 additions & 11 deletions .github/workflows/testing_plugin-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
sudo apt-get update
sudo apt-get install libmuparser-dev python-dev-is-python3 libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov
pip install numpy
- name: Set up the build
- name: Configure Plugin
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
Expand All @@ -48,8 +48,8 @@ jobs:
cd plugin-template
mkdir build
cd build
cmake .. -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none" -DUSE_OWN_CRPROPA=ON
- name: Build CRPropa
cmake .. -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none" -DUSE_OWN_CRPROPA=On
- name: Build Plugin
run: |
cd plugin-template/build
make
Expand All @@ -63,6 +63,75 @@ jobs:
with:
name: "test-report_${{matrix.config.os}}"
path: plugin-template/build/Testing/Temporary/LastTest.log
x64-old-crpropa:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-24"
os: ubuntu-24.04
cxx: "g++-14"
cc: "gcc-14"
fc: "gfortran-14"
swig_builtin: "On"
py: "/usr/bin/python3"
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: "3.3"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the logic correctly, this will test the old CRPropa version 3.3 with the plugin template at this point, not the new plugin with your compatibility check.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, somehow I did not think about this, but yes the plugin template is also set to 3.3 .
Pulling the 3.3 repository manually and installing it should fix it.

repository: "CRPropa/CRPropa3"
- name: Preinstall
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev python3-venv python-dev-is-python3 libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov
python -m venv $GITHUB_WORKSPACE/venv
source $GITHUB_WORKSPACE/venv/bin/activate
python -m pip install --upgrade pip
pip install numpy
- name: Install CRPropa
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/venv -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none"
make -j
make install
- name: Configure Plugin
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/venv/lib
cd plugin-template
mkdir build
cd build
cmake .. -DCRPropa_INSTALL_PREFIX=$GITHUB_WORKSPACE/venv -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none" -DUSE_OWN_CRPROPA=Off
- name: Build Plugin
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/venv/lib
cd plugin-template/build
make
- name: Run tests
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/venv/lib
cd plugin-template/build
ctest --output-on-failure --repeat until-pass:3
- name: Archive test results
if: always()
uses: actions/upload-artifact@v7
with:
name: "test-report_${{matrix.config.os}}-old-crpropa"
path: plugin-template/build/Testing/Temporary/LastTest.log
arm:
runs-on: ${{ matrix.config.os }}
strategy:
Expand All @@ -85,7 +154,7 @@ jobs:
sudo apt-get install libmuparser-dev python-dev-is-python3 libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov
pip install numpy
pip show numpy
- name: Set up the build
- name: Configure Plugin
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
Expand All @@ -94,8 +163,8 @@ jobs:
cd plugin-template
mkdir build
cd build
cmake .. -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none" -DUSE_OWN_CRPROPA=ON
- name: Build CRPropa
cmake .. -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none" -DUSE_OWN_CRPROPA=On
- name: Build Plugin
run: |
cd plugin-template/build
make
Expand All @@ -109,7 +178,76 @@ jobs:
with:
name: "test-report_${{matrix.config.os}}"
path: plugin-template/build/Testing/Temporary/LastTest.log

arm-old-crpropa:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-24"
os: ubuntu-24.04-arm
cxx: "g++-14"
cc: "gcc-14"
fc: "gfortran-14"
swig_builtin: "On"
py: "/usr/bin/python3"
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: "3.3"
repository: "CRPropa/CRPropa3"
- name: Preinstall
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev python3-venv python-dev-is-python3 libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov
python -m venv $GITHUB_WORKSPACE/venv
source $GITHUB_WORKSPACE/venv/bin/activate
python -m pip install --upgrade pip
pip install numpy
pip show numpy
- name: Install CRPropa
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/venv -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none"
make -j
make install
- name: Configure Plugin
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/venv/lib
cd plugin-template
mkdir build
cd build
cmake .. -DCRPropa_INSTALL_PREFIX=$GITHUB_WORKSPACE/venv -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none" -DUSE_OWN_CRPROPA=Off
- name: Build Plugin
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/venv/lib
cd plugin-template/build
make
- name: Run tests
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/venv/lib
cd plugin-template/build
ctest --output-on-failure --repeat until-pass:3
- name: Archive test results
if: always()
uses: actions/upload-artifact@v7
with:
name: "test-report_${{matrix.config.os}}-old-crpropa"
path: plugin-template/build/Testing/Temporary/LastTest.log
mac:
runs-on: ${{ matrix.config.os }}
strategy:
Expand All @@ -130,11 +268,11 @@ jobs:
run: |
brew install hdf5 fftw cfitsio muparser libomp swig
python3 -m venv venv
source venv/bin/activate
source $GITHUB_WORKSPACE/venv/bin/activate
python -m pip install --upgrade pip
pip install numpy cmake
pip show numpy # cross-check numpy version for Python_NumPy_INCLUDE_DIR
- name: Set up the build
- name: Configure Plugin
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
Expand All @@ -152,9 +290,9 @@ jobs:
-DENABLE_TESTING=On \
-DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} \
-DPython_INSTALL_PACKAGE_DIR=$GITHUB_WORKSPACE/venv/lib/python3.14/site-packages \
-DUSE_OWN_CRPROPA=ON
-DUSE_OWN_CRPROPA=On

- name: Build CRPropa
- name: Build Plugin
run: |
cd plugin-template/build
make
Expand All @@ -170,3 +308,86 @@ jobs:
with:
name: "test-report_${{matrix.config.name}}"
path: plugin-template/build/Testing/Temporary/LastTest.log
mac-old-crpropa:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "macos-14"
os: macos-14
cxx: "clang++"
cc: "clang"
fc: "gfortran-14"
swig_builtin: "On" #uses swig 4.0.2
py: "/usr/bin/python3" # python 3.14
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: "3.3"
repository: "CRPropa/CRPropa3"
- name: Preinstall
run: |
brew install hdf5 fftw cfitsio muparser libomp swig
python -m venv $GITHUB_WORKSPACE/venv
source $GITHUB_WORKSPACE/venv/bin/activate
python -m pip install --upgrade pip
pip install numpy cmake
pip show numpy # cross-check numpy version for Python_NumPy_INCLUDE_DIR
- name: Install CRPropa
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
CRPROPA_DATA_PATH: "/Users/runner/work/CRPropa3/CRPropa3/build/data"
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/venv \
-DENABLE_PYTHON=True \
-DPython_EXECUTABLE=$GITHUB_WORKSPACE/venv/bin/python \
-DENABLE_TESTING=On \
-DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} \
-DPython_INSTALL_PACKAGE_DIR=$GITHUB_WORKSPACE/venv/lib/python3.14/site-packages
make -j
make install
- name: Configure Plugin
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
CRPROPA_DATA_PATH: "/Users/runner/work/CRPropa3/CRPropa3/build/data"
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
cd plugin-template
mkdir build
cd build

cmake .. \
-DCRPropa_INSTALL_PREFIX=$GITHUB_WORKSPACE/venv \
-DENABLE_PYTHON=True \
-DENABLE_TESTING=On \
-DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} \
-DUSE_OWN_CRPROPA=Off

- name: Build Plugin
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
cd plugin-template/build
make
- name: Run tests
env:
CRPROPA_DATA_PATH: "/Users/runner/work/CRPropa3/CRPropa3/plugin-template/build/data"
run: |
source $GITHUB_WORKSPACE/venv/bin/activate
cd plugin-template/build
ctest --output-on-failure --repeat until-pass:3
- name: Archive test results
if: always()
uses: actions/upload-artifact@v7
with:
name: "test-report_${{matrix.config.name}}-old-crpropa"
path: plugin-template/build/Testing/Temporary/LastTest.log
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ install/
lib/
share/
doc/api/
.vscode/

!final_doc/
!conda-bld/build.sh
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
## CRPropa vNext

### Bug fixes:
* Double free error can no be prevented by handing over stack objects as reference to `ref_ptr<T>` instead as pointer

### New features:

### Interface changes:
* `Module::process(Candidate* cand)` removed, now `Module::process(ref_ptr<Candidate> cand)` needs to be overriden instead
* Stack objects now need to be handed over as reference not as pointer to `ref_ptr<T>`

### Features that are deprecated and will be removed after this release

### Removed features
* `Referenced` class removed, `ref_ptr<T>` now reference counts over `std:shared_ptr<T>`
* `Module::process(Candidate* cand)` removed, now `Module::process(ref_ptr<Candidate> cand)` needs to be overriden instead. This breaks most plugins, see [Plugin Readme](plugin-template/README.md#compability-with-older-crpropa-versions) for an easy fix.
* Removed `Clock.h` (can be replaced with `std::chrono::high_resolution_clock` from `chrono.h`)
* Removed `AssocVector.h` (can be replaced with `std::unordered_map` from `unordered_map.h`)

### New plugins and resources linked on the webpages

Expand Down
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
cmake_minimum_required(VERSION 3.14)

project(CRPropa Fortran C CXX)
project(CRPropa VERSION 3.3.0 LANGUAGES Fortran C CXX)
set(CRPROPA_RELEASE_VERSION 3.3.0+) # Update for new release
set(CRPROPA_DATAFILE_VER "2026-07-08") # Version of data files

# calculate the version tag for easy in code version check
math(EXPR CRPROPA_VERSION_TAG "
${CRPropa_VERSION_MAJOR}*1000000 + ${CRPropa_VERSION_MINOR}*1000 + ${CRPropa_VERSION_PATCH}
")
# if pre release version add one to CRPROPA_VERSION_TAG
if(${CRPROPA_RELEASE_VERSION} MATCHES "[\+]$")
math(EXPR CRPROPA_VERSION_TAG "${CRPROPA_VERSION_TAG} + 1")
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

Expand Down Expand Up @@ -321,7 +330,6 @@ include_directories(include ${CRPROPA_EXTRA_INCLUDES})
add_library(crpropa SHARED
${CMAKE_CURRENT_SOURCE_DIR}/src/base64.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Candidate.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Clock.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Cosmology.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/EmissionMap.cpp
Expand Down Expand Up @@ -530,8 +538,13 @@ if(ENABLE_PYTHON AND Python_FOUND)
set_target_properties(crpropa-swig PROPERTIES
BUILD_RPATH "$<TARGET_FILE_DIR:crpropa>"
INSTALL_RPATH "@loader_path;${CMAKE_INSTALL_FULL_LIBDIR}"
LINK_FLAGS "-flat_namespace -undefined suppress"
)
else()
set_target_properties(crpropa-swig PROPERTIES
BUILD_RPATH "$<TARGET_FILE_DIR:crpropa>"
INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}"
)
set_property(TARGET crpropa-swig APPEND PROPERTY LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)


Expand Down
Loading
Loading