|
|
|||
File indexing completed on 2026-01-10 10:11: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 geocel/SurfaceParams.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include "corecel/cont/LabelIdMultiMap.hh" 0010 #include "corecel/data/CollectionMirror.hh" 0011 #include "corecel/data/ParamsDataInterface.hh" 0012 0013 #include "SurfaceData.hh" 0014 0015 namespace celeritas 0016 { 0017 namespace inp 0018 { 0019 struct Surfaces; 0020 } 0021 class VolumeParams; 0022 0023 //---------------------------------------------------------------------------// 0024 /*! 0025 * Map volumetric geometry information to surface IDs. 0026 * 0027 * See the introduction to \rstref{the Geometry API section,api_geometry} for 0028 * a detailed description of surfaces in the detector geometry description. 0029 * 0030 * The specification of \em surfaces using \em volume relationships is required 0031 * by volume-based geometries such as Geant4 and VecGeom 1, so it is not 0032 * currently possible to define different properties for the different \em 0033 * faces of a volume unless those faces are surrounded by distinct geometric 0034 * volumes. Since ORANGE and VecGeom 2 support true surface 0035 * definitions, a future extension will allow the user to attach surface 0036 * properties to, for example, different sides of a cube. 0037 * 0038 * \internal Construction requirements: 0039 * - Volumes and instances in the surface input must be within bounds. 0040 * - Volumes are allowed to be empty if no surfaces are defined. 0041 */ 0042 class SurfaceParams final : public ParamsDataInterface<SurfaceParamsData> 0043 { 0044 public: 0045 //!@{ 0046 //! \name Type aliases 0047 using SurfaceMap = LabelIdMultiMap<SurfaceId>; 0048 //!@} 0049 0050 public: 0051 // Construct from surface input 0052 SurfaceParams(inp::Surfaces const&, VolumeParams const& volumes); 0053 0054 // Construct without building any surface data structures 0055 SurfaceParams(); 0056 0057 //// METADATA ACCESS //// 0058 0059 //! Whether any surfaces are present 0060 bool empty() const { return labels_.empty(); } 0061 0062 //! Whether surfaces are disabled for non-optical problems 0063 bool disabled() const { return this->host_ref().volume_surfaces.empty(); } 0064 0065 //! Number of surfaces 0066 SurfaceId::size_type num_surfaces() const { return labels_.size(); } 0067 0068 //! Get surface metadata 0069 SurfaceMap const& labels() const { return labels_; } 0070 0071 //// DATA ACCESS //// 0072 0073 //! Reference to CPU geometry data 0074 HostRef const& host_ref() const final { return data_.host_ref(); } 0075 0076 //! Reference to managed GPU geometry data 0077 DeviceRef const& device_ref() const final { return data_.device_ref(); } 0078 0079 private: 0080 // Host/device storage and reference 0081 CollectionMirror<SurfaceParamsData> data_; 0082 // Metadata: surface labels 0083 SurfaceMap labels_; 0084 }; 0085 0086 //---------------------------------------------------------------------------// 0087 0088 extern template class CollectionMirror<SurfaceParamsData>; 0089 extern template class ParamsDataInterface<SurfaceParamsData>; 0090 0091 //---------------------------------------------------------------------------// 0092 } // 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 |
|