[Gmsh] Possible problems with find_edge function

Chaman Singh Verma csv610 at gmail.com
Fri May 29 07:18:44 CEST 2009


Hello,

Here is the piece of original code from gmsh in BDS.cpp. Although I am not
quite sure, but
feel that there might be some unintentional problems with the code.

(1) Problem #1:     find_edge is a query function and it has created
temporary instance of
                           BDS_Edge. When created, it changes the structure
( i.e. add edge to the
                           point). Since there are no destructor in the
BDS_Edge those change may
                           persist forever.

(2) Problem #2:     Looks like the edges are undirectional. Why the reverse
edge points
                           are not checked ? There are some cases, where I
found that we query
                           for {p1,p2} and in the triangle reverse edge (
p2,p1) is available.


BDS_Edge *BDS_Mesh::find_edge(BDS_Point *p1, BDS_Point *p2, BDS_Face *t)
const
{
  BDS_Point P1(p1->iD);
  BDS_Point P2(p2->iD);

  BDS_Edge E(&P1, &P2);

  if(t->e1->p1->iD == E.p1->iD && t->e1->p2->iD == E.p2->iD)
    return t->e1;
  if(t->e2->p1->iD == E.p1->iD && t->e2->p2->iD == E.p2->iD)
    return t->e2;
  if(t->e3->p1->iD == E.p1->iD && t->e3->p2->iD == E.p2->iD)
    return t->e3;
  return 0;
}

Can someone clarify my doubts ?

Thanks.

Chaman Singh Verma

Poona, India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20090529/a276e8de/attachment.html>