meshpro/dmsh

Boundary Node Identification

griff10000 opened this issue · 6 comments

What is the best way to extract boundary node indices from a finished mesh?

mesh.is_boundary_point should do it.

Many thanks for your prompt response. I used the following approach to generate the boundary nodes:

import meshplex
mesh = meshplex.MeshTri(X, cells)

idx = np.where(mesh.is_boundary_node == True)
x, y = X[idx,0].flatten(), X[idx,1].flatten()

I appreciate that this may not be optimal. However, I wonder if there is way of directly accessing an 'ordered list' of boundary nodes as I assume such a list is being generated for the show() function?

Better use the boolean index directly:

Xb = X[mesh.is_boundary_node]

Or, if you need the coords separately,

x, y = X[mesh.is_boundary_node].T

Thanks again.

I believe mesh.is_boundary_node is no longer valid? It comes up with AttributeError: 'MeshTri' object has no attribute 'is_boundary_node'

@ml14je Try is_boundary_point. ipythons expansions can also help exploring a module if you're unsure about a method name.