mc.h 1.21 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once

#include <iostream>
#include <vector>
#include <string>
#include "measurements.h"
#include "random.h"
#include "parser.h"
#include "types.h"

using namespace std;

13
class abstract_mc
14
15
16
17
18
19
20
21
22
{
	private:
                void param_init(string dir);
                void random_clear();
                void random_write(odump& d);
                void seed_write(string fn);
                void random_read(idump& d);
		void random_init();

Lukas Weber's avatar
Lukas Weber committed
23
		int _sweep = 0;
24
25
26
		int therm = 0;
	protected:
		parser param;
27
                randomnumbergenerator * rng = 0;
28
		
29
		virtual void init() = 0;
30
31
32
		virtual void write(odump &out) = 0;
		virtual bool read(idump &in) = 0;
		virtual void write_output(std::ofstream &f) = 0;
33
		virtual void do_update() = 0;
34
	public:	
35
                double random01();
Lukas Weber's avatar
Lukas Weber committed
36
		int sweep() const;
37

38
		virtual void do_measurement() = 0;
39
40
41
42
43
44
45
46
47

		// these functions do a little more, like taking care of the
		// random number generator state, then call the child class versions.
		void _init();
		void _write(std::string dir);
		bool _read(std::string dir);
		void _write_output(std::string filename);

		void _do_update();
48
		
49
		bool is_thermalized();
50
51
		measurements measure;	
		
52
53
		abstract_mc(string dir);
		virtual ~abstract_mc();
54
};