Ok, I'm with you and agree that function is probably the way to go.  I'd think a function call like extract_... is what you need.

The full matrix method embeds (or used to) the constraint in the row (at the cost of introducing asymmetry), so even without enforce_constraints_exactly() you should recover the constrained value to some accuracy commensurate with your linear solver tolerance. 

The constrain_element_residual() should do the trick if it replaces whatever residual value you have with

Re(i) = u(i) - u_constrained

For either dirichlet or hanging-node type constraints... Right?

----- Original Message -----
From: Derek Gaston <derek.gaston@inl.gov>
To: Kirk, Benjamin (JSC-EG)
Cc: libmesh-devel@lists.sourceforge.net <libmesh-devel@lists.sourceforge.net>
Sent: Fri Oct 31 15:36:47 2008
Subject: Re: [Libmesh-devel] Contraints for JFNK hanging nodes and Dirchlet BC's

On Oct 31, 2008, at 2:00 PM, Benjamin Kirk wrote:

> I use it to extract element-based Dofs, and they get properly 
> constrained.
> Would the residual value then be the current value - the constraned 
> value,
> as you mention?

I didn't know that method existed.  It looks like it's pretty much 
achieving the same goal that enforce_constraints_exactly() does.... it 
at least means that you are calculating your next residual using the 
properly constrained value.

Unfortunately, this doesn't help with calculating a constrained 
value.  For instance, let's say that on solve #23 your solver decides 
it's converged... and libMesh writes out the solution.  Do you have 
any idea what the value of your solution at the hanging nodes is?  
Unless you called enforce_constraints_exactly() before you wrote out 
the solution.... you don't.

One idea would be for me to overwrite my own residual before I add it 
into the global residual.... I guess I could call is_constrained() on 
every node on the element and if it is then I could overwrite what 
residual is there with u - constrained_value before I add it in..... 
this is essentially the work I was thinking 
constrain_element_residual() would do.