Skip to content

Commit 3e72e79

Browse files
chore: Add testcase for multiple grids in mesh2d (#607)
1 parent ce8119e commit 3e72e79

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/dflowfm/test_net.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,31 @@ def test_create_2d():
180180
mesh2d.create_rectilinear(extent=bbox, dx=0.5, dy=0.75)
181181

182182
mesh2d_output = mesh2d.get_mesh2d()
183+
assert np.isclose(min(mesh2d_output.node_x), 1)
184+
assert np.isclose(max(mesh2d_output.node_x), 3)
185+
assert np.isclose(min(mesh2d_output.node_y), -2)
186+
assert np.isclose(max(mesh2d_output.node_y), 4)
183187
assert mesh2d_output.node_x.size == 45
184188
assert mesh2d_output.edge_nodes.size == 152
185189

186190

191+
def test_create_2d_multiple_grids():
192+
bbox = (1.0, -2.0, 3.0, 4.0)
193+
bbox2 = (-2.0, -2.0, 0.0, 4.0)
194+
195+
mesh2d = Mesh2d(meshkernel=MeshKernel())
196+
mesh2d.create_rectilinear(extent=bbox, dx=0.5, dy=0.75)
197+
mesh2d.create_rectilinear(extent=bbox2, dx=0.5, dy=0.75)
198+
199+
mesh2d_output = mesh2d.get_mesh2d()
200+
assert np.isclose(min(mesh2d_output.node_x), -2)
201+
assert np.isclose(max(mesh2d_output.node_x), 3)
202+
assert np.isclose(min(mesh2d_output.node_y), -2)
203+
assert np.isclose(max(mesh2d_output.node_y), 4)
204+
assert mesh2d_output.node_x.size == 90
205+
assert mesh2d_output.edge_nodes.size == 304
206+
207+
187208
@pytest.mark.parametrize(
188209
"deletemeshoption,inside,nnodes,nedgenodes,nfaces",
189210
[

0 commit comments

Comments
 (0)