Commit 8e58d325 authored by Lukas Weber's avatar Lukas Weber
Browse files

make sweeps accessible by mc

parent 989ac7b1
......@@ -44,26 +44,30 @@ double abstract_mc::random01() {
return rng->d();
}
int abstract_mc::sweep() const {
return _sweep;
}
void abstract_mc::_init() {
random_init();
init();
}
void abstract_mc::_do_update() {
sweep++;
_sweep++;
do_update();
}
void abstract_mc::_write(std::string dir) {
odump d(dir+"dump");
random_write(d);
d.write(sweep);
d.write(_sweep);
write(d);
d.close();
seed_write(dir+"seed");
dir+="sweeps";
ofstream f; f.open(dir.c_str());
f << ( (is_thermalized()) ? sweep-therm : 0 ) << " " << sweep <<endl;
f << ( (is_thermalized()) ? _sweep-therm : 0 ) << " " << _sweep <<endl;
f.close();
}
......@@ -72,7 +76,7 @@ bool abstract_mc::_read(std::string dir) {
if (!d)
return false;
random_read(d);
d.read(sweep);
d.read(_sweep);
if(!read(d))
return false;
......@@ -90,6 +94,6 @@ void abstract_mc::_write_output(std::string filename) {
}
bool abstract_mc::is_thermalized() {
return sweep>therm;
return _sweep>therm;
}
......@@ -22,7 +22,7 @@ class abstract_mc
void random_read(idump& d);
void random_init();
int sweep = 0;
int _sweep = 0;
int therm = 0;
protected:
parser param;
......@@ -34,6 +34,7 @@ class abstract_mc
virtual void do_update() = 0;
public:
double random01();
int sweep() const;
virtual void do_measurement() = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment