Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-10 10:05:44

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/ElementCdfCalculator.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/cont/Span.hh"
0010 #include "celeritas/inp/Grid.hh"
0011 #include "celeritas/mat/MaterialData.hh"
0012 #include "celeritas/phys/Model.hh"
0013 
0014 namespace celeritas
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Calculate the microscopic cross section CDF table for a material.
0019  *
0020  * The CDF is used to sample an element from a material for a discrete
0021  * interaction. It's computed for each energy bin across all constituent
0022  * elements.
0023  */
0024 class ElementCdfCalculator
0025 {
0026   public:
0027     //!@{
0028     //! \name Type aliases
0029     using SpanConstElement = Span<MatElementComponent const>;
0030     using XsTable = Model::XsTable;
0031     //!@}
0032 
0033   public:
0034     // Construct from elements in a material
0035     explicit ElementCdfCalculator(SpanConstElement elements);
0036 
0037     // Calculate the CDF in place from the microscopic cross sections
0038     void operator()(XsTable& grids);
0039 
0040   private:
0041     SpanConstElement elements_;
0042 };
0043 
0044 //---------------------------------------------------------------------------//
0045 }  // namespace celeritas