From 72f9bd2c4362d98ba65c71da52c6f20169df2f97 Mon Sep 17 00:00:00 2001 From: Isaac Shoebottom Date: Mon, 3 Feb 2025 16:26:21 -0400 Subject: [PATCH] WIP --- Assignment/1/eikonal.jl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Assignment/1/eikonal.jl b/Assignment/1/eikonal.jl index 4ee7854..1ef7444 100644 --- a/Assignment/1/eikonal.jl +++ b/Assignment/1/eikonal.jl @@ -1,4 +1,5 @@ using DelimitedFiles +using Plots # Solves the Eikonal equation using the Fast Sweeping Method # Input is in file with name stored in source @@ -10,14 +11,17 @@ function solveEikonal(ni, nj, h, source, tol = 1E-6) U = ones(ni+2, nj+2) * Inf initialize!(F, U, ni, nj, source) maxerr = 1 + iters = 0 while maxerr > tol maxerr = 0 maxerr = sweep!(U, ni+1, 2, 2, nj+1, F, h, maxerr) # North-East maxerr = sweep!(U, ni+1, 2, nj+1, 2, F, h, maxerr) # North-West maxerr = sweep!(U, 2, ni+1, nj+1, 2, F, h, maxerr) # South-West maxerr = sweep!(U, 2, ni+1, 2, nj+1, F, h, maxerr) # South-East + iters += 1 end - U[2:ni+1, 2:nj+1] + # U[2:ni+1, 2:nj+1] + U end # Perform one set of sweeps on matrix U using directions specified in @@ -93,7 +97,7 @@ function initialize!(F, U, ni, nj, source) end # Call on file "ex1.txt" with the following format: -println(solveEikonal(7, 7, 1, "ex1.txt")) +display(solveEikonal(7, 7, 1, "ex1.txt")) # Call on file "test100.txt" with the following format: -# println(solveEikonal(100, 100, 1, "test100.txt")) \ No newline at end of file +heatmap(1:100, 1:100, solveEikonal(100, 100, 1, "test100.txt"), color=:gist_yarg) \ No newline at end of file