On Nov 17, 2010, at 2:24 PM, Roy Stogner wrote:

> 
> On Wed, 17 Nov 2010, Cody Permann wrote:
> 
>> Found it!  There is a call to MeshBase::contract() inside of
>> EquationSystems::reinit() which certainly changes the Mesh.  I
>> commented out that line of code and my example ran without seg
>> faulting.
> 
> That's just a workaround - if we never delete coarsened elements then
> certainly we're never going to hit a segfault when trying to reference
> them again.
> 
>> Please advise on the correct resolution.  Do we need to
>> add in a subsequent call to prepare_for_use() or clear() inside of
>> EquationSystems::reinit() or is it the caller's responsibility?
> 
> It definitely should not be the caller's responsibility.  And no need
> to call the whole prepare_for_use(); clear_point_locator() alone
> should be sufficient.
> 
> But I'm still not certain why it isn't already being cleared
> appropriately.  MeshRefinement::refine_and_coarsen_elements() should
> be calling prepare_for_use whenever the mesh has changed.  

It is - I verified this

> And because
> PointLocatorTree only operates on active elements, it shouldn't care
> whether or not we delete subactive elements after it's constructed.

Sounds good, but are you completely sure?  Check out the find_element() routine
on line 501 inside of tree_node.C which is where the seg fault occurs.  That 
method 
is using an internal data structure of pointers to elements.  That data 
structure would 
be out of date after the call to mesh::contract() because contract() calls 
renumber_nodes_and_elements() which changes pointers around.

I propose we add a call to clear_point_locator() right after the call to 
contract() inside
of EquationSystems.reinit().  I already made this change in my local copy and 
everything seems to be working correctly without the explicit call to clear the 
point
locator in user code anymore.

Cody


> ---
> Roy


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to