From c69573126b2d9fdb907b94ecab754417b95b842a Mon Sep 17 00:00:00 2001 From: Emile Date: Thu, 14 Feb 2019 13:34:25 +0100 Subject: updated the calcAllForces function now using the given galaxyindex to calculate the force acting on a star --- db_actions.go | 6 +++--- 1 file 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) -- cgit 1.4.1