libMesh/libmesh — pull request #215 by bwspenc (2014-03-04 22:14:27+00:00)
Title: Make Elem::nullify_neighbors() public

I'm adding and deleting elements to implement Heaviside-enriched XFEM using the phantom node method. I have this up and running in MOOSE, but to accomplish this, I've had to make a few changes (OK, really ugly hacks) to libmesh because it appears that libmesh does not really support adding and deleting elements outside of adaptivity. I'd like to resolve those issues to enable adding and deleting elements during a transient analysis outside the adaptivity system. This would also be useful for other purposes, such as an element death capability.

I need to call nullify_neighbors() on elements that I've deleted, but I can't because it's protected, so I've made it public in this commit. It looks like the intent was originally to only permit MeshRefinement to call many of these methods by making them protected and making MeshRefinement a friend of Elem. There are some comments at the end of the Elem class definition that indicate that MeshRefinement is a friend to enable it to call the build methods, but in the current version, those methods are actually all public, so those comment must be out of date. Maybe it's time for Elem to unfriend MeshRefinement.

FYI, the other place I've hit trouble in adding and deleting elements is in EquationSystems::reinit(), where it's calling System::prolong_vectors(), which calls System::restrict_vectors(). The code chokes on the calls to System::project_vector() because my newly created elements and nodes are missing old dof indices. I also hit trouble in the call to system->localize_solution() because the size of the solution vector changed. I've been able to run my models by commenting out the problematic code in System::restrict_vectors(). It seems like these are things we ought to be able to work out.