fealpy icon indicating copy to clipboard operation
fealpy copied to clipboard

网格转化问题

Open lalala753 opened this issue 1 year ago • 2 comments

魏老师您好 我用fealpy做四边形网格剖分的测试

from fealpy.mesh.quadrangle_mesh import QuadrangleMesh
from fealpy.mesh import PolygonMesh

box = [0, 1, 0, 1]
mesh = QuadrangleMesh.from_box(box, nx=Nxy, ny=Nxy)
node = mesh.node
cell = mesh.ds.cell
mesh = PolygonMesh(node, cell)

会报错, 我检查源码
.\fealpy\fealpy\mesh\polygon_mesh.py 第27行的 elif isinstance(cell, np.ndarray) == 2: 是错的 这句话会返回一个布尔类型的数据 把2改成1才能得到想要的网格结果

lalala753 avatar Dec 17 '23 18:12 lalala753

是的,这里有一个 bug,已经修正。

import matplotlib.pyplot as plt
from fealpy.mesh import QuadrangleMesh
from fealpy.mesh import PolygonMesh

box = [0, 1, 0, 1]
mesh = QuadrangleMesh.from_box(box, nx=10, ny=10)
node = mesh.entity('node')
cell = mesh.entity('cell')
mesh = PolygonMesh(node, cell)

mesh.add_plot(plt)
plt.show()

image

weihuayi avatar Dec 19 '23 08:12 weihuayi

@lalala753 请用更规范的接口调用 FEALPy

weihuayi avatar Dec 19 '23 08:12 weihuayi