source: Sophya/trunk/SophyaLib/BaseTools/randfmt.h@ 3615

Last change on this file since 3615 was 3615, checked in by cmv, 16 years ago

Modifs relatives a l'introduction de RandomGeneratorInterface + delete de srandgen.c, cmv 01/05/2009

File size: 1.3 KB
Line 
1#ifndef FMTRANDGEN_H_SEEN
2#define FMTRANDGEN_H_SEEN
3
4// Classes FMTRandGen
5// Generateur aleatoire utilisant le code dSFMT
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 "dsfmtflags.h"
15#include "dSFMT.h"
16#include "randinterf.h"
17
18#include <vector>
19
20namespace SOPHYA {
21
22//! Pseudorandom number generator class using dSFMT code
23class FMTRandGen : public RandomGeneratorInterface {
24
25 public:
26 FMTRandGen(uint_4 seed=12345);
27 virtual ~FMTRandGen();
28
29 virtual void SetSeed(uint_4 seed);
30 virtual void SetSeed(vector<uint_4> seed);
31 virtual void AutoInit(int lp=0);
32 virtual void ShowRandom();
33
34 friend class ObjFileIO<FMTRandGen> ;
35
36 protected:
37 virtual r_8 Next();
38 dsfmt_t dsfmt_;
39
40};
41
42// Classe pour la gestion de persistance PPF : ObjFileIO<FMTRandGen>
43
44/*! Writes the random generator object state in the POutPersist stream \b os */
45inline POutPersist& operator << (POutPersist& os, FMTRandGen & obj)
46{ ObjFileIO<FMTRandGen> fio(&obj); fio.Write(os); return(os); }
47/*! Reads the random generator object state from the PInPersist stream \b is */
48inline PInPersist& operator >> (PInPersist& is, FMTRandGen & obj)
49{ ObjFileIO<FMTRandGen> fio(&obj); is.SkipToNextObject(); fio.Read(is); return(is); }
50
51} /* namespace SOPHYA */
52
53#endif
Note: See TracBrowser for help on using the repository browser.