aivika-4.5: A multi-method simulation library

CopyrightCopyright (c) 2009-2016, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Simulation.Aivika.Dynamics

Contents

Description

Tested with: GHC 8.0.1

The module defines the Dynamics monad representing a time varying polymorphic function.

Synopsis

Dynamics Monad

data Dynamics a Source #

A value in the Dynamics monad represents a polymorphic time varying function.

Instances

Monad Dynamics Source # 

Methods

(>>=) :: Dynamics a -> (a -> Dynamics b) -> Dynamics b #

(>>) :: Dynamics a -> Dynamics b -> Dynamics b #

return :: a -> Dynamics a #

fail :: String -> Dynamics a #

Functor Dynamics Source # 

Methods

fmap :: (a -> b) -> Dynamics a -> Dynamics b #

(<$) :: a -> Dynamics b -> Dynamics a #

MonadFix Dynamics Source # 

Methods

mfix :: (a -> Dynamics a) -> Dynamics a #

Applicative Dynamics Source # 

Methods

pure :: a -> Dynamics a #

(<*>) :: Dynamics (a -> b) -> Dynamics a -> Dynamics b #

(*>) :: Dynamics a -> Dynamics b -> Dynamics b #

(<*) :: Dynamics a -> Dynamics b -> Dynamics a #

MonadIO Dynamics Source # 

Methods

liftIO :: IO a -> Dynamics a #

ParameterLift Dynamics Source # 
SimulationLift Dynamics Source # 
DynamicsLift Dynamics Source # 
ResultComputing Dynamics Source # 
Eq (Dynamics a) Source # 

Methods

(==) :: Dynamics a -> Dynamics a -> Bool #

(/=) :: Dynamics a -> Dynamics a -> Bool #

Floating a => Floating (Dynamics a) Source # 
Fractional a => Fractional (Dynamics a) Source # 
Num a => Num (Dynamics a) Source # 
Show (Dynamics a) Source # 

Methods

showsPrec :: Int -> Dynamics a -> ShowS #

show :: Dynamics a -> String #

showList :: [Dynamics a] -> ShowS #

class DynamicsLift m where Source #

A type class to lift the Dynamics computations to other computations.

Minimal complete definition

liftDynamics

Methods

liftDynamics :: Dynamics a -> m a Source #

Lift the specified Dynamics computation to another computation.

runDynamicsInStartTime :: Dynamics a -> Simulation a Source #

Run the Dynamics computation in the initial time point.

runDynamicsInStopTime :: Dynamics a -> Simulation a Source #

Run the Dynamics computation in the final time point.

runDynamicsInIntegTimes :: Dynamics a -> Simulation [IO a] Source #

Run the Dynamics computation in all integration time points.

runDynamicsInTime :: Double -> Dynamics a -> Simulation a Source #

Run the Dynamics computation in the specified time point.

runDynamicsInTimes :: [Double] -> Dynamics a -> Simulation [IO a] Source #

Run the Dynamics computation in the specified time points.

Error Handling

catchDynamics :: Exception e => Dynamics a -> (e -> Dynamics a) -> Dynamics a Source #

Exception handling within Dynamics computations.

finallyDynamics :: Dynamics a -> Dynamics b -> Dynamics a Source #

A computation with finalization part like the finally function.

throwDynamics :: Exception e => e -> Dynamics a Source #

Like the standard throw function.

Simulation Time

time :: Dynamics Double Source #

Computation that returns the current simulation time.

isTimeInteg :: Dynamics Bool Source #

Whether the current time is an integration time.

integIteration :: Dynamics Int Source #

Return the integration iteration closest to the current simulation time.

integPhase :: Dynamics Int Source #

Return the integration phase for the current simulation time. It is (-1) for non-integration time points.

Debugging

traceDynamics :: String -> Dynamics a -> Dynamics a Source #

Show the debug message with the current simulation time.