Documentation ¶
Index ¶
- Constants
- func CalcAllForces(database *sql.DB, star structs.Star2D, galaxyIndex int64, theta float64) structs.Vec2
- func CalcAllForcesNode(star structs.Star2D, nodeID int64, theta float64) structs.Vec2
- func ConnectToDB(dbname string) *sql.DB
- func DeleteAllNodes(database *sql.DB)
- func DeleteAllStars(database *sql.DB)
- func GenForestTree(database *sql.DB, index int64) string
- func GetListOfStarIDs(db *sql.DB) []int64
- func GetListOfStarIDsTimestep(db *sql.DB, timestep int64) []int64
- func GetListOfStarsCsv(db *sql.DB) []string
- func GetListOfStarsGo(database *sql.DB) []structs.Star2D
- func GetListOfStarsTree(database *sql.DB, treeindex int64) []structs.Star2D
- func GetStar(db *sql.DB, starID int64) structs.Star2D
- func GetStarIDTimestep(db *sql.DB, starID int64) int64
- func InitNodesTable(db *sql.DB)
- func InitStarsTable(db *sql.DB)
- func InsertList(database *sql.DB, filename string)
- func InsertStar(database *sql.DB, star structs.Star2D, index int64) int64
- func NewTree(database *sql.DB, width float64)
- func UpdateCenterOfMass(database *sql.DB, index int64)
- func UpdateTotalMass(database *sql.DB, index int64)
Constants ¶
const ( DBUSER = "postgres" DBNAME = "postgres" DBSSLMODE = "disable" )
Variables ¶
This section is empty.
Functions ¶
func CalcAllForces ¶
func CalcAllForces(database *sql.DB, star structs.Star2D, galaxyIndex int64, theta float64) 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 CalcAllForcesNode ¶
calcAllForces nodes calculates the forces in between a sta log.Printf("Calculating the forces acting on the star %v", star)r and a node and returns the overall force TODO: implement the calcForce(star, centerOfMass) {...} function TODO: implement the getSubtreeIDs(nodeID) []int64 {...} function
func ConnectToDB ¶
connectToDB returns a pointer to an sql database writing to the database
func DeleteAllNodes ¶
deleteAll Stars deletes all the rows in the nodes table
func DeleteAllStars ¶
deleteAll Stars deletes all the rows in the stars table
func GenForestTree ¶
genForestTree generates a forest representation of the tree with the given index
func GetListOfStarIDs ¶
GetListOfStarIDs returns a list of all star ids in the stars table
func GetListOfStarIDsTimestep ¶
GetListOfStarIDs returns a list of all star ids in the stars table with the given timestep
func GetListOfStarsCsv ¶
getListOfStarsCsv returns an array of strings containing the coordinates of all the stars in the stars table
func GetListOfStarsGo ¶
getListOfStarsGo returns the list of stars in go struct format
func GetListOfStarsTree ¶
getListOfStarsTreeCsv returns an array of strings containing the coordinates of all the stars in the given tree
func GetStar ¶
GetStar returns the star with the given ID from the stars table
func GetStarIDTimestep ¶
getStarIDTimestep returns the timestep the given starID is currently inside of
func InsertList ¶
insertList inserts all the stars in the given .csv into the stars and nodes table
func InsertStar ¶
insertStar inserts the given star into the stars table and the nodes table tree
func NewTree ¶
newTree creates a new tree with the given width
func UpdateCenterOfMass ¶
updateCenterOfMass recursively updates the center of mass of all the nodes starting at the node with the given root index
Types ¶
This section is empty.