From 0814c6ef3d40ab34ec7ba769ad2bb543809599d8 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Thu, 19 Sep 2024 15:52:14 +0200 Subject: [PATCH] Allow end of world in navigator assertions --- CMakeLists.txt | 2 +- core/include/detray/navigation/navigator.hpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54905998b..d7374426f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ # Set up the project. cmake_minimum_required( VERSION 3.11 ) -project( detray VERSION 0.75.1 LANGUAGES CXX ) +project( detray VERSION 0.75.2 LANGUAGES CXX ) # Set up the used C++ standard(s). set( CMAKE_CXX_STANDARD 20 CACHE STRING "The (host) C++ standard to use" ) diff --git a/core/include/detray/navigation/navigator.hpp b/core/include/detray/navigation/navigator.hpp index 277fcf704..da4115b47 100644 --- a/core/include/detray/navigation/navigator.hpp +++ b/core/include/detray/navigation/navigator.hpp @@ -238,7 +238,8 @@ class navigator { /// Set start/new volume DETRAY_HOST_DEVICE inline void set_volume(dindex v) { - assert(v < detector().volumes().size()); + assert(detail::is_invalid_value(static_cast(v)) || + v < detector().volumes().size()); if (v != m_volume_index) { // Make sure the new volume is properly initialized set_no_trust(); @@ -694,8 +695,10 @@ class navigator { return navigation.m_heartbeat; } - assert(navigation.volume() < - navigation.detector().volumes().size()); + // Either end of world or valid volume index + assert(detail::is_invalid_value(navigation.volume()) || + navigation.volume() < + navigation.detector().volumes().size()); // Run inspection when needed (keep for debugging) // const auto &track = propagation._stepping();