Is there a direct way to calculate the number of boundary vertices? I know that for instance Th.nv gives the total number of vertices in the domain so I was wondering if there is a similar way to do it on boundary faces, if not how can I approach this problem?
the command Th.nbe
should give you the number of edges I think. See the documentation here
Th.nbe gives you the total number of boundary elements from which you can get the vertex ID for each element. I need the total number of vertices which is basically the number of unique IDs.
For a simple closed curve boundary, you just call Th.nbe
as Julien suggested. And for those more complex cases, you can also use the following FreeFEM code and it’s fast
fespace Bh(Th, P1);
varf vGamma(u, v) = on(labels(Th), u=1);
real[int] gamma = vGamma(0, Bh, tgv=-1);
int nbv = gamma.sum;
1 Like