On Mon, 6 Oct 2014, Rodrigo Broggi wrote:

> Yeah, I have actually the same mesh (these are two consecutive steps of a
> Newton method) so I should use:
>
> Real normh1 = system.calculate_norm(uh - vh,H1);  ?????
>
> uh and vh are NumericVector<Number> type right?

I don't think we overload NumericVector::operator-.  Returning a
new NumericVector[1] would make it too easy to generate temporary vectors
(which is expensive) accidentally.

So here where you *want* to generate a temporary vector, so it's more
convoluted, something like:

AutoPtr<NumericVector<Number> > diff_h = uh.clone();
diff_h -= vh;
Real normh1 = system.calculate_norm(diff_h,H1);


1) Alternatively, returning an expression template would make it too
necessary to write expression template code (which is complicated)
extensively.  But patches from anyone else who wants to write that
code would be welcome.
---
Roy

------------------------------------------------------------------------------
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to