本文整理匯總了Golang中github.com/mumax/3/data.Mesh.WorldSize方法的典型用法代碼示例。如果您正苦於以下問題:Golang Mesh.WorldSize方法的具體用法?Golang Mesh.WorldSize怎麽用?Golang Mesh.WorldSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/mumax/3/data.Mesh
的用法示例。
在下文中一共展示了Mesh.WorldSize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: AddSlonczewskiTorque
// Add Slonczewski ST torque to torque (Tesla).
// see slonczewski.cu
func AddSlonczewskiTorque(torque, m, J, fixedP *data.Slice, Msat, alpha, pol, λ, ε_prime LUTPtr, regions *Bytes, mesh *data.Mesh) {
N := torque.Len()
cfg := make1DConf(N)
thickness := float32(mesh.WorldSize()[Z])
k_addslonczewskitorque_async(torque.DevPtr(X), torque.DevPtr(Y), torque.DevPtr(Z),
m.DevPtr(X), m.DevPtr(Y), m.DevPtr(Z), J.DevPtr(Z),
fixedP.DevPtr(X), fixedP.DevPtr(Y), fixedP.DevPtr(Z),
unsafe.Pointer(Msat), unsafe.Pointer(alpha),
thickness, unsafe.Pointer(pol),
unsafe.Pointer(λ), unsafe.Pointer(ε_prime),
regions.Ptr, N, cfg)
}
示例2: compensateLRSurfaceCharges
func compensateLRSurfaceCharges(m *data.Mesh, mxLeft, mxRight float64, bsat float64) *data.Slice {
h := data.NewSlice(3, m.Size())
H := h.Vectors()
world := m.WorldSize()
cell := m.CellSize()
size := m.Size()
q := cell[Z] * cell[Y] * bsat
q1 := q * mxLeft
q2 := q * (-mxRight)
prog, maxProg := 0, (size[Z]+1)*(size[Y]+1)
// surface loop (source)
for I := 0; I < size[Z]; I++ {
for J := 0; J < size[Y]; J++ {
prog++
util.Progress(prog, maxProg, "removing surface charges")
y := (float64(J) + 0.5) * cell[Y]
z := (float64(I) + 0.5) * cell[Z]
source1 := [3]float64{0, y, z} // left surface source
source2 := [3]float64{world[X], y, z} // right surface source
// volume loop (destination)
for iz := range H[0] {
for iy := range H[0][iz] {
for ix := range H[0][iz][iy] {
dst := [3]float64{ // destination coordinate
(float64(ix) + 0.5) * cell[X],
(float64(iy) + 0.5) * cell[Y],
(float64(iz) + 0.5) * cell[Z]}
h1 := hfield(q1, source1, dst)
h2 := hfield(q2, source2, dst)
// add this surface charges' field to grand total
for c := 0; c < 3; c++ {
H[c][iz][iy][ix] += float32(h1[c] + h2[c])
}
}
}
}
}
}
return h
}
示例3: AddSlonczewskiTorque2
// Add Slonczewski ST torque to torque (Tesla).
// see slonczewski.cu
func AddSlonczewskiTorque2(torque, m *data.Slice, Msat, J, fixedP, alpha, pol, λ, ε_prime MSlice, mesh *data.Mesh) {
N := torque.Len()
cfg := make1DConf(N)
flt := float32(mesh.WorldSize()[Z])
k_addslonczewskitorque2_async(
torque.DevPtr(X), torque.DevPtr(Y), torque.DevPtr(Z),
m.DevPtr(X), m.DevPtr(Y), m.DevPtr(Z),
Msat.DevPtr(0), Msat.Mul(0),
J.DevPtr(Z), J.Mul(Z),
fixedP.DevPtr(X), fixedP.Mul(X),
fixedP.DevPtr(Y), fixedP.Mul(Y),
fixedP.DevPtr(Z), fixedP.Mul(Z),
alpha.DevPtr(0), alpha.Mul(0),
pol.DevPtr(0), pol.Mul(0),
λ.DevPtr(0), λ.Mul(0),
ε_prime.DevPtr(0), ε_prime.Mul(0),
unsafe.Pointer(uintptr(0)), flt,
N, cfg)
}