Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-03 09:43:49

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/phys/ImportedModelAdapter.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <initializer_list>
0010 #include <memory>
0011 #include <unordered_map>
0012 #include <utility>
0013 #include <vector>
0014 
0015 #include "corecel/Assert.hh"
0016 #include "corecel/OpaqueId.hh"
0017 #include "corecel/cont/Span.hh"
0018 #include "celeritas/Quantities.hh"
0019 #include "celeritas/Types.hh"
0020 #include "celeritas/io/ImportProcess.hh"
0021 
0022 #include "Applicability.hh"
0023 #include "ImportedProcessAdapter.hh"
0024 #include "Model.hh"
0025 #include "PDGNumber.hh"
0026 
0027 namespace celeritas
0028 {
0029 class ParticleParams;
0030 
0031 //---------------------------------------------------------------------------//
0032 /*!
0033  * Construct microscopic cross section from imported physics data.
0034  */
0035 class ImportedModelAdapter
0036 {
0037   public:
0038     //!@{
0039     //! \name Type aliases
0040     using MicroXsBuilders = Model::MicroXsBuilders;
0041     using SpanConstPDG = Span<PDGNumber const>;
0042     using SPConstImported = std::shared_ptr<ImportedProcesses const>;
0043     using Energy = units::MevEnergy;
0044     using EnergyBounds = Array<Energy, 2>;
0045     //!@}
0046 
0047   public:
0048     // Construct from shared table data
0049     ImportedModelAdapter(SPConstImported imported,
0050                          ParticleParams const& particles,
0051                          ImportProcessClass process_class,
0052                          ImportModelClass model_class,
0053                          SpanConstPDG pdg_numbers);
0054 
0055     // Construct from shared table data
0056     ImportedModelAdapter(SPConstImported imported,
0057                          ParticleParams const& particles,
0058                          ImportProcessClass process_class,
0059                          ImportModelClass model_class,
0060                          std::initializer_list<PDGNumber> pdg_numbers);
0061 
0062     // Construct micro cross sections from the given particle/material type
0063     MicroXsBuilders micro_xs(Applicability range) const;
0064 
0065     // Get the xs energy grid bounds for the given material and particle
0066     EnergyBounds energy_grid_bounds(ParticleId, PhysMatId) const;
0067 
0068     // Get the low energy limit for the given particle
0069     Energy low_energy_limit(ParticleId) const;
0070 
0071     // Get the high energy limit for the given particle
0072     Energy high_energy_limit(ParticleId) const;
0073 
0074   private:
0075     //// TYPES ////
0076 
0077     using ImportProcessId = ImportedProcesses::ImportProcessId;
0078 
0079     //// DATA ////
0080 
0081     SPConstImported imported_;
0082     ImportModelClass model_class_;
0083     std::unordered_map<ParticleId, ImportProcessId> particle_to_process_;
0084 
0085     //// HELPER FUNCTIONS ////
0086 
0087     ImportModel const& get_model(ParticleId) const;
0088 };
0089 
0090 //---------------------------------------------------------------------------//
0091 }  // namespace celeritas