.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_union.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_union.py: Union meshing ============= .. GENERATED FROM PYTHON SOURCE LINES 7-8 In this example we will see how to define a mesh from the union of several meshes. .. GENERATED FROM PYTHON SOURCE LINES 10-14 .. code-block:: Python import openturns as ot import openturns.viewer as otv import otmeshing as otm .. GENERATED FROM PYTHON SOURCE LINES 15-16 Define two non-overlapping meshes .. GENERATED FROM PYTHON SOURCE LINES 16-20 .. code-block:: Python dim = 2 mesh1 = ot.IntervalMesher([1] * dim).build(ot.Interval(dim)) mesh2 = ot.IntervalMesher([1] * dim).build(ot.Interval([2.0] * dim, [3.0] * dim)) .. GENERATED FROM PYTHON SOURCE LINES 21-22 Compute the mesh of both cylinders .. GENERATED FROM PYTHON SOURCE LINES 22-25 .. code-block:: Python mesher = otm.UnionMesher() union = mesher.build([mesh1, mesh2]) .. GENERATED FROM PYTHON SOURCE LINES 26-27 Plot union .. GENERATED FROM PYTHON SOURCE LINES 27-32 .. code-block:: Python graph = union.draw() graph.setLegendPosition("upper left") graph.setTitle("Mesh union") view = otv.View(graph) .. image-sg:: /auto_examples/images/sphx_glr_plot_union_001.png :alt: Mesh union :srcset: /auto_examples/images/sphx_glr_plot_union_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 33-34 .. code-block:: Python otv.View.ShowAll() .. _sphx_glr_download_auto_examples_plot_union.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_union.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_union.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_union.zip `