Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tutorial to show how to use pyvista-gmsh which is inspired by gmsh tutorial #1

Merged
merged 46 commits into from
Dec 23, 2023

Conversation

tkoyama010
Copy link
Member

@tkoyama010 tkoyama010 commented Jul 25, 2022

import pvgmsh
import pyvista
import numpy as np


# Gmsh Python tutorial 1
# https://gitlab.onelab.info/gmsh/gmsh/blob/gmsh_4_10_5/tutorials/python/t1.py

vertices = np.array([[0, 0, 0], [0.1, 0, 0], [0.1, 0.3, 0], [0, 0.3, 0]])
faces = np.hstack([[4, 0, 1, 2, 3]])
surf = pyvista.PolyData(vertices, faces)

# pvgmsh does not support PhysicalGroup; group configuration can be easily done with PyVista.

mesh = pvgmsh.generate_mesh(surf)

plotter = pyvista.Plotter(shape=(1, 2))
plotter.subplot(0, 0)
plotter.add_mesh(surf, color="tan", show_edges=True)
plotter.subplot(0, 1)
plotter.add_mesh(mesh, color="tan", show_edges=True)
plotter.show(cpos="xy")

test

@tkoyama010 tkoyama010 added the enhancement New feature or request label Jul 25, 2022
tests/test_gmsh.py Outdated Show resolved Hide resolved
tests/test_gmsh.py Outdated Show resolved Hide resolved
tests/test_gmsh.py Outdated Show resolved Hide resolved
tests/test_gmsh.py Outdated Show resolved Hide resolved
tests/test_gmsh.py Outdated Show resolved Hide resolved
@tkoyama010 tkoyama010 changed the title Add Gmsh Python tutorial 1 Add Tutorial 1 Jul 28, 2022
pvgmsh/__init__.py Outdated Show resolved Hide resolved
@tkoyama010 tkoyama010 marked this pull request as ready for review December 23, 2023 04:34
@tkoyama010 tkoyama010 changed the title Add Tutorial 1 Add tutorial to show how to use pyvista-gmsh which is inspired by gmsh tutorial Dec 23, 2023
@tkoyama010 tkoyama010 added documentation Improvements or additions to documentation enhancement New feature or request and removed enhancement New feature or request labels Dec 23, 2023
@tkoyama010 tkoyama010 merged commit cab3db4 into main Dec 23, 2023
2 checks passed
@tkoyama010 tkoyama010 deleted the feat/tutorial-1 branch December 23, 2023 06:32
@tkoyama010
Copy link
Member Author

@allcontributors please add @tkoyama010 for ideas

Copy link
Contributor

@tkoyama010

I've put up a pull request to add @tkoyama010! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant