feat: re-hide inner states, properly reset sundials
This commit is contained in:
parent
80d4aef23f
commit
76dc461d44
14 changed files with 162 additions and 253 deletions
11
exm/ball.ml
11
exm/ball.ml
|
|
@ -40,17 +40,16 @@ let step ({ zin; lx; _ } as s) zfalse =
|
|||
of_array [| -. 0.8 *. lx.{0}; 0.0; lx.{2}; lx.{3} |] else lx in
|
||||
of_array [| s.lx.{1} |], { zin=zfalse; lx; i=false }
|
||||
|
||||
let bouncing_ball ()
|
||||
: (state, _, _, carray, carray, carray, zarray, carray) hnode
|
||||
= let yd = cmake csize in
|
||||
let bouncing_ball () : (_, _, carray, carray, carray, zarray, carray) hnode =
|
||||
let yd = cmake csize in
|
||||
let zout = cmake zsize in
|
||||
let zfalse = zmake 1 in
|
||||
let fder _ _ y = fder y yd in
|
||||
let fzer _ _ y = fzer y zout in
|
||||
let step s _ = step s zfalse in
|
||||
let init _ = { zin=zfalse; lx=of_array [|y'0;y0;x'0;x0|]; i=true } in
|
||||
let reset _ _ = init () in
|
||||
HNode { init; fder; fzer; fout; step; reset; horizon;
|
||||
let state = { zin=zfalse; lx=of_array [|y'0;y0;x'0;x0|]; i=true } in
|
||||
let reset _ _ = state in
|
||||
HNode { state; fder; fzer; fout; step; reset; horizon;
|
||||
jump; cset; cget; zset; csize; zsize }
|
||||
|
||||
let errmsg = "Too many arguments for the model (needed: 0)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue