Last change
on this file since 4019 was 4019, checked in by cmv, 14 years ago |
ajout generateurs tinymt32+64, cmv 24/09/2011
|
File size:
1.6 KB
|
Line | |
---|
1 | #ifndef RANDTMT32_H_SEEN
|
---|
2 | #define RANDTMT32_H_SEEN
|
---|
3 |
|
---|
4 | // Classes TinyMT32RandGen
|
---|
5 | // Generateur aleatoire utilisant le code TinyMT 32 bits
|
---|
6 | //
|
---|
7 | // R. Ansari (C) UPS+LAL IN2P3/CNRS 2009
|
---|
8 | // C. Magneville (C) DAPNIA/SPP CEA 2009
|
---|
9 |
|
---|
10 |
|
---|
11 | #include "machdefs.h"
|
---|
12 | #include "objfio.h"
|
---|
13 |
|
---|
14 | #include "randinterf.h"
|
---|
15 |
|
---|
16 | #include <vector>
|
---|
17 |
|
---|
18 | //--- Declaration de la struct definie ds tinymt32.h - inclus uniquement dans le .cc
|
---|
19 | struct TINYMT32_T ;
|
---|
20 | typedef struct TINYMT32_T tinymt32_t;
|
---|
21 | //-------------------
|
---|
22 |
|
---|
23 | namespace SOPHYA {
|
---|
24 |
|
---|
25 | //! Pseudorandom number generator class using dSFMT code
|
---|
26 | class TinyMT32RandGen : public RandomGeneratorInterface {
|
---|
27 |
|
---|
28 | public:
|
---|
29 | TinyMT32RandGen(uint_4 seed=12345);
|
---|
30 | virtual ~TinyMT32RandGen();
|
---|
31 |
|
---|
32 | virtual void SetSeed(uint_4 seed);
|
---|
33 | virtual void SetSeed(vector<uint_4> seed);
|
---|
34 | virtual void AutoInit(int lp=0);
|
---|
35 | virtual void ShowRandom();
|
---|
36 |
|
---|
37 | friend class ObjFileIO<TinyMT32RandGen> ;
|
---|
38 |
|
---|
39 | protected:
|
---|
40 | virtual r_8 Next();
|
---|
41 | tinymt32_t* tinymt32_ptr_; // Pointeur car tinymt32_t pas encore defini
|
---|
42 |
|
---|
43 | };
|
---|
44 |
|
---|
45 | // Classe pour la gestion de persistance PPF : ObjFileIO<TinyMT32RandGen>
|
---|
46 |
|
---|
47 | /*! Writes the random generator object state in the POutPersist stream \b os */
|
---|
48 | inline POutPersist& operator << (POutPersist& os, TinyMT32RandGen & obj)
|
---|
49 | { ObjFileIO<TinyMT32RandGen> fio(&obj); fio.Write(os); return(os); }
|
---|
50 | /*! Reads the random generator object state from the PInPersist stream \b is */
|
---|
51 | inline PInPersist& operator >> (PInPersist& is, TinyMT32RandGen & obj)
|
---|
52 | { ObjFileIO<TinyMT32RandGen> fio(&obj); is.SkipToNextObject(); fio.Read(is); return(is); }
|
---|
53 |
|
---|
54 | } /* namespace SOPHYA */
|
---|
55 |
|
---|
56 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.