-
Notifications
You must be signed in to change notification settings - Fork 0
/
mfm.go
42 lines (36 loc) · 945 Bytes
/
mfm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package engine
import (
"github.com/mumax/3/cuda"
"github.com/mumax/3/data"
)
var (
MFM sSetter
MFMLift numberParam
MFMTipSize numberParam
mfmconv_ *cuda.MFMConvolution
)
func init() {
MFM.init("MFM", "", "MFM image", SetMFM)
MFMLift = numParam(50e-9, "m", reinitmfmconv)
MFMTipSize = numParam(1e-3, "m", reinitmfmconv)
DeclLValue("MFMLift", &MFMLift, "MFM lift height")
DeclLValue("MFMTipSize", &MFMTipSize, "MFM tip size")
}
func SetMFM(dst *data.Slice) {
buf := cuda.Buffer(3, Mesh().Size())
defer cuda.Recycle(buf)
if mfmconv_ == nil {
reinitmfmconv()
}
mfmconv_.Exec(buf, M.Buffer(), geometry.Gpu(), Bsat.gpuLUT1(), regions.Gpu())
cuda.Madd3(dst, buf.Comp(0), buf.Comp(1), buf.Comp(2), 1, 1, 1)
}
func reinitmfmconv() {
GUI.SetBusy(true)
defer GUI.SetBusy(false)
if mfmconv_ == nil {
mfmconv_ = cuda.NewMFM(Mesh(), MFMLift.v, MFMTipSize.v)
} else {
mfmconv_.Reinit(MFMLift.v, MFMTipSize.v)
}
}