chore: improve main
This commit is contained in:
parent
ebcceefe4c
commit
3b5e01b163
1 changed files with 10 additions and 9 deletions
|
|
@ -9,16 +9,16 @@ let stop = ref 30.0
|
|||
let greedy = ref false
|
||||
let inplace = ref false
|
||||
let steps = ref 1
|
||||
let model = ref ""
|
||||
let model = ref None
|
||||
|
||||
let gt0i v i = v := if i <= 0 then 1 else i
|
||||
let gt0f v f = v := if f <= 0.0 then 1.0 else f
|
||||
let hasmodel = ref false
|
||||
let modelargs = ref []
|
||||
|
||||
let set_model s =
|
||||
if !hasmodel then modelargs := s :: !modelargs
|
||||
else model := s; hasmodel := true
|
||||
match !model with
|
||||
| None -> model := Some s
|
||||
| Some _ -> modelargs := s :: !modelargs
|
||||
|
||||
let opts = [
|
||||
"-sample", Arg.Int (gt0i sample), "n \tSample count (default=10)";
|
||||
|
|
@ -40,11 +40,12 @@ let z = StatefulZ.(Functional.zsolve)
|
|||
let s = Solver.solver_c c z
|
||||
open Format
|
||||
let m = match !model with
|
||||
| "ball" -> Ball.bouncing_ball
|
||||
| "vdp" -> Vdp.van_der_pol
|
||||
| "sincos" -> Sincos.sinus_cosinus
|
||||
| "sqrt" -> Sqrt.sqrt
|
||||
| _ -> eprintf "Unknown model: %s\n" !model; exit 2
|
||||
| None -> eprintf "Missing model\n"; exit 2
|
||||
| Some "ball" -> Ball.bouncing_ball
|
||||
| Some "vdp" -> Vdp.van_der_pol
|
||||
| Some "sincos" -> Sincos.sinus_cosinus
|
||||
| Some "sqrt" -> Sqrt.sqrt
|
||||
| Some s -> eprintf "Unknown model: %s\n" s; exit 2
|
||||
let m = try m !modelargs with Invalid_argument s -> eprintf "%s\n" s; exit 2
|
||||
|
||||
let state = if !inplace then (module State.InPlaceSimState : State.SimState)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue