Skip to content

Commit 27e4891

Browse files
committed
Add C++ Energy class
1 parent a263c83 commit 27e4891

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

c_energy.cpp

Whitespace-only changes.

native/include/c_energy.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include<cmath>
2+
3+
class Energy {
4+
public:
5+
bool set_up;
6+
Energy();
7+
int nx, ny, nz, n;
8+
double dx, dy, dz;
9+
double unit_length;
10+
double *spin;
11+
double *Ms;
12+
double *Ms_inv;
13+
double *field;
14+
double *energy;
15+
double *coordinates;
16+
int *ngbs;
17+
virtual void compute_field(double t) = 0;
18+
double compute_energy();
19+
void setup(int nx, int ny, int nz, double dx, double dy, double dz, double unit_length, double *spin, double *Ms, double *Ms_inv);
20+
};
21+
22+
class Exchange : public Energy {
23+
public:
24+
Exchange(double *A) : A(A) {
25+
set_up = false;
26+
}
27+
double *A;
28+
void compute_field(double t);
29+
};

0 commit comments

Comments
 (0)