fealpy
fealpy copied to clipboard
add the `number_of_edges_of_cells()` function to the class StructureQuadMeshDataStructure?
魏老师, 可以在 class StructureQuadMeshDataStructure
中添加 number_of_edges_of_cells()
函数么?
添加的时, number_of_edges_of_cells()
可以返回 (NC,)
个值, 而不是单值 4
么?
你的理由是什么? 在什么场景下要用到这种情形?
------------------ Original ------------------
From: "YcZhang"<[email protected]>;
Date: Tue, Jun 16, 2020 11:23 AM
To: "weihuayi/fealpy"<[email protected]>;
Cc: "Subscribed"<[email protected]>;
Subject: [weihuayi/fealpy] add the number_of_edges_of_cells()
function to the class StructureQuadMeshDataStructure? (#14)
魏老师, 可以在 class StructureQuadMeshDataStructure 中添加 number_of_edges_of_cells() 函数么? 添加的时, number_of_edges_of_cells() 可以返回 (NC,) 个值, 而不是单值 4 么?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
计算 number_of_local_dofs
时会用到, 我没有区分 tri mesh, quad mesh, polygon mesh, 写成了下面
def number_of_local_dofs(self, p=None):
p = self.p if p is None else p
mesh = self.mesh
NCE = mesh.number_of_edges_of_cells()
# # if mesh is tri or quad mesh, NCE will be the int value
if isinstance(NCE, int):
NC = mesh.number_of_cells()
NCE = NCE*np.ones((NC,), dtype=self.itype)
ldofs = NCE * (p + 1) + (p + 1) * (p + 2) // 2
return ldofs
我最开始以为 quad mesh 会与 tri mesh 一样返回一个单值, 但是我发现 quad mesh 的 StructureQuadMeshDataStructure
就没有这个 number_of_edges_of_cells()
函数.
我需要先将 quad mesh 转成 polygon mesh 吗
tri mesh, quad mesh 和 polygon mesh 的数据结构能否统一呢, 就是 fealpy 能否不单独区分 tri mesh 和 quad mesh, 都是统一的按照 polygon mesh 来对待?
可以统一, 只是相关程序还在开发中, 还没有稳定下来. 我会把 StructureQuadMesh 增加一个接口, 这样就和其它网格的接口一致. 但是从节省内存的角度, Tri 和 Quad Mesh 返回顶点个数应该是一个整数, 但应该不影响计算啊.
------------------ Original ------------------
From: "YcZhang"<[email protected]>;
Date: Tue, Jun 16, 2020 08:29 PM
To: "weihuayi/fealpy"<[email protected]>;
Cc: "魏华祎"<[email protected]>; "Comment"<[email protected]>;
Subject: Re: [weihuayi/fealpy] add the number_of_edges_of_cells()
function to the class StructureQuadMeshDataStructure? (#14)
tri mesh, quad mesh 和 polygon mesh 的数据结构能否统一呢, 就是 fealpy 能否不单独区分 tri mesh 和 quad mesh, 都是统一的按照 polygon mesh 来对待?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
我已经更新了 Struct Quad mesh 的接口. 你是实现一个什么样的空间?
是的, 魏老师, 并不影响计算, 我改一下自己的程序就好了, 这个空间是 hybrid high-order 方法的空间, 类似于 WG 的空间, 不过重构算子时差别比较大
tri mesh, quad mesh 和 polygon mesh 的数据结构能否统一呢, 就是 fealpy 能否不单独区分 tri mesh 和 quad mesh, 都是统一的按照 polygon mesh 来对待?
This would be super helpful.
可以统一的, HalfEdgeMesh2d (fealpy/mesh/HalfEdgeMesh2d.py) 就是这样一个统一的数据结构, 只是目前基本功能还没有完全稳定下来.
它引入了半边数据结构, 可以统一表示 tri, quad, polygon 数据结构. 核心数据结构采用了动态数组的技术, 更适合自适应算法.
原始的数据结构中, 有些接口返回的数据是有区别的, 比如单元边的个数, 三角形返回一个整数 3, 四边形返回整数 4, 多边形返回一个长度为 (NC, ) 的一维数组. 这样返回有效率方面的考虑, 这样也更切合用户对不同网格类型的预期.
但也许还是可以改进一下的, 还是上面的单元边个数的例子, 三角形返回一个长度为 1 的一维数组 np.array([3]) 即可. 这样可以以数值离散中利用数组的广播功能, 简化数值离散程序对网格进行区分编程的繁琐.
是的, 魏老师, 并不影响计算, 我改一下自己的程序就好了, 这个空间是 hybrid high-order 方法的空间, 类似于 WG 的空间, 不过重构算子时差别比较大
正常情况下, 三角形, 四边形是特殊的多边形, 所以我感觉重构算子时不应该差别很大的, 应该是一样的, 你再考虑一下.
这样可以以数值离散中利用数组的广播功能, 简化数值离散程序对网格进行区分编程的繁琐.
是的, 目前程序需要判断一下网格类型.
正常情况下, 三角形, 四边形是特殊的多边形, 所以我感觉重构算子时不应该差别很大的, 应该是一样的,
是一样的