CRandVec.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 // CRandVec.h
00012 //
00021 #ifndef _CRandVec_h
00022 #define _CRandVec_h
00023 
00024 #ifndef ANSI_HDRS
00025 #include <math.h>
00026 #else
00027 #include <cmath>
00028 #endif
00029 #include "DoubleVector.h"
00030 #include "RNG.h"
00031 
00032 
00033 class UTILIB_API CRandVec {
00034 
00035 public:
00036 
00038   CRandVec(RNG *generator=NULL);
00040   virtual ~CRandVec() {}
00041 
00043   virtual DoubleVector& operator()();
00045   virtual void operator()(DoubleVector& vec) = 0;
00046 
00048   virtual RNG *generator();
00050   virtual void generator(RNG *p);
00051 
00052 protected:
00053 
00055   RNG   *pGenerator;
00057   DoubleVector results;
00058 
00059 };
00060 
00061 
00062 inline CRandVec::CRandVec(RNG *gen)
00063 {
00064     pGenerator = gen;
00065 }
00066 
00067 inline RNG *CRandVec::generator()
00068 {
00069     return(pGenerator);
00070 }
00071 
00072 inline void CRandVec::generator(RNG *p)
00073 {
00074     pGenerator = p;
00075 }
00076 
00077 
00078 inline DoubleVector& CRandVec::operator()()
00079 {
00080 this->operator()(results);
00081 return results;
00082 }
00083 
00084 #endif