![]() |
|
|||
File indexing completed on 2025-02-22 10:31:22
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2021-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/geo/GeoMaterialView.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include "GeoMaterialData.hh" 0011 0012 namespace celeritas 0013 { 0014 //---------------------------------------------------------------------------// 0015 /*! 0016 * Access geometry-to-material conversion. 0017 */ 0018 class GeoMaterialView 0019 { 0020 public: 0021 //!@{ 0022 //! \name Type aliases 0023 using GeoMaterialData = NativeCRef<GeoMaterialParamsData>; 0024 //!@} 0025 0026 public: 0027 // Construct from shared data 0028 inline CELER_FUNCTION GeoMaterialView(GeoMaterialData const& params); 0029 0030 // Return material for the given volume 0031 inline CELER_FUNCTION MaterialId material_id(VolumeId volume) const; 0032 0033 private: 0034 GeoMaterialData const& params_; 0035 }; 0036 0037 //---------------------------------------------------------------------------// 0038 // INLINE DEFINITIONS 0039 //---------------------------------------------------------------------------// 0040 /*! 0041 * Construct from shared data. 0042 */ 0043 CELER_FUNCTION 0044 GeoMaterialView::GeoMaterialView(GeoMaterialData const& params) 0045 : params_(params) 0046 { 0047 } 0048 0049 //---------------------------------------------------------------------------// 0050 /*! 0051 * Return material for the given volume. 0052 * 0053 * Note that this will *fail* if the particle is outside -- the volume ID will 0054 * be false. 0055 */ 0056 CELER_FUNCTION MaterialId GeoMaterialView::material_id(VolumeId volume) const 0057 { 0058 CELER_EXPECT(volume < params_.materials.size()); 0059 return params_.materials[volume]; 0060 } 0061 0062 //---------------------------------------------------------------------------// 0063 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |