X-Git-Url: http://git.treefish.org/~alex/phys/u1casc.git/blobdiff_plain/802a4416b46bb8f41830e0e85e1b4d658760742f..7881248ae203732681a17726f2ecd20b248f2d83:/u1casc-ordinary/sim.hpp?ds=inline diff --git a/u1casc-ordinary/sim.hpp b/u1casc-ordinary/sim.hpp index af989c9..986ae37 100644 --- a/u1casc-ordinary/sim.hpp +++ b/u1casc-ordinary/sim.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "latlib/neigh.h" @@ -17,10 +18,11 @@ public: neigh *nb; complex *U, *phi; double kappa[2], lambda[2], beta; - + void _newParas(); + private: + void _resetConfig(); void _makeSweep(); - void _newParas(); gsl_rng* rangsl; double rhoPhi(const int& iphi, const int& x0, const complex& candPhi); double rhoU(const int& x0, const int& nu0, const complex& candU); @@ -32,6 +34,8 @@ sim::sim(o815 *_O815) : o815::sim( _O815, sizeof(complex)* _O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[1]*(2+4) ) { + struct timeval tv; + lsize4 = _O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[1]; nb = new neigh(4, _O815->comargs.lsize[0], _O815->comargs.lsize[0], _O815->comargs.lsize[0], _O815->comargs.lsize[1]); @@ -39,8 +43,9 @@ sim::sim(o815 *_O815) : o815::sim( _O815, phi = (complex*)confMem; U = (complex*)(confMem + sizeof(complex)*lsize4*2); + gettimeofday(&tv, NULL); rangsl = gsl_rng_alloc(gsl_rng_ranlxs0); - gsl_rng_set(rangsl, time(NULL)); + gsl_rng_set(rangsl, 1000000 * tv.tv_sec + tv.tv_usec); } void sim::_makeSweep() { @@ -56,7 +61,9 @@ void sim::_newParas() { lambda[0] = (*O815->paraQ)["lambdaone"]; lambda[1] = (*O815->paraQ)["lambdatwo"]; beta = (*O815->paraQ)["beta"]; +} +void sim::_resetConfig() { for(int ix=0; ix