@@ -5,8 +5,11 @@ Plotting meshes
55===============
66
77.. |MeshedRegion | replace :: :class: `MeshedRegion <ansys.dpf.core.meshed_region.MeshedRegion> `
8+ .. |MeshesContainer | replace :: :class: `MeshesContainer <ansys.dpf.core.meshes_container.MeshesContainer> `,
89.. |Model | replace :: :class: `Model <ansys.dpf.core.model.Model> `
910.. |plot | replace :: :func: `plot()<ansys.dpf.core.model.Model.plot> `
11+ .. |plotMesh | replace :: :func: `plot()<ansys.dpf.core.meshed_region.MeshedRegion.plot> `
12+ .. |plotMeshes | replace :: :func: `plot()<ansys.dpf.core.meshes_container.MeshesContainer.plot> `
1013.. |DpfPlotter | replace :: :class: `DpfPlotter<ansys.dpf.core.plotter.DpfPlotter> `
1114.. |add_mesh | replace :: :func: `add_mesh()<ansys.dpf.core.plotter.DpfPlotter.add_mesh> `
1215.. |show_figure | replace :: :func: `show_figure()<ansys.dpf.core.plotter.DpfPlotter.show_figure> `
@@ -22,8 +25,11 @@ of a model.
2225Define the mesh
2326---------------
2427
25- The mesh object in DPF is a |MeshedRegion |. In this tutorial we will download
26- a pontoon simulation result file available in our `Examples ` package:
28+ The mesh object in DPF is a |MeshedRegion |. You can plot a |MeshedRegion | or a
29+ |MeshesContainer |, that is a collection of |MeshedRegion |.
30+
31+ In this tutorial we will download a pontoon simulation result file available in
32+ our `Examples ` package:
2733
2834.. code-block :: python
2935
@@ -37,6 +43,7 @@ Here, we use the |MeshedRegion| associated with the DPF |Model| object.
3743However, you can obtain your |MeshedRegion | by other methods. For more
3844information see the tutorials section : :ref: `ref_tutorials_mesh `.
3945
46+
4047To plot the mesh you have three different methods:
4148
4249 1) :ref: `method_plot_mesh_1 `
@@ -102,17 +109,24 @@ the plot you can use additional PyVista arguments (available at:
102109
103110.. _method_plot_mesh_2 :
104111
105- Plot the |MeshedRegion | with the |plot | method
106- ----------------------------------------------
112+ Plot the |MeshedRegion | or the |MeshesContainer | with the |plotMesh | method
113+ ---------------------------------------------------------------------------
114+
115+ |MeshedRegion |
116+ ^^^^^^^^^^^^^^
107117
108118This second approach demands a |MeshedRegion | object. Thus, we extract
109- it from our |Model | object . Then, in the same way of the first approach,
110- you just have to use the |plot | method.
119+ it from our |Model | object.
111120
112121.. code-block :: python
113122
114123 # Extract the mesh
115124 my_meshed_region = my_model.metadata.meshed_region
125+
126+ Just like in the first approach, use the |plotMesh | method.
127+
128+ .. code-block :: python
129+
116130 # Use the plot() method to plot the mesh
117131 my_meshed_region.plot()
118132
@@ -125,14 +139,43 @@ you just have to use the |plot| method.
125139 my_meshed_region.plot()
126140
127141As, the meshed region is generated from the model’s metadata,
128- the plot generated here is identical to the plot generated by the ":ref: `method_plot_mesh_1 `" approach.
142+ the plot generated here is identical to the plot generated by
143+ the ":ref: `method_plot_mesh_1 `" approach.
129144
130145The default plotter settings display the mesh with edges, lighting
131146and axis widget enabled. Nevertheless, as we use the
132147`PyVista <https://github.com/pyvista/pyvista >`_ library to create
133148the plot you can use additional PyVista arguments (available at:
134149:func: `pyvista.plot `), just like in ":ref: `method_plot_mesh_1 `"
135150
151+ |MeshesContainer |
152+ ^^^^^^^^^^^^^^^^^
153+
154+ There are different ways to obtain a |MeshesContainer |.
155+
156+ Here we get a |MeshesContainer | by using the :class: `meshes_provider <ansys.dpf.core.operators.mesh.meshes_provider.meshes_provider> `
157+ operator.
158+
159+ .. code-block :: python
160+
161+ # Get the meshes container
162+ my_meshes = ops.mesh.mesh_provider(data_sources = dpf.DataSources(pontoon_file)).eval()
163+
164+ Just like in the first approach, use the |plotMeshes | method.
165+
166+ .. code-block :: python
167+
168+ # Use the plot() method to plot the mesh
169+ my_meshes.plot()
170+
171+ .. rst-class :: sphx-glr-script-out
172+
173+ .. jupyter-execute ::
174+ :hide-code:
175+
176+ my_meshes = ops.mesh.mesh_provider(data_sources=dpf.DataSources(pontoon_file)).eval()
177+ my_meshes.plot()
178+
136179.. _method_plot_mesh_3 :
137180
138181Plot the |MeshedRegion | with the |DpfPlotter | class
@@ -174,4 +217,5 @@ object and |add_mesh| method
174217(available at: :func: `pyvista.plot `).
175218
176219You can also plot results data on its supporting mesh. For a detailed demonstration
177- check: :ref: `ref_plotting_data_on_the_mesh `
220+ check: :ref: `ref_plotting_data_on_the_mesh `
221+
0 commit comments