@@ -822,12 +822,12 @@ function add_plate!(Phase, Temp, Grid::AbstractGeneralGrid;
822822 ind = zeros (Bool, size (X))
823823 ind_slice = zeros (Bool, size (X[:, :, 1 ]))
824824
825- for k = 1 : size (Z)[ 3 ]
826- if Z[ 1 , 1 , k] >= zlim_[1 ] && Z[1 , 1 , k] <= zlim_[2 ]
825+ for k = 1 : size (Z, 3 )
826+ if zlim_[1 ] <= Z[1 , 1 , k] <= zlim_[2 ]
827827 inpolygon! (ind_slice, xlim_, ylim_, X[:, :, k], Y[:, :, k])
828- ind[:, :, k] = ind_slice
828+ @views ind[:, :, k] = ind_slice
829829 else
830- ind[:, :, k] = zeros (size (X[:, :, 1 ]))
830+ @views ind[:, :, k] = zeros (size (X[:, :, 1 ]))
831831 end
832832 end
833833
@@ -1312,7 +1312,7 @@ function compute_thermal_structure(Temp, X, Y, Z, Phase, s::SpreadingRateTemp, s
13121312 Distance = perpendicular_distance_to_segment (px, py, x1, y1, x2, y2)
13131313
13141314 # Calculate thermal age
1315- ThermalAge = abs (Distance * 1e3 * 1e2 ) / SpreadingVel + AgeRidge * 1e6 # Thermal age in years
1315+ ThermalAge = abs (Distance * 1e5 ) / SpreadingVel + AgeRidge * 1e6 # Thermal age in years
13161316 if ThermalAge > maxAge * 1e6
13171317 ThermalAge = maxAge * 1e6
13181318 end
@@ -1342,11 +1342,7 @@ end
13421342# Function to determine the side of a point with respect to a line (adjusted for segment direction)
13431343function side_of_line (x, y, x1, y1, x2, y2, direction)
13441344 side = (x2 - x1) * (y - y1) - (y2 - y1) * (x - x1)
1345- if direction == :left
1346- return side > 0
1347- else
1348- return side < 0
1349- end
1345+ direction == :left ? side > 0 : side < 0
13501346end
13511347
13521348# Function to determine in which region a point lies (based on delimiters)
@@ -1356,11 +1352,7 @@ function determine_region(px, py, delimiters, segments)
13561352 x2, y2 = delimiters[i][2 ]
13571353
13581354 # Determine the direction of the segments
1359- if x2 < x1
1360- direction = :left # Shift left
1361- else
1362- direction = :right # Shift to the right
1363- end
1355+ direction = x2 < x1 ? :left : :right
13641356
13651357 # Check the side of the line considering the direction
13661358 if side_of_line (px, py, x1, y1, x2, y2, direction)
0 commit comments