Skip to content

Commit

Permalink
deploy: a8cfb56
Browse files Browse the repository at this point in the history
  • Loading branch information
Huite committed Aug 12, 2024
1 parent 90727c3 commit e5a205b
Show file tree
Hide file tree
Showing 26 changed files with 290 additions and 57 deletions.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/examples/gmsh-basic.doctree
Binary file not shown.
Binary file modified .doctrees/examples/sg_execution_times.doctree
Binary file not shown.
Binary file modified .doctrees/examples/triangle-basic.doctree
Binary file not shown.
Binary file modified .doctrees/examples/triangle-geospatial.doctree
Binary file not shown.
Binary file modified .doctrees/sg_execution_times.doctree
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Gmsh allows for specifying cell sizes not just on polygons (regions) like\nTriangle (left), but on individual vertices as well, as is visible around the\ndiagonal (right).\n\n## Defaults\n\nThe GmshMesher class is initialized with a number of default parameters:\n\n"
"Gmsh allows for specifying cell sizes in a more flexible way. Triangle (left)\nonly supports polygons (regions) with fixed cell sizes and explicitly placed\nvertices. Gmsh is capable of forcing refinement in a larger zone around\nfeatures as is visible around the diagonal (right).\n\n## Defaults\n\nThe GmshMesher class is initialized with a number of default parameters:\n\n"
]
},
{
Expand Down
Binary file modified _downloads/7a7ce2204255f277838397c00eecb9b7/gmsh-basic.zip
Binary file not shown.
Binary file modified _downloads/8d89d0cac7b99393a56c43d6bed625ed/triangle-basic.zip
Binary file not shown.
17 changes: 17 additions & 0 deletions _downloads/901731ce545f172d35561b334a49dd37/triangle-basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@
pm.plot(vertices, triangles, ax=ax)
gdf.plot(facecolor="none", edgecolor="red", ax=ax)

# %%
# Specify cell size along line string
# -----------------------------------
#
# Finally, we may also specify the cell size along the line.

line = sg.LineString([(2.0, 8.0), (8.0, 2.0)])
gdf = gpd.GeoDataFrame(geometry=[polygon, line])
gdf["cellsize"] = [2.0, 0.5]

fig, ax = plt.subplots()

mesher = pm.TriangleMesher(gdf)
vertices, triangles = mesher.generate()
pm.plot(vertices, triangles, ax=ax)
gdf.plot(facecolor="none", edgecolor="red", ax=ax)

# %%
# Conclusion
# ----------
Expand Down
Binary file not shown.
7 changes: 4 additions & 3 deletions _downloads/b2f739ff5661dbbdc862aeef3d14c095/gmsh-basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@
pm.plot(vertices, triangles, ax=ax1)

# %%
# Gmsh allows for specifying cell sizes not just on polygons (regions) like
# Triangle (left), but on individual vertices as well, as is visible around the
# diagonal (right).
# Gmsh allows for specifying cell sizes in a more flexible way. Triangle (left)
# only supports polygons (regions) with fixed cell sizes and explicitly placed
# vertices. Gmsh is capable of forcing refinement in a larger zone around
# features as is visible around the diagonal (right).
#
# Defaults
# --------
Expand Down
18 changes: 18 additions & 0 deletions _downloads/c93ce4bc3dd147e1f4354d872a3387a0/triangle-basic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,24 @@
"line = sg.LineString(\n [\n [9.0, 2.0],\n [9.0, 8.0],\n ]\n)\ngdf = gpd.GeoDataFrame(geometry=[donut, refined, line, *points])\ngdf[\"cellsize\"] = [2.0, 0.5, np.nan] + (len(points) * [np.nan])\n\nmesher = pm.TriangleMesher(gdf)\nvertices, triangles = mesher.generate()\n\nfig, ax = plt.subplots()\npm.plot(vertices, triangles, ax=ax)\ngdf.plot(facecolor=\"none\", edgecolor=\"red\", ax=ax)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Specify cell size along line string\n\nFinally, we may also specify the cell size along the line.\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"line = sg.LineString([(2.0, 8.0), (8.0, 2.0)])\ngdf = gpd.GeoDataFrame(geometry=[polygon, line])\ngdf[\"cellsize\"] = [2.0, 0.5]\n\nfig, ax = plt.subplots()\n\nmesher = pm.TriangleMesher(gdf)\nvertices, triangles = mesher.generate()\npm.plot(vertices, triangles, ax=ax)\ngdf.plot(facecolor=\"none\", edgecolor=\"red\", ax=ax)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Binary file modified _images/sphx_glr_gmsh-basic_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/sphx_glr_triangle-basic_010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 40 additions & 14 deletions _sources/examples/gmsh-basic.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ in the appropriate manner for Gmsh.
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
Expand Down Expand Up @@ -140,21 +147,31 @@ and whistles for defining cellsizes.
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
.. GENERATED FROM PYTHON SOURCE LINES 69-77
Gmsh allows for specifying cell sizes not just on polygons (regions) like
Triangle (left), but on individual vertices as well, as is visible around the
diagonal (right).
.. GENERATED FROM PYTHON SOURCE LINES 69-78
Gmsh allows for specifying cell sizes in a more flexible way. Triangle (left)
only supports polygons (regions) with fixed cell sizes and explicitly placed
vertices. Gmsh is capable of forcing refinement in a larger zone around
features as is visible around the diagonal (right).

Defaults
--------

The GmshMesher class is initialized with a number of default parameters:

.. GENERATED FROM PYTHON SOURCE LINES 77-80
.. GENERATED FROM PYTHON SOURCE LINES 78-81
.. code-block:: Python
Expand All @@ -176,7 +193,7 @@ The GmshMesher class is initialized with a number of default parameters:
fields = Empty GeoDataFrame
Columns: []
Index: []
tmpdir = <TemporaryDirectory '/tmp/tmp76as3hlo'>
tmpdir = <TemporaryDirectory '/tmp/tmp4o9loswg'>
recombine_all = False
mesh_size_extend_from_boundary = True
mesh_size_from_points = True
Expand All @@ -189,7 +206,7 @@ The GmshMesher class is initialized with a number of default parameters:
.. GENERATED FROM PYTHON SOURCE LINES 81-88
.. GENERATED FROM PYTHON SOURCE LINES 82-89
The parameters of Gmsh differ from Triangle, but they work the same: they can
be altered after initialization to control the triangulation.
Expand All @@ -199,7 +216,7 @@ Forcing points, lines, local refinement

We can force points and lines into the triangulation:

.. GENERATED FROM PYTHON SOURCE LINES 88-115
.. GENERATED FROM PYTHON SOURCE LINES 89-116
.. code-block:: Python
Expand Down Expand Up @@ -243,12 +260,14 @@ We can force points and lines into the triangulation:

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
<Axes: >
.. GENERATED FROM PYTHON SOURCE LINES 116-122
.. GENERATED FROM PYTHON SOURCE LINES 117-123
Quadrilateral meshes
--------------------
Expand All @@ -257,7 +276,7 @@ One of the features of Gmsh is that it is also capable of generating
quadrilateral (dominant) meshes, by recombining triangles. We can achieve
this by changing a parameter on the mesher:

.. GENERATED FROM PYTHON SOURCE LINES 122-131
.. GENERATED FROM PYTHON SOURCE LINES 123-132
.. code-block:: Python
Expand All @@ -279,18 +298,25 @@ this by changing a parameter on the mesher:
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
.. GENERATED FROM PYTHON SOURCE LINES 132-137
.. GENERATED FROM PYTHON SOURCE LINES 133-138
Writing to file
---------------
It's also possible to use the Python bindings to write a Gmsh ``.msh`` file.
This file can be opened using the Gmsh GUI to e.g. inspect the generated
mesh.

.. GENERATED FROM PYTHON SOURCE LINES 137-140
.. GENERATED FROM PYTHON SOURCE LINES 138-141
.. code-block:: Python
Expand All @@ -304,7 +330,7 @@ mesh.
.. GENERATED FROM PYTHON SOURCE LINES 141-150
.. GENERATED FROM PYTHON SOURCE LINES 142-151
Conclusion
----------
Expand All @@ -319,7 +345,7 @@ polygons.

.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 0.361 seconds)
**Total running time of the script:** (0 minutes 0.355 seconds)


.. _sphx_glr_download_examples_gmsh-basic.py:
Expand Down
8 changes: 4 additions & 4 deletions _sources/examples/sg_execution_times.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Computation times
=================
**00:01.541** total execution time for 3 files **from examples**:
**00:01.613** total execution time for 3 files **from examples**:

.. container::

Expand All @@ -33,11 +33,11 @@ Computation times
- Time
- Mem (MB)
* - :ref:`sphx_glr_examples_triangle-basic.py` (``triangle-basic.py``)
- 00:00.632
- 00:00.708
- 0.0
* - :ref:`sphx_glr_examples_triangle-geospatial.py` (``triangle-geospatial.py``)
- 00:00.548
- 00:00.550
- 0.0
* - :ref:`sphx_glr_examples_gmsh-basic.py` (``gmsh-basic.py``)
- 00:00.361
- 00:00.355
- 0.0
86 changes: 84 additions & 2 deletions _sources/examples/triangle-basic.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ in the appropriate manner for triangle.
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
Expand Down Expand Up @@ -188,6 +195,13 @@ recreate the mesher.
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
Expand Down Expand Up @@ -227,6 +241,13 @@ with a cell size in the geodataframe.
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
Expand Down Expand Up @@ -262,6 +283,13 @@ Holes in polygons work as expected:
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
Expand Down Expand Up @@ -297,6 +325,13 @@ exactly with the coordinates of the exterior boundary of the inner polygon.
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
Expand Down Expand Up @@ -369,6 +404,8 @@ contents of the geodataframe on top of the generated mesh:

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
<Axes: >
Expand Down Expand Up @@ -416,12 +453,57 @@ x = 9.0.

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
<Axes: >
.. GENERATED FROM PYTHON SOURCE LINES 174-178
Specify cell size along line string
-----------------------------------

Finally, we may also specify the cell size along the line.

.. GENERATED FROM PYTHON SOURCE LINES 178-190
.. code-block:: Python
line = sg.LineString([(2.0, 8.0), (8.0, 2.0)])
gdf = gpd.GeoDataFrame(geometry=[polygon, line])
gdf["cellsize"] = [2.0, 0.5]
fig, ax = plt.subplots()
mesher = pm.TriangleMesher(gdf)
vertices, triangles = mesher.generate()
pm.plot(vertices, triangles, ax=ax)
gdf.plot(facecolor="none", edgecolor="red", ax=ax)
.. image-sg:: /examples/images/sphx_glr_triangle-basic_010.png
:alt: triangle basic
:srcset: /examples/images/sphx_glr_triangle-basic_010.png
:class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

.. code-block:: none
/home/runner/work/pandamesh/pandamesh/pandamesh/common.py:82: FutureWarning: RangeIndex.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.
if not features.index.is_integer():
<Axes: >
.. GENERATED FROM PYTHON SOURCE LINES 174-181
.. GENERATED FROM PYTHON SOURCE LINES 191-198
Conclusion
----------
Expand All @@ -434,7 +516,7 @@ sizes, and linestrings and points to steer the triangulation.

.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 0.632 seconds)
**Total running time of the script:** (0 minutes 0.708 seconds)


.. _sphx_glr_download_examples_triangle-basic.py:
Expand Down
Loading

0 comments on commit e5a205b

Please sign in to comment.