[Gmsh] Print value of a list item
David Colignon
david.colignon at ulg.ac.be
Fri Aug 21 11:08:15 CEST 2015
On 21/08/15 09:51, look wrote:
> Dear gmsh list,
>
> how can I get the value of a list item ( for example heights[5] ) printed in the output window of the gmsh GUI? I tried Printf ( heights[5] ); so far but it didn’t work.
>
> Thank you in advance,
>
> Kate
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh
>
Hi,
see http://www.geuz.org/gmsh/doc/texinfo/gmsh.html#General-commands
Printf ( char-expression <, expression-list> );
Prints a character expression in the information window and/or on the terminal. Printf is equivalent to the printf C
function: char-expression is a format string that can contain formatting characters (%f, %e, etc.). Note that all expressions
are evaluated as floating point values in Gmsh (see Expressions), so that only valid floating point formatting characters make
sense in char-expression. See t5.geo, for an example of the use of Printf.
and http://www.geuz.org/gmsh/doc/texinfo/gmsh.html#t5_002egeo
...
...
// We also print some variables on the terminal (note that, since all
// variables are treated internally as floating point numbers, the format
// string should only contain valid floating point format specifiers like
// `%g', `%f', '%e', etc.):
Printf("Hole %g (center = {%g,%g,%g}, radius = %g) has number %g!",
t, x, y, z, r, thehole) ;
Regards,
Dave
--
David Colignon, Ph.D.
1er Logisticien de Recherche
Université de Liège
ACE - Applied & Computational Electromagnetics
Quartier POLYTECH 1 - Montefiore B28
Allée de la découverte 10
4000 Liège - BELGIQUE
Tél: +32 (0)4 366 37 32
http://www.ulg.ac.be/nic4