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

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

RandomGeneratorInterface + dSFMT etc..., cmv 28/04/2009

File size: 1.3 KB
RevLine 
[3602]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
33 friend class ObjFileIO<FMTRandGen> ;
34
35 protected:
36 virtual r_8 Next();
37 dsfmt_t dsfmt_;
38
39};
40
41// Classe pour la gestion de persistance PPF : ObjFileIO<FMTRandGen>
42
43/*! Writes the random generator object state in the POutPersist stream \b os */
44inline POutPersist& operator << (POutPersist& os, FMTRandGen & obj)
45{ ObjFileIO<FMTRandGen> fio(&obj); fio.Write(os); return(os); }
46/*! Reads the random generator object state from the PInPersist stream \b is */
47inline PInPersist& operator >> (PInPersist& is, FMTRandGen & obj)
48{ ObjFileIO<FMTRandGen> fio(&obj); is.SkipToNextObject(); fio.Read(is); return(is); }
49
50} /* namespace SOPHYA */
51
52#endif
Note: See TracBrowser for help on using the repository browser.