ansys-fluent-visualization 0.15.dev0__tar.gz → 0.17.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. ansys_fluent_visualization-0.17.dev0/AUTHORS +12 -0
  2. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/PKG-INFO +13 -9
  3. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/README.rst +3 -3
  4. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/pyproject.toml +8 -5
  5. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/src/ansys/fluent/visualization/__init__.py +18 -3
  6. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/src/ansys/fluent/visualization/_config.py +4 -1
  7. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/containers.py +67 -0
  8. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/src/ansys/fluent/visualization/contour.py +2 -2
  9. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/graphics/__init__.py +6 -0
  10. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/graphics/abstract_graphics_defns.py +44 -0
  11. ansys_fluent_visualization-0.15.dev0/src/ansys/fluent/visualization/pyvista/pyvista_objects.py → ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/graphics/graphics_objects.py +16 -16
  12. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/graphics/graphics_windows.py +148 -0
  13. ansys_fluent_visualization-0.15.dev0/src/ansys/fluent/visualization/pyvista/pyvista_windows_manager.py → ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py +353 -234
  14. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/graphics/pyvista/__init__.py +0 -0
  15. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/graphics/pyvista/graphics_defns.py +176 -0
  16. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/matplotlib/__init__.py +17 -0
  17. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/__init__.py +6 -0
  18. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/abstract_plotter_defns.py +51 -0
  19. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/matplotlib/__init__.py +0 -0
  20. {ansys_fluent_visualization-0.15.dev0/src/ansys/fluent/visualization → ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter}/matplotlib/plotter_defns.py +34 -6
  21. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/plotly/__init__.py +0 -0
  22. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/plotly/plotter_defns.py +176 -0
  23. ansys_fluent_visualization-0.15.dev0/src/ansys/fluent/visualization/matplotlib/matplot_objects.py → ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/plotter_objects.py +9 -9
  24. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/plotter_windows.py +123 -0
  25. ansys_fluent_visualization-0.15.dev0/src/ansys/fluent/visualization/matplotlib/matplot_windows_manager.py → ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py +71 -34
  26. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/pyvista/__init__.py +0 -0
  27. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/plotter/pyvista/plotter_defns.py +167 -0
  28. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/src/ansys/fluent/visualization/post_data_extractor.py +14 -14
  29. ansys_fluent_visualization-0.17.dev0/src/ansys/fluent/visualization/pyvista/__init__.py +17 -0
  30. ansys_fluent_visualization-0.15.dev0/src/ansys/fluent/visualization/matplotlib/__init__.py +0 -6
  31. ansys_fluent_visualization-0.15.dev0/src/ansys/fluent/visualization/pyvista/__init__.py +0 -6
  32. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/LICENSE +0 -0
  33. {ansys_fluent_visualization-0.15.dev0 → ansys_fluent_visualization-0.17.dev0}/src/ansys/fluent/visualization/post_windows_manager.py +0 -0
@@ -0,0 +1,12 @@
1
+ # This is the list of PyFluent Visualization's significant contributors.
2
+ #
3
+ # This file does not necessarily list everyone who has contributed code.
4
+ #
5
+ # For contributions made under a Corporate CLA, the organization is
6
+ # added to this file.
7
+ #
8
+ # If you have contributed to the repository and want to be added to this file,
9
+ # submit a request.
10
+ #
11
+ #
12
+ ANSYS, Inc.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: ansys-fluent-visualization
3
- Version: 0.15.dev0
3
+ Version: 0.17.dev0
4
4
  Summary: A python wrapper for ansys Fluent visualization
5
5
  Home-page: https://github.com/ansys/pyfluent-visualization
6
6
  License: MIT
@@ -16,12 +16,16 @@ Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Dist: ansys-fluent-core (>=0.27.dev0,<1.0)
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Requires-Dist: ansys-fluent-core (>=0.29.dev0,<1.0)
21
+ Requires-Dist: imageio (>=2.36.1)
20
22
  Requires-Dist: importlib-metadata (>=4.0,<5.0) ; python_version < "3.9"
21
- Requires-Dist: matplotlib (>=3.9.0)
22
- Requires-Dist: pyside6 (>=6.7.2,<6.8.0)
23
- Requires-Dist: pyvista (>=0.44.1,<0.45.0)
23
+ Requires-Dist: matplotlib (>=3.6.0)
24
+ Requires-Dist: plotly (>=5.24.0)
25
+ Requires-Dist: pyside6 (>=6.8.1,<6.9.0)
26
+ Requires-Dist: pyvista[jupyter] (>=0.44.0)
24
27
  Requires-Dist: pyvistaqt (>=0.11.1,<0.12.0)
