Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 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/optical/MaterialData.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Macros.hh"
0011 #include "corecel/Types.hh"
0012 #include "corecel/data/Collection.hh"
0013 #include "celeritas/Types.hh"
0014 #include "celeritas/grid/GenericGridData.hh"
0015 
0016 #include "Types.hh"
0017 
0018 namespace celeritas
0019 {
0020 namespace optical
0021 {
0022 //---------------------------------------------------------------------------//
0023 /*!
0024  * Shared optical material properties.
0025  */
0026 template<Ownership W, MemSpace M>
0027 struct MaterialParamsData
0028 {
0029     template<class T>
0030     using Items = Collection<T, W, M>;
0031     template<class T>
0032     using OpticalMaterialItems = Collection<T, W, M, OpticalMaterialId>;
0033     template<class T>
0034     using VolumeItems = celeritas::Collection<T, W, M, VolumeId>;
0035 
0036     //// MEMBER DATA ////
0037 
0038     OpticalMaterialItems<GenericGridRecord> refractive_index;
0039     VolumeItems<OpticalMaterialId> optical_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                && !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         reals = other.reals;
0061         return *this;
0062     }
0063 };
0064 
0065 //---------------------------------------------------------------------------//
0066 }  // namespace optical
0067 }  // namespace celeritas