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/UniverseInserter.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Types.hh"
0011 #include "corecel/cont/EnumArray.hh"
0012 #include "corecel/data/CollectionBuilder.hh"
0013 #include "corecel/io/Label.hh"
0014 
0015 #include "../OrangeData.hh"
0016 #include "../OrangeTypes.hh"
0017 
0018 namespace celeritas
0019 {
0020 namespace detail
0021 {
0022 //---------------------------------------------------------------------------//
0023 /*!
0024  * Construct a universe entry.
0025  */
0026 class UniverseInserter
0027 {
0028   public:
0029     //!@{
0030     //! \name Type aliases
0031     using Data = HostVal<OrangeParamsData>;
0032     using VecLabel = std::vector<Label>;
0033     //!@}
0034 
0035   public:
0036     // Construct from full parameter data
0037     UniverseInserter(VecLabel* universe_labels,
0038                      VecLabel* surface_labels,
0039                      VecLabel* volume_labels,
0040                      Data* data);
0041 
0042     // Append the number of local surfaces and volumes
0043     UniverseId operator()(UniverseType type,
0044                           Label univ_label,
0045                           VecLabel surface_labels,
0046                           VecLabel volume_labels);
0047 
0048   private:
0049     VecLabel* universe_labels_;
0050     VecLabel* surface_labels_;
0051     VecLabel* volume_labels_;
0052 
0053     CollectionBuilder<UniverseType, MemSpace::host, UniverseId> types_;
0054     CollectionBuilder<size_type, MemSpace::host, UniverseId> indices_;
0055     CollectionBuilder<size_type> surfaces_;
0056     CollectionBuilder<size_type> volumes_;
0057 
0058     EnumArray<UniverseType, size_type> num_universe_types_{};
0059     size_type accum_surface_{0};
0060     size_type accum_volume_{0};
0061 };
0062 
0063 //---------------------------------------------------------------------------//
0064 }  // namespace detail
0065 }  // namespace celeritas