![]() |
|
|||
File indexing completed on 2025-09-15 08:54:42
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/ext/Convert.root.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <TLeaf.h> 0010 0011 #include "corecel/Macros.hh" 0012 0013 namespace celeritas 0014 { 0015 //---------------------------------------------------------------------------// 0016 // FREE FUNCTIONS 0017 //---------------------------------------------------------------------------// 0018 /*! 0019 * Fetch single-dimension leaves. 0020 */ 0021 template<class T> 0022 inline auto from_leaf(TLeaf const& leaf) -> T 0023 { 0024 CELER_EXPECT(!leaf.IsZombie()); 0025 return static_cast<T>(leaf.GetValue()); 0026 } 0027 0028 //---------------------------------------------------------------------------// 0029 /*! 0030 * Fetch leaves containing `std::array<double, 3>`. 0031 */ 0032 inline Real3 from_array_leaf(TLeaf const& leaf) 0033 { 0034 CELER_EXPECT(!leaf.IsZombie()); 0035 CELER_ASSERT(leaf.GetLen() == 3); 0036 return {static_cast<real_type>(leaf.GetValue(0)), 0037 static_cast<real_type>(leaf.GetValue(1)), 0038 static_cast<real_type>(leaf.GetValue(2))}; 0039 } 0040 0041 //---------------------------------------------------------------------------// 0042 } // 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 |
![]() ![]() |