Does anyone know how to do this? I need to identify the DoFs that touch the boundary of the domain and I would like to do this through the coordinates, like, if x == y == 0 && x == y == 1.

I had such difficulty and I used the folloing lines to get the connectivity of edges with respect to triangles

fespace RT(Th, RT0);
// array of no of (1 or 2) triangles on each side of edge associated to dof
// and associated edge number
int[int,int] trofdof(RT.ndof,4);
trofdof=-1;// -1 means not (yet) defined
for (int k=0;k<Th.nt;k++){
for (int i=0;i<3;i++){
int noki=RT(k,i);// df of element k and edge i
if (trofdof(noki,0)==-1){
trofdof(noki,0)=k;
trofdof(noki,1)=i;
}
else if (trofdof(noki,2)==-1){
trofdof(noki,2)=k;
trofdof(noki,3)=i;
}
else {
cout << "error trofdof" << endl;
}
}}

Then trofdof(j, ) has a -1 means that j is the index of dof on the boundary.
If you want the coordinates you can do

// coordinates of dof
real[int] rtx(RT.ndof),rty(RT.ndof);
for (int j=0;j<RT.ndof;j++){
int k=trofdof(j,0);
int i=trofdof(j,1);
rtx(j)=(Th[k][(i+1)%3].x+Th[k][(i+2)%3].x)/2.;
rty(j)=(Th[k][(i+1)%3].y+Th[k][(i+2)%3].y)/2.;
}