Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-28 08:51:12

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file orange/detail/SurfacesRecordBuilder.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <vector>
0010 
0011 #include "corecel/Macros.hh"
0012 #include "corecel/data/Collection.hh"
0013 #include "corecel/data/CollectionBuilder.hh"
0014 #include "corecel/data/DedupeCollectionBuilder.hh"
0015 
0016 #include "../OrangeData.hh"
0017 #include "../surf/VariantSurface.hh"
0018 
0019 namespace celeritas
0020 {
0021 namespace detail
0022 {
0023 //---------------------------------------------------------------------------//
0024 /*!
0025  * Convert a vector of surfaces into type-deleted local surface data.
0026  *
0027  * The input surfaces should already be deduplicated.
0028  */
0029 class SurfacesRecordBuilder
0030 {
0031   public:
0032     //!@{
0033     //! \name Type aliases
0034     template<class T>
0035     using Items = Collection<T, Ownership::value, MemSpace::host>;
0036     using RealId = OpaqueId<real_type>;
0037     using VecSurface = std::vector<VariantSurface>;
0038     using result_type = SurfacesRecord;
0039     //!@}
0040 
0041   public:
0042     // Construct with pointers to the underlying storage
0043     SurfacesRecordBuilder(Items<SurfaceType>* types,
0044                           Items<RealId>* real_ids,
0045                           Items<real_type>* reals);
0046 
0047     // Construct a record of all the given surfaces
0048     result_type operator()(VecSurface const& surfaces);
0049 
0050   private:
0051     CollectionBuilder<SurfaceType> types_;
0052     CollectionBuilder<RealId> real_ids_;
0053     DedupeCollectionBuilder<real_type> reals_;
0054 };
0055 
0056 //---------------------------------------------------------------------------//
0057 }  // namespace detail
0058 }  // namespace celeritas