Fix rounding error bug in calculation of number of top-level cells
Because a value of 0.99
was used to force rounding down (see changelog), trying to use a top-level cells count of ~100 could lead to rounding to +/-1 from expected value. This more adaptive approach should avoid this issue for arbitrarily large numbers of top-level cells (at least until Ncells^2 approaches the floating point limit).
There is a potential issue if trying to use one top-level cell. I think it might make sense to enforce a minimum value for the tol
that I've introduced (could be the previously-used 0.99
, for instance, just needs to be less than 1). Thought I'd ask here before adding more logic, though.
Edited by Kyle Oman