[Gmsh] Question about early post increment

Jim Monte jim.gmsh at gmail.com
Sat Sep 10 00:39:37 CEST 2016


Hi All,

I was trying to build arrays of point IDs and related things and used the
post increment essentially as shown in the simple example below. In this
example, the array element pid[0] is unassigned while pid[1] has a value,
although I would have expected pid[0] to be the only assigned value. Am I
misunderstanding how the increment operator is supposed to work in Gmsh?

Jim Monte

/*************** start of example *************************/
i = 0; /* index to current point ID */
j = newp; /* get a new point ID */
pid[i++] = j; /* save point ID */
Point(j) = {1, 2, 3}; /* assign value to point */
xyz[] = Point{pid[0]}; /* retrieve coordinates of point */
Printf("x=%g; y=%g; z=%g", xyz[0], xyz[1], xyz[2]); /* output */
xyz[] = Point{pid[1]}; /* retrieve coordinates */
Printf("x=%g; y=%g; z=%g", xyz[0], xyz[1], xyz[2]); /* output */
/*************** end of example *************************/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20160909/a0507680/attachment.html>


More information about the gmsh mailing list