Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:23:58

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 // Project include(s)
0012 #include "detray/definitions/detail/qualifiers.hpp"
0013 
0014 // System include(s)
0015 #include <cstdint>
0016 #include <ostream>
0017 
0018 namespace detray::navigation {
0019 
0020 /// @enum NavigationDirection
0021 /// The navigation direction is always with respect to a given track direction
0022 enum class direction : std::int_least8_t { e_backward = -1, e_forward = 1 };
0023 
0024 /// @enum Navigation status flags
0025 enum class status : std::int_least8_t {
0026   e_abort = -3,          ///< error occurred, navigation will be aborted
0027   e_exit = -2,           ///< navigation finished/reached the end of geometry
0028   e_unknown = -1,        ///< unknown state/not initialized
0029   e_towards_object = 0,  ///< move towards next geometry object
0030   e_on_object = 1,       ///< reached a geometry object that is not a portal
0031   e_on_portal = 2,       ///< reached portal (material) surface
0032 };
0033 
0034 /// Navigation trust levels determine how the candidates cache is updated
0035 enum class trust_level : std::uint_least8_t {
0036   e_no_trust = 0u,  ///< re-initialize the volume (i.e. run local navigation)
0037   e_fair = 1u,      ///< update the distance & order of the candidates
0038   e_high = 3u,      ///< update the dist. to the next candidate (current target)
0039   e_full = 4u       ///< don't update anything
0040 };
0041 
0042 // Print the values of an enum by identifier
0043 #define ENUM_PRINT(x) \
0044   case x:             \
0045     os << #x;         \
0046     break
0047 
0048 DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, direction d) {
0049   switch (d) {
0050     using enum direction;
0051     ENUM_PRINT(e_backward);
0052     ENUM_PRINT(e_forward);
0053   }
0054   return os;
0055 }
0056 
0057 DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, status st) {
0058   switch (st) {
0059     using enum status;
0060     ENUM_PRINT(e_abort);
0061     ENUM_PRINT(e_exit);
0062     ENUM_PRINT(e_unknown);
0063     ENUM_PRINT(e_towards_object);
0064     ENUM_PRINT(e_on_object);
0065     ENUM_PRINT(e_on_portal);
0066   }
0067   return os;
0068 }
0069 
0070 DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, trust_level d) {
0071   switch (d) {
0072     using enum trust_level;
0073     ENUM_PRINT(e_no_trust);
0074     ENUM_PRINT(e_fair);
0075     ENUM_PRINT(e_high);
0076     ENUM_PRINT(e_full);
0077   }
0078   return os;
0079 }
0080 
0081 #undef ENUM_PRINT
0082 }  // namespace detray::navigation