[MOAB-dev] a bug in Coupler::locate_points

Huayi Wei weihuayi at xtu.edu.cn
Mon Jul 13 19:55:10 CDT 2015


Hi, Moab Dev,

In the following member function,  I think it is a bug for line ` tl = 
new TupleList(3, 0, 0, 0, num_points);`.

Here create new TupleList which address will cover the address tl passed 
by user, and then user can not accsess
it.

I think  it should be ' tl->initialize(3, 0, 0, 0, num_points)`,

````
ErrorCode Coupler::locate_points(double *xyz, unsigned int num_points,
                                  double rel_eps,
                                  double abs_eps,
                                  TupleList *tl,
                                  bool store_local)
{

.......

   // Copy into tl if passed in and storing locally
   if (tl && store_local) {
     tl = new TupleList(3, 0, 0, 0, num_points);
     tl->enableWriteAccess();
     memcpy(tl->vi_wr, tl_tmp->vi_rd, 3 * tl_tmp->get_n() * sizeof(int));
     tl->set_n(tl_tmp->get_n());
     tl->disableWriteAccess();
   }
....
}
```

Best

Huayi


More information about the moab-dev mailing list