![]() |
|
|||
File indexing completed on 2025-02-22 10:31:30
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2020-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/random/distribution/DeltaDistribution.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include "corecel/Types.hh" 0011 0012 namespace celeritas 0013 { 0014 //---------------------------------------------------------------------------// 0015 /*! 0016 * Distribution where the "sampled" value is just the given value. 0017 */ 0018 template<class T> 0019 class DeltaDistribution 0020 { 0021 public: 0022 //!@{ 0023 //! \name Type aliases 0024 using value_type = T; 0025 //!@} 0026 0027 public: 0028 // Constructor 0029 explicit CELER_FUNCTION DeltaDistribution(value_type value) : value_(value) 0030 { 0031 } 0032 0033 // "Sample" the value 0034 template<class Generator> 0035 CELER_FUNCTION value_type operator()(Generator&) const 0036 { 0037 return value_; 0038 } 0039 0040 private: 0041 value_type value_; 0042 }; 0043 0044 //---------------------------------------------------------------------------// 0045 } // 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 |
![]() ![]() |