|
Last change
on this file since 3795 was 3620, checked in by ansari, 16 years ago |
|
les includes dSFMT.h ... mis ds le fichier randfmt.cc uniquement, declaration d'un pointeur dsfmt_t au lieu de la structure - Reza 06/06/2009
|
|
File size:
1.5 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 "randinterf.h"
|
|---|
| 15 |
|
|---|
| 16 | #include <vector>
|
|---|
| 17 |
|
|---|
| 18 | //--- Declaration de la struct definie ds dSFMT.h - inclus uniquement dans le .cc
|
|---|
| 19 | struct DSFMT_T ;
|
|---|
| 20 | typedef struct DSFMT_T dsfmt_t;
|
|---|
| 21 | //-------------------
|
|---|
| 22 |
|
|---|
| 23 | namespace SOPHYA {
|
|---|
| 24 |
|
|---|
| 25 | //! Pseudorandom number generator class using dSFMT code
|
|---|
| 26 | class FMTRandGen : public RandomGeneratorInterface {
|
|---|
| 27 |
|
|---|
| 28 | public:
|
|---|
| 29 | FMTRandGen(uint_4 seed=12345);
|
|---|
| 30 | virtual ~FMTRandGen();
|
|---|
| 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<FMTRandGen> ;
|
|---|
| 38 |
|
|---|
| 39 | protected:
|
|---|
| 40 | virtual r_8 Next();
|
|---|
| 41 | dsfmt_t* dsfmt_ptr_; // Pointeur car dsfmt_t pas encore defini
|
|---|
| 42 |
|
|---|
| 43 | };
|
|---|
| 44 |
|
|---|
| 45 | // Classe pour la gestion de persistance PPF : ObjFileIO<FMTRandGen>
|
|---|
| 46 |
|
|---|
| 47 | /*! Writes the random generator object state in the POutPersist stream \b os */
|
|---|
| 48 | inline POutPersist& operator << (POutPersist& os, FMTRandGen & obj)
|
|---|
| 49 | { ObjFileIO<FMTRandGen> 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, FMTRandGen & obj)
|
|---|
| 52 | { ObjFileIO<FMTRandGen> 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.