28
+ Requires-Dist: vtk (<9.4.0) ; python_version < "3.13"
25
29
  Project-URL: Documentation, https://visualization.fluent.docs.pyansys.com/
26
30
  Project-URL: Repository, https://github.com/ansys/pyfluent-visualization
27
31
  Project-URL: Source, https://github.com/ansys/pyfluent-visualization
@@ -81,7 +85,7 @@ the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>
81
85
  Installation
82
86
  ------------
83
87
  The ``ansys-fluent-visualization`` package supports Python 3.10 through Python
84
- 3.12 on Windows and Linux.
88
+ 3.13 on Windows and Linux.
85
89
 
86
90
  If you are using Python 3.10, download and install the wheel file for the ``vtk`` package from
87
91
  `here for Windows <https://github.com/pyvista/pyvista-wheels/raw/main/vtk-9.1.0.dev0-cp310-cp310-win_amd64.whl>`_
@@ -131,11 +135,11 @@ the PyFluent-Visualization documentation.
131
135
 
132
136
  .. code:: python
133
137
 
134
- from ansys.fluent.visualization.pyvista import Graphics
138
+ from ansys.fluent.visualization import Graphics
135
139
  graphics = Graphics(session=session)
136
140
  temperature_contour = graphics.Contours["contour-temperature"]
137
141
  temperature_contour.field = "temperature"
138
- temperature_contour.surfaces_list = ["in1", "in2", "out1"]
142
+ temperature_contour.surfaces = ["in1", "in2", "out1"]
139
143
  temperature_contour.display("window-1")
140
144
 
141
145
  Usage in a JupyterLab environment
@@ -51,7 +51,7 @@ the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>
51
51
  Installation
52
52
  ------------
53
53
  The ``ansys-fluent-visualization`` package supports Python 3.10 through Python
54
- 3.12 on Windows and Linux.
54
+ 3.13 on Windows and Linux.
55
55
 
56
56
  If you are using Python 3.10, download and install the wheel file for the ``vtk`` package from
57
57
  `here for Windows <https://github.com/pyvista/pyvista-wheels/raw/main/vtk-9.1.0.dev0-cp310-cp310-win_amd64.whl>`_
@@ -101,11 +101,11 @@ the PyFluent-Visualization documentation.
101
101
 
102
102
  .. code:: python
103
103
 
104
- from ansys.fluent.visualization.pyvista import Graphics
104
+ from ansys.fluent.visualization import Graphics
105
105
  graphics = Graphics(session=session)
106
106
  temperature_contour = graphics.Contours["contour-temperature"]
107
107
  temperature_contour.field = "temperature"
108
- temperature_contour.surfaces_list = ["in1", "in2", "out1"]
108
+ temperature_contour.surfaces = ["in1", "in2", "out1"]
109
109
  temperature_contour.display("window-1")
110
110
 
111
111
  Usage in a JupyterLab environment
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
5
5
  [tool.poetry]
6
6
  # Check https://python-poetry.org/docs/pyproject/ for all available sections
7
7
  name = "ansys-fluent-visualization"
8
- version = "0.15.dev0"
8
+ version = "0.17.dev0"
9
9
  description = "A python wrapper for ansys Fluent visualization"
10
10
  license = "MIT"
11
11
  authors = ["ANSYS, Inc. <ansys.support@ansys.com>"]
