File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 2
2
#include < iostream>
3
3
#include " c_micro_sim.h"
4
4
5
+ class Integrator ; // forward declaration
5
6
// Base class for the drivers
6
7
class Driver {
7
8
public:
@@ -13,15 +14,37 @@ class Driver {
13
14
double * alpha;
14
15
double gamma;
15
16
double t;
17
+ MicroSim * sim;
18
+ Integrator * integrator;
19
+
20
+ virtual void run_until (double t) {};
16
21
};
17
22
18
23
19
- class Integrator_RK4 {
24
+ // Abstract class
25
+ class Integrator {
26
+ public:
27
+ Integrator () {};
28
+ virtual void _setup (int N) {};
29
+ // Allow magnetisation to update (via LLG + effective field)
30
+ // TODO: figure out how to set the update function in Driver class
31
+ virtual void compute_RHS (void (* f) (double * m, double t)) {};
32
+ }
33
+
34
+ // Integrators should be independent of any driver/sim class
35
+ class Integrator_RK4 : public Integrator {
20
36
public:
21
37
Integrator_RK4 () {};
22
38
virtual ~Integrator_RK4 () {std::cout << " Killing RK4 integrator\n " ;};
23
39
// Will get the parameters from a simulation class
24
40
// void _setup(MicroSim * sim, Driver * driver);
25
- std::vector<double > rk_steps; // N * 4 array
26
- void integration_step (double (*f)(double t, double y));
41
+ std::vector<double > rk1; // N array
42
+ std::vector<double > rk2; // N array
43
+ std::vector<double > rk3; // N array
44
+ std::vector<double > rk4; // N array
45
+ void integration_step (double (*f)(double t, double m)); // compute_RHS ??
46
+ void _setup (int N);
47
+ int N;
48
+ double t;
49
+ double dt;
27
50
};
Original file line number Diff line number Diff line change
1
+ #include "m_driver.h"
2
+
3
+ void Integrator_RK4 ::_setup (int N ) {
4
+ this -> rk_steps (N * 4 , 0.0 );
5
+ }
You can’t perform that action at this time.
0 commit comments