module Simulation.Aivika.Dynamics.Interpolate
(initDynamics,
discreteDynamics,
interpolateDynamics) where
import Simulation.Aivika.Internal.Specs
import Simulation.Aivika.Internal.Dynamics
initDynamics :: Dynamics a -> Dynamics a
initDynamics (Dynamics m) =
Dynamics $ \p ->
let sc = pointSpecs p
in m $ p { pointTime = basicTime sc 0 0,
pointIteration = 0,
pointPhase = 0 }
discreteDynamics :: Dynamics a -> Dynamics a
discreteDynamics (Dynamics m) =
Dynamics $ \p ->
if pointPhase p == 0 then
m p
else
let sc = pointSpecs p
n = pointIteration p
in m $ p { pointTime = basicTime sc n 0,
pointPhase = 0 }
interpolateDynamics :: Dynamics a -> Dynamics a
interpolateDynamics (Dynamics m) =
Dynamics $ \p ->
if pointPhase p >= 0 then
m p
else
let sc = pointSpecs p
n = pointIteration p
in m $ p { pointTime = basicTime sc n 0,
pointPhase = 0 }