Skip to content

Commit f27295d

Browse files
Port Fidimag to C++
Large commit - port Fidimag to build everything as C++ rather than C. Why? Because this is Stage 1 of our complex plan to make Fidimag faster and more readable, and part of this involves using Classes at the C++ level rather than at the Python level for energy terms in order to reduce the amount of slow Python code. Co-Authored-By: David Ignacio Cortee <[email protected]>
1 parent 7ebf35b commit f27295d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+133430
-394
lines changed

fidimag/atomistic/hexagonal_mesh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
"""
1+
r"""
32
Represent hexagonal 2D mesh.
43
54
The hexagons are pointy topped (as against flat topped). We use axial
@@ -38,6 +37,7 @@
3837
Coordinates a
3938
4039
"""
40+
4141
import numpy as np
4242
from math import sqrt
4343

fidimag/atomistic/lib/anis.c renamed to fidimag/atomistic/lib/anis.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "clib.h"
22

33

4-
void compute_anis(double *restrict spin, double *restrict field,
5-
double *restrict mu_s_inv,
6-
double *restrict energy,
7-
double *restrict Ku, double *restrict axis, int n) {
4+
void compute_anis(double * spin, double * field,
5+
double * mu_s_inv,
6+
double * energy,
7+
double * Ku, double * axis, int n) {
88

99
/* Remember that the magnetisation order is
1010
* mx1, my1, mz1, mx2, my2, mz2, mx3,...
@@ -40,10 +40,10 @@ void compute_anis(double *restrict spin, double *restrict field,
4040
}
4141

4242

43-
void compute_anis_cubic(double *restrict spin, double *restrict field,
44-
double *restrict mu_s_inv,
45-
double *restrict energy,
46-
double *restrict Kc, int n) {
43+
void compute_anis_cubic(double * spin, double * field,
44+
double * mu_s_inv,
45+
double * energy,
46+
double * Kc, int n) {
4747

4848
/* Remember that the magnetisation order is
4949
* mx1, my1, mz1, mx2, my2, mz2, mx3,...

0 commit comments

Comments
 (0)