Last active
January 13, 2026 08:31
-
-
Save hovsep/27d1460172a2220de85da3653cdd032b to your computer and use it in GitHub Desktop.
Simulation mesh wrapped into step_sim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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