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 22#include < iostream>
33#include " c_micro_sim.h"
44
5+ class Integrator ; // forward declaration
56// Base class for the drivers
67class Driver {
78public:
@@ -13,15 +14,37 @@ class Driver {
1314 double * alpha;
1415 double gamma;
1516 double t;
17+ MicroSim * sim;
18+ Integrator * integrator;
19+
20+ virtual void run_until (double t) {};
1621};
1722
1823
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 {
2036public:
2137 Integrator_RK4 () {};
2238 virtual ~Integrator_RK4 () {std::cout << " Killing RK4 integrator\n " ;};
2339 // Will get the parameters from a simulation class
2440 // 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;
2750};
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