How do I obtain the matrix ordering of the boundaries?

How do I obtain the matrix ordering number of the boundary nodes?
In the following example I have generated a hexagonal mesh and six boundary nodes.
I want to obtain [1,4 0, 6, 5, 2] as an array.

I might be able to detect the matrix elements where the values are tgv.

border C1(t=0,2*pi) {x=cos(t); y=sin(t);label=1;}
mesh Th=buildmesh(C1(6));

plot(Th,wait=false);

fespace Vh(Th,P1);
Vh phi, w;
varf Prob(phi,w) = int2d(Th)(dx(phi)*dx(w)+dy(phi)*dy(w)) + on(1,phi=0);

matrix A =  Prob(Vh, Vh);

cout << A << endl;

I think , you need the list of DoF boundary.

border C1(t=0,2*pi) {x=cos(t); y=sin(t);label=1;}
mesh Th=buildmesh(C1(6));

fespace Vh(Th,P1);
Vh phi, w;
varf vBord(phi,w) = int1d(Th)(w);
Vh on1=vBord(0,Vh);
for(int i=0; i< Vh.ndof;++i)
if (on1[][i]>0) 
cout  << i << " " <<  endl; 


1 Like