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

[Fix] Fix doctest #821

Merged
merged 11 commits into from
Mar 26, 2024
Prev Previous commit
Next Next commit
skip mesh example code in geometry/mesh.py for requiring pymesh insta…
…lltion
  • Loading branch information
HydrogenSulfate committed Mar 26, 2024
commit b7536f09c10a21eb26d1d81abb8fe3421ebd98b2
28 changes: 14 additions & 14 deletions ppsci/geometry/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ def from_pymesh(cls, mesh: "pymesh.Mesh") -> "Mesh":
Examples:
>>> import ppsci
>>> import pymesh
>>> import numpy as np
>>> box = pymesh.generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1]))
>>> mesh = ppsci.geometry.Mesh.from_pymesh(box)
>>> print(mesh.vertices)
>>> import numpy as np # doctest: +SKIP
>>> box = pymesh.generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1])) # doctest: +SKIP
>>> mesh = ppsci.geometry.Mesh.from_pymesh(box) # doctest: +SKIP
>>> print(mesh.vertices) # doctest: +SKIP
[[0. 0. 0.]
[1. 0. 0.]
[1. 1. 0.]
Expand Down Expand Up @@ -203,9 +203,9 @@ def translate(self, translation: np.ndarray, relative: bool = True) -> "Mesh":
>>> import ppsci
>>> import pymesh
>>> import numpy as np
>>> box = pymesh.generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1]))
>>> mesh = ppsci.geometry.Mesh(box)
>>> print(mesh.vertices)
>>> box = pymesh.generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1])) # doctest: +SKIP
>>> mesh = ppsci.geometry.Mesh(box) # doctest: +SKIP
>>> print(mesh.vertices) # doctest: +SKIP
[[0. 0. 0.]
[1. 0. 0.]
[1. 1. 0.]
Expand All @@ -214,7 +214,7 @@ def translate(self, translation: np.ndarray, relative: bool = True) -> "Mesh":
[1. 0. 1.]
[1. 1. 1.]
[0. 1. 1.]]
>>> print(mesh.translate((-0.5, 0, 0.5), False).vertices) # the center is moved to the translation vector.
>>> print(mesh.translate((-0.5, 0, 0.5), False).vertices) # the center is moved to the translation vector. # doctest: +SKIP
[[-1. -0.5 0. ]
[ 0. -0.5 0. ]
[ 0. 0.5 0. ]
Expand All @@ -223,7 +223,7 @@ def translate(self, translation: np.ndarray, relative: bool = True) -> "Mesh":
[ 0. -0.5 1. ]
[ 0. 0.5 1. ]
[-1. 0.5 1. ]]
>>> print(mesh.translate((-0.5, 0, 0.5), True).vertices) # the translation vector is directly added to the geometry coordinates
>>> print(mesh.translate((-0.5, 0, 0.5), True).vertices) # the translation vector is directly added to the geometry coordinates # doctest: +SKIP
[[-0.5 0. 0.5]
[ 0.5 0. 0.5]
[ 0.5 1. 0.5]
Expand Down Expand Up @@ -276,9 +276,9 @@ def scale(
>>> import ppsci
>>> import pymesh
>>> import numpy as np
>>> box = pymesh.generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1]))
>>> mesh = ppsci.geometry.Mesh(box)
>>> print(mesh.vertices)
>>> box = pymesh.generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1])) # doctest: +SKIP
>>> mesh = ppsci.geometry.Mesh(box) # doctest: +SKIP
>>> print(mesh.vertices) # doctest: +SKIP
[[0. 0. 0.]
[1. 0. 0.]
[1. 1. 0.]
Expand All @@ -287,8 +287,8 @@ def scale(
[1. 0. 1.]
[1. 1. 1.]
[0. 1. 1.]]
>>> mesh = mesh.scale(2, (0.25, 0.5, 0.75))
>>> print(mesh.vertices)
>>> mesh = mesh.scale(2, (0.25, 0.5, 0.75)) # doctest: +SKIP
>>> print(mesh.vertices) # doctest: +SKIP
[[-0.25 -0.5 -0.75]
[ 1.75 -0.5 -0.75]
[ 1.75 1.5 -0.75]
Expand Down