// number of cells in the magnet. // not necessarily integer as cells can have fractional volume. func magnetNCell() float64 { if geometry.Gpu().IsNil() { return float64(Mesh().NCell()) } else { return float64(cuda.Sum(geometry.Gpu())) } }
func spaceFill() float64 { if geometry.Gpu().IsNil() { return 1 } else { return float64(cuda.Sum(geometry.buffer)) / float64(geometry.Mesh().NCell()) } }
// Returns anisotropy energy in joules. func GetAnisotropyEnergy() float64 { buf := cuda.Buffer(1, Edens_anis.Mesh().Size()) defer cuda.Recycle(buf) cuda.Zero(buf) AddAnisotropyEnergyDensity(buf) return cellVolume() * float64(cuda.Sum(buf)) }
// average of slice over universe func sAverageUniverse(s *data.Slice) []float64 { nCell := float64(prod(s.Size())) avg := make([]float64, s.NComp()) for i := range avg { avg[i] = float64(cuda.Sum(s.Comp(i))) / nCell checkNaN1(avg[i]) } return avg }
func GetTopologicalCharge() float64 { s, recycle := Ext_TopologicalChargeDensity.Slice() if recycle { defer cuda.Recycle(s) } c := Mesh().CellSize() N := Mesh().Size() return (0.25 * c[X] * c[Y] / math.Pi / float64(N[Z])) * float64(cuda.Sum(s)) }