Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:11:00

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/optical/MaterialData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "corecel/grid/NonuniformGridData.hh"
0013 #include "celeritas/Types.hh"
0014 
0015 #include "Types.hh"
0016 
0017 namespace celeritas
0018 {
0019 namespace optical
0020 {
0021 //---------------------------------------------------------------------------//
0022 /*!
0023  * Shared optical material properties.
0024  */
0025 template<Ownership W, MemSpace M>
0026 struct MaterialParamsData
0027 {
0028     template<class T>
0029     using Items = Collection<T, W, M>;
0030     template<class T>
0031     using OpticalMaterialItems = Collection<T, W, M, OptMatId>;
0032     template<class T>
0033     using VolumeItems = celeritas::Collection<T, W, M, VolumeId>;
0034 
0035     //// MEMBER DATA ////
0036 
0037     OpticalMaterialItems<NonuniformGridRecord> refractive_index;
0038     VolumeItems<OptMatId> optical_id;
0039     OpticalMaterialItems<PhysMatId> core_material_id;
0040 
0041     // Backend data
0042     Items<real_type> reals;
0043 
0044     //// MEMBER FUNCTIONS ////
0045 
0046     //! Whether all data are assigned and valid
0047     explicit CELER_FUNCTION operator bool() const
0048     {
0049         return !refractive_index.empty() && !optical_id.empty()
0050                && !core_material_id.empty() && !reals.empty();
0051     }
0052 
0053     //! Assign from another set of data
0054     template<Ownership W2, MemSpace M2>
0055     MaterialParamsData& operator=(MaterialParamsData<W2, M2> const& other)
0056     {
0057         CELER_EXPECT(other);
0058         refractive_index = other.refractive_index;
0059         optical_id = other.optical_id;
0060         core_material_id = other.core_material_id;
0061         reals = other.reals;
0062         return *this;
0063     }
0064 };
0065 
0066 //---------------------------------------------------------------------------//
0067 }  // namespace optical
0068 }  // namespace celeritas