-
Notifications
You must be signed in to change notification settings - Fork 0
/
buffered.go
51 lines (50 loc) · 1.37 KB
/
buffered.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
43
44
45
46
47
48
49
50
51
package engine
//
//import (
// "github.com/mumax/3/cuda"
// "github.com/mumax/3/data"
// "github.com/mumax/3/util"
//)
//
//// A buffered quantity is stored in GPU memory at all times.
//type buffered struct {
// info
// buffer *data.Slice
//}
//
//// init metadata but does not allocate yet
//func (q *buffered) init(nComp int, name, unit string) {
// q.info = Info(nComp, name, unit)
//}
//
//// allocate storage (not done by init, as mesh size may not yet be known then)
//func (q *buffered) alloc() {
// q.buffer = cuda.NewSlice(3, q.Mesh().Size())
//}
//
//// get buffer (on GPU, no need to recycle)
//func (q *buffered) Slice() (s *data.Slice, recycle bool) {
// return q.buffer, false
//}
//
//// Set the value of one cell.
//func (q *buffered) SetCell(ix, iy, iz int, v ...float64) {
// nComp := q.NComp()
// util.Argument(len(v) == nComp)
// for c := 0; c < nComp; c++ {
// cuda.SetCell(q.buffer, c, ix, iy, iz, float32(v[c]))
// }
//}
//
//// Get the value of one cell.
//func (q *buffered) GetCell(comp, ix, iy, iz int) float64 {
// return float64(cuda.GetCell(q.buffer, comp, ix, iy, iz))
//}
//
//func (q *buffered) Region(r int) *sliceInRegion { return &sliceInRegion{q, r} }
//
//func (q *buffered) TableData() []float64 { return Average(q) }
//
//func (q *buffered) String() string { return util.Sprint(q.buffer.HostCopy()) }
//
//func (q *buffered) Mesh() *data.Mesh { return Mesh() }