Build mesh from a vector of nodes

The way you set up your matrix of nodes, it is \in\mathbb{R}^{9\times2}. You are treating it somehow mixed, like sometimes as \in\mathbb{R}^{9\times2} an sometimes as \in\mathbb{R}^{2\times 9}. Check the documentation Types for matrix size.

real[int,int] nodes = [[0,0],[0.5,0],[1,0],[0,0.5],[0.5,0.5],[1,0.5],[0,1],
                      [0.5,1],[1,1]];

// cout << nodes << endl;
cout << "nrows = " << nodes.n << ", ncols" << nodes.m << endl;

border bdry(t=0,nodes.n-1){ P.x=nodes(t,0); P.y=nodes(t,1); label=1; };
plot(bdry(nodes.n-1),dim=2,wait=1,cmm="boundary");

Also, your boundary is not a closed loop, so it won’t mesh of course.

Check also post Building a border from an array of vertices - #2 by fivanci, although, I see now there is lapsus calami in there as well. It should be, in declaration,
real[int,int] vtxCoords(2,nn); and later in code vtxCoords.n-1\mapstovtxCoords.m-1.

if