[Gmsh] .geo script: How to creat a matrix of coordinates?

Olavo Luppi Silva olavo.luppi at ig.com.br
Thu Feb 9 21:02:12 CET 2012


Dear gmsh community

I'm wondering if it is possible to have .geo code like this:

/*********************************/
lc = 0.1;
coords[]= { {1,1,1}, {-1,1,1}, {1,-1,1}, {-1,-1,1} };

For i In {0:3}
    Point(i+1) = {coords[i,0],coords[i,1],coords[i,2],lc};
EndFor
/*********************************/

That is, 'coords' is a matrix of values.  I'm aware that if 'coords' is a
list (a vector) of values the piece of code below would work. But if
'coords'  could be declared as a matrix, the rest of my code would be a lot
easier.

/*********************************/
lc = 0.1;
coords[]= { 1,1,1, -1,1,1, 1,-1,1, -1,-1,1 };

aux=0;
N = #coords[]/3;
For i In {0:N-1}
    Point(i) = {coords[aux+0],coords[aux+1],coords[aux+2],lc};
    aux = aux+3;
EndFor
/*********************************/

Thanks
Olavo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20120209/755316a3/attachment.html>