Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:28

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