1 -- 2 -- Patricia Fasel 3 -- Los Alamos National Laboratory 4 -- 1990 August 5 -- 6 module Output (outGamteb) where 7 8 import GamtebType 9 import Consts 10 import Utils 11 import InitTable 12 import Array--1.3 13 14 outGamteb :: Int -> [Stat] -> [Result] -> [Char] 15 outGamteb nPart stats results = 16 "Number of particles " ++ show nPart ++ "\n" 17 ++ outXsectTbl 18 ++ outResultsRaw results 19 ++ outStats stats 20 ++ outResults results 21 22 23 -- output the result of particle transformations 24 -- outResults :: [Result] -> [Char] 25 outResults results = 26 "\nScatter, Escape, Transit tables:\n" ++ show resArray 27 where 28 resArray = accumArray (+) 0 ((1, 1), (numExit, numLev)) results 29 30 31 -- print statistics 32 -- outStats :: [Stat] -> [Char] 33 outStats stats = 34 showStats titles statList 35 where 36 statArray = accumArray (+) 0 (1, numStat) stats 37 statList = elems statArray 38 titles = ["Number of escapes: ", 39 "Number of transits: ", 40 "Number of scatters: ", 41 "Number of energy kills: ", 42 "Number of weight kills: ", 43 "Number of roulettes: ", 44 "Number of splits: ", 45 "Number of collisions: ", 46 "Number of noncollisions: ", 47 "Number of roulettes kills: ", 48 "Weight of roulette kills: ", 49 "Weight of roulette gains: "] 50 showStats [] [] = "" 51 showStats (t:ts) (s:ss) = t ++ show s ++ "\n" ++ showStats ts ss 52 53 54 -- output result list 55 outResultsRaw :: [Result] -> [Char] 56 outResultsRaw [] = [] 57 outResultsRaw (((i, t), w):rs) = 58 "Result: index " ++ show i 59 ++ " type " ++ show t 60 ++ " weight " ++ show w ++ "\n" 61 ++ outResultsRaw rs 62 63 64 -- print cross section tables of constant data 65 outXsectTbl :: [Char] 66 outXsectTbl = 67 "\nEnergy table:\n" ++ show (ergs!1) 68 ++ "\nCompton table:\n" ++ show (xComp!1) 69 ++ "\nPair table:\n" ++ show (xPair!1) 70 ++ "\nPhoto table:\n" ++ show (xPhot!1) ++ "\n"