Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Detray Core include(s)
0012 #include "detray/core/detail/multi_store.hpp"
0013 #include "detray/core/detail/single_store.hpp"
0014 #include "detray/core/detail/tuple_container.hpp"
0015 
0016 // Vecmem include(s)
0017 #include <vecmem/containers/device_vector.hpp>
0018 
0019 namespace detray {
0020 
0021 // Single store test
0022 /// @{
0023 using single_store_t = single_store<double, vecmem::vector, geometry_context>;
0024 using single_store_dev_t =
0025     single_store<double, vecmem::device_vector, geometry_context>;
0026 /// @}
0027 
0028 // Tuple container test
0029 /// @{
0030 using tuple_cont_t = detail::tuple_container<dtuple, vecmem::vector<int>,
0031                                              vecmem::vector<double>>;
0032 using tuple_cont_dev_t =
0033     detail::tuple_container<dtuple, vecmem::device_vector<int>,
0034                             vecmem::device_vector<double>>;
0035 /// @}
0036 
0037 // Regular multi store test (uses vectors as containers in every tuple element)
0038 /// @{
0039 enum class reg_type_ids : std::uint_least8_t {
0040   e_size = 0u,
0041   e_float = 1u,
0042   e_double = 2u,
0043 };
0044 
0045 using reg_multi_store_t =
0046     regular_multi_store<reg_type_ids, empty_context, dtuple, vecmem::vector,
0047                         std::size_t, float, double>;
0048 using reg_multi_store_dev_t =
0049     regular_multi_store<reg_type_ids, empty_context, dtuple,
0050                         vecmem::device_vector, std::size_t, float, double>;
0051 /// @}
0052 
0053 /// Multi store test
0054 /// @{
0055 
0056 /// Test type that holds vecemem members and forces a hierarchical view/buffer
0057 /// treatment
0058 
0059 enum class type_ids : std::uint_least8_t {
0060   e_float = 0u,
0061   e_test_class = 1u,
0062 };
0063 
0064 template <template <typename...> class vector_t = dvector>
0065 struct test_class {
0066   using view_type = dmulti_view<dvector_view<int>, dvector_view<double>>;
0067   using const_view_type =
0068       dmulti_view<dvector_view<const int>, dvector_view<const double>>;
0069   using buffer_type =
0070       dmulti_buffer<dvector_buffer<int>, dvector_buffer<double>>;
0071 
0072   DETRAY_HOST explicit test_class(vecmem::memory_resource* mr)
0073       : first(mr), second(mr) {}
0074 
0075   template <concepts::device_view view_t>
0076   DETRAY_HOST_DEVICE explicit test_class(view_t v)
0077       : first(detail::get<0>(v.m_view)), second(detail::get<1>(v.m_view)) {}
0078 
0079   DETRAY_HOST view_type get_data() {
0080     return view_type{vecmem::get_data(first), vecmem::get_data(second)};
0081   }
0082 
0083   vector_t<int> first;
0084   vector_t<double> second;
0085 };
0086 
0087 using multi_store_t =
0088     multi_store<type_ids, empty_context, dtuple, vecmem::vector<float>,
0089                 test_class<vecmem::vector>>;
0090 using multi_store_dev_t =
0091     multi_store<type_ids, empty_context, dtuple, vecmem::device_vector<float>,
0092                 test_class<vecmem::device_vector>>;
0093 /// @}
0094 
0095 void test_single_store(typename single_store_t::view_type store_view,
0096                        vecmem::data::vector_view<double> sum_data);
0097 
0098 void test_tuple_container(typename tuple_cont_t::view_type store_view,
0099                           vecmem::data::vector_view<double> sum_data);
0100 
0101 void test_reg_multi_store(typename reg_multi_store_t::view_type store_view,
0102                           vecmem::data::vector_view<double> sum_data);
0103 
0104 void test_multi_store(typename multi_store_t::view_type store_view,
0105                       vecmem::data::vector_view<double> sum_data);
0106 
0107 }  // namespace detray