hpgem / nanomesh

Python workflow tool for generating meshes from 2D and 3D image data
http://nanomesh.readthedocs.org
Apache License 2.0
28 stars 5 forks source link

Feature labels of vertices in features? #297

Open spectraldecomp opened 3 weeks ago

spectraldecomp commented 3 weeks ago

I use classes = m.point_data['gmsh:physical'] to get the class labels of each point in my mesh, but only the vertices on the boundaries/contour of each feature are labeled. Is there a way to have the points in the inner region of each boundary be labeled accordingly?

stefsmeets commented 2 weeks ago

You could use the point data to decide whether a vertex is inside or outside. There is no 'automatic' way of doing it atm.

spectraldecomp commented 2 weeks ago

It seems like point_data['gmsh:physical'] assigns labels according to the contour of the feature and not the interior of the feature.

I.e. image

When what we might expect is image

Is this the intended behavior?

I have a temporary solution to get nearly the latter behavior by using cell_data_dict['gmsh:physical']['triangle'] and assigning labels according to the triangle each point belongs.

stefsmeets commented 1 week ago

Hi @spectraldecomp Actually, on second thought, yes that is the intended behaviour. The code finds the interfaces, not the points inside a region. In your second example, you could not know if the edge vertices are inside, or outside the region.

The better way to approach this is to use the mesh.cell_data, and use that as a mask on the vertices (mesh.points). This will give you the points inside or outside the regions as in your second figure.