Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:00

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/core/detail/container_buffers.hpp"
0013 #include "detray/core/detail/container_views.hpp"
0014 #include "detray/definitions/indexing.hpp"
0015 #include "detray/geometry/surface_descriptor.hpp"
0016 #include "detray/navigation/accelerators/search_window.hpp"
0017 #include "detray/utils/concepts.hpp"
0018 #include "detray/utils/grid/concepts.hpp"
0019 #include "detray/utils/ranges/ranges.hpp"
0020 
0021 // System include(s)
0022 #include <concepts>
0023 
0024 namespace detray::concepts {
0025 
0026 /// Concept for detray geometry acceleration structures
0027 template <class A>
0028 concept accelerator = requires(const A acc) {
0029   typename A::value_type;
0030   typename A::query_type;
0031 
0032   // Iterate through all contained geometry objects
0033   { acc.all() } -> ranges::range_of<typename A::value_type>;
0034 
0035   // Get the geometry objects close to the given query point
0036   {
0037     acc.search(typename A::query_type())
0038   } -> ranges::range_of<typename A::value_type>;
0039 
0040   {
0041     acc.search(typename A::query_type(), detray::search_window<dindex, 2>())
0042   } -> ranges::range_of<typename A::value_type>;
0043 
0044   // TODO: In order to require the final search method, we need to
0045   // pass a detector, which is auto-deduced...
0046 };
0047 
0048 /// Concept for a collection of accelerator (data) that can be stored in the
0049 /// detector
0050 template <class AC>
0051 concept accelerator_collection =
0052     viewable<AC> && bufferable<AC> &&
0053     requires(const AC accel_coll, unsigned int idx) {
0054       typename AC::size_type;
0055       requires concepts::accelerator<typename AC::value_type>;
0056 
0057       { accel_coll[idx] } -> concepts::accelerator;
0058     };
0059 
0060 /// Acceleration structure that contains surfaces (surface descriptors)
0061 /// TODO: Add surface descriptor concept to geometry package
0062 template <class A>
0063 concept surface_accelerator =
0064     concepts::accelerator<A> &&
0065     std::same_as<typename A::value_type,
0066                  surface_descriptor<typename A::value_type::mask_link,
0067                                     typename A::value_type::material_link,
0068                                     typename A::value_type::transform_link,
0069                                     typename A::value_type::navigation_link>>;
0070 
0071 /// Acceleration structure that contains volumes (volume indices)
0072 template <class A>
0073 concept volume_accelerator =
0074     concepts::accelerator<A> && std::same_as<typename A::value_type, dindex>;
0075 
0076 }  // namespace detray::concepts