1 -- Glasgow Haskell 0.403 : FINITE ELEMENT PROGRAM V2
    2 -- **********************************************************************
    3 -- *                                                                    *
    4 -- * FILE NAME : printsource.hs         DATE : 13-3-1991                *
    5 -- *                                                                    *
    6 -- * CONTENTS : Print source data. Return source data as [char].        *
    7 -- *                                                                    *
    8 -- **********************************************************************
    9 
   10 module PrintSource(source_data) where
   11 
   12 import Database
   13 
   14 import DB_interface
   15 
   16 import Basics
   17 
   18 source_data :: (Array Int Int, Array Int Float) -> [Char]
   19 source_data db
   20       = 
   21         control_data db ++ 
   22         node_data db ++ 
   23         material_data db ++ 
   24         elements db ++ 
   25         plds db
   26 
   27 control_data db
   28       = "\n\n\nCONTROL DATA :\n\n" ++
   29         "   Total number of nodes = " ++ (showlj 3 (nnode db)) ++ "\n" ++
   30         "   Number of elements    = " ++ (showlj 3 (nelem db)) ++ "\n" ++
   31         "   Number of point loads = " ++ (showlj 3 (nplds db)) ++ "\n" ++
   32         "   Total number of materials = "++ (showlj 3 (nmats db)) ++ "\n\n\n"
   33 
   34 node_data db 
   35       = "NODE INFORMATION  :\n\n" ++
   36         (concat ( map a_node_s [1..(nnode db)] )) ++ "\n\n"
   37         where  
   38         a_node_s = a_node db
   39 
   40 a_node db node
   41       = "  Node.no = " ++ (showlj 3 node) ++  "   x = "
   42         ++ (showlj 8 x) ++ "   y = " ++ (showlj 8 y)
   43         ++ "   bc = " ++ ( showlj 3 bc) ++ "\n"
   44         where
   45         (x,y) = getnxy db node
   46         bc    = getnbc db node
   47 
   48 material_data db
   49       = "MATERIAL INFORMATION :\n\n"
   50         ++ (concat (map a_material_s [1..(nmats db)]))
   51         where
   52         a_material_s = a_material db
   53 
   54 a_material db material =
   55         "  Material No.=" ++ (showlj 3 material) ++ "   EA = "
   56         ++ (showlj 8 ea) ++ "   EI = " ++ (showlj 8 ei) ++ "\n"
   57         where
   58         (ea,ei) = getmpro db material
   59 
   60 elements db
   61       = "\nELEMENT DATA:\n\n" ++
   62         (concat (map (a_element_s) [1..(nelem db)])) ++ "\n\n"
   63         where
   64         a_element_s = a_element db
   65         
   66 a_element db element =
   67         "  Element No.=" ++ (showlj 3 element) ++ "   Node.L ="
   68         ++ (showlj 3 nodel) ++ "   Node.R =" ++ (showlj 3 noder)
   69         ++ "   Material No. =" ++ (showlj 3 material) ++ "\n"
   70         where
   71         (nodel,noder) = getenlr db element
   72         material      = getemat db element
   73 
   74 plds db
   75       = "\nPOINT LOADS DATA:\n\n" ++
   76         (concat (map (a_load_s) [1..(nplds db)])) ++ "\n\n"
   77         where
   78         a_load_s = a_load db
   79 
   80 a_load db n =
   81         "  To_point No." ++ (showlj 3 to_point) ++ "  Px = "
   82         ++ (showlj 9 px) ++ "  Py = " ++ (showlj 9 py)
   83         ++ "  M = " ++ (showlj 9 m) ++ "\n"
   84         where
   85         (to_point,px,py,m) = getpld db n
   86 
   87