# How do I obtain the matrix ordering of the boundaries?

**URL:** <https://community.freefem.org/t/how-do-i-obtain-the-matrix-ordering-of-the-boundaries/2834>\
**Category:** General Discussion\
**Created:** [December 13, 2023, 7:27pm UTC](https://community.freefem.org/t/how-do-i-obtain-the-matrix-ordering-of-the-boundaries/2834 "2023-12-13T19:27:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksugahar](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ksugahar/32/2115_2.png) [@ksugahar](https://community.freefem.org/u/ksugahar)\
**Post date:** [December 13, 2023, 7:27pm UTC](https://community.freefem.org/t/how-do-i-obtain-the-matrix-ordering-of-the-boundaries/2834/1 "2023-12-13T19:27:38Z")

</div>

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.

```auto
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;

```

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [December 18, 2023, 9:50am UTC](https://community.freefem.org/t/how-do-i-obtain-the-matrix-ordering-of-the-boundaries/2834/2 "2023-12-18T09:50:26Z")

</div>

I think , you need the list of DoF boundary.

```auto
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; 

```
