#lang scheme/base
(provide (all-defined-out))
(define-struct ode-step-type
(name
can-use-dydt-in?
gives-exact-dydt-out?
make
apply
reset
order))
(define-values (struct:ode-step
ode-step-constructor
ode-step?
ode-step-field-ref
set-ode-step-field!)
(make-struct-type 'ode-step #f 3 0))
(define (make-ode-step step-type dim)
(ode-step-constructor
step-type
dim
((ode-step-type-make step-type) dim)))
(define ode-step-step-type
(make-struct-field-accessor ode-step-field-ref 0 'step-type))
(define set-ode-stepper-step-type!
(make-struct-field-mutator set-ode-step-field! 0 'step-type))
(define ode-step-dimension
(make-struct-field-accessor ode-step-field-ref 1 'dimension))
(define set-ode-step-dimension!
(make-struct-field-mutator set-ode-step-field! 1 'dimension))
(define ode-step-state
(make-struct-field-accessor ode-step-field-ref 2 'state))
(define set-ode-step-state!
(make-struct-field-mutator set-ode-step-field! 2 'state))
(define (ode-step-name step)
(ode-step-type-name (ode-step-step-type step)))
(define (ode-step-order step)
((ode-step-type-order (ode-step-step-type step))
(ode-step-state step)))
(define (ode-step-apply step t h y y-err dydt-in dydt-out dydt)
((ode-step-type-apply (ode-step-step-type step))
(ode-step-state step) (ode-step-dimension step)
t h y y-err dydt-in dydt-out dydt))
(define (ode-step-reset step)
((ode-step-type-reset (ode-step-step-type step))
(ode-step-state step) (ode-step-dimension step)))