![]() |
|
|||
File indexing completed on 2025-09-17 08:59:59
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/GeoVolumeFinder.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include "corecel/Config.hh" 0010 0011 #include "GeoParamsInterface.hh" 0012 0013 namespace celeritas 0014 { 0015 //---------------------------------------------------------------------------// 0016 /*! 0017 * Find a volume ID by searching for a label. 0018 * 0019 * This generally should be a fallback for looking directly from a Geant4 0020 * pointer. It will first do an exact match for the label, then do a fuzzier 0021 * search. It emits warnings for inexact matches and returns a null \c VolumeId 0022 * if not found. 0023 */ 0024 class GeoVolumeFinder 0025 { 0026 public: 0027 //!@{ 0028 //! \name Type aliases 0029 using VolumeMap = GeoParamsInterface::VolumeMap; 0030 //!@} 0031 0032 public: 0033 // Construct from an interface 0034 explicit inline GeoVolumeFinder(GeoParamsInterface const& geo); 0035 0036 // Perform search 0037 VolumeId operator()(Label const& label) const noexcept(!CELERITAS_DEBUG); 0038 0039 private: 0040 VolumeMap const& vols_; 0041 }; 0042 0043 //---------------------------------------------------------------------------// 0044 // INLINE DEFINITIONS 0045 //---------------------------------------------------------------------------// 0046 /*! 0047 * Construct from geometry volume names. 0048 */ 0049 GeoVolumeFinder::GeoVolumeFinder(GeoParamsInterface const& geo) 0050 : vols_{geo.volumes()} 0051 { 0052 } 0053 0054 //---------------------------------------------------------------------------// 0055 } // 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 |
![]() ![]() |