MUniform.h

00001 /*  _________________________________________________________________________
00002  *
00003  *  UTILIB: A utility library for developing portable C++ codes.
00004  *  Copyright (c) 2001, Sandia National Laboratories.
00005  *  This software is distributed under the GNU Lesser General Public License.
00006  *  For more information, see the README file in the top UTILIB directory.
00007  *  _________________________________________________________________________
00008  */
00009 
00010 //
00011 // MUniform.h
00012 //
00020 #ifndef __MUniform_h
00021 #define __MUniform_h
00022 
00023 #include "CRandVec.h"
00024 #include "Uniform.h"
00025 
00026 
00027 class UTILIB_API MUniform: public CRandVec {
00028 
00029 public:
00030 
00032     MUniform();
00034     MUniform(RNG *gen, DoubleVector& mean, DoubleVector& range_vec_);
00036     MUniform(RNG *gen, DoubleVector& mean, double range_const_);
00038     virtual ~MUniform() {}
00039 
00041     int set(DoubleVector& mean, DoubleVector& range_vec_);
00043     int set(DoubleVector& mean, double range_const_);
00044 
00046     virtual RNG *generator() {return CRandVec::generator();} 
00048     virtual void generator(RNG* p);
00049 
00051     DoubleVector& operator()() {return this->CRandVec::operator()(); }
00053     void operator()(DoubleVector& new_vec);
00054 
00055 protected:
00056 
00058     Uniform     unif_dev;
00059 
00061     DoubleVector        mean;
00063     DoubleVector        range_vec;
00065     double              range_const;
00066 
00067 };
00068 
00069 
00070 inline void MUniform::generator(RNG *p)
00071 {
00072 CRandVec::generator(p);
00073 unif_dev.generator(p);
00074 }
00075 
00076 #endif
00077