Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:55

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