1 -- Glasow Haskell 0.403 : FINITE ELEMENT PROGRAM V2
    2 -- **********************************************************************
    3 -- *                                                                    *
    4 -- * FILE NAME : assemble_loadvec.hs          DATE : 13-3-1991          *
    5 -- *                                                                    *
    6 -- * CONTENTS : Assemble the global load vector.                        *
    7 -- *                                                                    *
    8 -- **********************************************************************
    9 
   10 module Assemble_loadvec (loadvec) where
   11 
   12 import Basics
   13 import Vector
   14 import DB_interface
   15 import Degrees
   16 
   17 loadvec :: (Array Int Int, Array Int Float) -> Vec Float
   18 
   19 loadvec s =
   20         incrvec initial_value index_value_assoc_s
   21         where
   22         initial_value = makevec (ndgrs s) ( \ i -> 0.0 )
   23         index_value_assoc_s = index_value_assoc s 
   24 
   25 index_value_assoc s =
   26         foldl assemble_s [] [1 .. (nplds s)]
   27         where
   28         assemble_s = assemble s 
   29 
   30 assemble  s till_now_d ii =
   31         till_now_d ++ d_this'
   32         where
   33         d_this' = filter valid_degree (azip degrees loads)
   34         valid_degree (dgr , x) = (dgr /=0)
   35         degrees = getndgr s node
   36         loads   = [px,py,m]
   37         (node,px,py,m) = getpld s ii