Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:40

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 celeritas/grid/XsGridInserter.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <utility>
0010 #include <vector>
0011 
0012 #include "corecel/Types.hh"
0013 #include "corecel/data/Collection.hh"
0014 #include "corecel/data/CollectionBuilder.hh"
0015 #include "corecel/data/DedupeCollectionBuilder.hh"
0016 #include "corecel/grid/UniformGridData.hh"
0017 #include "celeritas/Types.hh"
0018 #include "celeritas/inp/Grid.hh"
0019 
0020 #include "XsGridData.hh"
0021 
0022 namespace celeritas
0023 {
0024 //---------------------------------------------------------------------------//
0025 /*!
0026  * Manage data and help construction of physics cross section grids.
0027  */
0028 class XsGridInserter
0029 {
0030   public:
0031     //!@{
0032     //! \name Type aliases
0033     using GridId = ItemId<XsGridRecord>;
0034     using GridValues
0035         = Collection<XsGridRecord, Ownership::value, MemSpace::host>;
0036     using Values = Collection<real_type, Ownership::value, MemSpace::host>;
0037     //!@}
0038 
0039   public:
0040     // Construct with a reference to mutable host data
0041     XsGridInserter(Values* reals, GridValues* grids);
0042 
0043     // Add a grid of xs-like data
0044     GridId
0045     operator()(inp::UniformGrid const& lower, inp::UniformGrid const& upper);
0046 
0047     // Add a grid of uniform log-grid data
0048     GridId operator()(inp::UniformGrid const& grid);
0049 
0050   private:
0051     Values* values_;
0052     DedupeCollectionBuilder<real_type> reals_;
0053     CollectionBuilder<XsGridRecord, MemSpace::host, GridId> grids_;
0054 };
0055 
0056 //---------------------------------------------------------------------------//
0057 }  // namespace celeritas