feat: sundials
This commit is contained in:
parent
6cec3d6c5d
commit
80d4aef23f
8 changed files with 33 additions and 34 deletions
|
|
@ -52,26 +52,28 @@ let st = if !inplace then (module State.InPlaceSimState : State.SimState)
|
|||
else (module State.FunctionalSimState : State.SimState)
|
||||
|
||||
let () =
|
||||
(* if !sundials then *)
|
||||
(* if !greedy then *)
|
||||
(* (Format.eprintf "Sundials does not support greedy simulation\n"; exit 2) *)
|
||||
(* else *)
|
||||
(* let open StatefulSundials in *)
|
||||
(* let c = if !inplace then (module InPlace : Csolver.Csolver) *)
|
||||
(* else (module Functional : Csolver.Csolver) in *)
|
||||
(* let open (val c) in let open (val z) in *)
|
||||
(* let s = Solver.solver csolve (d_of_dc zsolve) in *)
|
||||
(* let open Sim.LazySim(val st) in run_until_n m s *)
|
||||
(* else *)
|
||||
let open (val m) in
|
||||
let m = init !modelargs in
|
||||
let open StatefulRK45 in
|
||||
let c = if !inplace then (module InPlace : Csolver.CsolverC)
|
||||
else (module Functional : Csolver.CsolverC) in
|
||||
let open (val c) in let open (val z) in
|
||||
let s = Solver.solver_c csolve zsolve in
|
||||
let sim = if !greedy then let open Sim.GreedySim(val st) in run_until_n m s
|
||||
else let open Sim.LazySim(val st) in run_until_n m (d_of_dc s) in
|
||||
let sim =
|
||||
if !sundials then
|
||||
if !greedy then
|
||||
(Format.eprintf "Sundials does not support greedy simulation\n"; exit 2)
|
||||
else
|
||||
let open StatefulSundials in
|
||||
let c = if !inplace then (module InPlace : Csolver.Csolver)
|
||||
else (module Functional : Csolver.Csolver) in
|
||||
let open (val c) in let open (val z) in
|
||||
let s = Solver.solver csolve (d_of_dc zsolve) in
|
||||
let open Sim.LazySim(val st) in run_until_n m s
|
||||
else
|
||||
let open StatefulRK45 in
|
||||
let c = if !inplace then (module InPlace : Csolver.CsolverC)
|
||||
else (module Functional : Csolver.CsolverC) in
|
||||
let open (val c) in let open (val z) in
|
||||
let s = Solver.solver_c csolve zsolve in
|
||||
if !greedy then let open Sim.GreedySim(val st) in run_until_n m s
|
||||
else let open Sim.LazySim(val st) in run_until_n m (d_of_dc s)
|
||||
in
|
||||
let open Solver in
|
||||
let HNode { init; csize; zsize; fder; fzer; cget; _ } = m in
|
||||
let state = init () in
|
||||
|
|
|
|||
|
|
@ -2,7 +2,4 @@
|
|||
|
||||
(library
|
||||
(name solvers)
|
||||
(libraries
|
||||
hsim
|
||||
;sundialsml
|
||||
))
|
||||
(libraries hsim sundialsml))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(*
|
||||
|
||||
open Hsim.Types
|
||||
open Hsim.Solver
|
||||
open Zls
|
||||
|
|
@ -68,4 +68,4 @@ module InPlace : Csolver.Csolver =
|
|||
|
||||
DNode { init; reset; step }
|
||||
end
|
||||
*)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue