[Gmsh] how to get length of an extrude array
Geordie McBain
gdmcbain at freeshell.org
Tue Dec 13 02:04:11 CET 2011
2011/12/13 Prakash Manandhar <jsaaymi at gmail.com>:
> I am a newbie. Say I have the following:
>
> h = 0.1;
> out[] = Extrude {h,0,0} {
> Surface{1, 5, 14, 10}; Layers{10 }; Recombine;
> };
>
> How do I get the length of the out array.
I don't know a nice way, but here's what I do:
%<---
Point(1) = {0, 0, 0};
out[] = Extrude {1, 0, 0} { Point{1};};
For i In {0:2}
Printf ("out[%g] = %g", i, out[i]);
EndFor
--->%
The message console then ends with:
%<---
out[0] = 2
out[1] = 1
Error : 'count.geo', line 4 : Uninitialized variable 'out[2]'
out[2] = 0
Info : Done reading 'count.geo'
--->%
which tells me that the length is two. Then I go back and rewrite the
program knowing that. This is only any good if the length is going to
be the same each time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: count.geo
Type: application/octet-stream
Size: 123 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20111213/8d5fc6cb/attachment.geo>