Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3c4e5a3
fix: try pyvista 0.46.5
moe-ad Feb 24, 2026
2f87c52
tests: parameterize test_plotter module with both backends
moe-ad Feb 25, 2026
1e869cf
fix: hack for the labeling example
moe-ad Feb 25, 2026
6bf2701
fix: add images
moe-ad Feb 25, 2026
1fcc569
tests: update doc string tests
moe-ad Feb 25, 2026
e3a79eb
build: revert back to pyvista 0.47.0
moe-ad Feb 26, 2026
1d2b1d4
test: disable autouse of plotter_backend fixture
moe-ad Mar 1, 2026
6e3561a
test: trigger ci
moe-ad Mar 1, 2026
e3df122
test: remove test-api from ci parallel tests
moe-ad Mar 1, 2026
7764666
test: cleanup tests
moe-ad Mar 2, 2026
4e3975f
test: run test-api separately
moe-ad Mar 2, 2026
d479441
test: fix for thread safe code
moe-ad Mar 2, 2026
3e94bc4
tests: revert
moe-ad Mar 2, 2026
f9f0b4d
test: switch to viz-interface for tests
moe-ad Mar 2, 2026
c8297cd
test: execute tests based on server type parameterization
moe-ad Mar 2, 2026
de19d2c
test: run test-api separately
moe-ad Mar 2, 2026
17afaea
test: check other failing test groups
moe-ad Mar 2, 2026
6ed2c4c
test: check if all other tests except test-{api,launcher} are fine
moe-ad Mar 3, 2026
f49a204
Merge branch 'main' into test/switch-tests-to-viz-interface
moe-ad Mar 3, 2026
7abe175
Merge branch 'main' into test/switch-tests-to-viz-interface
moe-ad Mar 3, 2026
795067f
fix: codestyle
moe-ad Mar 3, 2026
4f0fb2f
Merge branch 'main' into test/switch-tests-to-viz-interface
moe-ad Mar 4, 2026
3c62498
Merge branch 'main' into test/switch-tests-to-viz-interface
moe-ad Mar 4, 2026
ff18ae7
tests: add viz dependency
moe-ad Mar 5, 2026
0537351
fix: run-examples
moe-ad Mar 5, 2026
ec52a9e
test: without filtering
moe-ad Mar 5, 2026
3880aea
test: run api and launcher tests in parallel without sorting
moe-ad Mar 5, 2026
c41b6fd
test: run with filtering
moe-ad Mar 5, 2026
fc64d42
test: remove filtering and run all tests
moe-ad Mar 5, 2026
5293e5f
test: change test order
moe-ad Mar 5, 2026
9d680ed
cleanup
moe-ad Mar 6, 2026
d42d90a
update plot_on_geometries
moe-ad Mar 6, 2026
37fe896
Merge branch 'main' into test/switch-tests-to-viz-interface
moe-ad Mar 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,6 @@ jobs:
export DPF_DEFAULT_GRPC_MODE=insecure
tox --installpkg "$TOX_INSTALLPKG" ${TOX_XARG:+-x "$TOX_XARG"} -e test-api_entry,kill-servers

- name: "Run compatible tests in parallel"
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
TOX_INSTALLPKG: ${{ steps.tox-cli-arguments.outputs.TOX_INSTALLPKG }}
TOX_XARG: ${{ steps.tox-cli-arguments.outputs.TOX_XARG }}
with:
timeout_minutes: 20
max_attempts: 2
shell: bash
command: |
export DPF_DEFAULT_GRPC_MODE=insecure
tox run-parallel --installpkg "$TOX_INSTALLPKG" ${TOX_XARG:+-x "$TOX_XARG"} -m ciparalleltests

- name: "Test API test_server"
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
Expand Down Expand Up @@ -340,6 +327,32 @@ jobs:
export DPF_DEFAULT_GRPC_MODE=insecure
tox --installpkg "$TOX_INSTALLPKG" ${TOX_XARG:+-x "$TOX_XARG"} -e test-service,kill-servers

- name: "Run compatible tests in parallel"
Comment thread
moe-ad marked this conversation as resolved.
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
TOX_INSTALLPKG: ${{ steps.tox-cli-arguments.outputs.TOX_INSTALLPKG }}
TOX_XARG: ${{ steps.tox-cli-arguments.outputs.TOX_XARG }}
with:
timeout_minutes: 20
max_attempts: 2
shell: bash
command: |
export DPF_DEFAULT_GRPC_MODE=insecure
tox run-parallel --installpkg "$TOX_INSTALLPKG" ${TOX_XARG:+-x "$TOX_XARG"} -m ciparalleltests

