Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#68 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Python
Estrellas
5
Forks
1
Merge medio
1 h 19 min
PR fusionados (30 d)
6

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DHI/mikecore-python

Todos los issues de DHI/mikecore-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.