-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from mumax/master
updating this branch to latest mumax/3
- Loading branch information
Showing
415 changed files
with
42,239 additions
and
46,561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef _AMUL_H_ | ||
#define _AMUL_H_ | ||
|
||
#include "float3.h" | ||
|
||
// Returns mul * arr[i], or mul when arr == NULL; | ||
inline __device__ float amul(float *arr, float mul, int i) { | ||
return (arr == NULL)? (mul): (mul * arr[i]); | ||
} | ||
|
||
// Returns m * a[i], or m when a == NULL; | ||
inline __device__ float3 vmul(float *ax, float *ay, float *az, | ||
float mx, float my, float mz, int i) { | ||
return make_float3(amul(ax, mx, i), | ||
amul(ay, my, i), | ||
amul(az, mz, i)); | ||
} | ||
|
||
// Returns 1/Msat, or 0 when Msat == 0. | ||
inline __device__ float inv_Msat(float *Ms_, float Ms_mul, int i) { | ||
float ms = amul(Ms_, Ms_mul, i); | ||
if (ms == 0.0f) { | ||
return 0.0f; | ||
} else { | ||
return 1.0f / ms; | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,51 @@ | ||
package cuda | ||
|
||
import ( | ||
"unsafe" | ||
|
||
"github.com/mumax/3/data" | ||
"github.com/mumax/3/util" | ||
) | ||
|
||
// Adds cubic anisotropy field to Beff. | ||
// see cubicanisotropy.cu | ||
func AddCubicAnisotropy(Beff, m *data.Slice, k1_red, k2_red, k3_red LUTPtr, c1, c2 LUTPtrs, regions *Bytes) { | ||
// Add uniaxial magnetocrystalline anisotropy field to Beff. | ||
// see uniaxialanisotropy.cu | ||
func AddCubicAnisotropy2(Beff, m *data.Slice, Msat, k1, k2, k3, c1, c2 MSlice) { | ||
util.Argument(Beff.Size() == m.Size()) | ||
|
||
N := Beff.Len() | ||
cfg := make1DConf(N) | ||
|
||
k_addcubicanisotropy_async( | ||
k_addcubicanisotropy2_async( | ||
Beff.DevPtr(X), Beff.DevPtr(Y), Beff.DevPtr(Z), | ||
m.DevPtr(X), m.DevPtr(Y), m.DevPtr(Z), | ||
unsafe.Pointer(k1_red), unsafe.Pointer(k2_red), unsafe.Pointer(k3_red), | ||
c1[X], c1[Y], c1[Z], | ||
c2[X], c2[Y], c2[Z], | ||
regions.Ptr, N, cfg) | ||
Msat.DevPtr(0), Msat.Mul(0), | ||
k1.DevPtr(0), k1.Mul(0), | ||
k2.DevPtr(0), k2.Mul(0), | ||
k3.DevPtr(0), k3.Mul(0), | ||
c1.DevPtr(X), c1.Mul(X), | ||
c1.DevPtr(Y), c1.Mul(Y), | ||
c1.DevPtr(Z), c1.Mul(Z), | ||
c2.DevPtr(X), c2.Mul(X), | ||
c2.DevPtr(Y), c2.Mul(Y), | ||
c2.DevPtr(Z), c2.Mul(Z), | ||
N, cfg) | ||
} | ||
|
||
// Add uniaxial magnetocrystalline anisotropy field to Beff. | ||
// see uniaxialanisotropy.cu | ||
func AddUniaxialAnisotropy(Beff, m *data.Slice, k1_red, k2_red LUTPtr, u LUTPtrs, regions *Bytes) { | ||
func AddUniaxialAnisotropy2(Beff, m *data.Slice, Msat, k1, k2, u MSlice) { | ||
util.Argument(Beff.Size() == m.Size()) | ||
|
||
checkSize(Beff, m, k1, k2, u, Msat) | ||
|
||
N := Beff.Len() | ||
cfg := make1DConf(N) | ||
|
||
k_adduniaxialanisotropy_async(Beff.DevPtr(X), Beff.DevPtr(Y), Beff.DevPtr(Z), | ||
k_adduniaxialanisotropy2_async( | ||
Beff.DevPtr(X), Beff.DevPtr(Y), Beff.DevPtr(Z), | ||
m.DevPtr(X), m.DevPtr(Y), m.DevPtr(Z), | ||
unsafe.Pointer(k1_red), unsafe.Pointer(k2_red), | ||
u[X], u[Y], u[Z], | ||
regions.Ptr, N, cfg) | ||
Msat.DevPtr(0), Msat.Mul(0), | ||
k1.DevPtr(0), k1.Mul(0), | ||
k2.DevPtr(0), k2.Mul(0), | ||
u.DevPtr(X), u.Mul(X), | ||
u.DevPtr(Y), u.Mul(Y), | ||
u.DevPtr(Z), u.Mul(Z), | ||
N, cfg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.