[Gmsh] behavior of doubly nested loop ?

Roman Putanowicz putanowr at l5.pk.edu.pl
Thu Feb 7 21:23:35 CET 2013


> Dear gmsh, the following doubly nested loops gives me results that I do not understand,
> i.e. the index should count through from 0 to 19, without giving certain indices twice.
> 
> I use the most recent nightly build of gmsh (2.6.2-svn)
> 
> Perhaps, I do not see the forest for the trees, can you comment ?

Well the problem is that with the syntex {0:numnpx} you have not
numnpx elements but numnpx+1 elements (the counter goes from 0 to numnpx).
In that case you equation for index should be:

     index = uy * (numnpx+1) + ux;

If you are used to C/C++ loops it is easy to make this mistake 
(I know something about it :-);


Regards

Roman

-- 
Roman Putanowicz, PhD  < putanowr at l5.pk.edu.pl  >
Institute for Computational Civil Engng (L-5)
Dept. of Civil Engng, Cracow Univ. of Technology
www.l5.pk.edu.pl, tel. +48 12 628 2569, fax 2034