SST  11.0.0
StructuralSimulationToolkit
constant.h
1 // Copyright 2009-2021 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-2021, 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 _H_SST_CORE_RNG_EMPTY
13 #define _H_SST_CORE_RNG_EMPTY
14 
15 #include "math.h"
16 
17 #include "distrib.h"
18 
19 using namespace SST::RNG;
20 
21 namespace SST {
22 namespace RNG {
23 
24 /**
25  \class SSTConstantDistribution constant.h "sst/core/rng/constant.h"
26 
27  Implements a distribution which always returns a constant value (provided by the user). This
28  can be used in situations where the user may not want to apply a distribution.
29 */
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  */
39  mean = v;
40  }
41 
42  /**
43  Destroys the constant distribution
44  */
46 
47  }
48 
49  /**
50  Gets the next double for the distribution, in this case it will return the constant
51  value specified by the user
52  \return Constant value specified by the user when creating the class
53  */
54  double getNextDouble() {
55  return mean;
56  }
57 
58  /**
59  Gets the constant value for the distribution
60  \return Constant value specified by the user when creating the class
61  */
62  double getMean() {
63  return mean;
64  }
65 
66  protected:
67  /**
68  Describes the constant value to return from the distribution.
69  */
70  double mean;
71 
72 };
73 
74 }
75 }
76 
77 #endif
Base class of statistical distributions in SST.
Definition: distrib.h:24
Implements a distribution which always returns a constant value (provided by the user).
Definition: constant.h:30
double getMean()
Gets the constant value for the distribution.
Definition: constant.h:62
double getNextDouble()
Gets the next double for the distribution, in this case it will return the constant value specified b...
Definition: constant.h:54
double mean
Describes the constant value to return from the distribution.
Definition: constant.h:70
~SSTConstantDistribution()
Destroys the constant distribution.
Definition: constant.h:45
SSTConstantDistribution(double v)
Creates a constant distribution which returns a constant value.
Definition: constant.h:37