Skip to content

Commit e5bbe12

Browse files
committed
Add tests
1 parent 8c775cc commit e5bbe12

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tests/test_plotter.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,3 +809,47 @@ def test_plot_polyhedron():
809809

810810
# Plot the MeshedRegion
811811
mesh.plot()
812+
813+
814+
@pytest.mark.skipif(not HAS_PYVISTA, reason="This test requires pyvista")
815+
def test_plotter_add_scoping(fluent_mixing_elbow_steady_state):
816+
mesh: core.MeshedRegion = core.operators.mesh.mesh_provider(
817+
data_sources=fluent_mixing_elbow_steady_state()
818+
).eval()
819+
node_scoping = core.Scoping(location=core.locations.nodal, ids=mesh.nodes.scoping.ids[0:100])
820+
element_scoping = core.Scoping(
821+
location=core.locations.elemental, ids=mesh.elements.scoping.ids[0:100]
822+
)
823+
plt = DpfPlotter()
824+
plt.add_scoping(node_scoping, mesh, show_mesh=True, color="red")
825+
plt.add_scoping(element_scoping, mesh, color="green")
826+
plt.show_figure()
827+
828+
829+
@pytest.mark.skipif(not HAS_PYVISTA, reason="This test requires pyvista")
830+
def test_scoping_plot(fluent_mixing_elbow_steady_state):
831+
mesh: core.MeshedRegion = core.operators.mesh.mesh_provider(
832+
data_sources=fluent_mixing_elbow_steady_state()
833+
).eval()
834+
node_scoping = core.Scoping(location=core.locations.nodal, ids=mesh.nodes.scoping.ids[0:100])
835+
node_scoping.plot(mesh=mesh, color="red")
836+
element_scoping = core.Scoping(
837+
location=core.locations.elemental, ids=mesh.elements.scoping.ids[0:100]
838+
)
839+
element_scoping.plot(mesh=mesh, color="green")
840+
841+
842+
@pytest.mark.skipif(not HAS_PYVISTA, reason="This test requires pyvista")
843+
def test_scopingscontainer_plot(fluent_mixing_elbow_steady_state):
844+
mesh: core.MeshedRegion = core.operators.mesh.mesh_provider(
845+
data_sources=fluent_mixing_elbow_steady_state()
846+
).eval()
847+
node_scoping_1 = core.Scoping(location=core.locations.nodal, ids=mesh.nodes.scoping.ids[0:100])
848+
node_scoping_2 = core.Scoping(
849+
location=core.locations.nodal, ids=mesh.nodes.scoping.ids[300:400]
850+
)
851+
node_sc = core.ScopingsContainer()
852+
node_sc.add_label(label="scoping", default_value=1)
853+
node_sc.add_scoping(label_space={"scoping": 1}, scoping=node_scoping_1)
854+
node_sc.add_scoping(label_space={"scoping": 2}, scoping=node_scoping_2)
855+
node_sc.plot(mesh=mesh, show_mesh=True)

0 commit comments

Comments
 (0)