[Gmsh] ReplaceDuplicatePoints malfunction

Konstantinos Poulios logari81 at googlemail.com
Tue Apr 27 21:24:58 CEST 2010


Hi all!

I am currently trying to resolve a crash which can be reproduced with
the attached input file "ReplaceDuplicatePoints_Bug.geo" when one
runs:

gmsh ReplaceDuplicatePoints_Bug.geo -1

The crash occurs in "ReplaceDuplicatePoints" and I have narrowed down
its cause to the insertion of the vertex 106500 into the Tree
structure allNonDuplicatedPoints.

A test which can demonstrate the problem is the following:

1. temporary store the vertex 19223 into a variable test_vertex
2. use the Tree_Search function to check for test_vertex in
"allNonDuplicatedPoints" just before of the insertion of of the vertex
106500 into "allNonDuplicatedPoints" --> Reports that there is already
an equivalent vertex stored.
3. repeat the test 2 just after the insertion of of the vertex 106500
into "allNonDuplicatedPoints" --> Reports that there is no equivalent
vertex stored.

It seems that the rebalancing of the tree changes some of its
branches, which shouldn't be altered.

Since the "ReplaceDuplicatePoints" function is a very fundamental part
of gmsh, I believe it is very important to be very robust. I think
that the way this function is implemented is not roundoff-error safe.
Anyway I would appreciate any hint which could help me resolve this
issue.

By the way I would like to suggest 2 patches for the same function but
not relevant with this specific problem. The first one is performance
oriented and it removes some double calls of the Tree_search function.
The second is about an eventual typo in freeing memory. Both patches
are attached. Please review them.

Best Regards

Kostas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ReplaceDuplicatePoints_Bug.geo
Type: application/octet-stream
Size: 32309 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100427/ab303308/attachment.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ReplaceDuplicatePoints-1.patch
Type: text/x-patch
Size: 1494 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100427/ab303308/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ReplaceDuplicatePoints-2.patch
Type: text/x-patch
Size: 397 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100427/ab303308/attachment-0001.patch>