Sum comp

I often find that I want the total mass of a CompMap I've just generated. Indeed, in order to use that CompMap to modify an actual material (say, with the Extract method), I have to know the quantity related to the compmap I want to extract. I need this basically all the time. 

SO, in the comp_math class, I moved the Kahan summation step out of the normalization function into its own function. It's not clear to me whether this is allowed in the 1.0 series of releases. It doesn't break any functionality in the core API, but it does *add* a function to the core API. That is, after this change, no functionality disappears. However, a function does *appear*, namely the comp_math::Sum function. 

I also wrote a simple test. I could write more if needed.

Thoughts? 
I was just copying your test later in the series. :) I'll change it.



On Wed, Jul 16, 2014 at 2:45 PM, Anthony Scopatz <notifications@github.com>
wrote:

> In tests/comp_math_tests.cc:
>
> > @@ -68,6 +68,18 @@ TEST(CompMathTests, SubCloseComp) {
> >  }
> >
> >  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > +TEST(CompMathTests, Sum) {
> > +  CompMap v;
> > +  v[1] = 1.0;
> > +  v[2] = 2.0;
> > +  v[3] = 3.0;
>
> Minor nitpick, but a better test would be one where the keys and values
> don't sum to the same result :)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/cyclus/cyclus/pull/973/files#r15030006>.
>



-- 
http://katyhuff.github.com