Removing spline control points from mesh or ngmesh

More
3 years 8 months ago #3598 by ddrake
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)
# 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:
Code:
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
Attachments:
More
3 years 7 months ago #3621 by matthiash
Hi Dow,

Thanks for the report. The issue is fixed on master, see
github.com/NGSolve/netgen/commit/7b62f39...fa6008cd05ffb01821ea

Best,
Matthias
The following user(s) said Thank You: ddrake
Time to create page: 0.092 seconds