|
1 | 1 | <p align="center"> |
2 | 2 | <a href="https://github.com/nschloe/pygalmesh"><img alt="pygalmesh" src="https://nschloe.github.io/pygalmesh/pygalmesh-logo.svg" width="60%"></a> |
3 | | - <p align="center">Create high-quality 3D meshes with ease.</p> |
| 3 | + <p align="center">Create high-quality meshes with ease.</p> |
4 | 4 | </p> |
5 | 5 |
|
6 | 6 | [](https://pypi.org/project/pygalmesh) |
|
18 | 18 | [](https://lgtm.com/projects/g/nschloe/pygalmesh) |
19 | 19 | [](https://github.com/psf/black) |
20 | 20 |
|
21 | | -pygalmesh is a Python frontend to [CGAL](https://www.cgal.org/)'s [3D mesh generation |
22 | | -capabilities](https://doc.cgal.org/latest/Mesh_3/index.html). |
23 | | -pygalmesh makes it easy to create high-quality 3D volume meshes, periodic volume meshes, |
24 | | -and surface meshes. |
| 21 | +pygalmesh is a Python frontend to [CGAL](https://www.cgal.org/)'s |
| 22 | +[2D](https://doc.cgal.org/latest/Mesh_2/index.html) and [3D mesh generation |
| 23 | +capabilities](https://doc.cgal.org/latest/Mesh_3/index.html). pygalmesh makes it easy |
| 24 | +to create high-quality 2D, 3D volume meshes, periodic volume meshes, and surface meshes. |
25 | 25 |
|
26 | | -### Background |
27 | | - |
28 | | -CGAL offers two different approaches for mesh generation: |
29 | | - |
30 | | -1. Meshes defined implicitly by level sets of functions. |
31 | | -2. Meshes defined by a set of bounding planes. |
32 | | - |
33 | | -pygalmesh provides a front-end to the first approach, which has the following advantages |
34 | | -and disadvantages: |
35 | | - |
36 | | -* All boundary points are guaranteed to be in the level set within any specified |
37 | | - residual. This results in smooth curved surfaces. |
38 | | -* Sharp intersections of subdomains (e.g., in unions or differences of sets) need to be |
39 | | - specified manually (via feature edges, see below), which can be tedious. |
| 26 | +### Examples |
40 | 27 |
|
41 | | -On the other hand, the bounding-plane approach (realized by |
42 | | -[mshr](https://bitbucket.org/fenics-project/mshr)), has the following properties: |
| 28 | +#### 2D meshes |
| 29 | +<img src="https://nschloe.github.io/pygalmesh/rect.svg" width="30%"> |
43 | 30 |
|
44 | | -* Smooth, curved domains are approximated by a set of bounding planes, resulting in more |
45 | | - of less visible edges. |
46 | | -* Intersections of domains can be computed automatically, so domain unions etc. have |
47 | | - sharp edges where they belong. |
| 31 | +CGAL generates 2D meshes from linear contraints. |
| 32 | +```python |
| 33 | +import numpy |
| 34 | +import pygalmesh |
48 | 35 |
|
49 | | -See [here](https://github.com/nschloe/awesome-scientific-computing#meshing) for other |
50 | | -mesh generation tools. |
| 36 | +points = numpy.array([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]) |
| 37 | +constraints = [[0, 1], [1, 2], [2, 3], [3, 0]] |
51 | 38 |
|
52 | | -### Examples |
| 39 | +mesh = pygalmesh.generate_2d(points, constraints, cell_size=1.0e-1, num_lloyd_steps=10) |
| 40 | +# mesh.points, mesh.cells |
| 41 | +``` |
| 42 | +The quality of the mesh isn't very good, but can be improved with |
| 43 | +[optimesh](https://github.com/nschloe/optimesh). |
53 | 44 |
|
54 | 45 | #### A simple ball |
55 | 46 | <img src="https://nschloe.github.io/pygalmesh/ball.png" width="30%"> |
@@ -446,6 +437,34 @@ To run the pygalmesh unit tests, check out this repository and type |
446 | 437 | pytest |
447 | 438 | ``` |
448 | 439 |
|
| 440 | + |
| 441 | +### Background |
| 442 | + |
| 443 | +CGAL offers two different approaches for mesh generation: |
| 444 | + |
| 445 | +1. Meshes defined implicitly by level sets of functions. |
| 446 | +2. Meshes defined by a set of bounding planes. |
| 447 | + |
| 448 | +pygalmesh provides a front-end to the first approach, which has the following advantages |
| 449 | +and disadvantages: |
| 450 | + |
| 451 | +* All boundary points are guaranteed to be in the level set within any specified |
| 452 | + residual. This results in smooth curved surfaces. |
| 453 | +* Sharp intersections of subdomains (e.g., in unions or differences of sets) need to be |
| 454 | + specified manually (via feature edges, see below), which can be tedious. |
| 455 | + |
| 456 | +On the other hand, the bounding-plane approach (realized by |
| 457 | +[mshr](https://bitbucket.org/fenics-project/mshr)), has the following properties: |
| 458 | + |
| 459 | +* Smooth, curved domains are approximated by a set of bounding planes, resulting in more |
| 460 | + of less visible edges. |
| 461 | +* Intersections of domains can be computed automatically, so domain unions etc. have |
| 462 | + sharp edges where they belong. |
| 463 | + |
| 464 | +See [here](https://github.com/nschloe/awesome-scientific-computing#meshing) for other |
| 465 | +mesh generation tools. |
| 466 | + |
| 467 | + |
449 | 468 | ### License |
450 | 469 |
|
451 | 470 | pygalmesh is published under the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html). |
0 commit comments