Skip to content

Commit a5e05c4

Browse files
committed
Modified Setup_geometry
1 parent 7a3e317 commit a5e05c4

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/Setup_geometry.jl

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ function compute_thermal_structure(Temp, X, Y, Z, Phase, s::SpreadingRateTemp, s
12211221
Distance = perpendicular_distance_to_segment(px, py, x1, y1, x2, y2)
12221222

12231223
# Calculate thermal age
1224-
ThermalAge = abs(Distance * 1e3 * 1e2) / SpreadingVel + AgeRidge * 1e6 # Thermal age in years
1224+
ThermalAge = abs(Distance * 1e5) / SpreadingVel + AgeRidge * 1e6 # Thermal age in years
12251225
if ThermalAge > maxAge * 1e6
12261226
ThermalAge = maxAge * 1e6
12271227
end
@@ -1251,11 +1251,7 @@ end
12511251
# Function to determine the side of a point with respect to a line (adjusted for segment direction)
12521252
function side_of_line(x, y, x1, y1, x2, y2, direction)
12531253
side = (x2 - x1) * (y - y1) - (y2 - y1) * (x - x1)
1254-
if direction == :left
1255-
return side > 0
1256-
else
1257-
return side < 0
1258-
end
1254+
direction == :left ? side > 0 : side < 0
12591255
end
12601256

12611257
# Function to determine in which region a point lies (based on delimiters)
@@ -1265,11 +1261,7 @@ function determine_region(px, py, delimiters, segments)
12651261
x2, y2 = delimiters[i][2]
12661262

12671263
# Determine the direction of the segments
1268-
if x2 < x1
1269-
direction = :left # Shift left
1270-
else
1271-
direction = :right # Shift to the right
1272-
end
1264+
direction = x2 < x1 ? :left : :right
12731265

12741266
# Check the side of the line considering the direction
12751267
if side_of_line(px, py, x1, y1, x2, y2, direction)

test/test_ridge_segments.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ using Test
3030

3131
@test minimum(Temp) >= 0.0 # Minimum temperature
3232
@test maximum(Temp) <= 1350.0 # Maximum temperature
33-
@test all(Temp .>= 0.0) # Ensure no negative temperatures
34-
@test all(Temp .<= 1350.0) # Ensure no temperatures above max
33+
@test all((0), Temp) # Ensure no negative temperatures
34+
@test all((1350), Temp) # Ensure no temperatures above max
3535

3636
# Check if phases are correctly assigned in expected regions
37-
@test Phases[1, 1, 1] == 2 # Example: Verify a point's phase
38-
@test Phases[end, end, end] == 2 # Example: Verify another point's phase
37+
@test first(Phases) == 2 # Example: Verify a point's phase
38+
@test last(Phases) == 2 # Example: Verify another point's phase
3939
end

0 commit comments

Comments
 (0)