forked from bwoodsend/meshzoo-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKG-INFO
219 lines (163 loc) · 7.25 KB
/
PKG-INFO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
Metadata-Version: 2.1
Name: meshzoo
Version: 0.7.5
Summary: Collection of explicitly constructed meshes
Home-page: https://github.com/nschloe/meshzoo
Author: Nico Schlömer
Author-email: [email protected]
License: GPL-3.0-or-later
Project-URL: Code, https://github.com/nschloe/meshzoo
Project-URL: Issues, https://github.com/nschloe/meshzoo/issues
Project-URL: Funding, https://github.com/sponsors/nschloe
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Provides-Extra: all
Provides-Extra: plot
License-File: LICENSE.txt
# meshzoo
[![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)
[![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&label=chat&message=on%20discord&color=7289da&style=flat-square)](https://discord.gg/PBCCvwHqpv)
[![gh-actions](https://img.shields.io/github/workflow/status/nschloe/meshzoo/ci?style=flat-square)](https://github.com/nschloe/meshzoo/actions?query=workflow%3Aci)
[![codecov](https://img.shields.io/codecov/c/github/nschloe/meshzoo.svg?style=flat-square)](https://codecov.io/gh/nschloe/meshzoo)
[![LGTM](https://img.shields.io/lgtm/grade/python/github/nschloe/meshzoo.svg?style=flat-square)](https://lgtm.com/projects/g/nschloe/meshzoo)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
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/nschloe/pygmsh/),
[MeshPy](https://github.com/inducer/meshpy),
[mshr](https://bitbucket.org/fenics-project/mshr),
[pygalmesh](https://github.com/nschloe/pygalmesh/),
[dmsh](https://github.com/nschloe/dmsh/)),
but something simple and fast that makes use of the structure of the domain. Enter
meshzoo.
### Examples
#### Triangle
<img src="https://nschloe.github.io/meshzoo/triangle.svg" width="20%">
```python
import meshzoo
bary, cells = meshzoo.triangle(8)
# corners = numpy.array(
# [
# [0.0, -0.5 * numpy.sqrt(3.0), +0.5 * numpy.sqrt(3.0)],
# [1.0, -0.5, -0.5],
# ]
# )
# points = numpy.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://nschloe.github.io/meshzoo/rectangle.svg"/></td>
<td width="50%"><img src="https://nschloe.github.io/meshzoo/rectangle-quad.svg"/></td>
</tr>
</table>
```python
import meshzoo
points, cells = meshzoo.rectangle_tri(
(0.0, 0.0),
(1.0, 1.0),
n=11, # or (11, 11)
variant="zigzag", # or "up", "down", "center"
)
points, cells = meshzoo.rectangle_quad((0.0, 0.0), (1.0, 1.0), n=11)
```
#### Regular polygon
| <img src="https://nschloe.github.io/meshzoo/4gon.svg" width="70%"> | <img src="https://nschloe.github.io/meshzoo/6gon.svg" width="70%"> | <img src="https://nschloe.github.io/meshzoo/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://nschloe.github.io/meshzoo/4gon_disk.svg" width="70%"> | <img src="https://nschloe.github.io/meshzoo/6gon_disk.svg" width="70%"> | <img src="https://nschloe.github.io/meshzoo/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)
```
#### Möbius strip
<img src="https://nschloe.github.io/meshzoo/moebius.png" width="20%">
```python
import meshzoo
points, cells = meshzoo.moebius(num_twists=1, nl=60, nw=11)
```
#### Sphere (surface)
| <img src="https://nschloe.github.io/meshzoo/uv_sphere.png" width="80%"> | <img src="https://nschloe.github.io/meshzoo/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 normal points outwards.
| <img src="https://nschloe.github.io/meshzoo/tetra-sphere.png" width="70%"> | <img src="https://nschloe.github.io/meshzoo/octa-sphere.png" width="70%"> | <img src="https://nschloe.github.io/meshzoo/icosa-sphere.png" width="70%"> |
| :----: | :---: | :---: |
|`meshzoo.tetra_sphere(10)` | `meshzoo.octa_sphere(10)` | `meshzoo.icosa_sphere(10)` |
#### Ball (solid)
| <img src="https://nschloe.github.io/meshzoo/ball-tetra.png" width="70%"> | <img src="https://nschloe.github.io/meshzoo/ball-hexa.png" width="70%"> |
| :----: | :---: |
```python
import meshzoo
points, cells = meshzoo.ball_tetra(10)
points, cells = meshzoo.ball_hexa(10)
```
#### Tube
<img src="https://nschloe.github.io/meshzoo/tube.png" width="20%">
```python
import meshzoo
points, cells = meshzoo.tube(length=1.0, radius=1.0, n=30)
```
#### Cube
| <img src="https://nschloe.github.io/meshzoo/cube.png" width="70%"> | <img src="https://nschloe.github.io/meshzoo/cube-hexa.png" width="50%"> |
| :----: | :---: |
```python
import meshzoo
points, cells = meshzoo.cube_tetra((0.0, 0.0, 0.0), (1.0, 1.0, 1.0), n=11)
points, cells = meshzoo.cube_hexa((0.0, 0.0, 0.0), (1.0, 1.0, 1.0), n=11)
```
### Extra, extra
In addition to this, the
[`examples/`](https://github.com/nschloe/meshzoo/tree/main/examples) directory
contains a couple of instructive examples for other mesh generators.
### Installation
meshzoo is [available from the Python Package
Index](https://pypi.org/project/meshzoo/), so simply do
```
pip install meshzoo
```
to install.
### Testing
To run the meshzoo unit tests, check out this repository and run
```
pytest
```
### License
meshzoo is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).