Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:04

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2025 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 // Local include(s).
0009 #include "traccc/alpaka/utils/make_magnetic_field.hpp"
0010 
0011 #include "magnetic_field_types.hpp"
0012 
0013 // Project include(s).
0014 #include "traccc/definitions/primitives.hpp"
0015 #if defined(ALPAKA_ACC_GPU_CUDA_ENABLED)
0016 #include "traccc/cuda/utils/make_magnetic_field.hpp"
0017 #elif defined(ALPAKA_ACC_GPU_HIP_ENABLED)
0018 //
0019 #elif defined(ALPAKA_ACC_SYCL_ENABLED)
0020 #include "../utils/get_queue.hpp"
0021 #include "traccc/sycl/utils/make_magnetic_field.hpp"
0022 #endif
0023 
0024 // System include(s).
0025 #include <stdexcept>
0026 
0027 namespace traccc::alpaka {
0028 
0029 magnetic_field make_magnetic_field(const magnetic_field& bfield,
0030                                    [[maybe_unused]] const queue& queue) {
0031 #if defined(ALPAKA_ACC_GPU_CUDA_ENABLED)
0032   return traccc::cuda::make_magnetic_field(
0033       bfield, traccc::cuda::magnetic_field_storage::global_memory);
0034 #elif defined(ALPAKA_ACC_GPU_HIP_ENABLED)
0035   if (bfield.is<const_bfield_backend_t<traccc::scalar> >()) {
0036     return magnetic_field{covfie::field<const_bfield_backend_t<scalar> >{
0037         bfield.as_field<const_bfield_backend_t<traccc::scalar> >()}};
0038   } else if (bfield.is<host::inhom_bfield_backend_t<traccc::scalar> >()) {
0039     return magnetic_field{
0040         covfie::field<inhom_bfield_backend_t<traccc::scalar> >(
0041             bfield.as_field<host::inhom_bfield_backend_t<traccc::scalar> >())};
0042   } else {
0043     throw std::invalid_argument(
0044         "Unsupported storage method chosen for inhomogeneous b-field");
0045   }
0046 #elif defined(ALPAKA_ACC_SYCL_ENABLED)
0047   ::sycl::queue q(::alpaka::getNativeHandle(details::get_queue(queue)));
0048   traccc::sycl::queue_wrapper qw{&q};
0049   return traccc::sycl::make_magnetic_field(bfield, qw);
0050 #else
0051   return bfield;
0052 #endif
0053 }
0054 
0055 }  // namespace traccc::alpaka