From 999a45b25f3f7d9a4e7356a41a9ea6c1ac18520b Mon Sep 17 00:00:00 2001 From: emile Date: Wed, 17 Oct 2018 14:09:01 +0200 Subject: Rephrasing comments --- forces/forces.go | 8 ++++---- main.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/forces/forces.go b/forces/forces.go index caeda75..5e29dc8 100644 --- a/forces/forces.go +++ b/forces/forces.go @@ -55,7 +55,7 @@ func accelerations(stars_arr []structs.Star2D, nr int) structs.Vec2 { } // accelerationThread calculates the acceleration acting on a given amount of stars in a given range for a given slice of stars -// as a go-routine +// utilizing go-methods func accelerationThread(starSlice []structs.Star2D, localRangeStart int, localRangeEnd int, channel chan structs.Star2D) { // iterate over the given range for index := localRangeStart; index < localRangeEnd; index++ { @@ -75,13 +75,13 @@ func accelerationThread(starSlice []structs.Star2D, localRangeStart int, localRa // CalcAllAccelerations calculates all the accelerations acting in between all the stars in the given starSlice slice and // returns a "new" slice containing the stars with their new velocities func CalcAllAccelerations(starSlice []structs.Star2D, threads int) []structs.Star2D { - // create a channel for bundling the stars generated in the go-routines + // create a channel for bundling the stars generated in the go-methods channel := make(chan structs.Star2D, 1000) sliceLength := len(starSlice) // calculate the local range - // Example: 100 stars with 4 threads = 25 stars / thread + // Example: 100 stars with 4 threads = 25 stars per thread localRangeLen := sliceLength / threads // generate a new slice for storing the stars @@ -89,7 +89,7 @@ func CalcAllAccelerations(starSlice []structs.Star2D, threads int) []structs.Sta logplus.LogNeutral(fmt.Sprintf("Starting %d workers, each processing %d stars", threads, localRangeLen)) - // start n go threads + // start n go-methods each covering a part of the whole slice for i := 0; i < threads; i++ { // define the local range diff --git a/main.go b/main.go index d6297c5..de319c4 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ func main() { var threads int = 8 var frames int = 1 var rangeStart int = 0 - var rangeEnd int = 25000 + var rangeEnd int = 5000 // the slice starsSlice stores the star structures starsSlice := []structs.Star2D{ -- cgit 1.4.1