cyclus/cyclus — pull request #632 by rwcarlsen (2013-10-29 18:25:42+00:00)
Title: Modify ResourceBuff::PopQty to be more exact.

Previously, resourcebuf would return to you a total quantity of resources +/- eps_rsrc of the quantity you tried to extract. This is really annoying and so I have changed it. It now does exact matching. If you want to extract more than is there, you can't. If you want to extract everything, then you can `buf.PopN(buf.count());.

Two examples of where the previous behavior is problematic:

* Impossible to extract a quantity less than eps_rsrc from a buffer.
* I am an enrichment facility. I calculate the amount of natural uranium needed to satisfy an order of quantity X of arbitrary enrichment. I extract quantity Y of necessary natural u from my natural u buffer, but my buffer quietly actually gave me slightly less than the quantity I told it to extract, Y'. If the order enrichment happens to be for natural uranium, then X == Y. If I every try to extract quantity X of the order's enriched composition from this popped natural u material, I get a negative quantity extraction error (rightfully), because that resource isn't actually qty>=X since Y' < Y. So the enrichment facility would have to write special code to work around this behavior.