Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-10 10:05:50

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/phys/SurfacePhysicsMapData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/data/Collection.hh"
0010 
0011 #include "SurfaceModel.hh"
0012 
0013 namespace celeritas
0014 {
0015 //---------------------------------------------------------------------------//
0016 /*!
0017  * Device-compatible map between surface+layer IDs and actions/indices.
0018  *
0019  * One or more instances of these should be stored as member data inside a
0020  * downstream ParamsData class. For instance, optical surface physics will have
0021  * one map for roughness, one for reflectivity, and one for interaction.
0022  *
0023  * \todo support for layers
0024  * \todo generalize to other ID types/subtypes and use for volumetric physics
0025  * to eliminate some of the complexity?
0026  */
0027 template<Ownership W, MemSpace M>
0028 struct SurfacePhysicsMapData
0029 {
0030     //// TYPES ////
0031 
0032     using SurfaceLayer = SurfaceModel::SurfaceLayer;
0033     using ModelSurfaceId = SurfaceModel::ModelSurfaceId;
0034     template<class T>
0035     using SurfaceItems = Collection<T, W, M, SurfaceId>;
0036 
0037     //// DATA ////
0038 
0039     SurfaceItems<ActionId> action_ids;
0040     SurfaceItems<ModelSurfaceId> model_surface_ids;
0041 
0042     //// METHODS ////
0043 
0044     //! True if assigned
0045     explicit CELER_FUNCTION operator bool() const
0046     {
0047         return !action_ids.empty()
0048                && action_ids.size() == model_surface_ids.size();
0049     }
0050 
0051     //! Assign from another set of data
0052     template<Ownership W2, MemSpace M2>
0053     SurfacePhysicsMapData& operator=(SurfacePhysicsMapData<W2, M2> const& other)
0054     {
0055         CELER_EXPECT(other);
0056 
0057         action_ids = other.action_ids;
0058         model_surface_ids = other.model_surface_ids;
0059         return *this;
0060     }
0061 };
0062 
0063 //---------------------------------------------------------------------------//
0064 }  // namespace celeritas