feat: runtime as library

This commit is contained in:
Henri Saudubray 2025-06-30 16:45:23 +02:00
parent 8f6320b30e
commit dc8d941b84
Signed by: hms
GPG key ID: 7065F57ED8856128
24 changed files with 184 additions and 111 deletions

View file

@ -1,6 +1,16 @@
(env
(dev
(flags
(:standard -w -a))))
(rule
(targets sincosz_main.ml sincosz.ml sincosz.zci)
(targets sincosz.ml sincosz.zci)
(deps
(:zl sincosz.zls))
(action
(run zeluc -s f -o sincosz_main %{zl})))
(run zeluc %{zl})))
(executable
(public_name sincos.exe)
(name main)
(libraries std))

6
exm/zelus/sincos/main.ml Normal file
View file

@ -0,0 +1,6 @@
open Std
let input _ = ()
let output (now, (sin, cos)) = Format.printf "%.10e\t%.10e\t%.10e\n" now sin cos
let () = Runtime.go input Sincosz.g output

View file

@ -0,0 +1,21 @@
include Std
include Ztypes
include Solvers
module type IGNORE = sig end
module Defaultsolver : IGNORE = struct end
module Zlsrun = struct
module Make (S : IGNORE) = struct
let go s =
let s = Lift.lift_hsim s in
let open Hsim in
let state = (module State.InPlaceSimState : State.SimState) in
let solver =
Solver.solver (StatefulSundials.InPlace.csolve)
(Types.d_of_dc StatefulZ.InPlace.zsolve) in
let open Sim.Sim(val state) in
()
(* run_until_n (Utils.ignore 0 (run s solver)) 30. 1 ignore *)
end
end