-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIsingWindow.hpp
More file actions
85 lines (64 loc) · 1.46 KB
/
IsingWindow.hpp
File metadata and controls
85 lines (64 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef _ISING_WINDOW_
#define _ISING_WINDOW_
#include <QMainWindow>
#include <QWidget>
#include <QFormLayout>
#include <QLineEdit>
#include <QPainter>
#include <QHBoxLayout>
#include <QString>
#include <QGridLayout>
#include <QPushButton>
#include <QTimer>
#include <QLabel>
#include <thread>
#include "IsingMC.hpp"
class IsingWidget;
class IsingWindow : public QMainWindow {
Q_OBJECT;
public:
IsingWindow(unsigned, unsigned, double, double, QWidget *parent = 0);
~IsingWindow();
private:
QFormLayout *form;
QLineEdit *lne_J, *lne_b;
QGridLayout *grid;
IsingWidget *simwid;
QPushButton *btn_start;
QLabel *l_mag, *l_e;
public slots:
void set_J();
void set_b();
void toggle_simulation(bool);
};
// need new widget for ising window
// with seperate computation thread
//
// add start, stop and randomize functionality
class IsingWidget : public QWidget {
Q_OBJECT;
public:
IsingWidget(unsigned, unsigned, double, double, QWidget *parent = 0);
~IsingWidget();
void SetJ(double);
void SetBeta(double);
double Energy();
double Magnetization();
void ToggleSimulation(bool);
signals:
void GetMagnetization(const QString &);
void GetEnergy(const QString &);
public slots:
void OutputTextData();
protected:
void paintEvent(QPaintEvent *e);
void simulationThread(unsigned);
void startSimulation();
void stopSimulation();
private:
IsingMC *imc;
bool running;
unsigned iterations;
QTimer *render_timer, *text_timer;
};
#endif // #ifndef _ISING_WINDOW_