1 parent b650414 commit 46f1e2e01cfbba9d60bcbd0b46f63946230b7708
Showing with 14 additions and 12 deletions.
1. +2 −1 Numeric/Funfem.hs
2. +7 −7 Numeric/Funfem/Assembly.hs
3. +4 −4 Numeric/Funfem/Elements.hs
4. +1 −0 funfem.cabal
 @@ -1,8 +1,9 @@ module Numeric.Funfem ( module Numeric.Funfem.Algebra ,module Numeric.Funfem.Elements + ,module Numeric.Funfem.Assembly ) where import Numeric.Funfem.Algebra import Numeric.Funfem.Elements - +import Numeric.Funfem.Assembly
 @@ -14,17 +14,17 @@ module Numeric.Funfem.Assembly where -- | Derivative of function with respect to variable position -df :: Int -> -- ^ variable number - ([Double] -> Double) -> -- | function to differentiate - [Double] -> Double +df :: Int -- ^ @n@ variable number + -> ([Double] -> Double) -- ^ @f@ function to differentiate + -> [Double] -> Double df n f = let h = 0.001 in \x -> (f (take (n-1) x ++ [x !! (n-1) + h] ++ drop n x) - f x) / h -- | Integration function using Simpson's rule -intf :: ([Double] -> Double) -> -- | function to integrate - Double -> -- | lower bound of integral - Double -> -- | upper bound of integral - Double +intf :: ([Double] -> Double) -- ^ @f@ function to integrate + -> Double -- ^@a@ lower bound of integral + -> Double -- ^@b@ upper bound of integral + -> Double intf f a b = (f [a] + 4 * f [(a+b)/2.0] + f [b]) * (b-a)/ 6.0
 @@ -26,7 +26,7 @@ type Material = M.Map String Double class Element a where nodes :: a -> [Node] material :: a -> Material - shape :: a -> [([Double] -> Double)] + shape :: a -> [[Double] -> Double] -- | Linear line element. data Lin2 = Lin2 {nodesLin2 :: [Node], matLin2 :: Material} @@ -38,7 +38,7 @@ coorsLin2 el = map (head . coordinates) \$ nodesLin2 el lengthLin2 :: Lin2 -> Double lengthLin2 el = let [x1,x2] = coorsLin2 el in abs (x1 - x2) -shapeLin2 :: Lin2 -> [([Double] -> Double)] +shapeLin2 :: Lin2 -> [[Double] -> Double] shapeLin2 el = [f1, f2] where l = lengthLin2 el @@ -54,10 +54,10 @@ instance Element Lin2 where -{- + n1 = Node [0.0] 1 n2 = Node [1.0] 2 mat = M.fromList [("conductivity", 1.0)] el1 = Lin2 [n1,n2] mat --} +
 @@ -24,5 +24,6 @@ library Numeric.Funfem, Numeric.Funfem.Algebra, Numeric.Funfem.Elements + Numeric.Funfem.Assembly ghc-options: -Wall -O2