- name: "Run api and launcher tests in parallel"
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
TOX_INSTALLPKG: ${{ steps.tox-cli-arguments.outputs.TOX_INSTALLPKG }}
TOX_XARG: ${{ steps.tox-cli-arguments.outputs.TOX_XARG }}
with:
timeout_minutes: 20
max_attempts: 2
shell: bash
command: |
export DPF_DEFAULT_GRPC_MODE=insecure
tox --installpkg "$TOX_INSTALLPKG" ${TOX_XARG:+-x "$TOX_XARG"} -e pretest,test-api,test-launcher,posttest,kill-servers

- name: "Combine coverage results"
shell: bash
run: |
Expand Down
23 changes: 22 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime
from glob import glob
import os
import shutil
import sys
from pathlib import Path
import subprocess
Expand Down Expand Up @@ -381,6 +382,24 @@
# A list of files that should not be packed into the epub file.
epub_exclude_files = ["search.html"]

def _copy_labels_images(app, exception):
"""Override sphinx-gallery images for 03-labels.py example.

The images captured during CI run do not show the labels as expected,
and the behavior is not reproducible locally. This hook replaces whatever
sphinx-gallery generated during the CI run.
"""
_LABELS_IMAGES_SRC = Path(__file__).parent / "images" / "plotting"
_LABELS_IMAGES_PATTERN = "sphx_glr_03-labels"
if exception:
return
target_dir = Path(app.outdir) / "_images"
if not target_dir.exists():
return
for src in _LABELS_IMAGES_SRC.glob(f"{_LABELS_IMAGES_PATTERN}*"):
dst = target_dir / src.name
shutil.copy2(src, dst)

# Define custom docutils roles for solver badges
from sphinx_design.badges_buttons import BadgeRole

Expand All @@ -393,7 +412,9 @@ def setup(app):
}

for role_name, color in badge_roles.items():
app.add_role(name=role_name, role=BadgeRole(color=color))
app.add_role(name=role_name, role=BadgeRole(color))

app.connect("build-finished", _copy_labels_images)

# Common content for every RST file such us links
rst_epilog = ""
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@

###############################################################################
# Show points together with the mesh
points.plot(mesh, cpos=cpos, point_size=15, color="blue")
points.plot(mesh, cpos=cpos, point_size=25, color="blue")

###############################################################################
# Create line passing through the geometry's diagonal:
line = Line([[0.03, 0.03, 0.05], [0.0, 0.06, 0.0]], n_points=50)

###############################################################################
# Show line with the 3D mesh
line.plot(mesh, cpos=cpos, color="black")
line.plot(mesh, cpos=cpos, color="black", width=5.0)

###############################################################################
# Create vertical plane passing through the mid point:
Expand Down Expand Up @@ -150,7 +150,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 3D plot of Points and display mesh:
pl = DpfPlotter()
pl.add_field(field_points, render_points_as_spheres=True, point_size=10)
pl.add_field(field_points, render_points_as_spheres=True, point_size=25)
pl.add_mesh(mesh, style="surface", show_edges=True, color="w", opacity=0.3)
pl.show_figure(show_axes=True, cpos=cpos)

