MeshFile.Write writes a 3 21 header for meshes with 6- or 8-node elements
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with mikecore/MeshFile.py:345-348 and the element-writing loop to see how the header is chosen; compare that with element creation in mikecore/MeshBuilder.py:150-153 and mikecore/MeshFile.py:390-393. Reproduce with a 6-node mesh and MeshFile.ReadMesh(path). Done means unsupported element widths are rejected rather than written with a mismatched header; the suggested read-side exception is also worth checking at mikecore/MeshFile.py:305-313.
由索引模型根据 Issue 内容生成。
描述
Summary
MeshFile.Write() picks the element header line from _hasQuads alone (mikecore/MeshFile.py:345-348):
if not self._hasQuads:
maxNodesPerElmt, elmtType = 3, 21
else:
maxNodesPerElmt, elmtType = 4, 25
Elements with 6 or 8 nodes (types 32/33) are never considered. MeshBuilder.CreateMesh() accepts them (mikecore/MeshBuilder.py:150-153), and MeshFile.Create() only sets _hasQuads for 4-node elements (mikecore/MeshFile.py:390-393). So a mesh of quadratic elements is written with the header <n> 3 21, while the row loop still writes every node, which makes the rows 6 or 8 values wide.
Reproduce
Build a mesh with 6-node triangles via MeshBuilder, call CreateMesh().Write(path), then MeshFile.ReadMesh(path).
- The written header claims max 3 nodes per element, code 21, and doesn't match the rows.
- On read,
Read()only recognises 3 and 4 nodes per element (mikecore/MeshFile.py:305-313), so those elements getElementType = 0.
mikeio can reach this too: it writes .mesh through MeshBuilder().CreateMesh().Write(), e.g. to_mesh on a quadratic mesh.
Background
The .mesh format documents only codes 21 (all triangles) and 25 (quads present) for the element header. There's no documented quadratic form (32/33 are dfsu element types).
Suggested fix
- In
Write(), derivemaxNodesPerElmtfrom the widest element instead of_hasQuads, and raise on any element with other than 3 or 4 nodes, since.meshcan't represent it. - Probably make
Read()raise on such elements too, instead of the silentElementType = 0(there's a# TODO: Throw an exception?there).
Found while reviewing #53.
🤖 Generated with Claude Code
- 主要语言
- Python
- 星标
- 5
- 派生
- 1
- 平均合并
- 1 小时 19 分钟
- 30 天内合并 PR
- 6
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DHI/mikecore-python 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
DHI/mikecore-python#70 ·
维护者通常 1 天内回复
-
Four test assertions carried over from the C# suite are still commented out可能已有人在做 @ryan-kipawa 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
DHI/mikecore-python#49 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
DHI/mikecore-python#59 ·
维护者通常 1 天内回复
-
New submesh feature (2027) makes all dfsu fail!可能已有人在做 @ryan-kipawa 于 9 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 42/100
DHI/mikecore-python#54 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 45/100
DHI/mikecore-python#52 ·
维护者通常 1 天内回复
查看 DHI/mikecore-python 的全部 Issue
相似的 Issue
-
first
难度 2/5 1-3 小时 新手友好度 72/100
AcademySoftwareFoundation/rmtc#54 · 1 条评论 ·
-
feature/cohorts feature/feature-flags team/feature-flags
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
License examples/ as MIT可能已有人在做 @PGrayCS 今天认领。 未关闭documentation enhancement example good first issue
难度 2/5 1-3 小时 新手友好度 84/100
speedyk-005/yasbd-lib#383 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
interactions-py/interactions.py#1827 ·
-
Managed start can fail when OpenVMM reads its control capability before NVX writes it可能已有人在做 @ppenna 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复