MeshFile element-code check is a tautology and does nothing
- 主要言語
- Python
- スター
- 5
- フォーク
- 1
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
`mikecore/MeshFile.py` (around line 281, in `ReadMesh`) contains:
```python
# Element code must be 21 or 25 (21 for triangular meshes, 25 for mixed meshes)
if (elmtCode != 21) or (elmtCode != 25):
pass # TODO?? Do we care?
```
The condition is a tautology: no integer can be equal to both 21 and 25, so `!= 21 or != 25` is true for every possible value — including the two the comment says are valid. It needs `and`.
Today this is harmless, because the body is `pass`. The problem is the invitation: the `TODO` asks someone to decide what to do with an unexpected code, and anyone who fills the body in — with a `raise`, a warning, anything — makes it fire on *every* mesh, valid ones included.
The check is also redundant as written. A few lines further down, `ElementType` is derived per element from the number of corners actually parsed, so the header code is not what the reader relies on.
Two things to settle:
1. Remove the dead block so the trap is gone. (Doing this in a PR alongside this issue.)
2. Decide the policy: should an element code other than 21 or 25 raise, warn, or continue to be ignored? Right now `elmtCode` is read from the header and never used for anything.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
mikecore/MeshFile.py の ReadMesh を 281 行目付近から確認し、elmtCode と、その後の ElementType の導出がどのように使われているかを追ってください。ヘッダーコードに必須の役割があるかを確認し、21 と 25 以外のコードに対する動作を決定し、有効な mesh の解析を変更せずに、不要な恒真条件ブロックが削除されることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100