Back to home page

EIC code displayed by LXR

 
 

    


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

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/io/ImportMaterial.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <map>
0011 #include <string>
0012 #include <vector>
0013 
0014 namespace celeritas
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Enum for storing G4State enumerators.
0019  */
0020 enum class ImportMaterialState
0021 {
0022     other,
0023     solid,
0024     liquid,
0025     gas,
0026     size_
0027 };
0028 
0029 //---------------------------------------------------------------------------//
0030 /*!
0031  * Particle production cutoff values: range and approximate energy.
0032  */
0033 struct ImportProductionCut
0034 {
0035     double energy{};  //!< [MeV]
0036     double range{};  //!< [length]
0037 };
0038 
0039 //---------------------------------------------------------------------------//
0040 /*!
0041  * Fractional elemental composition of a given material.
0042  */
0043 struct ImportMatElemComponent
0044 {
0045     //!@{
0046     //! \name Type aliases
0047     using ElIndex = unsigned int;
0048     //!@}
0049 
0050     ElIndex element_id{};  //!< Index of element in ImportElement
0051     double number_fraction{};  //!< [unitless]
0052 };
0053 
0054 //---------------------------------------------------------------------------//
0055 /*!
0056  * Material data as specified by a geometry model.
0057  *
0058  * These are the "real life properties" unaffected by changes to the user's
0059  * physics selection.
0060  */
0061 struct ImportGeoMaterial
0062 {
0063     //!@{
0064     //! \name Type aliases
0065     using VecComponent = std::vector<ImportMatElemComponent>;
0066     //!@}
0067 
0068     std::string name{};
0069     ImportMaterialState state{ImportMaterialState::other};
0070     double temperature{};  //!< [K]
0071     double number_density{};  //!< [1/length^3]
0072     VecComponent elements;
0073 };
0074 
0075 //---------------------------------------------------------------------------//
0076 /*!
0077  * Distinct materials as modified by physics.
0078  *
0079  * User-selected regions can alter physics properties so that the same
0080  * "geometry material" can correspond to multiple "physics materials". These
0081  * include the behavior of the material as an optical region.
0082  *
0083  * - \c geo_material_id is a geometry material corresponding to the index in
0084  *   the \c ImportData.geo_materials
0085  * - \c optical_material_id is an \em optional optical material corresponding
0086  *   to the index in the \c ImportData.optical_materials
0087  *
0088  * Geant4 requires an optical material to correspond to a single geo material,
0089  * but we may relax this restriction in the future.
0090  */
0091 struct ImportPhysMaterial
0092 {
0093     //!@{
0094     //! \name Type aliases
0095     using Index = unsigned int;
0096     using PdgInt = int;
0097     using MapIntCutoff = std::map<PdgInt, ImportProductionCut>;
0098     //!@}
0099 
0100 #ifndef SWIG
0101     static inline constexpr Index unspecified = -1;
0102 #endif
0103 
0104     Index geo_material_id{};  //!< Index in geo_materials list
0105     Index optical_material_id{unspecified};  //!< Optional index in optical mat
0106     MapIntCutoff pdg_cutoffs;  //!< Cutoff per PDG
0107 };
0108 
0109 //---------------------------------------------------------------------------//
0110 // FREE FUNCTIONS
0111 //---------------------------------------------------------------------------//
0112 
0113 // Get the string label for material state
0114 char const* to_cstring(ImportMaterialState s);
0115 
0116 //---------------------------------------------------------------------------//
0117 }  // namespace celeritas