Hi all!
First of all, thanks for reading.
I am trying to enhance the performance of this function and I wonder if there is a more Julian way to write it in order to make it faster!
I have 4 variables that I update inside a function ray0 and ray 1 and vectors and Time0 and Time1 are variables.
ray0 gets updated and Time0 recomputed in the while loop, and become ray1 and Time1 is computed. Now, the functions that I call output a new array that I am saving with the corresponding name, and then I rewrite ray0 and Time0 before the next iteration.
Is there a better way to do this?
Thanks for reading!
"This is a function that follows the Um and Thurber Pseudo Pending Algorithm"
function PBUT(ray0::Array{Float64, 2},f::Float64,P::Float64,F_V::Interpolations.GriddedInterpolation{Float64, 3, Float64, Gridded{Linear}, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}},F_S::Interpolations.GriddedInterpolation{Float64, 3, Float64, Gridded{Linear}, Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}})
# First add the central node
ray0=DoublePoints(ray0)
#p=plot(ray0[:,1],ray0[:,3],marker=:circle,yflip=true)
Time0=TravelTime(ray0,F_S);
Time1=copy(Time0);
dT=1;
# Add the necessary nodes & compute Travel Time
while dT>P
ray1=MoveNodes(ray0,f,F_V);
Time1=TravelTime(ray1,F_S);
dT=abs(Time0-Time1);
#plot!(p,ray1[:,1],ray1[:,3],marker=:circle)
#println("Paso1: dT= $dT")
ray0=copy(ray1);
Time0=copy(Time1);
if dT<=P
ray0=DoublePoints(ray1);
Time0=TravelTime(ray0,F_S);
ray1=MoveNodes(ray0,1.9,F_V);
Time1=TravelTime(ray1,F_S);
dT=abs(Time0-Time1);
#println("Paso2: dT= $dT")
#plot!(p,ray1[:,1],ray1[:,3],marker=:circle)
ray0=copy(ray1);
Time0=copy(Time1);
end
end
return Time0,ray0
end