[Gmsh] "For" loop with a variable incrementation step
Lucas Blattner Martinho
lucas.blattner at gmail.com
Tue Oct 20 01:01:40 CEST 2009
Dear Gmsh developers,
I am trying to use Gmsh's "For" loop with a variable incrementation step,
however I am not obtaining the expected results.
For example, I expected the following Gmsh commands
step = 1.0;
For k In {0:100:step}
Printf("step = %f k = %f", step, k ) >> "test.txt";
step = step +1;
EndFor
would produce an output file called "test.txt" containing the following
data:
step = 1.000000 k = 0.000000
step = 2.000000 k = 2.000000
step = 3.000000 k = 5.000000
.
.
.
and so on.
However, the previous commands result in the following output file:
step = 1.000000 k = 0.000000
step = 2.000000 k = 1.000000
step = 3.000000 k = 2.000000
step = 4.000000 k = 3.000000
step = 5.000000 k = 4.000000
.
.
.
and so on.
It seems that incrementation of the "step" variable inside the loop does not
result in a variable update of "k", which keeps growing with unit steps.
I found this strange behaviour while trying to emulate a "While" loop ,
which doesn't appear to be promptly available in Gmsh (by setting a "step"
variable bigger than the "for" loop's range, when some break
condition is satisfied
).
Am I missing something and these are in fact the expected behaviours, or
would this be a bug of some sort?
Is there a better way to work these issues around (emulating a "While" loop)
?
yours faithfully,
Lucas Blattner Martinho
**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20091019/d594b070/attachment.html>