1 {- 2 The calculation element factors and areas 3 4 XZ, 24/10/91 5 -} 6 7 {- 8 Modified to adopt S_arrays. 9 10 XZ, 19/2/92 11 -} 12 13 module Elefac ( get_el_det_fac ) where 14 15 import Defs 16 import S_Array -- not needed w/ proper module handling 17 import Norm -- ditto 18 19 ----------------------------------------------------------- 20 -- Calculating linear shape function factor and area -- 21 -- of each element. The first entry of the output -- 22 -- tuples is the element area and the second the element -- 23 -- factor. Called at the data setup stage. -- 24 ----------------------------------------------------------- 25 26 get_el_det_fac 27 :: Int -> (My_Array Int (Frac_type,Frac_type)) 28 -> (My_Array Int [Int]) 29 -> (My_Array Int (Frac_type,((Frac_type,Frac_type,Frac_type), 30 (Frac_type,Frac_type,Frac_type)))) 31 get_el_det_fac e_total coord p_steer = 32 s_listArray (1,e_total) 33 [ 34 (coord!^n1) `bindTo` ( \ (x1,y1) -> 35 (coord!^n2) `bindTo` ( \ (x2,y2) -> 36 (coord!^n3) `bindTo` ( \ (x3,y3) -> 37 ((x2-x1)*(y3-y1)-(x1-x3)*(y1-y2)) `bindTo` ( \ e_det -> 38 39 ( 40 ((abs (e_det)) / 2), 41 ( 42 ( 43 (y2-y3)/e_det, 44 (y3-y1)/e_det, 45 (y1-y2)/e_det 46 ), 47 ( 48 (x3-x2)/e_det, 49 (x1-x3)/e_det, 50 (x2-x1)/e_det 51 ) 52 ) 53 ) )))) 54 | [n1,n2,n3] <- s_elems p_steer 55 ] 56 where 57 bindTo x k = k x