Removing spline control points from mesh or ngmesh

Hi, I noticed that when a spline geometry is used to generate a mesh, the spline control points from the geometry may end up as mesh vertices. These extra vertices are not associated with any elements in the NGSolve mesh, and may be outside the domain, as in the simple example below.

Most of the time these extra vertices don’t cause any trouble, and when they do, it’s not too hard to work around the issues, but I would like to know if there is some way to remove them.

[code]from netgen.geom2d import SplineGeometry
import netgen.meshing as nm
import ngsolve as ng

geo = SplineGeometry()
geo.AddCircle([0, 0], 1)
mesh = ng.Mesh(geo.GenerateMesh(maxh=.2))

controlverts = [v for v in mesh.vertices if len(v.elements) == 0]
pts = [v.point for v in controlverts]

print(“controlverts”, controlverts)
print(“pts”, pts)
[/code]

This outputs:

Generate Mesh from spline geometry

controlverts [V1, V3, V5, V7]

pts [(1.0, -1.0), (1.0, 1.0), (-1.0, 1.0), (-1.0, -1.0)]

But if we then do this:

fes = ng.H1(mesh, order=1) gfu = ng.GridFunction(fes) gfu.vec[:] = 0 for v in mesh.vertices: pt = v.point mip = mesh(*v.point) value = gfu(mip) print("value", value)

The output is:
value 0.0 # evaluating at vertex V0 works fine, but V1 is outside the domain.
WARNING: MeshPoint not in mesh, can’t convert to BaseMappedIntegrationPoint!

Then a TypeError is raised when we try to evaluate gfu at mip…

Best,
Dow

Attachment: example.py

Hi Dow,

Thanks for the report. The issue is fixed on master, see

Best,
Matthias