meshzoo


Namemeshzoo JSON
Version 0.11.3 PyPI version JSON
download
home_page
SummaryCollection of explicitly constructed meshes
upload_time2024-01-19 10:19:32
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords mesh scientific engineering fem finite elements
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <a href="https://github.com/nschloe/meshzoo"><img alt="meshzoo" src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/meshzoo-logo.svg" width="60%"></a>
</p>

[![PyPi Version](https://img.shields.io/pypi/v/meshzoo.svg?style=flat-square)](https://pypi.org/project/meshzoo/)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/meshzoo.svg?style=flat-square)](https://pypi.org/project/meshzoo/)
[![GitHub stars](https://img.shields.io/github/stars/nschloe/meshzoo.svg?style=flat-square&logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/meshzoo)
[![Downloads](https://pepy.tech/badge/meshzoo/month?style=flat-square)](https://pepy.tech/project/meshzoo)

<!--[![PyPi downloads](https://img.shields.io/pypi/dm/meshzoo.svg?style=flat-square)](https://pypistats.org/packages/meshzoo)-->

[![Discord](https://img.shields.io/static/v1?logo=discord&logoColor=white&label=chat&message=on%20discord&color=7289da&style=flat-square)](https://discord.gg/PBCCvwHqpv)

When generating meshes for FEM/FVM computations, sometimes your geometry is so simple
that you don't need a complex mesh generator (like
[pygmsh](https://github.com/meshpro/pygmsh/),
[MeshPy](https://github.com/inducer/meshpy),
[mshr](https://bitbucket.org/fenics-project/mshr),
[pygalmesh](https://github.com/meshpro/pygalmesh/),
[dmsh](https://github.com/meshpro/dmsh/)),
but something simple and fast that makes use of the structure of the domain. Enter
meshzoo.

### Installation

Install meshzoo [from PyPI](https://pypi.org/project/meshzoo/) with

```
pip install meshzoo
```

### How to get a license

Licenses for personal and academic use can be purchased
[here](https://buy.stripe.com/5kA3eV8t8af83iE9AE).
You'll receive a confirmation email with a license key.
Install the key with

```
plm add <your-license-key>
```

on your machine and you're good to go.

For commercial use, please contact support@mondaytech.com.

### Examples

#### Triangle

<img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/triangle.svg" width="20%">

```python
import meshzoo

bary, cells = meshzoo.triangle(8)

# corners = np.array(
#     [
#         [0.0, -0.5 * numpy.sqrt(3.0), +0.5 * numpy.sqrt(3.0)],
#         [1.0, -0.5, -0.5],
#     ]
# )
# points = np.dot(corners, bary).T

# Process the mesh, e.g., write it to a file using meshio
# meshio.write_points_cells("triangle.vtk", points, {"triangle": cells})
```

#### Rectangle

<table width="100%">
  <tr width="100%">
  <td width="50%"><img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/rectangle.svg"/></td>
  <td width="50%"><img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/rectangle-quad.svg"/></td>
  </tr>
</table>

```python
import meshzoo
import numpy as np

points, cells = meshzoo.rectangle_tri(
    np.linspace(0.0, 1.0, 11),
    np.linspace(0.0, 1.0, 11),
    variant="zigzag",  # or "up", "down", "center"
)

points, cells = meshzoo.rectangle_quad(
    np.linspace(0.0, 1.0, 11),
    np.linspace(0.0, 1.0, 11),
    cell_type="quad4",  # or "quad8", "quad9"
)
```

#### Regular polygon

| <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/4gon.svg" width="70%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/6gon.svg" width="70%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/9gon.svg" width="70%"> |
| :---------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------: |
|                                   `meshzoo.ngon(4, 8)`                                    |                                   `meshzoo.ngon(6, 8)`                                    |                                   `meshzoo.ngon(9, 8)`                                    |

```python
import meshzoo

points, cells = meshzoo.ngon(5, 11)
```

#### Disk

| <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets//4gon_disk.svg" width="70%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/6gon_disk.svg" width="70%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/9gon_disk.svg" width="70%"> |
| :---------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: |
|                                      `meshzoo.disk(4, 8)`                                       |                                      `meshzoo.disk(6, 8)`                                      |                                      `meshzoo.disk(9, 8)`                                      |

The disk meshes are inflations of regular polygons.

```python
import meshzoo

points, cells = meshzoo.disk(6, 11)

points, cells = meshzoo.disk_quad(10, cell_type="quad4")  # or "quad8", "quad9"
```

#### Möbius strip

<img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/moebius.png" width="20%">

```python
import meshzoo

points, cells = meshzoo.moebius(num_twists=1, nl=60, nw=11)
```

#### Sphere (surface)

| <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/uv_sphere.png" width="80%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/geo-sphere.png" width="60%"> |
| :--------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------: |

```python
import meshzoo

points, cells = meshzoo.uv_sphere(num_points_per_circle=20, num_circles=10, radius=1.0)
points, tri, quad = meshzoo.geo_sphere(
    num_points_per_circle=20, num_circles=10, radius=1.0
)
```

Spheres can also be generated by refining the faces of [platonic
solids](https://en.wikipedia.org/wiki/Platonic_solid) and then "inflating" them. meshzoo
implements a few of them. The sphere generated from the icosahedron has the
highest-quality (most equilateral) triangles.

All cells are oriented such that its normals point outwards.

| <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/tetra-sphere.png" width="70%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/octa-sphere.png" width="70%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/icosa-sphere.png" width="70%"> |
| :-----------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: |
|                                    `meshzoo.tetra_sphere(10)`                                     |                                    `meshzoo.octa_sphere(10)`                                     |                                    `meshzoo.icosa_sphere(10)`                                     |

#### Ball (solid)

| <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/ball-tetra.png" width="70%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/ball-hexa.png" width="70%"> |
| :---------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: |

```python
import meshzoo

points, cells = meshzoo.ball_tetra(10)
points, cells = meshzoo.ball_hexa(10)
```

#### Tube

<img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/tube.png" width="20%">

```python
import meshzoo

points, cells = meshzoo.tube(length=1.0, radius=1.0, n=30)
```

#### Cube

| <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/cube.png" width="70%"> | <img src="https://raw.githubusercontent.com/meshpro/meshzoo/assets/cube-hexa.png" width="50%"> |
| :---------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: |

```python
import meshzoo
import numpy as np

points, cells = meshzoo.cube_tetra(
    np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11)
)
points, cells = meshzoo.cube_hexa(
    np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11)
)
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "meshzoo",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "mesh,scientific,engineering,fem,finite elements",
    "author": "",
    "author_email": "Nico Schl\u00f6mer <nico.schloemer@gmail.com>",
    "download_url": "",
    "platform": null,
    "description": "<p align=\"center\">\n  <a href=\"https://github.com/nschloe/meshzoo\"><img alt=\"meshzoo\" src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/meshzoo-logo.svg\" width=\"60%\"></a>\n</p>\n\n[![PyPi Version](https://img.shields.io/pypi/v/meshzoo.svg?style=flat-square)](https://pypi.org/project/meshzoo/)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/meshzoo.svg?style=flat-square)](https://pypi.org/project/meshzoo/)\n[![GitHub stars](https://img.shields.io/github/stars/nschloe/meshzoo.svg?style=flat-square&logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/meshzoo)\n[![Downloads](https://pepy.tech/badge/meshzoo/month?style=flat-square)](https://pepy.tech/project/meshzoo)\n\n<!--[![PyPi downloads](https://img.shields.io/pypi/dm/meshzoo.svg?style=flat-square)](https://pypistats.org/packages/meshzoo)-->\n\n[![Discord](https://img.shields.io/static/v1?logo=discord&logoColor=white&label=chat&message=on%20discord&color=7289da&style=flat-square)](https://discord.gg/PBCCvwHqpv)\n\nWhen generating meshes for FEM/FVM computations, sometimes your geometry is so simple\nthat you don't need a complex mesh generator (like\n[pygmsh](https://github.com/meshpro/pygmsh/),\n[MeshPy](https://github.com/inducer/meshpy),\n[mshr](https://bitbucket.org/fenics-project/mshr),\n[pygalmesh](https://github.com/meshpro/pygalmesh/),\n[dmsh](https://github.com/meshpro/dmsh/)),\nbut something simple and fast that makes use of the structure of the domain. Enter\nmeshzoo.\n\n### Installation\n\nInstall meshzoo [from PyPI](https://pypi.org/project/meshzoo/) with\n\n```\npip install meshzoo\n```\n\n### How to get a license\n\nLicenses for personal and academic use can be purchased\n[here](https://buy.stripe.com/5kA3eV8t8af83iE9AE).\nYou'll receive a confirmation email with a license key.\nInstall the key with\n\n```\nplm add <your-license-key>\n```\n\non your machine and you're good to go.\n\nFor commercial use, please contact support@mondaytech.com.\n\n### Examples\n\n#### Triangle\n\n<img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/triangle.svg\" width=\"20%\">\n\n```python\nimport meshzoo\n\nbary, cells = meshzoo.triangle(8)\n\n# corners = np.array(\n#     [\n#         [0.0, -0.5 * numpy.sqrt(3.0), +0.5 * numpy.sqrt(3.0)],\n#         [1.0, -0.5, -0.5],\n#     ]\n# )\n# points = np.dot(corners, bary).T\n\n# Process the mesh, e.g., write it to a file using meshio\n# meshio.write_points_cells(\"triangle.vtk\", points, {\"triangle\": cells})\n```\n\n#### Rectangle\n\n<table width=\"100%\">\n  <tr width=\"100%\">\n  <td width=\"50%\"><img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/rectangle.svg\"/></td>\n  <td width=\"50%\"><img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/rectangle-quad.svg\"/></td>\n  </tr>\n</table>\n\n```python\nimport meshzoo\nimport numpy as np\n\npoints, cells = meshzoo.rectangle_tri(\n    np.linspace(0.0, 1.0, 11),\n    np.linspace(0.0, 1.0, 11),\n    variant=\"zigzag\",  # or \"up\", \"down\", \"center\"\n)\n\npoints, cells = meshzoo.rectangle_quad(\n    np.linspace(0.0, 1.0, 11),\n    np.linspace(0.0, 1.0, 11),\n    cell_type=\"quad4\",  # or \"quad8\", \"quad9\"\n)\n```\n\n#### Regular polygon\n\n| <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/4gon.svg\" width=\"70%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/6gon.svg\" width=\"70%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/9gon.svg\" width=\"70%\"> |\n| :---------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------: |\n|                                   `meshzoo.ngon(4, 8)`                                    |                                   `meshzoo.ngon(6, 8)`                                    |                                   `meshzoo.ngon(9, 8)`                                    |\n\n```python\nimport meshzoo\n\npoints, cells = meshzoo.ngon(5, 11)\n```\n\n#### Disk\n\n| <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets//4gon_disk.svg\" width=\"70%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/6gon_disk.svg\" width=\"70%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/9gon_disk.svg\" width=\"70%\"> |\n| :---------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: |\n|                                      `meshzoo.disk(4, 8)`                                       |                                      `meshzoo.disk(6, 8)`                                      |                                      `meshzoo.disk(9, 8)`                                      |\n\nThe disk meshes are inflations of regular polygons.\n\n```python\nimport meshzoo\n\npoints, cells = meshzoo.disk(6, 11)\n\npoints, cells = meshzoo.disk_quad(10, cell_type=\"quad4\")  # or \"quad8\", \"quad9\"\n```\n\n#### M\u00f6bius strip\n\n<img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/moebius.png\" width=\"20%\">\n\n```python\nimport meshzoo\n\npoints, cells = meshzoo.moebius(num_twists=1, nl=60, nw=11)\n```\n\n#### Sphere (surface)\n\n| <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/uv_sphere.png\" width=\"80%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/geo-sphere.png\" width=\"60%\"> |\n| :--------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------: |\n\n```python\nimport meshzoo\n\npoints, cells = meshzoo.uv_sphere(num_points_per_circle=20, num_circles=10, radius=1.0)\npoints, tri, quad = meshzoo.geo_sphere(\n    num_points_per_circle=20, num_circles=10, radius=1.0\n)\n```\n\nSpheres can also be generated by refining the faces of [platonic\nsolids](https://en.wikipedia.org/wiki/Platonic_solid) and then \"inflating\" them. meshzoo\nimplements a few of them. The sphere generated from the icosahedron has the\nhighest-quality (most equilateral) triangles.\n\nAll cells are oriented such that its normals point outwards.\n\n| <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/tetra-sphere.png\" width=\"70%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/octa-sphere.png\" width=\"70%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/icosa-sphere.png\" width=\"70%\"> |\n| :-----------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: |\n|                                    `meshzoo.tetra_sphere(10)`                                     |                                    `meshzoo.octa_sphere(10)`                                     |                                    `meshzoo.icosa_sphere(10)`                                     |\n\n#### Ball (solid)\n\n| <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/ball-tetra.png\" width=\"70%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/ball-hexa.png\" width=\"70%\"> |\n| :---------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: |\n\n```python\nimport meshzoo\n\npoints, cells = meshzoo.ball_tetra(10)\npoints, cells = meshzoo.ball_hexa(10)\n```\n\n#### Tube\n\n<img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/tube.png\" width=\"20%\">\n\n```python\nimport meshzoo\n\npoints, cells = meshzoo.tube(length=1.0, radius=1.0, n=30)\n```\n\n#### Cube\n\n| <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/cube.png\" width=\"70%\"> | <img src=\"https://raw.githubusercontent.com/meshpro/meshzoo/assets/cube-hexa.png\" width=\"50%\"> |\n| :---------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: |\n\n```python\nimport meshzoo\nimport numpy as np\n\npoints, cells = meshzoo.cube_tetra(\n    np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11)\n)\npoints, cells = meshzoo.cube_hexa(\n    np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11)\n)\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Collection of explicitly constructed meshes",
    "version": "0.11.3",
    "project_urls": null,
    "split_keywords": [
        "mesh",
        "scientific",
        "engineering",
        "fem",
        "finite elements"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "82bc6c847ddb86496f44da211f52c166e5023951a081cb42b66500925ca52e2f",
                "md5": "a4e3ba34dc6146dfbd0dc80cc8cdc066",
                "sha256": "4f5bee5c42681ce6fc973559797fc925feb61d230028ce22eedabbe2f9aaefa1"
            },
            "downloads": -1,
            "filename": "meshzoo-0.11.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4e3ba34dc6146dfbd0dc80cc8cdc066",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 36441,
            "upload_time": "2024-01-19T10:19:32",
            "upload_time_iso_8601": "2024-01-19T10:19:32.073317Z",
            "url": "https://files.pythonhosted.org/packages/82/bc/6c847ddb86496f44da211f52c166e5023951a081cb42b66500925ca52e2f/meshzoo-0.11.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-19 10:19:32",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "meshzoo"
}
        
Elapsed time: 0.23278s