feat: support for model-requested horizons

This commit is contained in:
Henri Saudubray 2025-06-25 10:41:37 +02:00
parent 685de96eec
commit ac4e066bf8
Signed by: hms
GPG key ID: 7065F57ED8856128
24 changed files with 170 additions and 93 deletions

View file

@ -4,7 +4,7 @@ open Solvers
open Examples
open Common
open Types
open Lift
open Std.Lift
let sample = ref 1
let stop = ref 10.0
@ -53,12 +53,11 @@ let errmsg = "Usage: " ^ Sys.executable_name ^ " [OPTIONS] MODEL\nOptions are:"
let () = try Arg.parse (Arg.align opts) set_model errmsg with _ -> exit 2
let args = List.rev !modelargs
let () = ignore lift
let wrap_zelus (HNode m) =
let ret = Bigarray.(Array1.create Float64 c_layout 0) in
let fout s a y = ignore (m.fout s a y); ret in
let step s () = let _, s = m.step s () in ret, s in
let fout s t a y = ignore (m.fout s t a y); ret in
let step s t () = let _, s = m.step s t () in ret, s in
HNode { m with fout; step }
let m =
@ -67,7 +66,9 @@ let m =
match !model with
| None -> Format.eprintf "Missing model\n"; exit 2
| Some "ballz" -> wrap_zelus (lift Ballz.main)
| Some "ballzm" -> wrap_zelus (lift_hsim Ballz_main.main)
| Some "sincosz" -> wrap_zelus (lift Sincosz.f)
(* | Some "count" -> wrap_zelus (lift Count.count) *)
| Some s -> Format.eprintf "Unknown model: %s\n" s; exit 2
else
match !model with
@ -85,7 +86,7 @@ let st = if !inplace then (module State.InPlaceSimState : State.SimState)
else (module State.FunctionalSimState : State.SimState)
let output =
if !no_print then Output.ignore
if !no_print then Hsim.Utils.ignore
else if !speed then Output.print_h
else Output.print (* Output.ignore *)