Skip to content

Commit

Permalink
Attempted fix again, last commit on this for the night, need to focus…
Browse files Browse the repository at this point in the history
… on thesis changes
  • Loading branch information
ChristopherRabotin committed Apr 17, 2017
1 parent 07c05d5 commit 6881d68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion cmd/designer/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func StreamResults(prefix string, planets []smd.CelestialObject, rsltChan <-chan
}
for rslt := range rsltChan {
f.WriteString(rslt.CSV() + "\n")
wg.Done() // Call to release CPU
}
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/designer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ func main() {
vInfIn := []float64{vInfInVec.At(0, 0), vInfInVec.At(1, 0), vInfInVec.At(2, 0)}
prevResult := NewResult(launchDT, c3, len(planets)-1)
cpuChan <- true
wg.Add(1)
go GAPCP(arrivalDT, flybys[0], 0, vInfIn, prevResult)
wg.Add(1)
}
}
log.Println("[info] All valid launches started")
Expand Down Expand Up @@ -301,7 +301,6 @@ func GAPCP(launchDT time.Time, inFlyby Flyby, planetNo int, vInfIn []float64, pr
result.arrival = nextPlanetArrivalDT
result.vInf = vinfArr
rsltChan <- result
//wg.Done()
} else if ultraDebug {
log.Printf("[NOK ] vInf @ %s: %f km/s", toPlanet.Name, vinfArr)
}
Expand Down Expand Up @@ -359,12 +358,12 @@ func GAPCP(launchDT time.Time, inFlyby Flyby, planetNo int, vInfIn []float64, pr
result.arrival = arrivalDT
result.vInf = vinfArr
rsltChan <- result
//wg.Done()
} else if ultraDebug {
log.Printf("[NOK ] vInf @ %s on %s->%s: %f km/s", toPlanet.Name, depDT, arrivalDT, vinfArr)
}
// All done, let's free that CPU
<-cpuChan
wg.Done() // Call to release CPU
} else {
// Recursion, note the -1 to create the Next (since there is an inversion between planet velocity and the spacecraft vector)
vInfInNext := []float64{vInfNextInVecs[depDT][arrIdx].At(0, 0), vInfNextInVecs[depDT][arrIdx].At(1, 0), vInfNextInVecs[depDT][arrIdx].At(2, 0)}
Expand All @@ -377,6 +376,7 @@ func GAPCP(launchDT time.Time, inFlyby Flyby, planetNo int, vInfIn []float64, pr
// Won't go anywhere, let's move onto another date. and clear queue if needed.
select {
case <-cpuChan:
wg.Done() // Call to release CPU
continue
default:
continue
Expand Down

0 comments on commit 6881d68

Please sign in to comment.