Skip to content

Instantly share code, notes, and snippets.

@hovsep
Last active January 13, 2026 08:31
Show Gist options
  • Select an option

  • Save hovsep/27d1460172a2220de85da3653cdd032b to your computer and use it in GitHub Desktop.

Select an option

Save hovsep/27d1460172a2220de85da3653cdd032b to your computer and use it in GitHub Desktop.
Simulation mesh wrapped into step_sim
// I like my main func to be clean and short
func main() {
simMesh := getSimulationMesh()
// Run the mesh in a step simulation
step_sim.NewApp(simMesh, initSim).Run()
}
// Here is our step_sim wrapper, it provides REPL and some built-in commands: pause, resume, exit, help
func NewApp(fm *fmesh.FMesh, simInitFunc SimInitFunc) *Application {
cmdChan := make(chan Command)
ctx, cancel := context.WithCancel(context.Background())
app := &Application{
ctx: ctx,
cancel: cancel,
cmdChan: cmdChan,
REPL: NewREPL(cmdChan),
sim: NewSimulation(ctx, cmdChan, fm).Init(simInitFunc),
}
return app
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment