00001 // Copyright 2009-2015 Sandia Corporation. Under the terms 00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. 00003 // Government retains certain rights in this software. 00004 // 00005 // Copyright (c) 2009-2015, Sandia Corporation 00006 // All rights reserved. 00007 // 00008 // This file is part of the SST software package. For license 00009 // information, see the LICENSE file in the top level directory of the 00010 // distribution. 00011 00012 #ifndef _H_SST_CORE_RNG_EMPTY 00013 #define _H_SST_CORE_RNG_EMPTY 00014 00015 #include "math.h" 00016 00017 #include "distrib.h" 00018 00019 using namespace SST::RNG; 00020 00021 namespace SST { 00022 namespace RNG { 00023 00024 /** 00025 \class SSTConstantDistribution constant.h "sst/core/rng/constant.h" 00026 00027 Implements a distribution which always returns a constant value (provided by the user). This 00028 can be used in situations where the user may not want to apply a distribution. 00029 */ 00030 class SSTConstantDistribution : public SSTRandomDistribution { 00031 00032 public: 00033 /** 00034 Creates a constant distribution which returns a constant value. 00035 \param v Is the constant value the user wants returned by the distribution 00036 */ 00037 SSTConstantDistribution(double v) : 00038 SSTRandomDistribution() { 00039 mean = v; 00040 } 00041 00042 /** 00043 Destroys the constant distribution 00044 */ 00045 ~SSTConstantDistribution() { 00046 00047 } 00048 00049 /** 00050 Gets the next double for the distribution, in this case it will return the constant 00051 value specified by the user 00052 \return Constant value specified by the user when creating the class 00053 */ 00054 double getNextDouble() { 00055 return mean; 00056 } 00057 00058 /** 00059 Gets the constant value for the distribution 00060 \return Constant value specified by the user when creating the class 00061 */ 00062 double getMean() { 00063 return mean; 00064 } 00065 00066 protected: 00067 /** 00068 Describes the constant value to return from the distribution. 00069 */ 00070 double mean; 00071 00072 }; 00073 00074 } 00075 } 00076 00077 #endif