Skip to content

Commit ba0960c

Browse files
authored
Fix 'RegularDiscretization' of 'Box' (#1067)
1 parent d2f211a commit ba0960c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/discretization/regular.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,5 @@ end
177177

178178
function discretize(box::Box, method::RegularDiscretization)
179179
sz = fitdims(method.sizes, paramdim(box))
180-
CartesianGrid(extrema(box)..., dims=sz)
180+
RegularGrid(extrema(box)..., dims=sz)
181181
end

test/discretization.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,24 @@ end
335335
@test eltype(mesh) <: Quadrangle
336336
@test nvertices.(mesh) [4]
337337

338+
box = Box(merc(0, 0), merc(2, 2))
339+
mesh = discretize(box, RegularDiscretization(10))
340+
@test mesh isa RegularGrid
341+
@test crs(mesh) <: Mercator
342+
@test nvertices(mesh) == 121
343+
@test nelements(mesh) == 100
344+
@test eltype(mesh) <: Quadrangle
345+
@test nvertices.(mesh) [4]
346+
347+
box = Box(latlon(-50, 150), latlon(50, 30))
348+
mesh = discretize(box, RegularDiscretization(10))
349+
@test mesh isa RegularGrid
350+
@test crs(mesh) <: LatLon
351+
@test nvertices(mesh) == 121
352+
@test nelements(mesh) == 100
353+
@test eltype(mesh) <: Quadrangle
354+
@test nvertices.(mesh) [4]
355+
338356
sphere = Sphere(cart(0, 0), T(1))
339357
mesh = discretize(sphere, RegularDiscretization(10))
340358
@test nvertices(mesh) == 10

0 commit comments

Comments
 (0)