Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

MeshFile.Write writes a 3 21 header for meshes with 6- or 8-node elements

Đang mở
#68 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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 get ElementType = 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(), derive maxNodesPerElmt from the widest element instead of _hasQuads, and raise on any element with other than 3 or 4 nodes, since .mesh can't represent it.
  • Probably make Read() raise on such elements too, instead of the silent ElementType = 0 (there's a # TODO: Throw an exception? there).

Found while reviewing #53.

🤖 Generated with Claude Code

Ngôn ngữ chính
Python
Star
5
Fork
1
Merge trung bình
1 giờ 19 phút
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DHI/mikecore-python

Tất cả issue của DHI/mikecore-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.