Expand All @@ -159,7 +159,7 @@
# Note that the line is only displayed if some points are found inside the mesh:
pl = DpfPlotter()
if not len(field_line) == 0:
pl.add_field(field_line, line.mesh, line_width=5)
pl.add_field(field_line, line.mesh, line_width=10)
pl.add_mesh(mesh, style="surface", show_edges=True, color="w", opacity=0.3)
pl.show_figure(show_axes=True, cpos=cpos)

Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ graphics = [
"matplotlib>=3.2",
# 3D plotting
"pyvista>=0.32.0",
"ansys-tools-visualization-interface==1.0.0a1",
"vtk!=9.4.0",
# Animations
"imageio",
Expand All @@ -55,6 +56,7 @@ plotting = [
"matplotlib>=3.2",
# 3D plotting
"pyvista>=0.32.0",
"ansys-tools-visualization-interface==1.0.0a1",
"vtk",
# Animations
"imageio",
Expand All @@ -70,6 +72,7 @@ operator_doc = [

doc = [
"ansys-sphinx-theme[autoapi]==1.7.2",
"ansys-tools-visualization-interface==1.0.0a1",
"enum-tools[sphinx]==0.13.0",
"graphviz==0.21",
"imageio==2.37.2",
Expand All @@ -94,6 +97,7 @@ doc = [
test = [
"ansys-platform-instancemanagement==1.1.2",
"ansys-tools-common==0.4.5",
"ansys-tools-visualization-interface==1.0.0a1",
"coverage==7.13.4",
"graphviz==0.21",
"imageio==2.37.2",
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/dpf/core/meshes_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def plot(self, fields_container=None, deform_by=None, scale_factor=1.0, **kwargs
... )
>>> disp_fc = disp_op.outputs.fields_container()
>>> meshes_cont.plot(disp_fc)
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)

"""
# DPF defaults
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/dpf/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def plot(self, color="w", show_edges=True, **kwargs):
>>> transient = examples.download_transient_result()
>>> model = Model(transient)
>>> model.plot()
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)

"""
from ansys.dpf.core.plotter import DpfPlotter
Expand Down
26 changes: 16 additions & 10 deletions src/ansys/dpf/core/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,15 +778,21 @@ def get_label_at_grid_point(index):
# The scalar data used will be the one of the last field added.
active_scalars = None
if parse(pv.__version__) >= parse("0.42.0"):
# Get actors of active renderer
# Get actors of active renderer.
# base_plotter.actors may return raw VTK actors (not PyVista Actor
# wrappers), so use GetMapper()/GetInput() for VTK-level access.
actors = list(self._backend.base_plotter.actors.values())
for actor in actors:
mapper = actor.mapper if hasattr(actor, "mapper") else None
if mapper:
dataset = mapper.dataset
if type(dataset) is pv.core.pointset.UnstructuredGrid:
active_scalars = dataset.active_scalars
break
vtk_mapper = actor.GetMapper() if hasattr(actor, "GetMapper") else None
if vtk_mapper is None:
continue
vtk_input = vtk_mapper.GetInput()
if vtk_input is None:
continue
dataset = pv.wrap(vtk_input)
if type(dataset) is pv.core.pointset.UnstructuredGrid:
active_scalars = dataset.active_scalars
break
elif parse(pv.__version__) >= parse("0.35.2"):
for data_set in self._backend.base_plotter._datasets:
if type(data_set) is pv.core.pointset.UnstructuredGrid:
Expand Down Expand Up @@ -1385,7 +1391,7 @@ def add_streamlines(
... radius=0.001,
... )
>>> pl.show_figure(show_axes=True)
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)
Comment thread
moe-ad marked this conversation as resolved.
"""
self._internal_plotter.add_streamlines(
streamlines=streamlines,
Expand Down Expand Up @@ -1505,7 +1511,7 @@ def add_scoping(
>>> plt.add_scoping(node_scoping, mesh, show_mesh=True, color="red")
>>> plt.add_scoping(element_scoping, mesh, color="green")
>>> plt.show_figure()
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)
"""
self._internal_plotter.add_scoping(
scoping=scoping, mesh=mesh, show_mesh=show_mesh, **kwargs
Expand All @@ -1531,7 +1537,7 @@ def show_figure(self, **kwargs):
>>> pl = DpfPlotter()
>>> pl.add_field(field, mesh)
>>> pl.show_figure()
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)
"""
if "notebook" in kwargs.keys():
warnings.simplefilter("once")
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/dpf/core/scoping.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,13 @@ def plot(self, mesh, show_mesh: bool = False, **kwargs):
... ids=mesh.nodes.scoping.ids[0:100]
... )
>>> node_scoping.plot(mesh=mesh, color="red")
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)
>>> element_scoping = dpf.Scoping(
... location=dpf.locations.elemental,
... ids=mesh.elements.scoping.ids[0:100]
... )
>>> element_scoping.plot(mesh=mesh, color="green")
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)
"""
from ansys.dpf.core.plotter import DpfPlotter

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/dpf/core/scopings_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def plot(
>>> node_sc.add_scoping(label_space={"scoping": 1}, scoping=node_scoping_1)
>>> node_sc.add_scoping(label_space={"scoping": 2}, scoping=node_scoping_2)
>>> node_sc.plot(mesh=mesh, show_mesh=True)
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)
"""
from itertools import cycle

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ envlist = pretest,test-{api,documentation,launcher,server,local_server,multi_ser
labels =
localparalleltests = pretest,test-{api,documentation,launcher,server,local_server,multi_server,custom_type_field,operators,server_errors},posttest,kill-servers
othertests = pretest,test-{workflow,remote_workflow,remote_operator,service},posttest,kill-servers
ciparalleltests = test-{api,documentation,launcher,local_server,multi_server,custom_type_field,operators,server_errors},kill-servers
ciparalleltests = test-{documentation,local_server,multi_server,custom_type_field,operators,server_errors},kill-servers

isolated_build_env = build

Expand Down
Loading