Thanks. it is ok now.

> On Jun 30, 2016, at 1:25 PM, John Peterson <jwpeter...@gmail.com> wrote:
> 
> 
> 
> On Thu, Jun 30, 2016 at 12:15 PM, John Peterson <jwpeter...@gmail.com 
> <mailto:jwpeter...@gmail.com>> wrote:
> 
> 
> On Thu, Jun 30, 2016 at 10:36 AM, 张江 <zhangjiang.d...@gmail.com 
> <mailto:zhangjiang.d...@gmail.com>> wrote:
> Hi,
> 
> I am trying to use libMesh::System::point_value(unsigned int var, const Point 
> &p, const Elem &e) const to get the value of a point.
> Before this function, I used a point locator to locate the element that the 
> point is in.
> However, when running the program, I found in this point_value function, 
> there is another point locator called before computing the point value. It is 
> strange because the code of this point_value() function do not have anything 
> about point locator.
> Can anyone tell me how to solve this? Thanks.
> 
> 
> Point p(1.5, 0.2, 0);
> const Elem *e = (*locator)(p);
> 
> float A[3];
> A[0] = asys->point_value(Ax_var, p, e);
> A[1] = asys->point_value(Ay_var, p, e);
> A[2] = asys->point_value(Az_var, p, e);
> 
> I haven't verified this, but I'd guess you are calling this overloaded 
> version of the function:
> 
>   Number point_value(unsigned int var, const Point & p,
>                      const bool insist_on_success = true) const;
> 
> where the Elem pointer is converted to "true" for the third argument.
> 
> The last argument of the function you're trying to call should be an Elem 
> reference, not a pointer.
> 
> Yes, I just wrote a test code and I think this is indeed the problem.  The 
> fix is to pass *e rather than e as the last argument.
>  
> This is kind of unfortunate, as the compiler doesn't even warn about the 
> unintended type conversion... maybe we should change the API somehow (use an 
> enum instead of a bool?).
> 
> -- 
> John

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to