mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-24 05:43:53 +00:00
This was a seperate repository in CVS and so it missed the conversion.
benchmarks/
As above.
31 lines
710 B
Haskell
31 lines
710 B
Haskell
--
|
|
-- Patricia Fasel
|
|
-- Los Alamos National Laboratory
|
|
-- 1990 August
|
|
--
|
|
module ElecField (elecField) where
|
|
|
|
import PicType
|
|
import Consts
|
|
import Data.Array
|
|
|
|
-- Phase III: Calculate electric fields
|
|
-- the x and y components of the electric field are approximated
|
|
-- by the first partial difference in each dimension
|
|
|
|
elecField :: Phi -> Electric
|
|
elecField phi =
|
|
(array ((0,0), (n,n))
|
|
([((i,j) , (phi!(i-1,j) - phi!(i,j)))
|
|
| i <- [1..n], j <- [0..n]]++
|
|
[((0,j) , (phi!(n,j) - phi!(0,j)))
|
|
| j <- [0..n]]),
|
|
|
|
array ((0,0), (n,n))
|
|
([((i,j) , (phi!(i,j+1) - phi!(i,j)))
|
|
| i <- [0..n], j <- [0..(n-1)]]++
|
|
[((i,n) , (phi!(i,0) - phi!(i,n)) )
|
|
| i <- [0..n]]))
|
|
where
|
|
n = nCell-1
|