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

调用TriangleMesh.from_domain_distmesh(domain, maxit=maxit)的问题 #616

Open
jibingquanm opened this issue Mar 14, 2024 · 1 comment
Open

Comments

@jibingquanm
Copy link

魏老师:
您好!我有两个问题想向您请教哇。
(1)根据您回复我如何绘制带圆孔矩形区域的命令,我在最新版本的fealpy中已经可以复现您的运行结果。然后根据您回复中的命令,我想扩展一下,在矩形区域中挖掉一个小矩形,于是导入了 import BoxWithBoxHolesDomain,即如下命令
import matplotlib.pyplot as plt
from fealpy.mesh import TriangleMesh
from fealpy.geometry import BoxWithBoxHolesDomain

box=[-2, 2, -2, 2],
boxs=[(-1, 1, -1, 1)]
hmin = 0.1
hmax = 0.1
domain = BoxWithBoxHolesDomain(box, boxs, hmin=hmin, hmax=hmax)
mesh = TriangleMesh.from_domain_distmesh(domain, maxit=100)
fig = plt.figure()
axes = fig.add_subplot(1, 1, 1)
mesh.add_plot(axes)
plt.show()

运行之后却是始终报错“AttributeError: 'BoxWithBoxHolesDomain' object has no attribute 'shape'”

魏老师,我想向您请教一下,我只是将区域更换了为了,domain = BoxWithBoxHolesDomain(box, boxs, hmin=hmin, hmax=hmax), 为什么会出现此类报错呢,,应该怎么正确调用呢?

(2)魏老师,我这阵子反复研读学习了您在notebook中的帮助文档,受益良多,期待您的后续更新哇!

感谢您和您团队的无私工作!!!祝您工作顺利^ ^。
纪兵权

@jibingquanm jibingquanm changed the title 调用TriangleMesh.from_domain_distmesh(domain, hmin, maxit=maxit)的问题 调用TriangleMesh.from_domain_distmesh(domain, maxit=maxit)的问题 Mar 14, 2024
@weihuayi
Copy link
Owner

代码已经更新,注意你原始的代码中
box=[-2, 2, -2, 2],多了一个逗号。

import matplotlib.pyplot as plt
from fealpy.mesh import TriangleMesh
from fealpy.geometry import BoxWithBoxHolesDomain

box=[-2, 2, -2, 2]
boxs=[(-1, 1, -1, 1)]
hmin = 0.1
hmax = 0.1
domain = BoxWithBoxHolesDomain(box, boxs, hmin=hmin, hmax=hmax)
mesh = TriangleMesh.from_domain_distmesh(domain, maxit=100)
fig = plt.figure()
axes = fig.add_subplot(1, 1, 1)
mesh.add_plot(axes)
plt.show()

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants