Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nschloe committed Feb 18, 2020
1 parent d6858ea commit 96067df
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions test/test_booleans.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ def test_fragments_diff_union():
mesh = pygmsh.generate_mesh(geo_object)
assert np.abs((compute_volume(mesh) - 1) / 1) < 1e-3
surf = 1 - 0.1 ** 2 * np.pi
outer_mask = np.where(mesh.cell_data["gmsh:physical"][1] == 1)[0]
outer_mask = np.where(mesh.cell_data_dict["gmsh:physical"]["triangle"] == 1)[0]
outer_cells = {}
outer_cells["triangle"] = mesh.cells_dict["triangle"][outer_mask]

inner_mask = np.where(mesh.cell_data["gmsh:physical"][1] == 2)[0]
inner_mask = np.where(mesh.cell_data_dict["gmsh:physical"]["triangle"] == 2)[0]
inner_cells = {}
inner_cells["triangle"] = mesh.cells_dict["triangle"][inner_mask]

Expand All @@ -165,8 +165,8 @@ def test_diff_physical_assignment():
geo_object2.boolean_difference([surf1], [surf2])
mesh = pygmsh.generate_mesh(geo_object2)
assert np.allclose(
mesh.cell_data["triangle"]["gmsh:physical"],
np.ones(mesh.cells["triangle"].shape[0]),
mesh.cell_data_dict["gmsh:physical"]["triangle"],
np.ones(mesh.cells_dict["triangle"].shape[0]),
)
surf = 1 - 0.1 ** 2 * np.pi
assert np.abs((compute_volume(mesh) - surf) / surf) < 1e-3
Expand Down
3 changes: 2 additions & 1 deletion test/test_hex.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def test(lcar=1.0):
# TODO compute hex volumes
assert (
abs(
compute_volume(meshio.Mesh(mesh.points, {"quad": mesh.cells["quad"]})) - ref
compute_volume(meshio.Mesh(mesh.points, {"quad": mesh.cells_dict["quad"]}))
- ref
)
< 1.0e-2 * ref
)
Expand Down
2 changes: 1 addition & 1 deletion test/test_opencascade_regular_extrusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test():

# Each grid-cell from layered extrusion will result in 6 tetrahedrons.
ref_tetras = 6 * x_layers * y_layers * z_layers
assert len(mesh.cells["tetra"]) == ref_tetras
assert len(mesh.cells_dict["tetra"]) == ref_tetras

return mesh

Expand Down
4 changes: 2 additions & 2 deletions test/test_recombine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def test():

mesh = pygmsh.generate_mesh(geom)

assert "quad" in mesh.cells.keys()
assert "quad" in mesh.cells_dict.keys()
ref = np.array([[0, 4, 8, 7], [7, 8, 6, 2], [4, 1, 5, 8], [8, 5, 3, 6]])
assert np.array_equal(ref, mesh.cells["quad"])
assert np.array_equal(ref, mesh.cells_dict["quad"])

return mesh

Expand Down
2 changes: 1 addition & 1 deletion test/test_regular_extrusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test():

# Each grid-cell from layered extrusion will result in 6 tetrahedrons.
ref_tetras = 6 * x_layers * y_layers * z_layers
assert len(mesh.cells["tetra"]) == ref_tetras
assert len(mesh.cells_dict["tetra"]) == ref_tetras

return mesh

Expand Down
2 changes: 1 addition & 1 deletion test/test_transfinite.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test(lcar=1.0):
geom.set_transfinite_surface(poly.surface, size=[11, 9])

mesh = pygmsh.generate_mesh(geom, geo_filename="transfinite.geo")
assert len(mesh.cells["triangle"]) == 10 * 8 * 2
assert len(mesh.cells_dict["triangle"]) == 10 * 8 * 2
return mesh


Expand Down

0 comments on commit 96067df

Please sign in to comment.