feat: polish & windviz & deploy
This commit is contained in:
parent
81b8e763bd
commit
465ad00f7b
78 changed files with 20622 additions and 2154 deletions
|
|
@ -30,39 +30,30 @@ func (p *Profile) Run(t0 float64, launch State, events *EventSink) []Result {
|
|||
results := make([]Result, 0, len(p.Stages))
|
||||
t, s := t0, launch
|
||||
|
||||
for i := 0; i < len(p.Stages); i++ {
|
||||
stage := p.Stages[i]
|
||||
ctx := StageContext{
|
||||
ProfileStart: t0,
|
||||
PropagatorStart: t,
|
||||
Launch: launch,
|
||||
PropagatorState: s,
|
||||
Direction: p.Direction,
|
||||
}
|
||||
res := stage.run(ctx, t, s, p.Globals, events)
|
||||
for _, stage := range p.Stages {
|
||||
res := stage.run(p.context(t0, t, launch, s), t, s, p.Globals, events)
|
||||
results = append(results, res)
|
||||
|
||||
last := res.Points[len(res.Points)-1]
|
||||
t = last.Time
|
||||
s = State{Lat: last.Lat, Lng: last.Lng, Altitude: last.Altitude}
|
||||
t, s = res.Path.Last()
|
||||
|
||||
// Follow Fallback chains until none remains.
|
||||
for res.Outcome == OutcomeFallback && stage.Fallback != nil {
|
||||
stage = stage.Fallback
|
||||
ctx = StageContext{
|
||||
ProfileStart: t0,
|
||||
PropagatorStart: t,
|
||||
Launch: launch,
|
||||
PropagatorState: s,
|
||||
Direction: p.Direction,
|
||||
}
|
||||
res = stage.run(ctx, t, s, p.Globals, events)
|
||||
res = stage.run(p.context(t0, t, launch, s), t, s, p.Globals, events)
|
||||
results = append(results, res)
|
||||
last = res.Points[len(res.Points)-1]
|
||||
t = last.Time
|
||||
s = State{Lat: last.Lat, Lng: last.Lng, Altitude: last.Altitude}
|
||||
t, s = res.Path.Last()
|
||||
}
|
||||
}
|
||||
|
||||
return results
|
||||
}
|
||||
|
||||
// context builds the StageContext for a stage starting at (tStart, sStart).
|
||||
func (p *Profile) context(t0, tStart float64, launch, sStart State) StageContext {
|
||||
return StageContext{
|
||||
ProfileStart: t0,
|
||||
PropagatorStart: tStart,
|
||||
Launch: launch,
|
||||
PropagatorState: sStart,
|
||||
Direction: p.Direction,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue