Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-26 09:34:34

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 corecel/inp/Distributions.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Types.hh"
0010 #include "corecel/cont/Array.hh"
0011 #include "corecel/math/NumericLimits.hh"
0012 
0013 namespace celeritas
0014 {
0015 namespace inp
0016 {
0017 //---------------------------------------------------------------------------//
0018 //! Sample from a truncated distribution
0019 template<class Distribution>
0020 struct TruncatedDistribution
0021 {
0022     Distribution distribution{};
0023     double lower{-numeric_limits<double>::infinity()};
0024     double upper{numeric_limits<double>::infinity()};
0025 };
0026 
0027 //---------------------------------------------------------------------------//
0028 //! "Sample" the given value
0029 template<class T>
0030 struct DeltaDistribution
0031 {
0032     T value{};
0033 };
0034 
0035 //---------------------------------------------------------------------------//
0036 //! Sample from a Gaussian (normal) distribution
0037 struct NormalDistribution
0038 {
0039     double mean{0};
0040     double stddev{1};
0041 };
0042 
0043 //---------------------------------------------------------------------------//
0044 //! Sample a point uniformly on the surface of a unit sphere
0045 struct IsotropicDistribution
0046 {
0047 };
0048 
0049 //---------------------------------------------------------------------------//
0050 //! Sample uniformly in a box
0051 struct UniformBoxDistribution
0052 {
0053     using Real3 = Array<double, 3>;
0054 
0055     Real3 lower{0, 0, 0};
0056     Real3 upper{0, 0, 0};
0057 };
0058 
0059 //---------------------------------------------------------------------------//
0060 }  // namespace inp
0061 }  // namespace celeritas