SST  12.0.1
StructuralSimulationToolkit
constant.h
1 // Copyright 2009-2022 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2022, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_RNG_CONSTANT_H
13 #define SST_CORE_RNG_CONSTANT_H
14 
15 #include "distrib.h"
16 #include "math.h"
17 
18 using namespace SST::RNG;
19 
20 namespace SST {
21 namespace RNG {
22 
23 /**
24  \class ConstantDistribution constant.h "sst/core/rng/constant.h"
25 
26  Implements a distribution which always returns a constant value (provided by the user). This
27  can be used in situations where the user may not want to apply a distribution.
28 */
30 {
31 
32 public:
33  /**
34  Creates a constant distribution which returns a constant value.
35  \param v Is the constant value the user wants returned by the distribution
36  */
37  ConstantDistribution(double v) : RandomDistribution() { mean = v; }
38 
39  /**
40  Destroys the constant distribution
41  */
43 
44  /**
45  Gets the next double for the distribution, in this case it will return the constant
46  value specified by the user
47  \return Constant value specified by the user when creating the class
48  */
49  double getNextDouble() { return mean; }
50 
51  /**
52  Gets the constant value for the distribution
53  \return Constant value specified by the user when creating the class
54  */
55  double getMean() { return mean; }
56 
57 protected:
58  /**
59  Describes the constant value to return from the distribution.
60  */
61  double mean;
62 };
63 
65 
66 } // namespace RNG
67 } // namespace SST
68 
69 #endif // SST_CORE_RNG_CONSTANT_H
double mean
Describes the constant value to return from the distribution.
Definition: constant.h:61
double getNextDouble()
Gets the next double for the distribution, in this case it will return the constant value specified b...
Definition: constant.h:49
double getMean()
Gets the constant value for the distribution.
Definition: constant.h:55
~ConstantDistribution()
Destroys the constant distribution.
Definition: constant.h:42
Base class of statistical distributions in SST.
Definition: distrib.h:22
Implements a distribution which always returns a constant value (provided by the user).
Definition: constant.h:29
ConstantDistribution(double v)
Creates a constant distribution which returns a constant value.
Definition: constant.h:37