about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhanemile <hanemile@chaosdorf.de>2018-09-28 18:12:20 +0200
committerhanemile <hanemile@chaosdorf.de>2018-09-28 18:12:20 +0200
commitc73e675866d056374ab8be170ed46110f1107bc8 (patch)
tree218f338abf346c942af09e571e4016d3ccf49c64
parent69f15d0f4f08758ca2ac6f3dc17cfd922f419018 (diff)
calc_all_forces calculates all the forces acting in the galaxy using go-threads
-rw-r--r--force.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/force.go b/force.go
index ed45849..16ee30e 100644
--- a/force.go
+++ b/force.go
@@ -46,3 +46,15 @@ func forces(stars_arr []star, nr int) {
 		}
 	}
 }
+
+// calc_all_forces iterates over all the stars in a given array and calculate the forces acting on all stars
+func calc_all_forces(arr []star) {
+
+	// Iterate over all the stars
+	for index, _ := range arr {
+
+		// Calculate the force acting inbetween the given star and all other stars
+		// This utilizes go-routines :D
+		go forces(arr, index)
+	}
+}