MeshFile element-code check is a tautology and does nothing
- Lenguaje dominante
- Python
- Estrellas
- 5
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
`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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza en mikecore/MeshFile.py, en ReadMesh, alrededor de la línea 281, y sigue cómo se usan elmtCode y la posterior derivación de ElementType. Confirma si el código de la cabecera tiene alguna función necesaria, decide el comportamiento para los códigos distintos de 21 y 25, y asegúrate de que se elimine el bloque tautológico muerto sin cambiar el análisis de meshes válidos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- data
- Tipo de issue
- Error
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100