Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2020-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/Model.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <memory>
0011 #include <set>
0012 #include <string>  // IWYU pragma: export
0013 #include <vector>
0014 
0015 #include "corecel/Types.hh"
0016 #include "celeritas/Types.hh"
0017 #include "celeritas/global/ActionInterface.hh"  // IWYU pragma: export
0018 #include "celeritas/grid/ValueGridBuilder.hh"
0019 #include "celeritas/grid/ValueGridType.hh"
0020 
0021 #include "Applicability.hh"  // IWYU pragma: export
0022 
0023 namespace celeritas
0024 {
0025 //---------------------------------------------------------------------------//
0026 /*!
0027  * Abstract base class representing a physics model with a discrete action.
0028  *
0029  * A Model is a representation (often an approximation) to a physics process
0030  * such as Compton scattering that is valid for one or more particle types in a
0031  * given range (or ranges) of energy.
0032  *
0033  * Each Model subclass is constructed with a unique ActionId by a Process,
0034  * which is effectively a group of Models. Once constructed, it is essentially
0035  * immutable.
0036  *
0037  * The model assumes a few responsibilities:
0038  * - It provides accessors for the ranges of applicability: the same model
0039  *   (interaction kernel) can apply to multiple particles at different energy
0040  *   ranges.
0041  * - It precalculates macroscopic cross sections for each range of
0042  *   applicability.
0043  * - It precalculates energy loss rates and range limiters for each range.
0044  * - If it has an interaction cross section, it provides an "execute" method
0045  *   for applying the interaction and possibly emitting secondaries.
0046  *
0047  * This class is similar to Geant4's G4VContinuousDiscrete process, but more
0048  * limited.
0049  */
0050 class Model : public CoreStepActionInterface
0051 {
0052   public:
0053     //@{
0054     //! Type aliases
0055     using UPConstGridBuilder = std::unique_ptr<ValueGridBuilder const>;
0056     using MicroXsBuilders = std::vector<UPConstGridBuilder>;
0057     using SetApplicability = std::set<Applicability>;
0058     //@}
0059 
0060   public:
0061     //! Get the applicable particle type and energy ranges of the model
0062     virtual SetApplicability applicability() const = 0;
0063 
0064     //! Get the microscopic cross sections for the given particle and material
0065     virtual MicroXsBuilders micro_xs(Applicability range) const = 0;
0066 
0067     //! Dependency ordering of the action
0068     StepActionOrder order() const final { return StepActionOrder::post; }
0069 };
0070 
0071 //---------------------------------------------------------------------------//
0072 }  // namespace celeritas