]> git.treefish.org Git - phys/heatbath.git/blob - sim-heatless.hpp
Switched to 2d and added multiple sim-algorithm compilation.
[phys/heatbath.git] / sim-heatless.hpp
1 #ifndef SIM_HPP
2 #define SIM_HPP
3
4 #include <gsl/gsl_rng.h>
5 #include <complex>
6 #include <math.h>
7
8 #include "latlib/neigh.h"
9
10 class sim : public o815::sim {
11 public:
12   struct siteconf {
13     complex<double> phi;
14   };
15   sim(o815 *_O815);
16   siteconf* conf;
17   unsigned int LSIZE2;
18
19 private:
20   void _makeSweep();
21   void _newParas();
22
23   gsl_rng* rangsl;
24
25   neigh *nb;
26
27   void updatePhi (const int& x);
28 };
29
30
31
32 sim::sim(o815 *_O815) : o815::sim( _O815, 
33                                    sizeof(siteconf)*
34                                    (_O815->comargs.lsize[0]*_O815->comargs.lsize[1]) ) {
35   conf = (siteconf*)confMem;
36
37   rangsl = gsl_rng_alloc(gsl_rng_ranlxs0);
38   gsl_rng_set(rangsl, time(NULL));
39
40   LSIZE2 = _O815->comargs.lsize[0] * _O815->comargs.lsize[1];
41
42   nb = new neigh(2, _O815->comargs.lsize[0], _O815->comargs.lsize[1]);
43 }
44
45 void sim::updatePhi (const int& x) 
46 {
47   const double r = gsl_rng_uniform(rangsl);
48   const double theta = gsl_rng_uniform(rangsl) * 2*M_PI;
49 }
50
51 void sim::_makeSweep() {  
52 }
53
54 void sim::_newParas() {
55   /* reset variables */
56 }
57
58 #endif