Paraiso-0.0.0.0: a code generator for partial differential equations solvers.

Language.Paraiso.OM.Builder.Internal

Description

A monadic library to build dataflow graphs for OM. Builder is only for Graph vector gauge () . Graphs with other annotation types can be created by fmap. This module exports everything, for writing other Builder modules.

Synopsis

Documentation

type Builder vector gauge val = State (BuilderState vector gauge) valSource

The Builder monad is used to build Kernels.

data BuilderState vector gauge Source

Constructors

BuilderState 

Fields

setup :: Setup vector gauge
 
target :: Graph vector gauge ()
 

Instances

(Show (vector gauge), C gauge, Vector vector) => Show (BuilderState vector gauge) 
Eq (Builder v g v2) 
(Vector v, C g, TRealm r, Typeable c, C c, Fractional c) => Fractional (Builder v g (Value r c))

you can convert GHC floating point immediates to Builder.

(Vector v, C g, TRealm r, Typeable c, C c) => Num (Builder v g (Value r c))

you can convert GHC numeric immediates to Builder.

Show (Builder v g v2) 
(Vector v, C g, TRealm r, Typeable c) => C (Builder v g (Value r c))

choose the larger or the smaller of the two.

(Vector v, C g, TRealm r, Typeable c, C c) => C (Builder v g (Value r c)) 
(Vector v, C g, TRealm r, Typeable c, C c) => C (Builder v g (Value r c))

Builder is Algebraic C. You can use sqrt and so on.

(Vector v, C g, TRealm r, Typeable c, C c) => C (Builder v g (Value r c))

Builder is Field C. You can use /, recip.

(Vector v, C g, TRealm r, Typeable c, C c) => C (Builder v g (Value r c)) 
(Vector v, C g, TRealm r, Typeable c, C c) => C (Builder v g (Value r c))

Builder is Ring C. You can use one, *.

(Vector v, C g, TRealm r, Typeable c) => C (Builder v g (Value r c)) 
(Vector v, C g, TRealm r, Typeable c, C c) => C (Builder v g (Value r c))

Builder is Additive C. You can use zero, +, -, negate.

(Vector v, C g, TRealm r) => Boolean (Builder v g (Value r Bool))

Builder is Boolean. You can use true, false, not, &&, ||.

type B a = (Vector v, C g) => Builder v g aSource

type BuilderOf r c = (Vector v, C g) => Builder v g (Value r c)Source

makeKernelSource

Arguments

:: (Vector v, C g) 
=> Setup v g

The Orthotope machine setup.

-> Name

The name of the kernel.

-> Builder v g ()

The builder monad.

-> Kernel v g ()

The created kernel.

Create a Kernel from a Builder monad.

initState :: Setup v g -> BuilderState v gSource

Create an initial state for Builder monad from a OM Setup.

modifyGSource

Arguments

:: (Vector v, C g) 
=> (Graph v g () -> Graph v g ())

The graph modifying function.

-> Builder v g ()

The state gets silently modified.

Modify the dataflow graph stored in the Builder.

getG :: (Vector v, C g) => Builder v g (Graph v g ())Source

Get the graph stored in the Builder.

freeNode :: B NodeSource

get the number of the next unoccupied Node in the graph.

addNodeSource

Arguments

:: (Vector v, C g) 
=> [Node]

The list of dependent nodes. The order is recorded.

-> Node v g ()

The new node to be added

-> Builder v g Node 

add a node to the graph.

valueToNode :: (TRealm r, Typeable c) => Value r c -> B NodeSource

convert a Value to a

lookUpStatic :: Named DynValue -> B ()Source

look up the Named DynValue with the correct name and type is included in the staticValues of the BuilderState

loadSource

Arguments

:: (TRealm r, Typeable c) 
=> r

The TRealm type.

-> c

The content type.

-> Name

The Name of the static value to load.

-> B (Value r c)

The loaded TLocal Value as a result.

Load from a static value.

storeSource

Arguments

:: (Vector v, C g, TRealm r, Typeable c) 
=> Name

The Name of the static value to store.

-> Builder v g (Value r c)

The Value to be stored.

-> Builder v g ()

The result.

Store to a static value.

reduceSource

Arguments

:: (Vector v, C g, Typeable c) 
=> Operator

The reduction Operator.

-> Builder v g (Value TLocal c)

The TLocal Value to be reduced.

-> Builder v g (Value TGlobal c)

The TGlobal Value that holds the reduction result.

Reduce over a TLocal Value using the specified reduction Operator to make a TGlobal Value

broadcastSource

Arguments

:: (Vector v, C g, Typeable c) 
=> Builder v g (Value TGlobal c)

The TGlobal Value to be broadcasted.

-> Builder v g (Value TLocal c)

The TLocal Value, all of them containing the global value.

Broadcast a TGlobal Value to make it a TLocal Value

shiftSource

Arguments

:: (Vector v, C g, Typeable c, C (v g)) 
=> v g

The amount of shift

-> Builder v g (Value TLocal c)

The TLocal Value to be shifted

-> Builder v g (Value TLocal c)

The shifted TLocal Value as a result.

Shift a TLocal Value with a constant vector.

loadIndexSource

Arguments

:: (Vector v, C g, Typeable c) 
=> c

The content type.

-> Axis v

The axis for which index is required

-> Builder v g (Value TLocal c)

The TLocal Value that contains the address as a result.

Load the Axis component of the mesh address, to a TLocal Value.

immSource

Arguments

:: (TRealm r, Typeable c) 
=> c

A Haskell value of type c to be stored.

-> B (Value r c)

TLocal Value with the c stored.

Create an immediate Value from a Haskell concrete value. TRealm is type-inferred.

mkOp1Source

Arguments

:: (Vector v, C g, TRealm r, Typeable c) 
=> Operator

The operator symbol

-> Builder v g (Value r c)

Input

-> Builder v g (Value r c)

Output

Make a unary operator

mkOp2Source

Arguments

:: (Vector v, C g, TRealm r, Typeable c) 
=> Operator

The operator symbol

-> Builder v g (Value r c)

Input 1

-> Builder v g (Value r c)

Input 2

-> Builder v g (Value r c)

Output

Make a binary operator