Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#68 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

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 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

主要言語
Python
スター
5
フォーク
1
平均マージ
1時間 19分
マージ済み PR(30日)
6

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DHI/mikecore-python のほかの issue

DHI/mikecore-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。