about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-02-14 13:34:25 +0100
committerEmile <hanemile@protonmail.com>2019-02-14 13:34:25 +0100
commitc69573126b2d9fdb907b94ecab754417b95b842a (patch)
tree8527d866a065983a64ce7280af4f84df59e9700f
parent07a4e26087c1241358c910e9cff218032b2939c8 (diff)
updated the calcAllForces function now using the given galaxyindex to calculate the force acting on a star
-rw-r--r--db_actions.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/db_actions.go b/db_actions.go
index 1cadf77..eec7a93 100644
--- a/db_actions.go
+++ b/db_actions.go
@@ -715,7 +715,7 @@ func updateTotalMassNode(nodeID int64) float64 {
 	if err != nil {
 		log.Fatalf("[ E ] updateTotalMassNode query: %v\n\t\t\t query: %s\n", err, query)
 	}
-
+	// TODO: implement the getSubtreeIDs(nodeID) []int64 {...} function
 	// iterate over all subnodes updating their total masses
 	for _, subnodeID := range subnode {
 		fmt.Println("----------------------------")
@@ -930,14 +930,14 @@ func getStarCoordinates(nodeID int64) structs.Vec2 {
 // CalcAllForces calculates all the forces acting on the given star.
 // The theta value it receives is used by the Barnes-Hut algorithm to determine what
 // stars to include into the calculations
-func CalcAllForces(database *sql.DB, star structs.Star2D, theta float64) structs.Vec2 {
+func CalcAllForces(database *sql.DB, star structs.Star2D, galaxyIndex int64, theta float64) structs.Vec2 {
 	db = database
 
 	// calculate all the forces and add them to the list of all forces
 	// this is done recursively
 	// first of all, get the root id
 	log.Println("getting the root ID")
-	rootID := getRootNodeID(1)
+	rootID := getRootNodeID(galaxyIndex)
 	log.Println("done getting the root ID")
 
 	log.Printf("Calculating the forces acting on the star %v", star)