@@ -25,11 +25,14 @@ packages = [
25
25
  [tool.poetry.dependencies]
26
26
  python = ">=3.10,<4.0"
27
27
  importlib-metadata = {version = "^4.0", python = "<3.9"}
28
- ansys-fluent-core = "~=0.27.dev0"
29
- pyvista = "~=0.44.1"
28
+ ansys-fluent-core = "~=0.29.dev0"
29
+ pyvista = { version = ">=0.44.0", extras = ["jupyter"]}
30
+ matplotlib = ">=3.6.0"
31
+ vtk = {version = "<9.4.0", python = "<3.13"}
30
32
  pyvistaqt = "~=0.11.1"
31
- pyside6 = "~=6.7.2"
32
- matplotlib = ">=3.9.0"
33
+ pyside6 = "~=6.8.1"
34
+ plotly = ">=5.24.0"
35
+ imageio= ">=2.36.1"
33
36
 
34
37
  [tool.poetry.urls]
35
38
  "Documentation" = "https://visualization.fluent.docs.pyansys.com/"
@@ -5,8 +5,10 @@ try:
5
5
  except ModuleNotFoundError:
6
6
  import importlib_metadata
7
7
 
8
- _VERSION_INFO = "Build date: September 14, 2024 05:41 UTC ShaID: 11b8965"
8
+ _VERSION_INFO = "Build date: January 06, 2025 09:12 UTC ShaID: a7bfb72"
9
9
  __version__ = importlib_metadata.version(__name__.replace(".", "-"))
10
+ PLOTTER = "matplotlib"
11
+ INTERACTIVE = False
10
12
 
11
13
 
12
14
  def version_info() -> str:
@@ -23,5 +25,18 @@ def version_info() -> str:
23
25
 
24
26
 
25
27
  from ansys.fluent.visualization._config import get_config, set_config # noqa: F401
26
- from ansys.fluent.visualization.matplotlib import Plots # noqa: F401
27
- from ansys.fluent.visualization.pyvista import Graphics # noqa: F401
28
+ from ansys.fluent.visualization.containers import ( # noqa: F401
29
+ Contour,
30
+ Mesh,
31
+ Monitor,
32
+ Pathline,
33
+ Surface,
34
+ Vector,
35
+ XYPlot,
36
+ )
37
+ from ansys.fluent.visualization.graphics import Graphics # noqa: F401
38
+ from ansys.fluent.visualization.graphics.graphics_windows import ( # noqa: F401
39
+ GraphicsWindow,
40
+ )
41
+ from ansys.fluent.visualization.plotter import Plots # noqa: F401
42
+ from ansys.fluent.visualization.plotter.plotter_windows import PlotterWindow
@@ -11,10 +11,13 @@ def get_config() -> dict:
11
11
  config : dict
12
12
  Keys are parameter names that can be passed to :func:`set_config`.
13
13
  """
14
+ import ansys.fluent.visualization as pyviz
15
+
16
+ _global_config["blocking"] = not pyviz.INTERACTIVE
14
17
  return _global_config.copy()
15
18
 
16
19
 
17
- def set_config(blocking: bool = True, set_view_on_display: str = None):
20
+ def set_config(blocking: bool = False, set_view_on_display: str = "isometric"):
18
21
  """Set visualization configuration.
19
22
 
20
23
  Parameters
@@ -0,0 +1,67 @@
1
+ """Containers for graphics."""
2
+
3
+ from ansys.fluent.visualization.graphics import Graphics
4
+ from ansys.fluent.visualization.plotter import Plots
5
+
6
+
7
+ class GraphicsContainer:
8
+ """Base class for graphics containers."""
9
+
10
+ def __getattr__(self, attr):
11
+ return getattr(self.obj, attr)
12
+
13
+ def __setattr__(self, attr, value):
14
+ setattr(self.obj, attr, value)
15
+
16
+
17
+ class Mesh(GraphicsContainer):
18
+ """Mesh."""
19
+
20
+ def __init__(self, solver, **kwargs):
21
+ self.__dict__["obj"] = Graphics(session=solver).Meshes.create(**kwargs)
22
+
23
+
24
+ class Surface(GraphicsContainer):
25
+ """Surface."""
26
+
27
+ def __init__(self, solver, **kwargs):
28
+ self.__dict__["obj"] = Graphics(session=solver).Surfaces.create(**kwargs)
29
+
30
+
31
+ class Contour(GraphicsContainer):
32
+ """Contour."""
33
+
34
+ def __init__(self, solver, **kwargs):
35
+ self.__dict__["obj"] = Graphics(session=solver).Contours.create(**kwargs)
36
+
37
+
38
+ class Vector(GraphicsContainer):
39
+ """Vector."""
40
+
41
+ def __init__(self, solver, **kwargs):
42
+ self.__dict__["obj"] = Graphics(session=solver).Vectors.create(**kwargs)
43
+
44
+
45
+ class Pathline(GraphicsContainer):
46
+ """Pathline."""
47
+
48
+ def __init__(self, solver, **kwargs):
49
+ self.__dict__["obj"] = Graphics(session=solver).Pathlines.create(**kwargs)
50
+
51
+
52
+ class XYPlot(GraphicsContainer):
53
+ """XYPlot."""
54
+
55
+ def __init__(self, solver, local_surfaces_provider=None, **kwargs):
56
+ self.__dict__["obj"] = Plots(
57
+ session=solver, local_surfaces_provider=Graphics(solver).Surfaces
58
+ ).XYPlots.create(**kwargs)
59
+
60
+
61
+ class Monitor(GraphicsContainer):
62
+ """Monitor."""
63
+
64
+ def __init__(self, solver, local_surfaces_provider=None, **kwargs):
65
+ self.__dict__["obj"] = Plots(
66
+ session=solver, local_surfaces_provider=Graphics(solver).Surfaces
67
+ ).Monitors.create(**kwargs)
@@ -85,13 +85,13 @@ class Contour:
85
85
  if graphics_mode.__class__.__name__ == "Graphics":
86
86
  contour = graphics_mode.Contours[contour_name]
87
87
  contour.field = self.field
88
- contour.surfaces_list = self.surfaces
88
+ contour.surfaces = self.surfaces
89
89
  contour.display()
90
90
  return contour
91
91
  elif graphics_mode.__class__.__name__ == "Solver":
92
92
  solver.results.graphics.contour[contour_name] = {
93
93
  "field": self.field,
94
- "surfaces_list": self.surfaces,
94
+ "surfaces": self.surfaces,
95
95
  }
96
96
  solver.results.graphics.contour.display(object_name=contour_name)
97
97
  return solver.results.graphics.contour[contour_name]
@@ -0,0 +1,6 @@
1
+ """A package that provides interfacing Fluent with graphics renderer (PyVista)."""
2
+
3
+ from ansys.fluent.visualization.graphics.graphics_objects import Graphics # noqa: F401
4
+ from ansys.fluent.visualization.graphics.graphics_windows_manager import ( # noqa: F401
5
+ graphics_windows_manager,
6
+ )
@@ -0,0 +1,44 @@
1
+ """Abstract module providing graphics functionality."""
2
+
3
+ from abc import ABC, abstractmethod
4
+
5
+
6
+ class AbstractRenderer(ABC):
7
+ """Abstract class for renderer."""
8
+
9
+ @abstractmethod
10
+ def show(self):
11
+ """Show graphics."""
12
+ pass
13
+
14
+ @abstractmethod
15
+ def render(self, mesh, **kwargs):
16
+ """Render graphics in window."""
17
+ pass
18
+
19
+ @abstractmethod
20
+ def save_graphic(self, file_name: str):
21
+ """Save graphics to the specified file.
22
+
23
+ Parameters
24
+ ----------
25
+ file_name : str
26
+ File name to save graphic.
27
+ """
28
+ pass
29
+
30
+ @abstractmethod
31
+ def get_animation(self, win_id: str):
32
+ """Animate windows.
33
+
34
+ Parameters
35
+ ----------
36
+ win_id : str
37
+ ID for the window to animate.
38
+ """
39
+ pass
40
+
41
+ @abstractmethod
42
+ def close(self):
43
+ """Close graphics window."""
44
+ pass
@@ -16,8 +16,8 @@ from ansys.fluent.core.post_objects.post_objects_container import (
16
16
  Graphics as GraphicsContainer,
17
17
  )
18
18
 
19
- from ansys.fluent.visualization.pyvista.pyvista_windows_manager import (
20
- pyvista_windows_manager,
19
+ from ansys.fluent.visualization.graphics.graphics_windows_manager import (
20
+ graphics_windows_manager,
21
21
  )
22
22
 
23
23
 
@@ -49,12 +49,12 @@ class Mesh(MeshDefn):
49
49
 
50
50
  .. code-block:: python
51
51
 
52
- from ansys.fluent.visualization.pyvista import Graphics
52
+ from ansys.fluent.visualization import Graphics
53
53
 
54
54
  graphics_session = Graphics(session)
55
55
  mesh1 = graphics_session.Meshes["mesh-1"]
56
56
  mesh1.show_edges = True
57
- mesh1.surfaces_list = ['wall']
57
+ mesh1.surfaces = ['wall']
58
58
  mesh1.display("window-0")
59
59
  """
60
60
 
@@ -71,7 +71,7 @@ class Mesh(MeshDefn):
71
71
  Whether to overlay graphics over existing graphics.
72
72
  The default is ``False``.
73
73
  """
74
- pyvista_windows_manager.plot(
74
+ graphics_windows_manager.plot(
75
75
  self, window_id=window_id, overlay=overlay, fetch_data=True
76
76
  )
77
77
 
@@ -81,12 +81,12 @@ class Pathlines(PathlinesDefn):
81
81
 
82
82
  .. code-block:: python
83
83
 
84
- from ansys.fluent.visualization.pyvista import Graphics
84
+ from ansys.fluent.visualization import Graphics
85
85
 
86
86
  graphics_session = Graphics(session)
87
87
  pathlines1 = graphics_session.Pathlines["pathlines-1"]
88
88
  pathlines1.field = "velocity-magnitude"
89
- pathlines1.surfaces_list = ['inlet']
89
+ pathlines1.surfaces = ['inlet']
90
90
  pathlines1.display("window-0")
91
91
  """
92
92
 
@@ -103,7 +103,7 @@ class Pathlines(PathlinesDefn):
103
103
  Whether to overlay graphics over existing graphics.
104
104
  The default is ``False``.
105
105
  """
106
- pyvista_windows_manager.plot(
106
+ graphics_windows_manager.plot(
107
107
  self, window_id=window_id, overlay=overlay, fetch_data=True
108
108
  )
109
109
 
@@ -122,7 +122,7 @@ class Surface(SurfaceDefn):
122
122
 
123
123
  .. code-block:: python
124
124
 
125
- from ansys.fluent.visualization.pyvista import Graphics
125
+ from ansys.fluent.visualization import Graphics
126
126
 
127
127
  graphics_session = Graphics(session)
128
128
  surface1 = graphics_session.Surfaces["surface-1"]
@@ -146,7 +146,7 @@ class Surface(SurfaceDefn):
146
146
  Whether to overlay graphics over existing graphics.
147
147
  The default is ``False``.
148
148
  """
149
- pyvista_windows_manager.plot(
149
+ graphics_windows_manager.plot(
150
150
  self, window_id=window_id, overlay=overlay, fetch_data=True
151
151
  )
152
152
 
@@ -165,12 +165,12 @@ class Contour(ContourDefn):
165
165
 
166
166
  .. code-block:: python
167
167
 
168
- from ansys.fluent.visualization.pyvista import Graphics
168
+ from ansys.fluent.visualization import Graphics
169
169
 
170
170
  graphics_session = Graphics(session)
171
171
  contour1 = graphics_session.Contours["contour-1"]
172
172
  contour1.field = "velocity-magnitude"
173
- contour1.surfaces_list = ['wall']
173
+ contour1.surfaces = ['wall']
174
174
  contour1.display("window-0")
175
175
  """
176
176
 
@@ -187,7 +187,7 @@ class Contour(ContourDefn):
187
187
  Whether to overlay graphics over existing graphics.
188
188
  The default is ``False``.
189
189
  """
190
- pyvista_windows_manager.plot(
190
+ graphics_windows_manager.plot(
191
191
  self, window_id=window_id, overlay=overlay, fetch_data=True
192
192
  )
193
193
 
@@ -206,11 +206,11 @@ class Vector(VectorDefn):
206
206
 
207
207
  .. code-block:: python
208
208
 
209
- from ansys.fluent.visualization.pyvista import Graphics
209
+ from ansys.fluent.visualization import Graphics
210
210
 
211
211
  graphics_session = Graphics(session)
212
212
  vector1 = graphics_session.Vectors["vector-1"]
213
- vector1.surfaces_list = ['symmetry']
213
+ vector1.surfaces = ['symmetry']
214
214
  vector1.scale = 4.0
215
215
  vector1.skip = 4
216
216
  vector1.display("window-0")
@@ -229,6 +229,6 @@ class Vector(VectorDefn):
229
229
  Whether to overlay graphics over existing graphics.
230
230
  The default is ``False``.
231
231
  """
232
- pyvista_windows_manager.plot(
232
+ graphics_windows_manager.plot(
233
233
  self, window_id=window_id, overlay=overlay, fetch_data=True
234
234
  )
@@ -0,0 +1,148 @@
1
+ """A wrapper to improve the user interface of graphics."""
2
+
3
+ from ansys.fluent.visualization import get_config
4
+ from ansys.fluent.visualization.graphics import graphics_windows_manager
5
+ from ansys.fluent.visualization.plotter.plotter_windows import PlotterWindow
6
+
7
+
8
+ class GraphicsWindow:
9
+ def __init__(self, grid: tuple = (1, 1)):
10
+ self._grid = grid
11
+ self._graphics_objs = []
12
+ self.window_id = None
13
+
14
+ def add_graphics(
15
+ self,
16
+ object,
17
+ position: tuple = (0, 0),
18
+ opacity: float = 1,
19
+ title: str = "",
20
+ ) -> None:
21
+ """Add data to a plot.
22
+
23
+ Parameters
24
+ ----------
25
+ object: GraphicsDefn
26
+ Object to plot as a sub-plot.
27
+ position: tuple, optional
28
+ Position of the sub-plot.
29
+ opacity: float, optional
30
+ Transparency of the sub-plot.
31
+ title: str, optional
32
+ Title of the sub-plot (only for plots).
33
+ """
34
+ self._graphics_objs.append({**locals()})
35
+
36
+ def _all_plt_objs(self):
37
+ from ansys.fluent.core.post_objects.post_object_definitions import PlotDefn
38
+
39
+ for obj in self._graphics_objs:
40
+ if not isinstance(obj["object"].obj, PlotDefn):
41
+ return False
42
+ return True
43
+
44
+ def show(self) -> None:
45
+ """Render the objects in window and display the same."""
46
+ self.window_id = graphics_windows_manager.open_window(grid=self._grid)
47
+ if self._all_plt_objs() and get_config()["blocking"]:
48
+ p = PlotterWindow(grid=self._grid)
49
+ for obj in self._graphics_objs:
50
+ p.add_plots(obj["object"], position=obj["position"], title=obj["title"])
51
+ p.show(self.window_id)
52
+ else:
53
+ self.graphics_window = graphics_windows_manager._post_windows.get(
54
+ self.window_id
55
+ )
56
+ self._renderer = self.graphics_window.renderer
57
+ self.plotter = self.graphics_window.renderer.plotter
58
+ for i in range(len(self._graphics_objs)):
59
+ graphics_windows_manager.add_graphics(
60
+ object=self._graphics_objs[i]["object"].obj,
61
+ window_id=self.window_id,
62
+ fetch_data=True,
63
+ overlay=True,
64
+ position=self._graphics_objs[i]["position"],
65
+ opacity=self._graphics_objs[i]["opacity"],
66
+ )
67
+ graphics_windows_manager.show_graphics(self.window_id)
68
+
69
+ def save_graphic(
70
+ self,
71
+ format: str,
72
+ ) -> None:
73
+ """Save a graphics.
74
+
75
+ Parameters
76
+ ----------
77
+ format : str
78
+ Graphic file format. Supported formats are SVG, EPS, PS, PDF, and TEX.
79
+
80
+ Raises
81
+ ------
82
+ ValueError
83
+ If the window does not support the specified format.
84
+ """
85
+ if self.window_id:
86
+ self._renderer.save_graphic(f"{self.window_id}.{format}")
87
+
88
+ def refresh_windows(
89
+ self,
90
+ session_id: str | None = "",
91
+ overlay: bool | None = False,
92
+ ) -> None:
93
+ """Refresh windows.
94
+
95
+ Parameters
96
+ ----------
97
+ session_id : str, optional
98
+ Session ID for refreshing the windows that belong only to this
99
+ session. The default is ``""``, in which case the windows in all
100
+ sessions are refreshed.
101
+ overlay : bool, Optional
102
+ Overlay graphics over existing graphics.
103
+ """
104
+ if self.window_id:
105
+ graphics_windows_manager.refresh_windows(
106
+ windows_id=[self.window_id], session_id=session_id, overlay=overlay
107
+ )
108
+
109
+ def animate_windows(
110
+ self,
111
+ session_id: str | None = "",
112
+ ) -> None:
113
+ """Animate windows.
114
+
115
+ Parameters
116
+ ----------
117
+ session_id : str, optional
118
+ Session ID for animating the windows that belong only to this
119
+ session. The default is ``""``, in which case the windows in all
120
+ sessions are animated.
121
+
122
+ Raises
123
+ ------
124
+ NotImplementedError
125
+ If not implemented.
126
+ """
127
+ if self.window_id:
128
+ graphics_windows_manager.animate_windows(
129
+ windows_id=[self.window_id], session_id=session_id
130
+ )
131
+
132
+ def close_windows(
133
+ self,
134
+ session_id: str | None = "",
135
+ ) -> None:
136
+ """Close windows.
137
+
138
+ Parameters
139
+ ----------
140
+ session_id : str, optional
141
+ Session ID for closing the windows that belong only to this session.
142
+ The default is ``""``, in which case the windows in all sessions
143
+ are closed.
144
+ """
145
+ if self.window_id:
146
+ graphics_windows_manager.close_windows(
147
+ windows_id=[self.window_id], session_id=session_id
148
+ )