db_actions

package module
v0.0.0-...-e0d8434 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

README

GoDoc Go Report Card

db_actions

Documentation

Index

Constants

View Source
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

func CalcAllForcesNode(star structs.Star2D, nodeID int64, theta float64) structs.Vec2

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

func ConnectToDB(dbname string) *sql.DB

connectToDB returns a pointer to an sql database writing to the database

func DeleteAllNodes

func DeleteAllNodes(database *sql.DB)

deleteAll Stars deletes all the rows in the nodes table

func DeleteAllStars

func DeleteAllStars(database *sql.DB)

deleteAll Stars deletes all the rows in the stars table

func GenForestTree

func GenForestTree(database *sql.DB, index int64) string

genForestTree generates a forest representation of the tree with the given index

func GetListOfStarIDs

func GetListOfStarIDs(db *sql.DB) []int64

GetListOfStarIDs returns a list of all star ids in the stars table

func GetListOfStarIDsTimestep

func GetListOfStarIDsTimestep(db *sql.DB, timestep int64) []int64

GetListOfStarIDs returns a list of all star ids in the stars table with the given timestep

func GetListOfStarsCsv

func GetListOfStarsCsv(db *sql.DB) []string

getListOfStarsCsv returns an array of strings containing the coordinates of all the stars in the stars table

func GetListOfStarsGo

func GetListOfStarsGo(database *sql.DB) []structs.Star2D

getListOfStarsGo returns the list of stars in go struct format

func GetListOfStarsTree

func GetListOfStarsTree(database *sql.DB, treeindex int64) []structs.Star2D

getListOfStarsTreeCsv returns an array of strings containing the coordinates of all the stars in the given tree

func GetStar

func GetStar(db *sql.DB, starID int64) structs.Star2D

GetStar returns the star with the given ID from the stars table

func GetStarIDTimestep

func GetStarIDTimestep(db *sql.DB, starID int64) int64

getStarIDTimestep returns the timestep the given starID is currently inside of

func InitNodesTable

func InitNodesTable(db *sql.DB)

func InitStarsTable

func InitStarsTable(db *sql.DB)

func InsertList

func InsertList(database *sql.DB, filename string)

insertList inserts all the stars in the given .csv into the stars and nodes table

func InsertStar

func InsertStar(database *sql.DB, star structs.Star2D, index int64) int64

insertStar inserts the given star into the stars table and the nodes table tree

func NewTree

func NewTree(database *sql.DB, width float64)

newTree creates a new tree with the given width

func UpdateCenterOfMass

func UpdateCenterOfMass(database *sql.DB, index int64)

updateCenterOfMass recursively updates the center of mass of all the nodes starting at the node with the given root index

func UpdateTotalMass

func UpdateTotalMass(database *sql.DB, index int64)

updateTotalMass gets a tree index and returns the nodeID of the trees root node

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL