fealpy
fealpy copied to clipboard
Bug in TriangleMesh
我有一段如下的代码,展示 MeshFactory 的用法
import numpy as np
import matplotlib.pyplot as plt
from fealpy.mesh import MeshFactory as MF
box = [0, 1, 0, 1]
mesh = MF.boxmesh2d(box, nx=10, ny=10, meshtype='tri')
mesh = MF.boxmesh2d(box, nx=10, ny=10, meshtype='quad')
mesh = MF.boxmesh2d(box, nx=10, ny=10, meshtype='poly')
fig = plt.figure()
axes= fig.gca()
mesh.add_plot(axes)
plt.show()
但运行遇到了问题, 报错信息如下:
Traceback (most recent call last):
File "mf.py", line 24, in <module>
mesh = MF.boxmesh2d(box, nx=10, ny=10, meshtype='poly')
File "/home/why/git/fealpy/fealpy/decorator/timer.py", line 20, in run
val = func(*args, **kwargs)
File "/home/why/git/fealpy/fealpy/mesh/MeshFactory.py", line 171, in boxmesh2d
pnode, pcell, pcellLocation = mesh.to_polygonmesh()
File "/home/why/git/fealpy/fealpy/mesh/TriangleMesh.py", line 1057, in to_polygonmesh
node2cell = self.ds.node_to_cell(localidx=True)
TypeError: node_to_cell() got an unexpected keyword argument 'localidx'
我认为这里是代码的一个 bug。
? 我这里可以正常运行 😂
这个是一个issue 示例😂,我给学生上课想让他们也养成在这里提问的习惯
该邮件从移动设备发送
--------------原始邮件-------------- 发件人:"YcZhang @.>; 发送时间:2021年6月4日(星期五) 下午2:55 收件人:"weihuayi/fealpy" @.>; 抄送:"魏华祎 @.>;"Author @.>; 主题:Re: [weihuayi/fealpy] Bug in TriangleMesh (#36)
? 我这里可以正常运行
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
OK~
给魏老师说个好用的小技巧,github上可以直接引用code:在网页界面下浏览code,左边的行数选中之后右键点permanent link,copy pasta到这里就会自动生成preview而且指回原code
https://github.com/weihuayi/fealpy/blob/6f5e5aa88a4b1037a471221f177b89147b8aa507/fealpy/mesh/TriangleMesh.py#L1039-L1063
@scaomath 谢谢书豪,这个技巧很实用👍