Skip to content

Conversation

@ksugahar
Copy link

Summary

Add a SetGeomInfo method to Element2d that allows setting the UV parametric coordinates (geominfo) for surface element vertices.

Motivation

This is essential for high-order curving of externally imported meshes (e.g., from Gmsh, Cubit, or other mesh generators). When meshes are imported without geometry, the geominfo is not set automatically, which prevents mesh.Curve(order) from working correctly.

Usage

from netgen.meshing import *

# After importing mesh and setting up geometry
for el in mesh.Elements2D():
    for i in range(len(el.vertices)):
        # Get UV coordinates from geometry for this vertex
        u, v = compute_uv_for_vertex(el.vertices[i])
        el.SetGeomInfo(i, u, v)

# Now curving works correctly
mesh.Curve(order)

API

Element2d.SetGeomInfo(vertex_index, u, v, trignum=0)

Parameters:

  • vertex_index: 0-based index of the vertex within the element
  • u, v: Surface parametric coordinates
  • trignum: Triangle number for STL meshing (default: 0)

Related

🤖 Generated with Claude Code

This adds a SetGeomInfo method to Element2d that allows setting the UV
parametric coordinates (geominfo) for surface element vertices.

This is essential for high-order curving of externally imported meshes
(e.g., from Gmsh, Cubit, or other mesh generators). When meshes are
imported without geometry, the geominfo is not set automatically, which
prevents mesh.Curve(order) from working correctly.

Usage:
```python
for el in mesh.Elements2D():
    for i in range(len(el.vertices)):
        # Get UV coordinates from geometry
        u, v = compute_uv_for_vertex(el.vertices[i])
        el.SetGeomInfo(i, u, v)
mesh.Curve(order)
```

Parameters:
- vertex_index: 0-based index of the vertex within the element
- u, v: Surface parametric coordinates
- trignum: Triangle number for STL meshing (default: 0)

Feature request: https://forum.ngsolve.org/t/feature-request-python-api-for-high-order-curving-of-externally-imported-meshes/3810

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant