[Gmsh] behavior of doubly nested loop ?

Oswald Benedikt Benedikt.Oswald at psi.ch
Thu Feb 7 21:53:52 CET 2013


Helllo Roman,

thanks! Indeed, you are very right.

I did not see the forest for the trees!

I appreciate your help!

Greetings to Cracow! Benedikt



-----Original Message-----
From: Roman Putanowicz [mailto:putanowr at l5.pk.edu.pl]
Sent: Thu 2/7/2013 21:23
To: Oswald Benedikt
Cc: gmsh at geuz.org
Subject: Re: [Gmsh] behavior of doubly nested loop ?
 
> 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