[Gmsh] how to get length of an extrude array

Ruth V. Sabariego r.sabariego at ulg.ac.be
Tue Dec 13 06:44:07 CET 2011


There is an easier way. The length of your array out[] is:
N = #out[] ;
HTH,
Ruth

--
Dr. Ir. Ruth V. Sabariego
University of Liege, Electrical Engineering & Computer Science, 
Applied & Computational Electromagnetics (ACE),
phone: +32-4-3663737 - fax: +32-4-3662910 - http://ace.montefiore.ulg.ac.be/



On 13 Dec 2011, at 02:13, Prakash Manandhar wrote:

> Thanks, that's exactly what I did. Regs, Prakash.
> 
> On Mon, Dec 12, 2011 at 8:04 PM, Geordie McBain <gdmcbain at freeshell.org> wrote:
> 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.
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20111213/2b2ed153/attachment.html>